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

DiagonalMatrix example?

Tags: None
(comma "," separated)
mpmcl
Registered Member
Posts
19
Karma
0

DiagonalMatrix example?

Thu Aug 19, 2010 2:12 pm
Is there an example of using DynamicMatrix anywhere? I would like to get something equivalent to

DynamicMatrixXd mat(Nrows)

but everything I have tried, e.g.,

DynamicMatrix<double, Dynamic> mat(Nrows)

complains that there should only be one template argument. [in Xcode]

Thanks.
User avatar
bjacob
Registered Member
Posts
658
Karma
3

Re: DiagonalMatrix example?

Fri Aug 20, 2010 1:09 pm
I guess by DynamicMatrix you meant DiagonalMatrix?

I don't know if we have many examples, but basically this is mostly used as the return type of asDiagonal().

Vector3f v(1,2,3);
cout << v.asDiagonal();

In Eigen2, that was about it. In Eigen3, DiagonalMatrix is fully usable as a special matrix class so you can do:

DiagonalMatrix<float, Dynamic> d(100); // 100x100 float diagonal matrix
d.diagonal() = some_vector; // initialize the diagonal coeffs;
MatrixXf othermatrix(100,100);
othermatrix = d * othermatrix; // diagonal products are well supported

See: http://eigen.tuxfamily.org/dox-devel/cl ... atrix.html


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]