Is there something like Primitive64Matrix.FACTORY.makeDiagonal(double...)
? I couldn't find anything like that in
https://www.ojalgo.org/code-examples/
I was hoping not to do Primitive64Matrix.FACTORY.rows(new double[][]{{1, 0, 0}, {0, 2, 0}, {0, 0, 5}})
since that's not exploiting the sparse structure of the diagonal matrix and therefore seems computationally inefficient for big matrices.
No, not directly like that. You can either create a sparse matrix and then just set the diagonal:
Using MatrixStore:s there is a DiagonalStore implementation. It is perhaps the closest thing to what you're looking for, but it's not very "direct" to instantiate. You have to do something like this:
or
... or you just create your own MatrixStore implementation. That's very easy to do, and there is a code example for that.