Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Compilation error using linear_least_squares_fitting_2

Subject: CGAL users discussion list

List archive

[cgal-discuss] Compilation error using linear_least_squares_fitting_2


Chronological Thread 
  • From: Genís <>
  • To:
  • Subject: [cgal-discuss] Compilation error using linear_least_squares_fitting_2
  • Date: Wed, 16 Sep 2009 10:30:34 +0200
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=aUFm77arzxxG6jcQ/1QkEmIdLHbtRPIu0a6a09i+NTjIGXDaXuKtutvUcMYear63de 8c80x/4XySUzIVKvovIc1RoD5xA9UOnObXM7r7cj+zMX7KPrpFjDvHLTgql4szsSyyj7 mNJB4ahKeNu9a/0C9azE/3HsgUYu3WVmAjfVI=

Hello.
I get the an extense compilation error every time I try to call to  CGAL::linear_least_squares_fitting_2() with a series of points constructed with a exact error-free kernel. Of course my program is not that simple as the example below, but it throws exactly the same error.
The piece of code:


#include <CGAL/Cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Gmpq.h>
#include <CGAL/linear_least_squares_fitting_2.h>
#include <list>

using namespace std;
int main(void){
typedef CGAL::Gmpq exact_double;
typedef CGAL::Cartesian<exact_double> Kernel;
typedef Kernel::Point_2         Point;
typedef Kernel::Line_2        Line;
  list<Point> l;
  l.push_back(Point(CGAL::Gmpq(5),CGAL::Gmp(5.2)));
  l.push_back(Point(CGAL::Gmpq(2.42),CGAL::Gmp(5)));
  l.push_back(Point(CGAL::Gmpq(1.23),CGAL::Gmp(3.2)));
  l.push_back(Point(CGAL::Gmpq(3.52),CGAL::Gmp(5.1)));


  Line line;
  CGAL::linear_least_squares_fitting_2(l.begin(), l.end(),line);

}

The compilation error:


./usr/include/CGAL/eigen_2.h: In function ‘void CGAL::CGALi::eigen_symmetric_2(const typename K::FT*, std::pair<typename K::Vector_2, typename K::Vector_2>&, std::pair<typename K::FT, typename K::FT>&) [with K = CGAL::Cartesian<CGAL::Gmpq>]’:
/usr/include/CGAL/linear_least_squares_fitting_2.h:83:   instantiated from ‘typename K::FT CGAL::CGALi::linear_least_squares_fitting_2(InputIterator, InputIterator, typename K::Line_2&, typename K::Point_2&, const K&, const typename K::Point_2*) [with InputIterator = std::_List_iterator<CGAL::Point_2<CGAL::Cartesian<CGAL::Gmpq> > >, K = CGAL::Cartesian<CGAL::Gmpq>]’
/usr/include/CGAL/linear_least_squares_fitting_2.h:132:   instantiated from ‘typename K::FT CGAL::linear_least_squares_fitting_2(InputIterator, InputIterator, typename K::Line_2&, const K&) [with InputIterator = std::_List_iterator<CGAL::Point_2<CGAL::Cartesian<CGAL::Gmpq> > >, K = CGAL::linear_least_squares_fitting_2(InputIterator, InputIterator, Line&) [with InputIterator = std::_List_iterator<CGAL::Point_2<CGAL::Cartesian<CGAL::Gmpq> > >, Line = main()::Line]::K]’
/usr/include/CGAL/linear_least_squares_fitting_2.h:162:   instantiated from ‘typename CGAL::Kernel_traits<Line>::Kernel::FT CGAL::linear_least_squares_fitting_2(InputIterator, InputIterator, Line&) [with InputIterator = std::_List_iterator<CGAL::Point_2<CGAL::Cartesian<CGAL::Gmpq> > >, Line = main()::Line]’
main.cc:20:   instantiated from here
/usr/include/CGAL/eigen_2.h:85: error: no matching function for call to ‘sqrt(CGAL::CGALi::eigen_symmetric_2(const typename K::FT*, std::pair<typename K::Vector_2, typename K::Vector_2>&, std::pair<typename K::FT, typename K::FT>&) [with K = CGAL::Cartesian<CGAL::Gmpq>]::FT&)’
/usr/include/bits/mathcalls.h:157: note: candidates are: double sqrt(double)
/usr/include/c++/4.3/cmath:430: note:                 float std::sqrt(float)
/usr/include/c++/4.3/cmath:434: note:                 long double std::sqrt(long double)
/usr/include/CGAL/eigen_2.h:86: error: no matching function for call to ‘sqrt(CGAL::CGALi::eigen_symmetric_2(const typename K::FT*, std::pair<typename K::Vector_2, typename K::Vector_2>&, std::pair<typename K::FT, typename K::FT>&) [with K = CGAL::Cartesian<CGAL::Gmpq>]::FT&)’
/usr/include/bits/mathcalls.h:157: note: candidates are: double sqrt(double)
/usr/include/c++/4.3/cmath:430: note:                 float std::sqrt(float)
/usr/include/c++/4.3/cmath:434: note:                 long double std::sqrt(long double)
/usr/include/CGAL/linear_least_squares_fitting_2.h:83:   instantiated from ‘typename K::FT CGAL::CGALi::linear_least_squares_fitting_2(InputIterator, InputIterator, typename K::Line_2&, typename K::Point_2&, const K&, const typename K::Point_2*) [with InputIterator = std::_List_iterator<CGAL::Point_2<CGAL::Cartesian<CGAL::Gmpq> > >, K = CGAL::Cartesian<CGAL::Gmpq>]’
/usr/include/CGAL/linear_least_squares_fitting_2.h:132:   instantiated from ‘typename K::FT CGAL::linear_least_squares_fitting_2(InputIterator, InputIterator, typename K::Line_2&, const K&) [with InputIterator = std::_List_iterator<CGAL::Point_2<CGAL::Cartesian<CGAL::Gmpq> > >, K = CGAL::linear_least_squares_fitting_2(InputIterator, InputIterator, Line&) [with InputIterator = std::_List_iterator<CGAL::Point_2<CGAL::Cartesian<CGAL::Gmpq> > >, Line = main()::Line]::K]’
/usr/include/CGAL/linear_least_squares_fitting_2.h:162:   instantiated from ‘typename CGAL::Kernel_traits<Line>::Kernel::FT CGAL::linear_least_squares_fitting_2(InputIterator, InputIterator, Line&) [with InputIterator = std::_List_iterator<CGAL::Point_2<CGAL::Cartesian<CGAL::Gmpq> > >, Line = main()::Line]’
main.cc:20:   instantiated from here
/usr/include/CGAL/eigen_2.h:100: error: no matching function for call to ‘sqrt(CGAL::CGALi::eigen_symmetric_2(const typename K::FT*, std::pair<typename K::Vector_2, typename K::Vector_2>&, std::pair<typename K::FT, typename K::FT>&) [with K = CGAL::Cartesian<CGAL::Gmpq>]::FT&)’
/usr/include/bits/mathcalls.h:157: note: candidates are: double sqrt(double)
/usr/include/c++/4.3/cmath:430: note:                 float std::sqrt(float)
/usr/include/c++/4.3/cmath:434: note:                 long double std::sqrt(long double)
/usr/include/CGAL/eigen_2.h:101: error: no matching function for call to ‘sqrt(CGAL::CGALi::eigen_symmetric_2(const typename K::FT*, std::pair<typename K::Vector_2, typename K::Vector_2>&, std::pair<typename K::FT, typename K::FT>&) [with K = CGAL::Cartesian<CGAL::Gmpq>]::FT&)’
/usr/include/bits/mathcalls.h:157: note: candidates are: double sqrt(double)
/usr/include/c++/4.3/cmath:430: note:                 float std::sqrt(float)
/usr/include/c++/4.3/cmath:434: note:                 long double std::sqrt(long double)
/usr/include/CGAL/eigen_2.h:107: error: no matching function for call to ‘sqrt(CGAL::CGALi::eigen_symmetric_2(const typename K::FT*, std::pair<typename K::Vector_2, typename K::Vector_2>&, std::pair<typename K::FT, typename K::FT>&) [with K = CGAL::Cartesian<CGAL::Gmpq>]::FT&)’
/usr/include/bits/mathcalls.h:157: note: candidates are: double sqrt(double)
/usr/include/c++/4.3/cmath:430: note:                 float std::sqrt(float)
/usr/include/c++/4.3/cmath:434: note:                 long double std::sqrt(long double)
/usr/include/CGAL/eigen_2.h:108: error: no matching function for call to ‘sqrt(CGAL::CGALi::eigen_symmetric_2(const typename K::FT*, std::pair<typename K::Vector_2, typename K::Vector_2>&, std::pair<typename K::FT, typename K::FT>&) [with K = CGAL::Cartesian<CGAL::Gmpq>]::FT&)’
/usr/include/bits/mathcalls.h:157: note: candidates are: double sqrt(double)
/usr/include/c++/4.3/cmath:430: note:                 float std::sqrt(float)
/usr/include/c++/4.3/cmath:434: note:                 long double std::sqrt(long double)
/usr/include/CGAL/centroid.h: In function ‘typename K::Point_2 CGAL::CGALi::centroid(InputIterator, InputIterator, const K&, const typename K::Point_2*) [with InputIterator = std::_List_iterator<CGAL::Point_2<CGAL::Cartesian<CGAL::Gmpq> > >, K = CGAL::Cartesian<CGAL::Gmpq>]’:
/usr/include/CGAL/centroid.h:172:   instantiated from ‘typename CGAL::Point<CGAL::Dimension::value, K>::type CGAL::centroid(InputIterator, InputIterator, const K&) [with InputIterator = std::_List_iterator<CGAL::Point_2<CGAL::Cartesian<CGAL::Gmpq> > >, K = CGAL::Cartesian<CGAL::Gmpq>]’
/usr/include/CGAL/linear_least_squares_fitting_2.h:60:   instantiated from ‘typename K::FT CGAL::CGALi::linear_least_squares_fitting_2(InputIterator, InputIterator, typename K::Line_2&, typename K::Point_2&, const K&, const typename K::Point_2*) [with InputIterator = std::_List_iterator<CGAL::Point_2<CGAL::Cartesian<CGAL::Gmpq> > >, K = CGAL::Cartesian<CGAL::Gmpq>]’
/usr/include/CGAL/linear_least_squares_fitting_2.h:132:   instantiated from ‘typename K::FT CGAL::linear_least_squares_fitting_2(InputIterator, InputIterator, typename K::Line_2&, const K&) [with InputIterator = std::_List_iterator<CGAL::Point_2<CGAL::Cartesian<CGAL::Gmpq> > >, K = CGAL::linear_least_squares_fitting_2(InputIterator, InputIterator, Line&) [with InputIterator = std::_List_iterator<CGAL::Point_2<CGAL::Cartesian<CGAL::Gmpq> > >, Line = main()::Line]::K]’
/usr/include/CGAL/linear_least_squares_fitting_2.h:162:   instantiated from ‘typename CGAL::Kernel_traits<Line>::Kernel::FT CGAL::linear_least_squares_fitting_2(InputIterator, InputIterator, Line&) [with InputIterator = std::_List_iterator<CGAL::Point_2<CGAL::Cartesian<CGAL::Gmpq> > >, Line = main()::Line]’
main.cc:20:   instantiated from here
/usr/include/CGAL/centroid.h:63: error: call of overloaded ‘Gmpq(unsigned int&)’ is ambiguous
/usr/include/CGAL/GMP/Gmpq_type.h:126: note: candidates are: CGAL::Gmpq::Gmpq(const std::string&, int) <near match>
/usr/include/CGAL/GMP/Gmpq_type.h:123: note:                 CGAL::Gmpq::Gmpq(double)
/usr/include/CGAL/GMP/Gmpq_type.h:91: note:                 CGAL::Gmpq::Gmpq(const CGAL::Gmpz&)
/usr/include/CGAL/GMP/Gmpq_type.h:88: note:                 CGAL::Gmpq::Gmpq(long unsigned int)
/usr/include/CGAL/GMP/Gmpq_type.h:85: note:                 CGAL::Gmpq::Gmpq(long int)
/usr/include/CGAL/GMP/Gmpq_type.h:82: note:                 CGAL::Gmpq::Gmpq(int)
/usr/include/CGAL/GMP/Gmpq_type.h:79: note:                 CGAL::Gmpq::Gmpq(const __mpq_struct*) <near match>
/usr/include/CGAL/GMP/Gmpq_type.h:66: note:                 CGAL::Gmpq::Gmpq(const CGAL::Gmpq&)



I'm sure I made an stupid mistake, but I dind't found any information about that. Any ideas?
By the way, if I use an inexact kernel (such as typedef CGAL::Cartesian<double> Kernel). Unfortanetly, I really need that kernel to be an error-less one.

--
Genís Aguilar López



Archive powered by MHonArc 2.6.16.

Top of Page