public class MatlabSolver extends java.lang.Object implements DirectSolver
DirectSolver.IterativeMethodANALYZED, DEFAULT_ITERATIVE_MAX_SOLVES, DEFAULT_ITERATIVE_TOLERANCE, FACTORED, UNSET| Constructor and Description |
|---|
MatlabSolver() |
| Modifier and Type | Method and Description |
|---|---|
void |
analyze(double[] vals,
int[] colIdxs,
int[] rowOffs,
int size,
int type)
Performs prefactor analysis on a matrix whose structure and values are
supplied in compressed row storage (CRS) format, using 1-based
indices, as described in the documentation for
Matrix.setCRSValues. |
void |
analyze(Matrix M,
int size,
int type)
Performs prefactor analysis on a specified matrix.
|
void |
analyzeAndFactor(Matrix M)
Factors a matrix.
|
void |
dispose()
Releases all internal resources allocated by this solver.
|
void |
factor()
Factors a previously analyzed matrix.
|
void |
factor(double[] vals)
Factors a previously analyzed matrix, using the numeric values supplied
by
vals. |
java.lang.String |
getErrorMessage()
|
long |
getNumNonZerosInFactors()
If possible, returns the number of non-zero elements in the
factorization.
|
int |
getState()
|
boolean |
hasIterativeSolves()
Returns true if this solver supports iterative solving, using a recent
directly-factored matrix as a preconditioner.
|
void |
incAll(int[] ar) |
void |
incIndices(double[] ar) |
void |
int2double(int[] ar,
double[] dar) |
void |
printArray(double[] ar) |
void |
printArray(int[] ar) |
void |
printArray(java.lang.String name,
double[] ar) |
void |
printArray(java.lang.String name,
int[] ar) |
void |
printData(double[] rows,
double[] cols,
double[] vals) |
void |
printIdxs(double[] rows,
double[] cols) |
void |
queryFullMatrix() |
void |
querySparseMatrix() |
void |
solve(double[] x,
double[] b)
Solves the system
|
void |
solve(VectorNd x,
VectorNd b)
Solves the system
|
void |
test() |
void |
write(java.lang.String filename) |
void |
writeArray(IndentingPrintWriter pw,
java.lang.String name,
double[] ar) |
void |
writeArray(IndentingPrintWriter pw,
java.lang.String name,
int[] ar) |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetIterativeMaxSolves, getIterativeMethod, getIterativeTolerance, getLastIterativeResidual, getLastIterativeSolves, getMaxRefinementSteps, getNumNegEigenvalues, getNumPerturbedPivots, getNumPosEigenvalues, hasMultipleRhsSolves, iterativeSolve, iterativeSolve, residual, setIterativeMaxSolves, setIterativeMethod, setIterativeTolerance, setMaxRefinementSteps, solvepublic void test()
public void analyze(Matrix M, int size, int type)
DirectSolverfactor(). If
size is less than the actual matrix size, then the analysis
is done on the principal submatrix of M defined by the first
size rows and columns.analyze in interface DirectSolverM - matrix to analyzesize - size of the matrix to factor.type - or-ed flags giving information about the matrix type. Typical flags are
SYMMETRIC or
POSITIVE_DEFINITEpublic void factor()
DirectSolverfactor in interface DirectSolverpublic void analyzeAndFactor(Matrix M)
DirectSolveranalyze (M, M.rowSize(), 0) factor()
analyzeAndFactor in interface DirectSolverM - matrix to factorpublic void querySparseMatrix()
public void queryFullMatrix()
public void solve(VectorNd x, VectorNd b)
DirectSolversolve in interface DirectSolverx - vector in which result is returnedb - right hand vector of matrix equationpublic void solve(double[] x,
double[] b)
DirectSolverM x = bwhere the solution and right hand side are supplied using
double[] objects.solve in interface DirectSolverx - vector in which result is returnedb - right hand vector of matrix equationpublic void write(java.lang.String filename)
public void writeArray(IndentingPrintWriter pw, java.lang.String name, double[] ar)
public void writeArray(IndentingPrintWriter pw, java.lang.String name, int[] ar)
public void printData(double[] rows,
double[] cols,
double[] vals)
public void printIdxs(double[] rows,
double[] cols)
public void printArray(java.lang.String name,
int[] ar)
public void printArray(int[] ar)
public void printArray(java.lang.String name,
double[] ar)
public void printArray(double[] ar)
public void int2double(int[] ar,
double[] dar)
public void incAll(int[] ar)
public void incIndices(double[] ar)
public boolean hasIterativeSolves()
DirectSolver.IterativeMethod are available, as are the
settings DirectSolver.setIterativeMethod(maspack.solvers.DirectSolver.IterativeMethod), DirectSolver.setIterativeMaxSolves(int) and
DirectSolver.setIterativeTolerance(double).hasIterativeSolves in interface DirectSolverpublic void analyze(double[] vals,
int[] colIdxs,
int[] rowOffs,
int size,
int type)
Matrix.setCRSValues. The number of
non-zero values is given by rowOffs[size]-1. If the matrix type
is symmetric, only the upper triangular portion should be supplied.
Because no matrix object is supplied, factor()
cannot be used after calling this method; use factor(vals) instead. The values supplied here may be used to assist
the analysis but are not used for any numeric factorization.
Not supported by this solver; matrices must be supplied as
Matrix objects.
analyze in interface DirectSolvervals - values of the non-zero matrix elementscolIdxs - 1-based column indices of the non-zero matrix elementsrowOffs - 1-based row start offsets into vals and
colIdxssize - size of the matrix to be analyzedtype - or-ed flags giving information about the matrix type, as
described for analyze(M,size,type)public void factor(double[] vals)
vals. These must be ordered in the same way as those
supplied to the most recent call to analyze().
Not supported by this solver; use factor() instead.
factor in interface DirectSolvervals - non-zero matrix element valuespublic int getState()
getState in interface DirectSolverpublic java.lang.String getErrorMessage()
analyze() or factor(), or
null if the method succeeded.
This solver does not record error messages, so null is
always returned.
getErrorMessage in interface DirectSolverpublic long getNumNonZerosInFactors()
analyze(). If the solver does not report this quantity, -1 is returned.
This solver does not report this quantity, so -1 is returned.
getNumNonZerosInFactors in interface DirectSolverpublic void dispose()
DirectSolverdispose in interface DirectSolver