This forum has been archived. All content is frozen. Please use KDE Discuss instead.

documentation bug : leastSquares

Tags: None
(comma "," separated)
thewoolymammoth
Registered Member
Posts
2
Karma
0

documentation bug : leastSquares

Wed Feb 17, 2010 12:49 am
Hi - firstly apologies if this is not the place to submit bugs - however, the example supplied for running Eigen::leastSquares on

http://eigen.tuxfamily.org/dox/group__L ... odule.html

Does not compile. I am using the latest tar ball (version 2.0.12), dowloaded 5 minutes ago

Eg


Code: Select all
     
Vector3d points[5];
points[0] = Vector3d( 3.02, 6.89, -4.32 );
points[1] = Vector3d( 2.01, 5.39, -3.79 );
points[2] = Vector3d( 2.41, 6.01, -4.01 );
points[3] = Vector3d( 2.09, 5.55, -3.86 );
points[4] = Vector3d( 2.58, 6.32, -4.10 );

Vector3d coeffs; // will store the coefficients a, b, c
linearRegression(
   5,
   &points,
   &coeffs,
   1);


Fails to compile with the error message:

error: no matching function for call to ‘linearRegression(int, Eigen::Vector3d (*)[5], Eigen::Vector3d*, int)

I Got around it with this kind of (ugly?) foo:

Code: Select all
Eigen::Vector3d** points = new Eigen::Vector3d*[5];
points[0] = new Eigen::Vector3d( 3.02, 6.89, -4.32 );
points[1] = new Eigen::Vector3d( 2.01, 5.39, -3.79 );
points[2] = new Eigen::Vector3d( 2.41, 6.01, -4.01 );
points[3] = new Eigen::Vector3d( 2.09, 5.55, -3.86 );
points[4] = new Eigen::Vector3d( 2.58, 6.32, -4.10 );
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
As you noticed the linearRegression function is very specifics and not always very convenient to use and I strongly encourage you to adapt it to your needs.


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]