[CLN-list] modular polynomials

Bruno Haible bruno at clisp.org
Sat Sep 27 21:24:06 CEST 2008


Hello Alexei,

> > You can introduce a new class, say, cl_UP_coefficients or cl_UP_embryo, that
> > has a set_coeff method and a finalize method that returns a cl_UP. cl_UP will
> > lose these methods, but have a constructor that takes a cl_UP_coefficients
> > argument.
> 
> Changing the coefficients is a common operation (think of division, GCD,
> etc). So this crippled^W immutable cl_UP is next to useless.

Indeed, division and GCD can become a lot slower if in-place modification of
polynomial is impossible. Then I agree with you, for option 2.

> > and provide a separate function for "deep copying" of a polynomial.
> 
> What about a copy constructor?

The copy-constructor and the assignment operator should always do the same
thing in C++. People won't understand if

     cl_UP a = ...;
     cl_UP b = a;

and

     cl_UP a = ...;
     cl_UP b;
     b = a;

behave differently. And in CLN these simple assignments are only copying
a simple reference, not the deep contents (see the other mail).

Bruno



More information about the CLN-list mailing list