本文整理匯總了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();
}
}
示例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();
}
}