本文整理汇总了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();
}
}