Java 类org.apache.commons.math3.linear.FieldDecompositionSolver 实例源码

项目:SME    文件:AdamsNordsieckTransformer.java   
/** Simple constructor.
 * @param n number of steps of the multistep method
 * (excluding the one being computed)
 */
private AdamsNordsieckTransformer(final int n) {

    final int rows = n - 1;

    // compute exact coefficients
    FieldMatrix<BigFraction> bigP = buildP(rows);
    FieldDecompositionSolver<BigFraction> pSolver =
        new FieldLUDecomposition<BigFraction>(bigP).getSolver();

    BigFraction[] u = new BigFraction[rows];
    Arrays.fill(u, BigFraction.ONE);
    BigFraction[] bigC1 = pSolver.solve(new ArrayFieldVector<BigFraction>(u, false)).toArray();

    // update coefficients are computed by combining transform from
    // Nordsieck to multistep, then shifting rows to represent step advance
    // then applying inverse transform
    BigFraction[][] shiftedP = bigP.getData();
    for (int i = shiftedP.length - 1; i > 0; --i) {
        // shift rows
        shiftedP[i] = shiftedP[i - 1];
    }
    shiftedP[0] = new BigFraction[rows];
    Arrays.fill(shiftedP[0], BigFraction.ZERO);
    FieldMatrix<BigFraction> bigMSupdate =
        pSolver.solve(new Array2DRowFieldMatrix<BigFraction>(shiftedP, false));

    // convert coefficients to double
    update         = MatrixUtils.bigFractionMatrixToRealMatrix(bigMSupdate);
    c1             = new double[rows];
    for (int i = 0; i < rows; ++i) {
        c1[i] = bigC1[i].doubleValue();
    }

}
项目:SME    文件:AdamsNordsieckFieldTransformer.java   
/** Simple constructor.
 * @param field field to which the time and state vector elements belong
 * @param n number of steps of the multistep method
 * (excluding the one being computed)
 */
private AdamsNordsieckFieldTransformer(final Field<T> field, final int n) {

    this.field = field;
    final int rows = n - 1;

    // compute coefficients
    FieldMatrix<T> bigP = buildP(rows);
    FieldDecompositionSolver<T> pSolver =
        new FieldLUDecomposition<T>(bigP).getSolver();

    T[] u = MathArrays.buildArray(field, rows);
    Arrays.fill(u, field.getOne());
    c1 = pSolver.solve(new ArrayFieldVector<T>(u, false)).toArray();

    // update coefficients are computed by combining transform from
    // Nordsieck to multistep, then shifting rows to represent step advance
    // then applying inverse transform
    T[][] shiftedP = bigP.getData();
    for (int i = shiftedP.length - 1; i > 0; --i) {
        // shift rows
        shiftedP[i] = shiftedP[i - 1];
    }
    shiftedP[0] = MathArrays.buildArray(field, rows);
    Arrays.fill(shiftedP[0], field.getZero());
    update = new Array2DRowFieldMatrix<T>(pSolver.solve(new Array2DRowFieldMatrix<T>(shiftedP, false)).getData());

}
项目:CARMA    文件:AdamsNordsieckTransformer.java   
/** Simple constructor.
 * @param nSteps number of steps of the multistep method
 * (excluding the one being computed)
 */
private AdamsNordsieckTransformer(final int nSteps) {

    // compute exact coefficients
    FieldMatrix<BigFraction> bigP = buildP(nSteps);
    FieldDecompositionSolver<BigFraction> pSolver =
        new FieldLUDecomposition<BigFraction>(bigP).getSolver();

    BigFraction[] u = new BigFraction[nSteps];
    Arrays.fill(u, BigFraction.ONE);
    BigFraction[] bigC1 = pSolver
        .solve(new ArrayFieldVector<BigFraction>(u, false)).toArray();

    // update coefficients are computed by combining transform from
    // Nordsieck to multistep, then shifting rows to represent step advance
    // then applying inverse transform
    BigFraction[][] shiftedP = bigP.getData();
    for (int i = shiftedP.length - 1; i > 0; --i) {
        // shift rows
        shiftedP[i] = shiftedP[i - 1];
    }
    shiftedP[0] = new BigFraction[nSteps];
    Arrays.fill(shiftedP[0], BigFraction.ZERO);
    FieldMatrix<BigFraction> bigMSupdate =
        pSolver.solve(new Array2DRowFieldMatrix<BigFraction>(shiftedP, false));

    // convert coefficients to double
    update         = MatrixUtils.bigFractionMatrixToRealMatrix(bigMSupdate);
    c1             = new double[nSteps];
    for (int i = 0; i < nSteps; ++i) {
        c1[i] = bigC1[i].doubleValue();
    }

}
项目:java-algebra-system    文件:GaussElimination.java   
/**
 * Inverse of a matrix.
 * @param a matrix
 * @return inverse matrix of a
 */
public GenMatrix<C> inverse(GenMatrix<C> a) {
    FieldMatrix<CMFieldElement<C>> am = CMFieldElementUtil.<C> toCMFieldMatrix(a);
    final FieldLUDecomposition<CMFieldElement<C>> lu = new FieldLUDecomposition<CMFieldElement<C>>(am);
    FieldDecompositionSolver<CMFieldElement<C>> fds = lu.getSolver();
    FieldMatrix<CMFieldElement<C>> bm = fds.getInverse();
    GenMatrix<C> g = CMFieldElementUtil.<C> matrixFromCMFieldMatrix(a.ring, bm);
    return g;
}
项目:java-algebra-system    文件:GaussElimination.java   
/**
 * Solve a linear system: a x = b.
 * @param a matrix
 * @param b vector of right hand side
 * @return a solution vector x
 */
public GenVector<C> solve(GenMatrix<C> a, GenVector<C> b) {
    FieldMatrix<CMFieldElement<C>> am = CMFieldElementUtil.<C> toCMFieldMatrix(a);
    FieldVector<CMFieldElement<C>> bv = CMFieldElementUtil.<C> toCMFieldElementVector(b);

    final FieldLUDecomposition<CMFieldElement<C>> lu = new FieldLUDecomposition<CMFieldElement<C>>(am);
    FieldDecompositionSolver<CMFieldElement<C>> fds = lu.getSolver();
    FieldVector<CMFieldElement<C>> xv = fds.solve(bv);
    GenVector<C> xa = CMFieldElementUtil.<C> vectorFromCMFieldVector(b.modul, xv);
    return xa;
}
项目:astor    文件:AdamsNordsieckTransformer.java   
/** Simple constructor.
 * @param nSteps number of steps of the multistep method
 * (excluding the one being computed)
 */
private AdamsNordsieckTransformer(final int nSteps) {

    // compute exact coefficients
    FieldMatrix<BigFraction> bigP = buildP(nSteps);
    FieldDecompositionSolver<BigFraction> pSolver =
        new FieldLUDecomposition<BigFraction>(bigP).getSolver();

    BigFraction[] u = new BigFraction[nSteps];
    Arrays.fill(u, BigFraction.ONE);
    BigFraction[] bigC1 = pSolver
        .solve(new ArrayFieldVector<BigFraction>(u, false)).toArray();

    // update coefficients are computed by combining transform from
    // Nordsieck to multistep, then shifting rows to represent step advance
    // then applying inverse transform
    BigFraction[][] shiftedP = bigP.getData();
    for (int i = shiftedP.length - 1; i > 0; --i) {
        // shift rows
        shiftedP[i] = shiftedP[i - 1];
    }
    shiftedP[0] = new BigFraction[nSteps];
    Arrays.fill(shiftedP[0], BigFraction.ZERO);
    FieldMatrix<BigFraction> bigMSupdate =
        pSolver.solve(new Array2DRowFieldMatrix<BigFraction>(shiftedP, false));

    // convert coefficients to double
    update         = MatrixUtils.bigFractionMatrixToRealMatrix(bigMSupdate);
    c1             = new double[nSteps];
    for (int i = 0; i < nSteps; ++i) {
        c1[i] = bigC1[i].doubleValue();
    }

}
项目:astor    文件:AdamsNordsieckTransformer.java   
/** Simple constructor.
 * @param nSteps number of steps of the multistep method
 * (excluding the one being computed)
 */
private AdamsNordsieckTransformer(final int nSteps) {

    // compute exact coefficients
    FieldMatrix<BigFraction> bigP = buildP(nSteps);
    FieldDecompositionSolver<BigFraction> pSolver =
        new FieldLUDecomposition<BigFraction>(bigP).getSolver();

    BigFraction[] u = new BigFraction[nSteps];
    Arrays.fill(u, BigFraction.ONE);
    BigFraction[] bigC1 = pSolver
        .solve(new ArrayFieldVector<BigFraction>(u, false)).toArray();

    // update coefficients are computed by combining transform from
    // Nordsieck to multistep, then shifting rows to represent step advance
    // then applying inverse transform
    BigFraction[][] shiftedP = bigP.getData();
    for (int i = shiftedP.length - 1; i > 0; --i) {
        // shift rows
        shiftedP[i] = shiftedP[i - 1];
    }
    shiftedP[0] = new BigFraction[nSteps];
    Arrays.fill(shiftedP[0], BigFraction.ZERO);
    FieldMatrix<BigFraction> bigMSupdate =
        pSolver.solve(new Array2DRowFieldMatrix<BigFraction>(shiftedP, false));

    // convert coefficients to double
    update         = MatrixUtils.bigFractionMatrixToRealMatrix(bigMSupdate);
    c1             = new double[nSteps];
    for (int i = 0; i < nSteps; ++i) {
        c1[i] = bigC1[i].doubleValue();
    }

}
项目:astor    文件:AdamsNordsieckTransformer.java   
/** Simple constructor.
 * @param nSteps number of steps of the multistep method
 * (excluding the one being computed)
 */
private AdamsNordsieckTransformer(final int nSteps) {

    // compute exact coefficients
    FieldMatrix<BigFraction> bigP = buildP(nSteps);
    FieldDecompositionSolver<BigFraction> pSolver =
        new FieldLUDecomposition<BigFraction>(bigP).getSolver();

    BigFraction[] u = new BigFraction[nSteps];
    Arrays.fill(u, BigFraction.ONE);
    BigFraction[] bigC1 = pSolver
        .solve(new ArrayFieldVector<BigFraction>(u, false)).toArray();

    // update coefficients are computed by combining transform from
    // Nordsieck to multistep, then shifting rows to represent step advance
    // then applying inverse transform
    BigFraction[][] shiftedP = bigP.getData();
    for (int i = shiftedP.length - 1; i > 0; --i) {
        // shift rows
        shiftedP[i] = shiftedP[i - 1];
    }
    shiftedP[0] = new BigFraction[nSteps];
    Arrays.fill(shiftedP[0], BigFraction.ZERO);
    FieldMatrix<BigFraction> bigMSupdate =
        pSolver.solve(new Array2DRowFieldMatrix<BigFraction>(shiftedP, false));

    // convert coefficients to double
    update         = MatrixUtils.bigFractionMatrixToRealMatrix(bigMSupdate);
    c1             = new double[nSteps];
    for (int i = 0; i < nSteps; ++i) {
        c1[i] = bigC1[i].doubleValue();
    }

}
项目:astor    文件:AdamsNordsieckTransformer.java   
/** Simple constructor.
 * @param nSteps number of steps of the multistep method
 * (excluding the one being computed)
 */
private AdamsNordsieckTransformer(final int nSteps) {

    // compute exact coefficients
    FieldMatrix<BigFraction> bigP = buildP(nSteps);
    FieldDecompositionSolver<BigFraction> pSolver =
        new FieldLUDecomposition<BigFraction>(bigP).getSolver();

    BigFraction[] u = new BigFraction[nSteps];
    Arrays.fill(u, BigFraction.ONE);
    BigFraction[] bigC1 = pSolver
        .solve(new ArrayFieldVector<BigFraction>(u, false)).toArray();

    // update coefficients are computed by combining transform from
    // Nordsieck to multistep, then shifting rows to represent step advance
    // then applying inverse transform
    BigFraction[][] shiftedP = bigP.getData();
    for (int i = shiftedP.length - 1; i > 0; --i) {
        // shift rows
        shiftedP[i] = shiftedP[i - 1];
    }
    shiftedP[0] = new BigFraction[nSteps];
    Arrays.fill(shiftedP[0], BigFraction.ZERO);
    FieldMatrix<BigFraction> bigMSupdate =
        pSolver.solve(new Array2DRowFieldMatrix<BigFraction>(shiftedP, false));

    // convert coefficients to double
    update         = MatrixUtils.bigFractionMatrixToRealMatrix(bigMSupdate);
    c1             = new double[nSteps];
    for (int i = 0; i < nSteps; ++i) {
        c1[i] = bigC1[i].doubleValue();
    }

}
项目:astor    文件:AdamsNordsieckTransformer.java   
/** Simple constructor.
 * @param nSteps number of steps of the multistep method
 * (excluding the one being computed)
 */
private AdamsNordsieckTransformer(final int nSteps) {

    // compute exact coefficients
    FieldMatrix<BigFraction> bigP = buildP(nSteps);
    FieldDecompositionSolver<BigFraction> pSolver =
        new FieldLUDecomposition<BigFraction>(bigP).getSolver();

    BigFraction[] u = new BigFraction[nSteps];
    Arrays.fill(u, BigFraction.ONE);
    BigFraction[] bigC1 = pSolver
        .solve(new ArrayFieldVector<BigFraction>(u, false)).toArray();

    // update coefficients are computed by combining transform from
    // Nordsieck to multistep, then shifting rows to represent step advance
    // then applying inverse transform
    BigFraction[][] shiftedP = bigP.getData();
    for (int i = shiftedP.length - 1; i > 0; --i) {
        // shift rows
        shiftedP[i] = shiftedP[i - 1];
    }
    shiftedP[0] = new BigFraction[nSteps];
    Arrays.fill(shiftedP[0], BigFraction.ZERO);
    FieldMatrix<BigFraction> bigMSupdate =
        pSolver.solve(new Array2DRowFieldMatrix<BigFraction>(shiftedP, false));

    // convert coefficients to double
    update         = MatrixUtils.bigFractionMatrixToRealMatrix(bigMSupdate);
    c1             = new double[nSteps];
    for (int i = 0; i < nSteps; ++i) {
        c1[i] = bigC1[i].doubleValue();
    }

}
项目:idylfin    文件:AdamsNordsieckTransformer.java   
/** Simple constructor.
 * @param nSteps number of steps of the multistep method
 * (excluding the one being computed)
 */
private AdamsNordsieckTransformer(final int nSteps) {

    // compute exact coefficients
    FieldMatrix<BigFraction> bigP = buildP(nSteps);
    FieldDecompositionSolver<BigFraction> pSolver =
        new FieldLUDecomposition<BigFraction>(bigP).getSolver();

    BigFraction[] u = new BigFraction[nSteps];
    Arrays.fill(u, BigFraction.ONE);
    BigFraction[] bigC1 = pSolver
        .solve(new ArrayFieldVector<BigFraction>(u, false)).toArray();

    // update coefficients are computed by combining transform from
    // Nordsieck to multistep, then shifting rows to represent step advance
    // then applying inverse transform
    BigFraction[][] shiftedP = bigP.getData();
    for (int i = shiftedP.length - 1; i > 0; --i) {
        // shift rows
        shiftedP[i] = shiftedP[i - 1];
    }
    shiftedP[0] = new BigFraction[nSteps];
    Arrays.fill(shiftedP[0], BigFraction.ZERO);
    FieldMatrix<BigFraction> bigMSupdate =
        pSolver.solve(new Array2DRowFieldMatrix<BigFraction>(shiftedP, false));

    // convert coefficients to double
    update         = MatrixUtils.bigFractionMatrixToRealMatrix(bigMSupdate);
    c1             = new double[nSteps];
    for (int i = 0; i < nSteps; ++i) {
        c1[i] = bigC1[i].doubleValue();
    }

}
项目:autoredistrict    文件:AdamsNordsieckTransformer.java   
/** Simple constructor.
 * @param n number of steps of the multistep method
 * (excluding the one being computed)
 */
private AdamsNordsieckTransformer(final int n) {

    final int rows = n - 1;

    // compute exact coefficients
    FieldMatrix<BigFraction> bigP = buildP(rows);
    FieldDecompositionSolver<BigFraction> pSolver =
        new FieldLUDecomposition<BigFraction>(bigP).getSolver();

    BigFraction[] u = new BigFraction[rows];
    Arrays.fill(u, BigFraction.ONE);
    BigFraction[] bigC1 = pSolver.solve(new ArrayFieldVector<BigFraction>(u, false)).toArray();

    // update coefficients are computed by combining transform from
    // Nordsieck to multistep, then shifting rows to represent step advance
    // then applying inverse transform
    BigFraction[][] shiftedP = bigP.getData();
    for (int i = shiftedP.length - 1; i > 0; --i) {
        // shift rows
        shiftedP[i] = shiftedP[i - 1];
    }
    shiftedP[0] = new BigFraction[rows];
    Arrays.fill(shiftedP[0], BigFraction.ZERO);
    FieldMatrix<BigFraction> bigMSupdate =
        pSolver.solve(new Array2DRowFieldMatrix<BigFraction>(shiftedP, false));

    // convert coefficients to double
    update         = MatrixUtils.bigFractionMatrixToRealMatrix(bigMSupdate);
    c1             = new double[rows];
    for (int i = 0; i < rows; ++i) {
        c1[i] = bigC1[i].doubleValue();
    }

}
项目:autoredistrict    文件:AdamsNordsieckFieldTransformer.java   
/** Simple constructor.
 * @param field field to which the time and state vector elements belong
 * @param n number of steps of the multistep method
 * (excluding the one being computed)
 */
private AdamsNordsieckFieldTransformer(final Field<T> field, final int n) {

    this.field = field;
    final int rows = n - 1;

    // compute coefficients
    FieldMatrix<T> bigP = buildP(rows);
    FieldDecompositionSolver<T> pSolver =
        new FieldLUDecomposition<T>(bigP).getSolver();

    T[] u = MathArrays.buildArray(field, rows);
    Arrays.fill(u, field.getOne());
    c1 = pSolver.solve(new ArrayFieldVector<T>(u, false)).toArray();

    // update coefficients are computed by combining transform from
    // Nordsieck to multistep, then shifting rows to represent step advance
    // then applying inverse transform
    T[][] shiftedP = bigP.getData();
    for (int i = shiftedP.length - 1; i > 0; --i) {
        // shift rows
        shiftedP[i] = shiftedP[i - 1];
    }
    shiftedP[0] = MathArrays.buildArray(field, rows);
    Arrays.fill(shiftedP[0], field.getZero());
    update = new Array2DRowFieldMatrix<T>(pSolver.solve(new Array2DRowFieldMatrix<T>(shiftedP, false)).getData());

}