本文整理汇总了Java中mikera.matrixx.AMatrix.isSquare方法的典型用法代码示例。如果您正苦于以下问题:Java AMatrix.isSquare方法的具体用法?Java AMatrix.isSquare怎么用?Java AMatrix.isSquare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mikera.matrixx.AMatrix
的用法示例。
在下文中一共展示了AMatrix.isSquare方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLUPInverse
import mikera.matrixx.AMatrix; //导入方法依赖的package包/类
public static Matrix createLUPInverse(AMatrix m) {
if (!m.isSquare()) { throw new IllegalArgumentException(
"Matrix must be square for inverse!"); }
int dims = m.rowCount();
Matrix am = new Matrix(m);
int[] rowPermutations = new int[dims];
// perform LU-based inverse on matrix
DecomposeLUP.decomposeLU(am, rowPermutations);
return DecomposeLUP.backSubstituteLU(am, rowPermutations);
}
示例2: setA
import mikera.matrixx.AMatrix; //导入方法依赖的package包/类
public LUPResult setA(AMatrix A) {
if(!A.isSquare())
throw new IllegalArgumentException("Input must be a square matrix.");
this.A = A;
this.numRows = A.rowCount();
this.numCols = A.columnCount();
decomp = new AltLU();
result = decomp._decompose(A);
return result;
}
示例3: solve
import mikera.matrixx.AMatrix; //导入方法依赖的package包/类
/**
* A general linear system solver,
* Returns the solution to the equation A.x = b, returns null if A is square and
* has no unique solution.
*
* @param A
* @param b
* @return
*/
public static AVector solve(AMatrix A, AVector b) {
if (A.isSquare())
return solveSquare(A,b);
else
return solveLeastSquares(A, b);
}