This project has moved and is read-only. For the latest updates, please go here.

Creating matrix from list of vectors

Jun 17, 2011 at 5:10 PM

Hi,

In Math.Net iridium I was able to create a matrix from a list of column vectors using

matrix.createfromcolumns(MyList)

Is there a replacement in Math.Net numerics?

Thanks,

Andrew

Jun 18, 2011 at 1:52 PM

Hi Andrew,

That method seems to have been dropped when we merged the two different matrix classes. If you would like us to add it back, please create a feature request. 

You could also use the Matrix SetColumn method.

var vectors = new List<Vector>();
// add data
var matrix = new DenseMatrix(vectors[0].Count, vectors.Count); //assuming each vector is the same length
for (var i = 0; i < 10; i++){
   matrix.SetColumn(i, vectors[i]);
}

Regards,
Marcus