Oskar,

I'm sure these are all related.  I did not mean to imply that your
compiler was broken!  Only that as I myself only have one, the only
testing I have done is with that one;  and since Sage has started
shipping with eclib (which is about 6 months) I know that lots of
other compilers out there can handle the code too.

I think I can see where the problems lie:   various constructors have
default arguemnts which default to 0, but NTL's RR has no automatic
coercion from integers (including constants such as 0)  which is why
there are already lots of manual coercions in my code.  If I have time
I'll try sending you patches, but without access to you compiler it
will not be easy to do this.

John

2008/5/6 Oskar45 <[EMAIL PROTECTED]>:
>
>  Hi John,
>
>  *JUST FOR TESTING OUT MY PREVIOUS SUSPICION*, I changed <procs/
>  cubic.cc> to
>
>
>  bigcomplex cubic::hess_root() const
>  {
>   bigfloat discr = I2bigfloat(disc());
>  //  if(!is_positive(disc()))
>  //    {
>  //      cout<<"Error: hess_root called with negative dicriminant!\n";
>  //      return to_bigfloat(0);
>  //    }
>
>   bigfloat P = I2bigfloat(p_semi());
>   bigfloat Q = I2bigfloat(q_semi());
>   bigfloat delta = sqrt(3*discr);
>   bigcomplex gamma(-Q,delta); gamma/=(2*P);
>   return gamma;
>  }
>
>  and then it compiled without warnings/errors properly [in particular.
>  I had no
>  problems in returning the bigcomplex gamma - so, my compiler doesn't
>  seem to
>  be broken at all, although you hinted at that before]. Therefore, I
>  still
>  believe that <return to_bigfloat(0)> in <bigcomplex cubic::hess_root()
>  const>
>  is simply not working as fine as you expected it with some compilers
>  because
>  eclib is too much occupied with g++ [it is well known that IRIX
>  MipsPro
>  compilers are quite a bit less tolerant than gcc/g++, BTW]. And so I
>  think
>  that returning <to_bigfloat(0)> as a bigcomplex in the above function
>  is not
>  handled as you want it to be universially...
>
>
>  However, upon continuing compilation, I get:
>
>
>  cc-1262 CC: ERROR File = /usr/include/CC/complex, Line = 53
>
>   No instance of constructor "NTL::RR::RR" matches the argument list.
>
>             The argument types are:  (int).
>     complex() : _M_re(0), _M_im(0) {}
>                       ^
>           detected during instantiation of
>  "std::complex<NTL::RR>::complex()"
>                     at line 43 of "compproc.cc"
>
>  cc-1262 CC: ERROR File = /usr/include/CC/complex, Line = 53
>
>   No instance of constructor "NTL::RR::RR" matches the argument list.
>
>             The argument types are:  (int).
>     complex() : _M_re(0), _M_im(0) {}
>                                 ^
>           detected during instantiation of
>  "std::complex<NTL::RR>::complex()"
>                     at line 43 of "compproc.cc"
>
>  cc-1278 CC: ERROR File = /usr/include/CC/complex, Line = 799
>   No instance of overloaded function "atan2" matches the argument
>  list.
>
>             The argument types are:  (const
>  std::complex<NTL::RR>::value_type,
>                       const std::complex<NTL::RR>::value_type).
>     return ::atan2(__z._M_im, __z._M_re);
>            ^
>           detected during instantiation of
>                     "NTL::RR std::arg(const std::complex<NTL::RR> &)"
>  at line
>                     54 of "compproc.cc"
>
>  cc-1387 CC: ERROR File = /usr/include/CC/complex, Line = 786
>   No suitable conversion function from "const
>
> std::complex<NTL::RR>::value_type"
>           to "double" exists.
>
>     return ::__sgilib::hypot(__z._M_re, __z._M_im);
>  cc-1262 CC: ERROR File = /usr/include/CC/complex, Line = 53
>
>   No instance of constructor "NTL::RR::RR" matches the argument list.
>
>             The argument types are:  (int).
>     complex() : _M_re(0), _M_im(0) {}
>                       ^
>           detected during instantiation of
>  "std::complex<NTL::RR>::complex()"
>                     at line 43 of "compproc.cc"
>
>  cc-1262 CC: ERROR File = /usr/include/CC/complex, Line = 53
>
>   No instance of constructor "NTL::RR::RR" matches the argument list.
>
>             The argument types are:  (int).
>     complex() : _M_re(0), _M_im(0) {}
>                                 ^
>           detected during instantiation of
>  "std::complex<NTL::RR>::complex()"
>                     at line 43 of "compproc.cc"
>
>  cc-1278 CC: ERROR File = /usr/include/CC/complex, Line = 799
>   No instance of overloaded function "atan2" matches the argument
>  list.
>
>             The argument types are:  (const
>  std::complex<NTL::RR>::value_type,
>                       const std::complex<NTL::RR>::value_type).
>     return ::atan2(__z._M_im, __z._M_re);
>            ^
>           detected during instantiation of
>                     "NTL::RR std::arg(const std::complex<NTL::RR> &)"
>  at line
>                     54 of "compproc.cc"
>
>  cc-1387 CC: ERROR File = /usr/include/CC/complex, Line = 786
>   No suitable conversion function from "const
>
> std::complex<NTL::RR>::value_type"
>           to "double" exists.
>
>     return ::__sgilib::hypot(__z._M_re, __z._M_im);
>                              ^
>           detected during instantiation of
>                     "NTL::RR std::abs(const std::complex<NTL::RR> &)"
>  at line
>                     59 of "compproc.cc"
>
>  cc-1387 CC: ERROR File = /usr/include/CC/complex, Line = 786
>   No suitable conversion function from "const
>
> std::complex<NTL::RR>::value_type"
>           to "double" exists.
>
>     return ::__sgilib::hypot(__z._M_re, __z._M_im);
>                                         ^
>           detected during instantiation of
>                     "NTL::RR std::abs(const std::complex<NTL::RR> &)"
>  at line
>                     59 of "compproc.cc"
>
>  cc-1389 CC: ERROR File = /usr/include/CC/complex, Line = 786
>   No suitable constructor exists to convert from "double" to
>  "NTL::RR".
>
>     return ::__sgilib::hypot(__z._M_re, __z._M_im);
>            ^
>           detected during instantiation of
>                     "NTL::RR std::abs(const std::complex<NTL::RR> &)"
>  at line
>                     59 of "compproc.cc"
>
>
>  cc-1262 CC: ERROR File = /usr/include/CC/complex, Line = 55
>   No instance of constructor "NTL::RR::RR" matches the argument list.
>
>             The argument types are:  (int).
>       : _M_re(__x), _M_im(0) {}
>                           ^
>           detected during instantiation of
>                     "std::complex<NTL::RR>::complex(const
>                     std::complex<NTL::RR>::value_type &)" at line 93
>  of
>                     "compproc.cc"
>                              ^
>           detected during instantiation of
>                     "NTL::RR std::abs(const std::complex<NTL::RR> &)"
>  at line
>                     59 of "compproc.cc"
>
>  cc-1387 CC: ERROR File = /usr/include/CC/complex, Line = 786
>   No suitable conversion function from "const
>
> std::complex<NTL::RR>::value_type"
>           to "double" exists.
>
>     return ::__sgilib::hypot(__z._M_re, __z._M_im);
>                                         ^
>           detected during instantiation of
>                     "NTL::RR std::abs(const std::complex<NTL::RR> &)"
>  at line
>                     59 of "compproc.cc"
>
>  cc-1389 CC: ERROR File = /usr/include/CC/complex, Line = 786
>   No suitable constructor exists to convert from "double" to
>  "NTL::RR".
>
>     return ::__sgilib::hypot(__z._M_re, __z._M_im);
>            ^
>           detected during instantiation of
>                     "NTL::RR std::abs(const std::complex<NTL::RR> &)"
>  at line
>                     59 of "compproc.cc"
>
>
>  cc-1262 CC: ERROR File = /usr/include/CC/complex, Line = 55
>   No instance of constructor "NTL::RR::RR" matches the argument list.
>
>             The argument types are:  (int).
>       : _M_re(__x), _M_im(0) {}
>                           ^
>           detected during instantiation of
>                     "std::complex<NTL::RR>::complex(const
>                     std::complex<NTL::RR>::value_type &)" at line 93
>  of
>                     "compproc.cc"
>
>
>  Do you think these are related to the above?
>
>  Best regards,
>  /oskar
>
>
>
>
>
>
>  On May 6, 7:46 pm, "John Cremona" <[EMAIL PROTECTED]> wrote:
>  > Oskar,
>  >
>  > I think you are probably right there.  Of course that code is never
>  > executed in practice since the way the code is organised this function
>  > is only called when disc is negative, but of course that is not going
>  > to keep the compiler happy.  So the line
>  >
>  > return to_bigfloat(0);
>  >
>  > should be replaced by
>  >
>  > return bigcomplex(to_bigfloat(0));
>  >
>  > or similar.
>  >
>  > Feel free to try that out, and I will patch my code accordingly.
>  >
>  > John
>  >
>  > 2008/5/6 Oskar45 <[EMAIL PROTECTED]>:
>
>
> >
>  >
>  >
>  >
>  >
>  > >  Hi John,
>  >
>  > >  thanks for your answer. Maybe it's of no relevance for the described
>  > >  problem but I noticed the following anyway:
>  >
>  > >  In procs/interface.h, I have
>  >
>  > >  ...
>  > >  #include <NTL/RR.h>
>  > >  #define bigfloat RR
>  > >  ...
>  > >  #include <complex>
>  > >  typedef complex<RR> CC;
>  > >  #define bigcomplex CC
>  > >  ...
>  > >  inline RR to_bigfloat(const int& n) {return to_RR(n);}
>  > >  inline RR to_bigfloat(const long& n) {return to_RR(n);}
>  > >  inline RR to_bigfloat(const double& x) {return to_RR(x);}
>  >
>  > >  In procs/cubic.cc, I have
>  >
>  > >  bigcomplex cubic::hess_root() const
>  > >  {
>  > >   bigfloat discr = I2bigfloat(disc());
>  > >   if(!is_positive(disc()))
>  > >     {
>  > >       cout<<"Error: hess_root called with negative dicriminant!\n";
>  > >       return
>  > >  to_bigfloat(0);                                                         
>    //
>  > >  <---- this is where the problem is
>  > >     }
>  > >   bigfloat P = I2bigfloat(p_semi());
>  > >   bigfloat Q = I2bigfloat(q_semi());
>  > >   bigfloat delta = sqrt(3*discr);
>  > >   bigcomplex gamma(-Q,delta); gamma/=(2*P);
>  > >   return gamma;
>  > >  }
>  >
>  > >  Could it be that the issue arises because a bigfloat is returned
>  > >  instead of a bigcomplex?
>  >
>  > >  Thanks.
>  > >  /oskar
>  >
>  > >  On May 3, 10:59 pm, "John Cremona" <[EMAIL PROTECTED]> wrote:
>  > >  > Well, as the author of eclib I hope I can help.  It is a C++ library.
>  > >  > It uses the NTL library, whcih includes a multiprecision real number
>  > >  > type called RR.  MTL does not have multiprecision complexes, so
>  > >  > implement those using RR for the real and imaginary parts, and a
>  > >  > standard C++ library template fto get a complex<RR> type;  that needs
>  > >  > some additional functionality which is provided in eclib.
>  >
>  > >  > Before Sage, I had only even compiled any of this using gcc.  My guess
>  > >  > is that whatever templates your system provides for complexes is not
>  > >  > working properly, or something else to do with template classes.
>  >
>  > >  > Maybey mabshoff or someone else has some ideas on how to proceed
>  >
>  > >  > John Cremona.
>  >
>  > >  > 2008/5/3 Oskar45 <[EMAIL PROTECTED]>:
>  >
>  > >  > >  Hi everyone,
>  >
>  > >  > >  am trying to get sage-2.11 running under the officially unsupported
>  > >  > >  [!!!]
>  > >  > >  Irix 6.5.30 with MipsPro 7.4.4 [my box is an SGI Fuel/R16000]. Up 
> to
>  > >  > >  now,
>  > >  > >  after battling a few inconsistencies, I got GMP, PARI and NTL
>  > >  > >  installed.
>  > >  > >  However, I now got stuck with the compilation of 
> <eclib-20080310.p0>.
>  > >  > >  As
>  > >  > >  Michael had suggested to me in private conversation, I'm posting to
>  > >  > >  the list
>  > >  > >  nevertheless hoping someone has a clue regarding my problem so I 
> can
>  > >  > >  continue:
>  >
>  > >  > >  cc-1262 CC: ERROR File = /usr/include/CC/complex, Line = 55
>  > >  > >   No instance of constructor "NTL::RR::RR" matches the argument 
> list.
>  >
>  > >  > >             The argument types are:  (int).
>  > >  > >       : _M_re(__x), _M_im(0) {}
>  > >  > >                           ^
>  > >  > >           detected during instantiation of
>  > >  > >                     "std::complex<NTL::RR>::complex(const
>  > >  > >                     std::complex<NTL::RR>::value_type &)" at line 
> 172
>  > >  > >  of
>  > >  > >                     "cubic.cc"
>  >
>  > >  > >  1 error detected in the compilation of "cubic.cc".
>  > >  > >  gmake[1]: *** [cubic_n.o] Error 2
>  > >  > >  gmake[1]: Leaving directory 
> `/disk03/mephisto/source/sage-2.11/spkg/
>  > >  > >  build/eclib-20080310.p0/src/procs'
>  >
>  > >  > >  All your help is certainly appreciated.
>  >
>  > >  > >  Best regards,
>  > >  > >  /oskar- Hide quoted text -
>  >
>  > >  > - Show quoted text -- Hide quoted text -
>
>
> >
>  > - Show quoted text -
>  >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to