本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE属性的具体用法?Java LocalizedFormats.NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE怎么用?Java LocalizedFormats.NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math3.exception.util.LocalizedFormats
的用法示例。
在下文中一共展示了LocalizedFormats.NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSubVector
/** {@inheritDoc} */
public FieldVector<T> getSubVector(int index, int n)
throws OutOfRangeException, NotPositiveException {
if (n < 0) {
throw new NotPositiveException(LocalizedFormats.NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE, n);
}
checkIndex(index);
checkIndex(index + n - 1);
SparseFieldVector<T> res = new SparseFieldVector<T>(field,n);
int end = index + n;
OpenIntToFieldHashMap<T>.Iterator iter = entries.iterator();
while (iter.hasNext()) {
iter.advance();
int key = iter.key();
if (key >= index && key < end) {
res.setEntry(key - index, iter.value());
}
}
return res;
}
示例2: getSubVector
/** {@inheritDoc} */
@Override
public RealVector getSubVector(int index, int n)
throws OutOfRangeException, NotPositiveException {
if (n < 0) {
throw new NotPositiveException(LocalizedFormats.NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE, n);
}
ArrayRealVector out = new ArrayRealVector(n);
try {
System.arraycopy(data, index, out.data, 0, n);
} catch (IndexOutOfBoundsException e) {
checkIndex(index);
checkIndex(index + n - 1);
}
return out;
}
示例3: getSubVector
/** {@inheritDoc} */
@Override
public OpenMapRealVector getSubVector(int index, int n)
throws NotPositiveException, OutOfRangeException {
checkIndex(index);
if (n < 0) {
throw new NotPositiveException(LocalizedFormats.NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE, n);
}
checkIndex(index + n - 1);
OpenMapRealVector res = new OpenMapRealVector(n);
int end = index + n;
Iterator iter = entries.iterator();
while (iter.hasNext()) {
iter.advance();
int key = iter.key();
if (key >= index && key < end) {
res.setEntry(key - index, iter.value());
}
}
return res;
}
示例4: getSubVector
/** {@inheritDoc} */
public FieldVector<T> getSubVector(int index, int n)
throws OutOfRangeException, NotPositiveException {
if (n < 0) {
throw new NotPositiveException(LocalizedFormats.NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE, n);
}
ArrayFieldVector<T> out = new ArrayFieldVector<T>(field, n);
try {
System.arraycopy(data, index, out.data, 0, n);
} catch (IndexOutOfBoundsException e) {
checkIndex(index);
checkIndex(index + n - 1);
}
return out;
}