arrays - How to convert from Jama Matrix object to double[][] - Java -
i have object matrix package jama, stored double[][] array. want return values of method matrix.inverse().
how can pass values matrix object double[][] array?
double k[][] = {{1,5,3,4} , {1,10,4,3} , {1,40,232,4} , {32,434,23,5}}; matrix getinverse = new matrix(k); double returnvalues[][] = getinverse.inverse(); // ---?----
it's hard know how answer without knowing more matrix
class itself. best approach to write todoublearray()
method in matrix
class, operate in way similar how toarray()
method words classes implement list
(which return object[]
).
it might simple returning internal double[][]
stored in matrix
instance.
since edit clarified using jama class, can this:
double returnvalues[][] = getinverse.inverse().getarray();
since not keeping reference inverse matrix
object, safe. in general, though, safe should not access internal array directly , instead use getarraycopy()
instead of getarray()
.
Comments
Post a Comment