/** * Configures internal parameters. * * @param decomposition Used to solve the linear system. * @param norm2Solution If true then the optimal 2-norm solution will be computed for degenerate systems. */ protected BaseLinearSolverQrp_FDRM(QRPDecomposition_F32 <FMatrixRMaj> decomposition, bool norm2Solution) { this.decomposition = decomposition; this.norm2Solution = norm2Solution; if (internalSolver.modifiesA()) { internalSolver = new LinearSolverSafe <FMatrixRMaj>(internalSolver); } }
public bool setA(T A) { if (alg.modifiesA()) { this.A = (T)UtilEjml.reshapeOrDeclare(this.A, A); this.A.To = A; return(alg.setA(this.A)); } return(alg.setA(A)); }
/** * <p> * Performs a matrix inversion operation that does not modify the original * and stores the results in another matrix. The two matrices must have the * same dimension.<br> * <br> * b = a<sup>-1</sup> * </p> * * <p> * If the algorithm could not invert the matrix then false is returned. If it returns true * that just means the algorithm finished. The results could still be bad * because the matrix is singular or nearly singular. * </p> * * <p> * For medium to large matrices there might be a slight performance boost to using * {@link LinearSolverFactory_CDRM} instead. * </p> * * @param input The matrix that is to be inverted. Not modified. * @param output Where the inverse matrix is stored. Modified. * @return true if it could invert the matrix false if it could not. */ public static bool invert(CMatrixRMaj input, CMatrixRMaj output) { LinearSolverDense <CMatrixRMaj> solver = LinearSolverFactory_CDRM.lu(input.numRows); if (solver.modifiesA()) { input = (CMatrixRMaj)input.copy(); } if (!solver.setA(input)) { return(false); } solver.invert(output); return(true); }
public virtual bool setA(T A) { if (alg.modifiesA()) { if (this.A == null) { this.A = (T)A.copy(); } else { if (this.A.getNumRows() != A.getNumRows() || this.A.getNumCols() != A.getNumCols()) { this.A.reshape(A.getNumRows(), A.getNumCols()); } this.A.set(A); } return(alg.setA(this.A)); } return(alg.setA(A)); }