With the Apache common math library I get back a primitive double array.
RealMatrix pInverse = new LUDecomposition(p).getSolver().getInverse();
double[][] temp = pInverse.getData();
I need to convert temp to a Double[][]
Double[][] inverse = new Double[][]temp;
If you are using Java 8+ you can use :
Double[][] inverse = Arrays.stream(temp)
.map(d -> Arrays.stream(d).boxed().toArray(Double[]::new))
.toArray(Double[][]::new);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With