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

Using Eigen in Windows

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

Using Eigen in Windows

Tue Oct 13, 2009 4:25 pm
hello,
i'm using MSVC 2008 and trying to compute SVD.
i'm testing with a matrix as in http://en.wikipedia.org/wiki/Singular_value_decomposition#Example.
Code: Select all
const int m = 4, n = 5;
MatrixXf A = MatrixXf(m, n); /* this is just a test, so i don't mind how much resource is used */
A <<
   1, 0, 0, 0, 2,
   0, 0, 3, 0, 0,
   0, 0, 0, 0, 0,
   0, 4, 0, 0, 0;
cout << A.svd().singularValues();


in Debug Mode, after trying to run the code the output was:
Assertion failed: index >= 0 && index < size(), file c:\program files\eigen2\eigen\src\core\coeffs.h, line 186


in Release Mode, the output was correct but the application still crashes and an error message box from visual studio is showed up (a screenshot: http://aurodeus.freehostia.com/skripsi/error.html)

any idea?

btw, in my real project i will need to set the values for each matrix element separately, so how to set values for each A(m,n) separately?
and since i'm working with Windows Forms Application (not a Console Application as above) i will need to get the Singular Values separately also and then convert them to String, so how to get the Singular Values separately?
many thanks before!
User avatar
bjacob
Registered Member
Posts
658
Karma
3

Re: Using Eigen in Windows

Tue Oct 13, 2009 6:20 pm
First of all, you seem primarily interested in SVD, which to be honest isn't the greatest aspect of Eigen 2.0 (where we explicitly say that it is experimental). I'd recommend you to either try the development branch, or re-evaluate Eigen when we release the next major version.

in Debug Mode, after trying to run the code the output was:

Assertion failed: index >= 0 && index < size(), file c:\program files\eigen2\eigen\src\core\coeffs.h, line 186



in Release Mode, the output was correct but the application still crashes and an error message box from visual studio is showed up (a screenshot: http://aurodeus.freehostia.com/skripsi/error.html)

any idea?

Yes, in Eigen 2.0 the SVD is only for MxN matrices with M>=N. I just added an assert to guard that. In the devel branch, JacobiSVD already does that.

how to set values for each A(m,n) separately?

As explained in the tutorial, just do A(m,n) = value;

how to get the Singular Values separately?

Not sure what you mean. matrix.svd().singularValues() returns you the vector of singular values. We don't offer yet a way to compute only one singular value, but be aware that if you start from a general matrix, computing just one singular value is almost as expensive as calculating them all. Only when you have e.g. a bidiagonal matrix, is there an optimization opportunity here.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
Aurodeus
Registered Member
Posts
2
Karma
0
OS

Re: Using Eigen in Windows

Wed Oct 14, 2009 4:14 pm
yeah i'm only interested in SVD because my i'm assigned to compute the matrix using SVD ;D ok thanks for your reply ;D


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]