本文整理匯總了Java中org.apache.commons.math3.linear.RealMatrix.getNorm方法的典型用法代碼示例。如果您正苦於以下問題:Java RealMatrix.getNorm方法的具體用法?Java RealMatrix.getNorm怎麽用?Java RealMatrix.getNorm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.math3.linear.RealMatrix
的用法示例。
在下文中一共展示了RealMatrix.getNorm方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSolver
import org.apache.commons.math3.linear.RealMatrix; //導入方法依賴的package包/類
/**
* @param data dense matrix represented in row-major form
* @return solver for the system Ax = b
*/
static Solver getSolver(double[][] data) {
if (data == null) {
return null;
}
RealMatrix M = new Array2DRowRealMatrix(data, false);
double infNorm = M.getNorm();
double singularityThreshold = infNorm * SINGULARITY_THRESHOLD_RATIO;
RRQRDecomposition decomposition = new RRQRDecomposition(M, singularityThreshold);
DecompositionSolver solver = decomposition.getSolver();
if (solver.isNonSingular()) {
return new Solver(solver);
}
// Otherwise try to report apparent rank
int apparentRank = decomposition.getRank(0.01); // Better value?
log.warn("{} x {} matrix is near-singular (threshold {}). Add more data or decrease the " +
"number of features, to <= about {}",
M.getRowDimension(),
M.getColumnDimension(),
singularityThreshold,
apparentRank);
throw new SingularMatrixSolverException(apparentRank, "Apparent rank: " + apparentRank);
}