Java Code Examples for org.apache.commons.math3.linear.MatrixUtils#bigFractionMatrixToRealMatrix()

The following examples show how to use org.apache.commons.math3.linear.MatrixUtils#bigFractionMatrixToRealMatrix() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdamsNordsieckTransformer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** 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();
    }

}
 
Example 2
Source File: AdamsNordsieckTransformer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** 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();
    }

}
 
Example 3
Source File: AdamsNordsieckTransformer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** 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();
    }

}
 
Example 4
Source File: AdamsNordsieckTransformer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** 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();
    }

}
 
Example 5
Source File: AdamsNordsieckTransformer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** 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();
    }

}
 
Example 6
Source File: AdamsNordsieckTransformer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** 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();
    }

}
 
Example 7
Source File: AdamsNordsieckTransformer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** 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();
    }

}
 
Example 8
Source File: AdamsNordsieckTransformer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** 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();
    }

}