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


Java LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT属性代码示例

本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT属性的具体用法?Java LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT怎么用?Java LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.math3.exception.util.LocalizedFormats的用法示例。


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

示例1: ArrayFieldVector

/**
 * Construct a vector by appending one vector to another vector.
 *
 * @param field Field to which the elements belong.
 * @param v1 First vector (will be put in front of the new vector).
 * @param v2 Second vector (will be put at back of the new vector).
 * @throws NullArgumentException if {@code v1} or {@code v2} is
 * {@code null}.
 * @throws ZeroException if both arrays are empty.
 * @see #ArrayFieldVector(FieldElement[], FieldElement[])
 */
public ArrayFieldVector(Field<T> field, T[] v1, T[] v2)
        throws NullArgumentException, ZeroException {
    MathUtils.checkNotNull(v1);
    MathUtils.checkNotNull(v2);
    if (v1.length + v2.length == 0) {
        throw new ZeroException(LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT);
    }
    data = MathArrays.buildArray(field, v1.length + v2.length);
    System.arraycopy(v1, 0, data, 0, v1.length);
    System.arraycopy(v2, 0, data, v1.length, v2.length);
    this.field = field;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:23,代码来源:ArrayFieldVector.java

示例2: createFieldVector

/**
 * Creates a {@link FieldVector} using the data from the input array.
 *
 * @param <T> the type of the field elements
 * @param data the input data
 * @return a data.length FieldVector
 * @throws NoDataException if {@code data} is empty.
 * @throws NullArgumentException if {@code data} is {@code null}.
 * @throws ZeroException if {@code data} has 0 elements
 */
public static <T extends FieldElement<T>> FieldVector<T> createFieldVector(final T[] data)
    throws NoDataException, NullArgumentException, ZeroException {
    if (data == null) {
        throw new NullArgumentException();
    }
    if (data.length == 0) {
        throw new ZeroException(LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT);
    }
    return new ArrayFieldVector<T>(data[0].getField(), data, true);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:20,代码来源:MatrixUtils.java

示例3: ArrayFieldVector

/**
 * Construct a vector from an array, copying the input array.
 * This constructor needs a non-empty {@code d} array to retrieve
 * the field from its first element. This implies it cannot build
 * 0 length vectors. To build vectors from any size, one should
 * use the {@link #ArrayFieldVector(Field, FieldElement[])} constructor.
 *
 * @param d Array.
 * @throws NullArgumentException if {@code d} is {@code null}.
 * @throws ZeroException if {@code d} is empty.
 * @see #ArrayFieldVector(Field, FieldElement[])
 */
public ArrayFieldVector(T[] d) {
    if (d == null) {
        throw new NullArgumentException();
    }
    try {
        field = d[0].getField();
        data = d.clone();
    } catch (ArrayIndexOutOfBoundsException e) {
        throw new ZeroException(LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT);
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:23,代码来源:ArrayFieldVector.java

示例4: createFieldVector

/**
 * Creates a {@link FieldVector} using the data from the input array.
 *
 * @param <T> the type of the field elements
 * @param data the input data
 * @return a data.length FieldVector
 * @throws NoDataException if {@code data} is empty.
 * @throws NullArgumentException if {@code data} is {@code null}.
 * @throws ZeroException if {@code data} has 0 elements
 */
public static <T extends FieldElement<T>> FieldVector<T> createFieldVector(final T[] data) {
    if (data == null) {
        throw new NullArgumentException();
    }
    if (data.length == 0) {
        throw new ZeroException(LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT);
    }
    return new ArrayFieldVector<T>(data[0].getField(), data, true);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:19,代码来源:MatrixUtils.java


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