List of usage examples for org.apache.commons.math3.exception.util LocalizedFormats NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE
LocalizedFormats NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE
To view the source code for org.apache.commons.math3.exception.util LocalizedFormats NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE.
Click Source Link
From source file:com.cloudera.oryx.common.math.OpenMapRealVector.java
@Override public OpenMapRealVector getSubVector(int index, int n) { checkIndex(index);// www . ja va2s. c o m 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; OpenIntToDoubleHashMap.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; }