Boost logo

Ublas :

Subject: [ublas] triplets for CSR format
From: Umut Tabak (u.tabak_at_[hidden])
Date: 2011-01-02 17:07:16


Dear all,

Digging through the previous posts, found out that (maybe the direct
answer is there but I am a bit tired of going in between messages)

index1_data()
index2_data()
value_data()

return the native CSR format, is there a way to reach the array format
of the index1_data, say directly the row array, because index1_data()
returns the row_ptr, so then I should do some manual tweaking and
wondered if there is a direct way that gives me these triplets.

Second question is on the retrieval of data from the above functions, by
a bit of trial and error, I found out that this works, naive perhaps,
not sure...

    std::vector<int> rowIndx;
    std::vector<int> colIndx;
    std::vector<double> vals;
    
std::copy(m.index1_data().begin(),m.index1_data().end(),std::back_inserter(rowIndx));
    
std::copy(m.index2_data().begin(),m.index2_data().end(),std::back_inserter(colIndx));
    
std::copy(m.value_data().begin(),m.value_data().end(),std::back_inserter(vals));
   

however I could not find where the above mentioned functions are
implemented, they are some kind of sequences, where begin() and end()
functions are defined but is this the right way to use these functions
to get the triplets for a matrix market export operation?

Best regards,
Umut