Subject: CGAL users discussion list
List archive
- From: Samaras <>
- To:
- Subject: [cgal-discuss] can't use the CGAL::sqrt() ?
- Date: Sun, 27 Oct 2013 05:54:09 -0700 (PDT)
Dear all,
I want to compute the norm() of point in D dimension. I am extending the
point_d class.
I use these typedefs:
#include <CGAL/Cartesian_d.h>
#include <CGAL/Gmpq.h>
typedef CGAL::Gmpq NT;
typedef CGAL::Cartesian_d<NT> Kernel;
typedef Kernel::Point_d PointD;
This is the method I am using sqrt() in:
NT norm() const {
NT result = 0;
for(int i = 0 ; i < this->dimension() ; ++i)
result += this->cartesian(i) * this->cartesian(i);
return sqrt(result);
// The problem
}
I receive errors both in the return of sqrt and in the passing of the
argument inside. By the way, I printed the result just before the call to
sqrt() and it was 3/1 (thus 3).
Compiler says:
/home/samaras/code/testProj/bla.cpp: In member function ‘NT Point::norm()
const’:
/home/samaras/code/testProj/bla.cpp:117:35: error: could not convert
‘CGAL::sqrt [with AS = CGAL::Gmpq, typename
CGAL::Algebraic_structure_traits<Type_>::Sqrt::result_type =
CGAL::Null_tag]((*(const CGAL::Gmpq*)(& result)))’ from
‘CGAL::Null_functor::result_type {aka CGAL::Null_tag}’ to ‘NT {aka
CGAL::Gmpq}’
/home/samaras/code/CGAL-4.3/include/CGAL/number_utils.h: In function
‘typename CGAL::Algebraic_structure_traits<Type_>::Sqrt::result_type
CGAL::sqrt(const AS&) [with AS = CGAL::Gmpq, typename
CGAL::Algebraic_structure_traits<Type_>::Sqrt::result_type =
CGAL::Null_tag]’:
/home/samaras/code/testProj/bla.cpp:117:35: instantiated from here
/home/samaras/code/CGAL-4.3/include/CGAL/number_utils.h:103:20: error: no
match for call to ‘(CGAL::Algebraic_structure_traits_base<CGAL::Gmpq,
CGAL::Null_tag>::Sqrt {aka CGAL::Null_functor}) (const CGAL::Gmpq&)’
What is the newbie missing?
George
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/can-t-use-the-CGAL-sqrt-tp4658306.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] can't use the CGAL::sqrt() ?, Samaras, 10/27/2013
- Re: [cgal-discuss] can't use the CGAL::sqrt() ?, Marc Glisse, 10/27/2013
- Re: [cgal-discuss] can't use the CGAL::sqrt() ?, Georgios Samaras, 10/27/2013
- Re: [cgal-discuss] can't use the CGAL::sqrt() ?, Marc Glisse, 10/27/2013
Archive powered by MHonArc 2.6.18.