Registered Member
|
Hi,
For dense matrix, one could use code like:
Although Eigen could define a large sparse matrix like:
How could I fill it with Random values? Thank you. |
Moderator
|
There is no convenient methods because the structure of the sparse matrix is a very important aspect, and it usually does not make much sense to initialize a sparse matrix with a random structure.
|
Registered Member
|
By using Armadilo+Arpack, one could construct large Sparse Matrix with Random values like: sp_cx_mat A (sprandu<sp_mat>(1000, 1000, 0.1), sprandu<sp_mat>(1000, 1000, 0.1)); It is convenient for me to testing the accuracy and efficiency of an algorithm. Anyway, thank you all the same. |
Moderator
|
we have a similar helper in test/sparse.h that you can adapt to remove the construction of the dense reference matrix.
|
Registered Member
|
Hi, Gael Sorry for bothering you again. I wrote a fragment of simple code to try, but it gives out fatal error C1083: Cannot open include file: 'split_test_helper.h': No such file or directory Yet, I cannot find such file in the whole Eigen folder...
|
Moderator
|
indeed, you cannot just directly include this file. Instead, you should rather copy/paste the related function and adjust it to your need.
For the record, split_test_helper.h is procedurally generated by cmake when configuring the unit test. |
Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]