[eigen] Sparse Matrix Block Insertion

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi there,

Thank you so much for your quick replies to my previous question.
I have another problem, though.
I'm dealing with a sparse vector.
Am I able to use .block function to insert a block of vector directly to the sparse vector ?
I tried     matrix.insert.block()  DIDN'T WORK
               matrix.block.insert() DIDN'T WORK
Do I have to insert everything one by one?
Appreciate any suggestions. Thanks




#include <iostream>
#include <Eigen/Eigen>
#include <Eigen/Sparse>

using namespace Eigen;
using namespace std;

int main()
{

    // I have a Vector A with length of 10
    SparseVector<double> vecA (10);
   
    // I have a Vector 4 with length of 4
    Vector4d vecB = VectorXd::Ones(4);

    // I want to insert the element of Vector B to A starting from 3rd row
    vecA.insert.block(2) = vecB;    // Problem is HERE
       
    return 0;
}


-- 
Gokturk Poyrazoglu
Mitsubishi Electric Research Laboratories (MERL)
201 Broadway, Cambridge, MA


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/