Java 类javax.vecmath.SingularMatrixException 实例源码

项目:CustomWorldGen    文件:TRSRTransformation.java   
public TRSRTransformation getUVLockTransform(EnumFacing originalSide)
{
    EnumFacing newSide = rotate(originalSide);
    try
    {
        return blockCenterToCorner(vanillaUvTransformGlobalToLocal.get(originalSide).compose(blockCornerToCenter(this.inverse())).compose(vanillaUvTransformLocalToGlobal.get(newSide)));
    }
    catch(SingularMatrixException e)
    {
        return new TRSRTransformation(null, null, new Vector3f(0, 0, 0), null);
    }
}
项目:asura-j    文件:MatrixUtils.java   
/**
 * 連立一次方程式mat*x=bを解きます.
 *
 * 行列matの中身は保持されないことに注意してください.
 *
 * @param mat
 * @param b
 * @param x
 * @throws SingularMatrixException
 */
public static void solve(GfMatrix mat, GfVector b, GfVector x)
        throws SingularMatrixException {
    // LU分解その1
    GfVector perm = new GfVector(mat.getNumRow());
    mat.LUD(mat, perm);
    x.LUDBackSolve(mat, b, perm);

    // 逆行列(中身はLU分解)
    // jacobi.invert();
    // x.mul(mat, b);
}
项目:asura-j    文件:MatrixUtils.java   
/**
 * 連立一次方程式mat*x=bを解きます. その2.
 */
public static int solve2(GfMatrix mat, GfVector b, GfVector x)
        throws SingularMatrixException {

    int rows = mat.getNumRow();
    int cols = mat.getNumCol();
    GfMatrix u = new GfMatrix(rows, rows);
    GfMatrix w = new GfMatrix(rows, cols);
    GfMatrix v = new GfMatrix(cols, cols);
    int rank = mat.SVD(u, w, v);
    x.SVDBackSolve(u, w, v, b);
    return rank;
}