當前位置: 首頁>>代碼示例>>Java>>正文


Java MatrixUtils.bigFractionMatrixToRealMatrix方法代碼示例

本文整理匯總了Java中org.apache.commons.math3.linear.MatrixUtils.bigFractionMatrixToRealMatrix方法的典型用法代碼示例。如果您正苦於以下問題:Java MatrixUtils.bigFractionMatrixToRealMatrix方法的具體用法?Java MatrixUtils.bigFractionMatrixToRealMatrix怎麽用?Java MatrixUtils.bigFractionMatrixToRealMatrix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.math3.linear.MatrixUtils的用法示例。


在下文中一共展示了MatrixUtils.bigFractionMatrixToRealMatrix方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: AdamsNordsieckTransformer

import org.apache.commons.math3.linear.MatrixUtils; //導入方法依賴的package包/類
/** 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();
    }

}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:39,代碼來源:AdamsNordsieckTransformer.java

示例2: AdamsNordsieckTransformer

import org.apache.commons.math3.linear.MatrixUtils; //導入方法依賴的package包/類
/** 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();
    }

}
 
開發者ID:Quanticol,項目名稱:CARMA,代碼行數:38,代碼來源:AdamsNordsieckTransformer.java


注:本文中的org.apache.commons.math3.linear.MatrixUtils.bigFractionMatrixToRealMatrix方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。