当前位置: 首页>>代码示例>>Java>>正文


Java ArrayFieldVector类代码示例

本文整理汇总了Java中org.apache.commons.math3.linear.ArrayFieldVector的典型用法代码示例。如果您正苦于以下问题:Java ArrayFieldVector类的具体用法?Java ArrayFieldVector怎么用?Java ArrayFieldVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ArrayFieldVector类属于org.apache.commons.math3.linear包,在下文中一共展示了ArrayFieldVector类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AdamsNordsieckTransformer

import org.apache.commons.math3.linear.ArrayFieldVector; //导入依赖的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: AdamsNordsieckFieldTransformer

import org.apache.commons.math3.linear.ArrayFieldVector; //导入依赖的package包/类
/** 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());

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:33,代码来源:AdamsNordsieckFieldTransformer.java

示例3: AdamsNordsieckTransformer

import org.apache.commons.math3.linear.ArrayFieldVector; //导入依赖的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

示例4: get_start_state

import org.apache.commons.math3.linear.ArrayFieldVector; //导入依赖的package包/类
private FieldVector<Complex> get_start_state(final String qubits) {
	FieldVector<Complex> state = new ArrayFieldVector<Complex>(ComplexField.getInstance(), (int) Math.pow(2, qubits.length()));
	state.setEntry(Integer.parseInt(qubits, 2), new Complex(1));
	return state;
}
 
开发者ID:QwertygidQ,项目名称:DeutschSim,代码行数:6,代码来源:Circuit.java

示例5: toCMFieldElementVector

import org.apache.commons.math3.linear.ArrayFieldVector; //导入依赖的package包/类
/**
 * Convert JAS <code>RingElem</code> to commons-math
 * <code>FieldElement</code>.
 * @param <C> ring element type
 * @param v JAS vector of ring elements
 * @return commons-math vector of CMFieldElementr objects
 */
public static <C extends RingElem<C>> FieldVector<CMFieldElement<C>> toCMFieldElementVector(GenVector<C> v) {
    if (v == null) {
        return null;
    }
    return new ArrayFieldVector<CMFieldElement<C>>(CMFieldElementUtil.<C> toCMFieldElement(v.val));
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:14,代码来源:CMFieldElementUtil.java


注:本文中的org.apache.commons.math3.linear.ArrayFieldVector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。