Re: [eigen] Re: Eigen interop with boost::multiprecision broken

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi Trevor,

Forget Borland and get a new up-to-date compiler. It's not C++
compliant. clang, gcc or Visual Studio, all 3 are free and are C++03
compliant and above.

Regards,

Matthieu

Le lun. 4 janv. 2021 à 07:25, Trevor Smith
<trevorsmith001@xxxxxxxxxxx> a écrit :
>
> Christop,
>
> Thanks for replying.
> Yes, really!
> Borland Builder Ver 1.0 does not use <iostream>  but all i/o goes via
> VCL using a class called AnsiString("Hello World").
>
> I have a copy of Borland Builder ver 4.50 somewhere round the house.
> Will try and load that and advise...
> Thanks for your encouragement.
>
> Regards,
>
> Trevor
>
> ------ Original Message ------
> From: "Christoph Hertzberg" <chtz@xxxxxxxxxxxxxxxxxxxxxxxx>
> To: eigen@xxxxxxxxxxxxxxxxxxx
> Sent: Monday, 4 Jan, 2021 At 11:31 AM
> Subject: Re: [eigen] Re: Eigen interop with boost::multiprecision broken
>
> Please don't hijack unrelated threads ...
>
> Are you really running Borland C++ Builder 1.0 (which according to
> wikipedia was released in 1997)? Are you able to upgrade to a newer
> compiler version (or switch to gcc, clang, or msvc which are much more
> frequently tested)?
>
> Eigen should be C++03 compatible, so if you have problems with a
> compliant compiler, please file a report. I don't understand what you
> mean by
>     using only “>>’s” and String.h.
>
> Cheers,
> Christoph
>
> On 03/01/2021 20.48, Trevor Smith wrote:
> > Ian,
> > Seems I have joined a blog site re Eigen.
> > I am a 77 year old blitzer of a programmer (started out with FORTRAN
> > in 1961!) and I may be only looking over the fence and should go away?
> > I will describe myself and you might tell me what I need to do...
> > My aim is to find a general matrix inverter.
> > I want it to solve 3D hydrodynamic equations per book “Hydrodynamics”
> > by Horace Lamb.
> > I run Borland’s Builder version 1.0 and am fluent with STL C++.
> > I have loaded and tried to get Eigen going only to find to my
> > frustration it does not seem to know about anything about AnsiString -
> > using only “>>’s” and String.h.
> > Bad luck and bye bye for me?
> > Any tips?
> > Happy days,
> > Trevor Smith
> > Sydney, Australia
> >   ------ Original Message ------
> > On  Monday, 4 Jan, 2021 At 1:11 AM, Ian Bell<ian.h.bell@xxxxxxxxx>
> > wrote:
> >
> > I can certainly file a bug report.  Thanks for confirming that I
> > didn't just do something stupid on my side.
> >
> > On Fri, Jan 1, 2021 at 6:07 PM Christoph Hertzberg
> > <chtz@xxxxxxxxxxxxxxxxxxxxxxxx <mailto:chtz@xxxxxxxxxxxxxxxxxxxxxxxx>
> > > wrote:
> > The breaking commit for your minimal example is this:
> >
> >
> >
> > https://gitlab.com/libeigen/eigen/-/commit/39c2cba810a573ae4d0efd2b0b80e08c934b99b3
> > <https://gitlab.com/libeigen/eigen/-/commit/39c2cba810a573ae4d0efd2b0b80e08c934b99b3>
> >
> >   Apparently that was necessary for cuda support -- not sure if this
> > is
> >   actually still necessary. On the 3.3 branch your code compiles fine:
> >   https://godbolt.org/z/nnqPEn <https://godbolt.org/z/nnqPEn>
> >
> >   Boost is actually not supposed to fiddle around in Eigen's internal
> >   namespace. OTOH, we don't properly document how one should add
> > support
> >   for complex custom types.
> >
> >   Could you file an issue for this?
> >
> >   Cheers,
> >   Christoph
> >
> >
> >
> >   On 01/01/2021 22.12, Ian Bell wrote:
> >   > It seems that at version 3.3.3 things were all good, and since
> > then there
> >   > have a been quite a few regressions for extended precision things.
> > I'm
> >   > trying to track down a couple of bugs on my side. My hypothesis is
> > that
> >   > there is somewhere a precision-destroying cast, but I'm not quite
> > sure.
> >   >
> >   > On Thu, Dec 31, 2020 at 3:47 PM Ian Bell <ian.h.bell@xxxxxxxxx
> > <mailto:ian.h.bell@xxxxxxxxx> > wrote:
> >   >
> >   >> I have no idea whether this is a problem with boost or Eigen, but
> > putting
> >   >> boost::multiprecision into Eigen Array/Matrix worked in older
> > versions of
> >   >> Eigen from circa 2017, but no longer does.  For instance this
> > example (
> >   >>
> > https://www.boost.org/doc/libs/1_75_0/libs/multiprecision/doc/html/boost_multiprecision/tut/eigen.html
> > <https://www.boost.org/doc/libs/1_75_0/libs/multiprecision/doc/html/boost_multiprecision/tut/eigen.html>
> >   >> ; copied below) used to work, but now when I compile with master,
> > I get
> >   >> complaints about the NumTraits. I'm at
> >   >> commit fdf2ee62c5174441076fb64c9737d89bbe102759.  I tried to look
> > into this
> >   >> a bit, but template-fu needs work.
> >   >>
> >   >> On Visual Studio 2019:
> >   >>
> >   >> Build started...
> >   >> 1>------ Build started: Project: boosteigen, Configuration:
> > Release x64
> >   >> ------
> >   >> 1>boosteigentest.cpp
> >   >> 1>C:\Users\ihb\PapersInProgress\Working\03a.
> >   >>
> > UlrichCubicSuperAncillary\code\bld\_deps\boost-src\boost/multiprecision/eigen.hpp(147,23):
> >   >> error C2977: 'Eigen::internal::conj_impl': too many template
> > arguments
> >   >> 1>C:\Users\ihb\PapersInProgress\Working\03a.
> >   >>
> > UlrichCubicSuperAncillary\code\bld\_deps\boost-src\boost/multiprecision/eigen.hpp(147):
> >   >> message : see declaration of 'Eigen::internal::conj_impl'
> >   >> 1>C:\Users\ihb\PapersInProgress\Working\03a.
> >   >>
> > UlrichCubicSuperAncillary\code\bld\_deps\boost-src\boost/multiprecision/eigen.hpp(164,8):
> >   >> error C2977: 'Eigen::internal::conj_impl': too many template
> > arguments
> >   >> 1>C:\Users\ihb\PapersInProgress\Working\03a.
> >   >>
> > UlrichCubicSuperAncillary\code\bld\_deps\boost-src\boost/multiprecision/eigen.hpp(157):
> >   >> message : see declaration of 'Eigen::internal::conj_impl'
> >   >>
> >   >> And on gcc 9.3.0:
> >   >>
> >   >> [100%] Building CXX object
> > CMakeFiles/boosteigen.dir/boosteigentest.cpp.o
> >   >> In file included from /input/boosteigentest.cpp:3:
> >   >> /bld/_deps/boost-src/boost/multiprecision/eigen.hpp:147:14:
> > error:
> >   >> redeclared with 2 template parameters
> >   >>    147 |       struct conj_impl;
> >   >>        |              ^~~~~~~~~
> >   >> In file included from
> >   >> /input/externals/ChebTools/externals/Eigen/Eigen/Core:164,
> >   >>                   from
> >   >> /bld/_deps/boost-src/boost/multiprecision/eigen.hpp:10,
> >   >>                   from /input/boosteigentest.cpp:3:
> >   >>
> > /input/externals/ChebTools/externals/Eigen/Eigen/src/Core/MathFunctions..h:263:34:
> >   >> note: previous declaration 'template<class Scalar> struct
> >   >> Eigen::internal::conj_impl' used 1 template parameter
> >   >>    263 | template<typename Scalar> struct conj_impl :
> >   >> conj_default_impl<Scalar> {};
> >   >>        |                                  ^~~~~~~~~
> >   >> In file included from /input/boosteigentest.cpp:3:
> >   >> /bld/_deps/boost-src/boost/multiprecision/eigen.hpp:157:100:
> > error: wrong
> >   >> number of template arguments (2, should be 1)
> >   >>    157 |       struct
> >   >> conj_impl<boost::multiprecision::detail::expression<tag, Arg1,
> > Arg2, Arg3,
> >   >> Arg4>, true>
> >   >>        |
> >   >>                                   ^
> >   >> In file included from
> >   >> /input/externals/ChebTools/externals/Eigen/Eigen/Core:164,
> >   >>                   from
> >   >> /bld/_deps/boost-src/boost/multiprecision/eigen.hpp:10,
> >   >>                   from /input/boosteigentest.cpp:3:
> >   >>
> > /input/externals/ChebTools/externals/Eigen/Eigen/src/Core/MathFunctions..h:263:34:
> >   >> note: provided for 'template<class Scalar> struct
> >   >> Eigen::internal::conj_impl'
> >   >>    263 | template<typename Scalar> struct conj_impl :
> >   >> conj_default_impl<Scalar> {};
> >   >>        |                                  ^~~~~~~~~
> >   >>
> >   >>
> >   >> Example:
> >   >>
> >   >> #include <iostream>#include
> > <boost/multiprecision/cpp_complex.hpp>#include
> > <boost/multiprecision/eigen.hpp>#include <Eigen/Dense>
> >   >> int main(){
> >   >>     using namespace Eigen;
> >   >>     typedef boost::multiprecision::cpp_complex_quad complex_type;
> >   >>     //
> >   >>     // We want to solve Ax = b for x,
> >   >>     // define A and b first:
> >   >>     //
> >   >>     Matrix<complex_type, 2, 2> A, b;
> >   >>     A << complex_type(2, 3), complex_type(-1, -2),
> > complex_type(-1, -4), complex_type(3, 6);
> >   >>     b << 1, 2, 3, 1;
> >   >>     std::cout << "Here is the matrix A:\n" << A << std::endl;
> >   >>     std::cout << "Here is the right hand side b:\n" << b <<
> > std::endl;
> >   >>     //
> >   >>     // Solve for x:
> >   >>     //
> >   >>     Matrix<complex_type, 2, 2> x =
> > A.fullPivHouseholderQr().solve(b);
> >   >>     std::cout << "The solution is:\n" << x << std::endl;
> >   >>     //
> >   >>     // Compute the error in the solution by using the norms of Ax
> > - b and b:
> >   >>     //
> >   >>     complex_type::value_type relative_error = (A*x - b).norm() /
> > b.norm();
> >   >>     std::cout << "The relative error is: " << relative_error <<
> > std::endl;
> >   >>     return 0;}
> >   >>
> >   >>
> >   >
> >
> >
> >
> >
> >
>
>
>
>


-- 
Quantitative researcher, Ph.D.
Blog: http://blog.audio-tk.com/
LinkedIn: http://www.linkedin.com/in/matthieubrucher



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/