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


Java Field类代码示例

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


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

示例1: getInstance

import org.apache.commons.math3.Field; //导入依赖的package包/类
/** Get the Nordsieck transformer for a given field and number of steps.
 * @param field field to which the time and state vector elements belong
 * @param nSteps number of steps of the multistep method
 * (excluding the one being computed)
 * @return Nordsieck transformer for the specified field and number of steps
 * @param <T> the type of the field elements
 */
@SuppressWarnings("unchecked")
public static <T extends RealFieldElement<T>> AdamsNordsieckFieldTransformer<T>
getInstance(final Field<T> field, final int nSteps) {
    synchronized(CACHE) {
        Map<Field<? extends RealFieldElement<?>>,
                  AdamsNordsieckFieldTransformer<? extends RealFieldElement<?>>> map = CACHE.get(nSteps);
        if (map == null) {
            map = new HashMap<Field<? extends RealFieldElement<?>>,
                                    AdamsNordsieckFieldTransformer<? extends RealFieldElement<?>>>();
            CACHE.put(nSteps, map);
        }
        @SuppressWarnings("rawtypes") // use rawtype to avoid compilation problems with java 1.5
        AdamsNordsieckFieldTransformer t = map.get(field);
        if (t == null) {
            t = new AdamsNordsieckFieldTransformer<T>(field, nSteps);
            map.put(field, (AdamsNordsieckFieldTransformer<T>) t);
        }
        return (AdamsNordsieckFieldTransformer<T>) t;

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

示例2: EmbeddedRungeKuttaFieldIntegrator

import org.apache.commons.math3.Field; //导入依赖的package包/类
/** Build a Runge-Kutta integrator with the given Butcher array.
 * @param field field to which the time and state vector elements belong
 * @param name name of the method
 * @param fsal index of the pre-computed derivative for <i>fsal</i> methods
 * or -1 if method is not <i>fsal</i>
 * @param minStep minimal step (sign is irrelevant, regardless of
 * integration direction, forward or backward), the last step can
 * be smaller than this
 * @param maxStep maximal step (sign is irrelevant, regardless of
 * integration direction, forward or backward), the last step can
 * be smaller than this
 * @param scalAbsoluteTolerance allowed absolute error
 * @param scalRelativeTolerance allowed relative error
 */
protected EmbeddedRungeKuttaFieldIntegrator(final Field<T> field, final String name, final int fsal,
                                            final double minStep, final double maxStep,
                                            final double scalAbsoluteTolerance,
                                            final double scalRelativeTolerance) {

    super(field, name, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);

    this.fsal = fsal;
    this.c    = getC();
    this.a    = getA();
    this.b    = getB();

    exp = field.getOne().divide(-getOrder());

    // set the default values of the algorithm control parameters
    setSafety(field.getZero().add(0.9));
    setMinReduction(field.getZero().add(0.2));
    setMaxGrowth(field.getZero().add(10.0));

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

示例3: DormandPrince853FieldIntegrator

import org.apache.commons.math3.Field; //导入依赖的package包/类
/** Simple constructor.
 * Build an eighth order Dormand-Prince integrator with the given step bounds
 * @param field field to which the time and state vector elements belong
 * @param minStep minimal step (sign is irrelevant, regardless of
 * integration direction, forward or backward), the last step can
 * be smaller than this
 * @param maxStep maximal step (sign is irrelevant, regardless of
 * integration direction, forward or backward), the last step can
 * be smaller than this
 * @param scalAbsoluteTolerance allowed absolute error
 * @param scalRelativeTolerance allowed relative error
 */
public DormandPrince853FieldIntegrator(final Field<T> field,
                                       final double minStep, final double maxStep,
                                       final double scalAbsoluteTolerance,
                                       final double scalRelativeTolerance) {
    super(field, METHOD_NAME, 12,
          minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);
    e1_01 = fraction(        116092271.0,       8848465920.0);
    e1_06 = fraction(         -1871647.0,          1527680.0);
    e1_07 = fraction(        -69799717.0,        140793660.0);
    e1_08 = fraction(    1230164450203.0,     739113984000.0);
    e1_09 = fraction(-1980813971228885.0, 5654156025964544.0);
    e1_10 = fraction(        464500805.0,       1389975552.0);
    e1_11 = fraction(    1606764981773.0,   19613062656000.0);
    e1_12 = fraction(          -137909.0,          6168960.0);
    e2_01 = fraction(          -364463.0,          1920240.0);
    e2_06 = fraction(          3399327.0,           763840.0);
    e2_07 = fraction(         66578432.0,         35198415.0);
    e2_08 = fraction(      -1674902723.0,        288716400.0);
    e2_09 = fraction(  -74684743568175.0,  176692375811392.0);
    e2_10 = fraction(          -734375.0,          4826304.0);
    e2_11 = fraction(        171414593.0,        851261400.0);
    e2_12 = fraction(            69869.0,          3084480.0);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:36,代码来源:DormandPrince853FieldIntegrator.java

示例4: buildArray

import org.apache.commons.math3.Field; //导入依赖的package包/类
/** Build an array of elements.
 * <p>
 * Complete arrays are filled with field.getZero()
 * </p>
 * @param <T> Type of the field elements
 * @param field field to which array elements belong
 * @param rows number of rows
 * @param columns number of columns (may be negative to build partial
 * arrays in the same way <code>new Field[rows][]</code> works)
 * @return a new array
 */
@SuppressWarnings("unchecked")
protected static <T extends FieldElement<T>> T[][] buildArray(final Field<T> field,
                                                              final int rows,
                                                              final int columns) {
    if (columns < 0) {
        T[] dummyRow = (T[]) Array.newInstance(field.getRuntimeClass(), 0);
        return (T[][]) Array.newInstance(dummyRow.getClass(), rows);
    }
    T[][] array =
        (T[][]) Array.newInstance(field.getRuntimeClass(), new int[] { rows, columns });
    for (int i = 0; i < array.length; ++i) {
        Arrays.fill(array[i], field.getZero());
    }
    return array;
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:27,代码来源:AbstractFieldMatrix.java

示例5: DormandPrince54FieldStepInterpolator

import org.apache.commons.math3.Field; //导入依赖的package包/类
/** Simple constructor.
 * @param field field to which the time and state vector elements belong
 * @param forward integration direction indicator
 * @param yDotK slopes at the intermediate points
 * @param globalPreviousState start of the global step
 * @param globalCurrentState end of the global step
 * @param softPreviousState start of the restricted step
 * @param softCurrentState end of the restricted step
 * @param mapper equations mapper for the all equations
 */
DormandPrince54FieldStepInterpolator(final Field<T> field, final boolean forward,
                                     final T[][] yDotK,
                                     final FieldODEStateAndDerivative<T> globalPreviousState,
                                     final FieldODEStateAndDerivative<T> globalCurrentState,
                                     final FieldODEStateAndDerivative<T> softPreviousState,
                                     final FieldODEStateAndDerivative<T> softCurrentState,
                                     final FieldEquationsMapper<T> mapper) {
    super(field, forward, yDotK,
          globalPreviousState, globalCurrentState, softPreviousState, softCurrentState,
          mapper);
    final T one = field.getOne();
    a70 = one.multiply(   35.0).divide( 384.0);
    a72 = one.multiply(  500.0).divide(1113.0);
    a73 = one.multiply(  125.0).divide( 192.0);
    a74 = one.multiply(-2187.0).divide(6784.0);
    a75 = one.multiply(   11.0).divide(  84.0);
    d0  = one.multiply(-12715105075.0).divide( 11282082432.0);
    d2  = one.multiply( 87487479700.0).divide( 32700410799.0);
    d3  = one.multiply(-10690763975.0).divide(  1880347072.0);
    d4  = one.multiply(701980252875.0).divide(199316789632.0);
    d5  = one.multiply( -1453857185.0).divide(   822651844.0);
    d6  = one.multiply(    69997945.0).divide(    29380423.0);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:34,代码来源:DormandPrince54FieldStepInterpolator.java

示例6: HighamHall54FieldIntegrator

import org.apache.commons.math3.Field; //导入依赖的package包/类
/** Simple constructor.
 * Build a fifth order Higham and Hall integrator with the given step bounds
 * @param field field to which the time and state vector elements belong
 * @param minStep minimal step (sign is irrelevant, regardless of
 * integration direction, forward or backward), the last step can
 * be smaller than this
 * @param maxStep maximal step (sign is irrelevant, regardless of
 * integration direction, forward or backward), the last step can
 * be smaller than this
 * @param scalAbsoluteTolerance allowed absolute error
 * @param scalRelativeTolerance allowed relative error
 */
public HighamHall54FieldIntegrator(final Field<T> field,
                                   final double minStep, final double maxStep,
                                   final double scalAbsoluteTolerance,
                                   final double scalRelativeTolerance) {
    super(field, METHOD_NAME, -1,
          minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);
    e = MathArrays.buildArray(field, 7);
    e[0] = fraction(-1,  20);
    e[1] = field.getZero();
    e[2] = fraction(81, 160);
    e[3] = fraction(-6,   5);
    e[4] = fraction(25,  32);
    e[5] = fraction( 1,  16);
    e[6] = fraction(-1,  10);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:28,代码来源:HighamHall54FieldIntegrator.java

示例7: Array2DRowFieldMatrix

import org.apache.commons.math3.Field; //导入依赖的package包/类
/**
 * Create a new {@code FieldMatrix<T>} using the input array as the underlying
 * data array.
 * <p>If an array is built specially in order to be embedded in a
 * {@code FieldMatrix<T>} and not used directly, the {@code copyArray} may be
 * set to {@code false}. This will prevent the copying and improve
 * performance as no new array will be built and no data will be copied.</p>
 *
 * @param field Field to which the elements belong.
 * @param d Data for the new matrix.
 * @param copyArray Whether to copy or reference the input array.
 * @throws DimensionMismatchException if {@code d} is not rectangular.
 * @throws NoDataException if there are not at least one row and one column.
 * @throws NullArgumentException if {@code d} is {@code null}.
 * @see #Array2DRowFieldMatrix(FieldElement[][])
 */
public Array2DRowFieldMatrix(final Field<T> field, final T[][] d, final boolean copyArray)
    throws DimensionMismatchException, NoDataException, NullArgumentException {
    super(field);
    if (copyArray) {
        copyIn(d);
    } else {
        MathUtils.checkNotNull(d);
        final int nRows = d.length;
        if (nRows == 0) {
            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
        }
        final int nCols = d[0].length;
        if (nCols == 0) {
            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
        }
        for (int r = 1; r < nRows; r++) {
            if (d[r].length != nCols) {
                throw new DimensionMismatchException(nCols, d[r].length);
            }
        }
        data = d;
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:40,代码来源:Array2DRowFieldMatrix.java

示例8: getField

import org.apache.commons.math3.Field; //导入依赖的package包/类
/** {@inheritDoc} */
public Field<SparseGradient> getField() {
    return new Field<SparseGradient>() {

        /** {@inheritDoc} */
        public SparseGradient getZero() {
            return createConstant(0);
        }

        /** {@inheritDoc} */
        public SparseGradient getOne() {
            return createConstant(1);
        }

        /** {@inheritDoc} */
        public Class<? extends FieldElement<SparseGradient>> getRuntimeClass() {
            return SparseGradient.class;
        }

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

示例9: getField

import org.apache.commons.math3.Field; //导入依赖的package包/类
/** {@inheritDoc} */
public Field<DerivativeStructure> getField() {
    return new Field<DerivativeStructure>() {

        /** {@inheritDoc} */
        public DerivativeStructure getZero() {
            return new DerivativeStructure(compiler.getFreeParameters(), compiler.getOrder(), 0.0);
        }

        /** {@inheritDoc} */
        public DerivativeStructure getOne() {
            return new DerivativeStructure(compiler.getFreeParameters(), compiler.getOrder(), 1.0);
        }

        /** {@inheritDoc} */
        public Class<? extends FieldElement<DerivativeStructure>> getRuntimeClass() {
            return DerivativeStructure.class;
        }

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

示例10: buildArray

import org.apache.commons.math3.Field; //导入依赖的package包/类
/** Build a double dimension  array of elements.
 * <p>
 * Arrays are filled with field.getZero()
 *
 * @param <T> the type of the field elements
 * @param field field to which array elements belong
 * @param rows number of rows in the array
 * @param columns number of columns (may be negative to build partial
 * arrays in the same way <code>new Field[rows][]</code> works)
 * @return a new array
 * @since 3.2
 */
@SuppressWarnings("unchecked")
public static <T> T[][] buildArray(final Field<T> field, final int rows, final int columns) {
    final T[][] array;
    if (columns < 0) {
        T[] dummyRow = buildArray(field, 0);
        array = (T[][]) Array.newInstance(dummyRow.getClass(), rows);
    } else {
        array = (T[][]) Array.newInstance(field.getRuntimeClass(),
                                          new int[] {
                                              rows, columns
                                          });
        for (int i = 0; i < rows; ++i) {
            Arrays.fill(array[i], field.getZero());
        }
    }
    return array;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:30,代码来源:MathArrays.java

示例11: createBlocksLayout

import org.apache.commons.math3.Field; //导入依赖的package包/类
/**
 * Create a data array in blocks layout.
 * <p>
 * This method can be used to create the array argument of the {@link
 * #BlockFieldMatrix(int, int, FieldElement[][], boolean)}
 * constructor.
 * </p>
 * @param <T> Type of the field elements.
 * @param field Field to which the elements belong.
 * @param rows Number of rows in the new matrix.
 * @param columns Number of columns in the new matrix.
 * @return a new data array in blocks layout.
 * @see #toBlocksLayout(FieldElement[][])
 * @see #BlockFieldMatrix(int, int, FieldElement[][], boolean)
 */
public static <T extends FieldElement<T>> T[][] createBlocksLayout(final Field<T> field,
                                                                   final int rows, final int columns) {
    final int blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;
    final int blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;

    final T[][] blocks = buildArray(field, blockRows * blockColumns, -1);
    int blockIndex = 0;
    for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
        final int pStart  = iBlock * BLOCK_SIZE;
        final int pEnd    = FastMath.min(pStart + BLOCK_SIZE, rows);
        final int iHeight = pEnd - pStart;
        for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
            final int qStart = jBlock * BLOCK_SIZE;
            final int qEnd   = FastMath.min(qStart + BLOCK_SIZE, columns);
            final int jWidth = qEnd - qStart;
            blocks[blockIndex] = buildArray(field, iHeight * jWidth);
            ++blockIndex;
        }
    }

    return blocks;
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:38,代码来源:BlockFieldMatrix.java

示例12: createBlocksLayout

import org.apache.commons.math3.Field; //导入依赖的package包/类
/**
 * Create a data array in blocks layout.
 * <p>
 * This method can be used to create the array argument of the {@link
 * #BlockFieldMatrix(int, int, FieldElement[][], boolean)}
 * constructor.
 * </p>
 * @param <T> Type of the field elements.
 * @param field Field to which the elements belong.
 * @param rows Number of rows in the new matrix.
 * @param columns Number of columns in the new matrix.
 * @return a new data array in blocks layout.
 * @see #toBlocksLayout(FieldElement[][])
 * @see #BlockFieldMatrix(int, int, FieldElement[][], boolean)
 */
public static <T extends FieldElement<T>> T[][] createBlocksLayout(final Field<T> field,
                                                                   final int rows, final int columns) {
    final int blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;
    final int blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;

    final T[][] blocks = MathArrays.buildArray(field, blockRows * blockColumns, -1);
    int blockIndex = 0;
    for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
        final int pStart  = iBlock * BLOCK_SIZE;
        final int pEnd    = FastMath.min(pStart + BLOCK_SIZE, rows);
        final int iHeight = pEnd - pStart;
        for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
            final int qStart = jBlock * BLOCK_SIZE;
            final int qEnd   = FastMath.min(qStart + BLOCK_SIZE, columns);
            final int jWidth = qEnd - qStart;
            blocks[blockIndex] = MathArrays.buildArray(field, iHeight * jWidth);
            ++blockIndex;
        }
    }

    return blocks;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:38,代码来源:BlockFieldMatrix.java

示例13: GillFieldStepInterpolator

import org.apache.commons.math3.Field; //导入依赖的package包/类
/** Simple constructor.
 * @param field field to which the time and state vector elements belong
 * @param forward integration direction indicator
 * @param yDotK slopes at the intermediate points
 * @param globalPreviousState start of the global step
 * @param globalCurrentState end of the global step
 * @param softPreviousState start of the restricted step
 * @param softCurrentState end of the restricted step
 * @param mapper equations mapper for the all equations
 */
GillFieldStepInterpolator(final Field<T> field, final boolean forward,
                          final T[][] yDotK,
                          final FieldODEStateAndDerivative<T> globalPreviousState,
                          final FieldODEStateAndDerivative<T> globalCurrentState,
                          final FieldODEStateAndDerivative<T> softPreviousState,
                          final FieldODEStateAndDerivative<T> softCurrentState,
                          final FieldEquationsMapper<T> mapper) {
    super(field, forward, yDotK,
          globalPreviousState, globalCurrentState, softPreviousState, softCurrentState,
          mapper);
    final T sqrt = field.getZero().add(0.5).sqrt();
    one_minus_inv_sqrt_2 = field.getOne().subtract(sqrt);
    one_plus_inv_sqrt_2  = field.getOne().add(sqrt);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:25,代码来源:GillFieldStepInterpolator.java

示例14: create

import org.apache.commons.math3.Field; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected GillFieldStepInterpolator<T> create(final Field<T> newField, final boolean newForward, final T[][] newYDotK,
                                              final FieldODEStateAndDerivative<T> newGlobalPreviousState,
                                              final FieldODEStateAndDerivative<T> newGlobalCurrentState,
                                              final FieldODEStateAndDerivative<T> newSoftPreviousState,
                                              final FieldODEStateAndDerivative<T> newSoftCurrentState,
                                              final FieldEquationsMapper<T> newMapper) {
    return new GillFieldStepInterpolator<T>(newField, newForward, newYDotK,
                                            newGlobalPreviousState, newGlobalCurrentState,
                                            newSoftPreviousState, newSoftCurrentState,
                                            newMapper);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:14,代码来源:GillFieldStepInterpolator.java

示例15: SparseFieldMatrix

import org.apache.commons.math3.Field; //导入依赖的package包/类
/**
 * Create a matrix with no data.
 *
 * @param field Field to which the elements belong.
 */
public SparseFieldMatrix(final Field<T> field) {
    super(field);
    rows = 0;
    columns= 0;
    entries = new OpenIntToFieldHashMap<T>(field);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:12,代码来源:SparseFieldMatrix.java


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