当前位置: 首页>>代码示例>>Java>>正文


Java DenseMatrix64F.copy方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:17,代码来源:MissingOps.java

示例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;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:21,代码来源:EJMLLinearSolver.java

示例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;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:24,代码来源:EJMLLinearSolver.java

示例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;

        }
    }
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:38,代码来源:MissingOps.java

示例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;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:29,代码来源:EJMLLinearSolver.java


注:本文中的org.ejml.data.DenseMatrix64F.copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。