Re: [eigen] Documentation for Eigen::{fitHyperplane,linearRegression} |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Documentation for Eigen::{fitHyperplane,linearRegression}*From*: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>*Date*: Tue, 20 Apr 2010 16:30:18 -0400*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:content-type :content-transfer-encoding; bh=dOs6OyHOJXiZDJgHjXkSx1TOJ4TETmvUblGOEmXSywA=; b=xlY04uhYXVN7bB9y70hbAJdMbC8hr6nmPvnRDvzTkbICv+nPcRBQSLC3UAd16uytOX w9UCj6B9ABOtAQMyDma6U4mc0Z37YYZW2dgNaoLFRlFfWbOVEHG1p0bgG5XH0pz4EpUc w7JEVf8rfaxIhFaFpyWjtocu7KmKO08n4cK5A=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=nUwE32LacrvyKB6M4ddX/UQERn9jQG8czXJeyL0YaFsTJNOAi+XOV4hTjjF1nx98/9 9vrCHHjTX5fCNXfANNYEukTNyX8T+WhOqV7aLbds/wdSu3oo31S32DBsLPorIezfaTcy mBO0bLOVOFvav5bC/tdtpuXJcmmTn7Rk1NEl4=

Yes, I'm aware there's a problem there actually, I was too lazy to fix it.... I can't use your code as-is because the use of "new" here is really inefficient, but i'll try to fix it soonish. However the LeastSquares module is probably going away in eigen3 as we figured that 1) it was really hard to come up with a good universal API and 2) it's always very easy to do with just a SVD decomposition. Benoit 2010/4/20 Tilman Vogel <tilman.vogel@xxxxxx>: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, > > I think, the example in the documentation is incorrect. The parameter > "points" is documented as "the array of pointers to the points on which > to perform the linear regression" and the code reveals that it is used > as such, however, the example does: > > 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 // the coord to express as a function of > // the other ones. 0 means x, 1 means y, 2 means z. > ); > > I.e. it passes a pointer to an array of points instead of an array of > pointers to points. Which is formally correct w.r.t. the level of > indirection, but actually, gcc 4.4.1 won't accept it. It can be forced > by doing > > Vector3d * p = points; > linearRegression( > 5, > &p, > &coeffs, > 1 // the coord to express as a function of > // the other ones. 0 means x, 1 means y, 2 means z. > ); > > but it will cause a segfault as expected. > > The example should be fixed to be: > > Vector3d * points[5]; > points[0] = new Vector3d( 3.02, 6.89, -4.32 ); > points[1] = new Vector3d( 2.01, 5.39, -3.79 ); > points[2] = new Vector3d( 2.41, 6.01, -4.01 ); > points[3] = new Vector3d( 2.09, 5.55, -3.86 ); > points[4] = new Vector3d( 2.58, 6.32, -4.10 ); > > Vector3d coeffs; // will store the coefficients a, b, c > linearRegression( > 5, > points, > &coeffs, > 1 // the coord to express as a function of > // the other ones. 0 means x, 1 means y, 2 means z. > ); > > > Regards, > > Tilman > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.12 (GNU/Linux) > Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ > > iEYEARECAAYFAkvNeeQACgkQ9ZPu6Yae8lk99gCeO8oeiGJE91/L4KGr0PlyjtHs > Gs8AnjhD/8bmkiFdraFdp3/ZxNbX74tk > =sNGM > -----END PGP SIGNATURE----- > > >

**References**:**[eigen] Documentation for Eigen::{fitHyperplane,linearRegression}***From:*Tilman Vogel

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] gdb pretty quaternion and vector printing** - Next by Date:
**Re: [eigen] gdb pretty quaternion and vector printing** - Previous by thread:
**[eigen] Documentation for Eigen::{fitHyperplane,linearRegression}** - Next by thread:
**[eigen] converting matrices to/from byte arrays**

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