Subject: CGAL users discussion list
List archive
- From: Marc Glisse <>
- To: aseverino <>
- Subject: Re: [cgal-discuss] Can't use Eigen matrices with CGAL::Gmpq
- Date: Tue, 23 Mar 2021 23:15:29 +0100 (CET)
- Ironport-hdrordr: A9a23:XKeFYak+lfalBcoUEUqeyfGS9Q7pDfLK3DAbvn1ZSRFFG/GwvcaogfgdyFvIkz4XQn4tgpStP6OHTHPa+/dOkOwsFJ2lWxTrv3btEZF64eLZsl/dMgD36+I178xdWodkDtmYNzJHpOb8pDK1CtMxhOSAmZrHuc7771NACT5ncLth6QARMHf5LmRTSBNdDZQ0ULqwj/AnmxOadX4abtu2CxA+NoD+jubGm578bRkNCwRP0mmzpAil8bvrVyWfty1ybxp03bwg/WLZ+jaX2oyftZiApiPh6w==
On Tue, 23 Mar 2021, aseverino wrote:
I'm trying to use Eigen matrices with CGAL::Gmpq:
typedef CGAL::Lazy_exact_nt<CGAL::Gmpq> LazyExact;
typedef Eigen::Matrix<LazyExact, 3, 1> Vector3Gmpq;
int main(int argc, char* argv[])
{
Vector3Gmpq test;
test.normalize();
return 0;
}
I get the error:
'return': cannot convert from 'CGAL::Null_functor::result_type' to
'CGAL::Gmpq'
With a better compiler, the full message is
In file included from /usr/include/eigen3/Eigen/Core:374,
from /usr/include/eigen3/Eigen/Dense:1,
from q.cc:1:
/usr/include/eigen3/Eigen/src/Core/MathFunctions.h: In instantiation of ‘T
Eigen::numext::sqrt(const T&) [with T = CGAL::Lazy_exact_nt<CGAL::Gmpq>]’:
/usr/include/eigen3/Eigen/src/Core/Dot.h:150:30: required from ‘void
Eigen::MatrixBase<Derived>::normalize() [with Derived =
Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 3, 1>]’
q.cc:9:24: required from here
/usr/include/eigen3/Eigen/src/Core/MathFunctions.h:1034:14: error: could not convert
‘CGAL::sqrt<CGAL::Lazy_exact_nt<CGAL::Gmpq> >((* & x))’ from
‘CGAL::Null_functor::result_type’ {aka ‘CGAL::Null_tag’} to ‘CGAL::Lazy_exact_nt<CGAL::Gmpq>’
1034 | return sqrt(x);
| ~~~~^~~
| |
| CGAL::Null_functor::result_type {aka CGAL::Null_tag}
In file included from /usr/include/CGAL/double.h:22,
from /usr/include/CGAL/number_type_basic.h:51,
from /usr/include/CGAL/basic.h:33,
from /usr/include/CGAL/Cartesian/Cartesian_base.h:20,
from /usr/include/CGAL/Simple_cartesian.h:20,
from
/usr/include/CGAL/Exact_predicates_exact_constructions_kernel.h:20,
from q.cc:2:
/usr/include/CGAL/number_utils.h: In instantiation of ‘typename
CGAL::Algebraic_structure_traits<Type_>::Sqrt::result_type CGAL::sqrt(const AS&) [with AS
= CGAL::Lazy_exact_nt<CGAL::Gmpq>; typename
CGAL::Algebraic_structure_traits<Type_>::Sqrt::result_type = CGAL::Null_tag]’:
/usr/include/eigen3/Eigen/src/Core/MathFunctions.h:1034:14: required from ‘T
Eigen::numext::sqrt(const T&) [with T = CGAL::Lazy_exact_nt<CGAL::Gmpq>]’
/usr/include/eigen3/Eigen/src/Core/Dot.h:150:30: required from ‘void
Eigen::MatrixBase<Derived>::normalize() [with Derived =
Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 3, 1>]’
q.cc:9:24: required from here
/usr/include/CGAL/number_utils.h:95:16: error: no match for call to
‘(CGAL::Algebraic_structure_traits<CGAL::Lazy_exact_nt<CGAL::Gmpq> >::Sqrt {aka
CGAL::Null_functor}) (const CGAL::Lazy_exact_nt<CGAL::Gmpq>&)’
95 | return sqrt( x );
| ~~~~^~~~~
And the reason is rather obvious: normalize needs to compute a square root, but Gmpq is a rational type, which cannot support square roots. With Gmpq, you are restricted to those operations in Eigen that do not use square roots. For the others, you need a different type (CORE::Expr?).
--
Marc Glisse
- [cgal-discuss] Can't use Eigen matrices with CGAL::Gmpq, aseverino, 03/23/2021
- Re: [cgal-discuss] Can't use Eigen matrices with CGAL::Gmpq, Marc Glisse, 03/23/2021
- Re: [cgal-discuss] Can't use Eigen matrices with CGAL::Gmpq, aseverino, 03/23/2021
- Re: [cgal-discuss] Can't use Eigen matrices with CGAL::Gmpq, Marc Glisse, 03/23/2021
Archive powered by MHonArc 2.6.19+.