本文整理汇总了Java中org.apache.commons.math3.Field.getZero方法的典型用法代码示例。如果您正苦于以下问题:Java Field.getZero方法的具体用法?Java Field.getZero怎么用?Java Field.getZero使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.Field
的用法示例。
在下文中一共展示了Field.getZero方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: createFieldIdentityMatrix
import org.apache.commons.math3.Field; //导入方法依赖的package包/类
/**
* Returns <code>dimension x dimension</code> identity matrix.
*
* @param <T> the type of the field elements
* @param field field to which the elements belong
* @param dimension dimension of identity matrix to generate
* @return identity matrix
* @throws IllegalArgumentException if dimension is not positive
* @since 2.0
*/
public static <T extends FieldElement<T>> FieldMatrix<T>
createFieldIdentityMatrix(final Field<T> field, final int dimension) {
final T zero = field.getZero();
final T one = field.getOne();
final T[][] d = MathArrays.buildArray(field, dimension, dimension);
for (int row = 0; row < dimension; row++) {
final T[] dRow = d[row];
Arrays.fill(dRow, zero);
dRow[row] = one;
}
return new Array2DRowFieldMatrix<T>(field, d, false);
}
示例3: createFieldIdentityMatrix
import org.apache.commons.math3.Field; //导入方法依赖的package包/类
/**
* Returns <code>dimension x dimension</code> identity matrix.
*
* @param <T> the type of the field elements
* @param field field to which the elements belong
* @param dimension dimension of identity matrix to generate
* @return identity matrix
* @throws IllegalArgumentException if dimension is not positive
* @since 2.0
*/
public static <T extends FieldElement<T>> FieldMatrix<T>
createFieldIdentityMatrix(final Field<T> field, final int dimension) {
final T zero = field.getZero();
final T one = field.getOne();
@SuppressWarnings("unchecked")
final T[][] d = (T[][]) Array.newInstance(field.getRuntimeClass(), new int[] { dimension, dimension });
for (int row = 0; row < dimension; row++) {
final T[] dRow = d[row];
Arrays.fill(dRow, zero);
dRow[row] = one;
}
return new Array2DRowFieldMatrix<T>(field, d, false);
}
示例4: OpenIntToFieldHashMap
import org.apache.commons.math3.Field; //导入方法依赖的package包/类
/**
* Build an empty map with default size and using zero for missing entries.
* @param field field to which the elements belong
*/
public OpenIntToFieldHashMap(final Field<T>field) {
this(field, DEFAULT_EXPECTED_SIZE, field.getZero());
}