public static void invert(LinearSolverDense <ZMatrixRMaj> solver, ZMatrixRMaj A, ZMatrixRMaj A_inv) { if (A.numRows != A_inv.numRows || A.numCols != A_inv.numCols) { throw new ArgumentException("A and A_inv must have the same dimensions"); } CommonOps_ZDRM.setIdentity(A_inv); solver.solve(A_inv, A_inv); }
public static ZMatrixRMaj checkIdentity(ZMatrixRMaj A, int numRows, int numCols) { if (A == null) { return(CommonOps_ZDRM.identity(numRows, numCols)); } else if (numRows != A.numRows || numCols != A.numCols) { throw new ArgumentException("Input is not " + numRows + " x " + numCols + " matrix"); } else { CommonOps_ZDRM.setIdentity(A); } return(A); }