本文整理汇总了Java中org.ejml.data.DenseMatrix64F.copy方法的典型用法代码示例。如果您正苦于以下问题:Java DenseMatrix64F.copy方法的具体用法?Java DenseMatrix64F.copy怎么用?Java DenseMatrix64F.copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ejml.data.DenseMatrix64F
的用法示例。
在下文中一共展示了DenseMatrix64F.copy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: det
import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
public static double det(DenseMatrix64F mat) {
int numCol = mat.getNumCols();
int numRow = mat.getNumRows();
if(numCol != numRow) {
throw new IllegalArgumentException("Must be a square matrix.");
} else if(numCol <= 6) {
return numCol >= 2? UnrolledDeterminantFromMinor.det(mat):mat.get(0);
} else {
LUDecompositionAlt_D64 alg = new LUDecompositionAlt_D64();
if(alg.inputModified()) {
mat = mat.copy();
}
return !alg.decompose(mat)?0.0D:alg.computeDeterminant().real;
}
}
示例2: invertSafe
import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
private boolean invertSafe(LinearSolver<DenseMatrix64F> solver, DenseMatrix64F A, boolean pseudoInverse)
{
DenseMatrix64F Ain = (solver.modifiesA() || isInversionTolerance()) ? A.copy() : A;
if (!initialiseSolver(solver, Ain))
return false;
solver.invert(getA_inv());
// Check for NaN or Infinity
double[] a_inv = A_inv.data;
for (int i = a_inv.length; i-- > 0;)
if (!Maths.isFinite(a_inv[i]))
return false;
if (isInversionTolerance() && invalidInversion(A, pseudoInverse))
return false;
System.arraycopy(a_inv, 0, A.data, 0, a_inv.length);
return true;
}
示例3: invertUnsafe
import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
private boolean invertUnsafe(LinearSolver<DenseMatrix64F> solver, DenseMatrix64F A, boolean pseudoInverse)
{
DenseMatrix64F Ain = (isInversionTolerance()) ? A.copy() : A;
if (!initialiseSolver(solver, Ain))
return false;
solver.invert(getA_inv());
// Check for NaN or Infinity
double[] a_inv = A_inv.data;
for (int i = a_inv.length; i-- > 0;)
if (!Maths.isFinite(a_inv[i]))
{
System.out.printf("Not finite\n");
return false;
}
if (isInversionTolerance() && invalidInversion(A, pseudoInverse))
return false;
System.arraycopy(a_inv, 0, A.data, 0, a_inv.length);
return true;
}
示例4: invertAndGetDeterminant
import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
public static double invertAndGetDeterminant(DenseMatrix64F mat, DenseMatrix64F result) {
final int numCol = mat.getNumCols();
final int numRow = mat.getNumRows();
if (numCol != numRow) {
throw new IllegalArgumentException("Must be a square matrix.");
}
if (numCol <= 5) {
if (numCol >= 2) {
UnrolledInverseFromMinor.inv(mat, result);
} else {
result.set(0, 1.0D / mat.get(0));
}
return numCol >= 2 ?
UnrolledDeterminantFromMinor.det(mat) :
mat.get(0);
} else {
LUDecompositionAlt_D64 alg = new LUDecompositionAlt_D64();
LinearSolverLu_D64 solver = new LinearSolverLu_D64(alg);
if (solver.modifiesA()) {
mat = mat.copy();
}
if (!solver.setA(mat)) {
return Double.NaN;
}
solver.invert(result);
return alg.computeDeterminant().real;
}
}
示例5: solveSafe
import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
/**
* Solves (one) linear equation, a x = b
* <p>
* Output is written to x.
* <p>
* A and/or B will not be modified. If you do not care then use
* {@link #solveUnsafe(LinearSolver, DenseMatrix64F, DenseMatrix64F, DenseMatrix64F)}
*
* @param solver
* @param A
* @param B
* @param X
* @return False if the equation is singular (no solution)
*/
private boolean solveSafe(LinearSolver<DenseMatrix64F> solver, DenseMatrix64F A, DenseMatrix64F B, DenseMatrix64F X)
{
if (solver.modifiesA())
A = A.copy();
if (solver.modifiesB())
B = B.copy();
if (!initialiseSolver(solver, A))
return false;
solver.solve(B, X);
return true;
}