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

Fill the sparse matrix by column non zero data+ indexes

Tags: None
(comma "," separated)
lukeweber
Registered Member
Posts
1
Karma
0
Hi, I am Java programmer , but i muste re write my code to C+ so it will be fun:),
1. I need to fill the sparse typ e matrix by columns(vectors), when i know the non-zero values and their indexes in double array, somebody help me?

THis is pseudocde, if i understand this correctly: the TRiplet T is sparse vector? where i Can store my values and indexes?
Code: Select all
typedef Eigen::Triplet<double> T;
std::vector<T> tripletList;
triplets.reserve(estimation_of_entries);
for(. i=0,i<size.T..)
for(.j=0,i<columns.size..)//for all columns
{
 v_ij=T.Scalar&
// ...
 tripletList.push_back(T(i,j,v_ij));
}
SparseMatrixType mat(rows,cols);
mat.setFromTriplets(triplet
Thanks for help.


Bookmarks



Who is online

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