How to override columns/rows of a matrix with Jeigen (vs. EJML)

284 views Asked by At

I'm using Jeigen for representing matrices in Java (Jeigen is a wrapper for Eigen). The library is fast and easy but I'm missing one cool feature. As far as I see, Jeigen does not support exchanging columns or rows (e.g. operation on column and then replace column with new values). Jeigen only supports setting individual entries.

Does somebody have an efficient workaround for this? Setting each value in a column is inefficient (especially if the column is large).

Alternatively, perhaps EJML supports this. But with EJML I have the problem that it is not possible to easy and fast convert a SimpleMatrix to a 1D array.

1

There are 1 answers

0
lessthanoptimal On

EJML internally stores a matrix as a 1D array. For a example:

DenseMatrix64F A = new DenseMatrix64F(10,12);
A.data <-- is a 1D array that stores the 10x12 matrix in row-major format.

So it's trivial to get a 1D array out of EJML.