/** {@inheritDoc} */ @Override public void setEntry(int index, double value) throws OutOfRangeException { try { data[index] = value; } catch (IndexOutOfBoundsException e) { checkIndex(index); } }
/** * Set a set of consecutive elements. * * @param index Index of first element to be set. * @param v Vector containing the values to set. * @throws OutOfRangeException if the index is inconsistent with the vector * size. */ public void setSubVector(int index, double[] v) throws OutOfRangeException { try { System.arraycopy(v, 0, data, index, v.length); } catch (IndexOutOfBoundsException e) { checkIndex(index); checkIndex(index + v.length - 1); } }
/** {@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; }
/** {@inheritDoc} */ @Override public void setSubVector(int index, RealVector v) throws OutOfRangeException { if (v instanceof ArrayRealVector) { setSubVector(index, ((ArrayRealVector) v).data); } else { try { for (int i = index; i < index + v.getDimension(); ++i) { data[i] = v.getEntry(i - index); } } catch (IndexOutOfBoundsException e) { checkIndex(index); checkIndex(index + v.getDimension() - 1); } } }
/** {@inheritDoc} */ @Override public void setEntry(int index, double value) throws OutOfRangeException { try { data[index] = value; } catch (IndexOutOfBoundsException e) { checkIndex(index); } }
/** {@inheritDoc} */ @Override public void setEntry(int index, double value) throws OutOfRangeException { try { data[index] = value; } catch (IndexOutOfBoundsException e) { checkIndex(index); } }
/** * Set a set of consecutive elements. * * @param index Index of first element to be set. * @param v Vector containing the values to set. * @throws OutOfRangeException if the index is inconsistent with the vector * size. */ public void setSubVector(int index, double[] v) throws OutOfRangeException { try { System.arraycopy(v, 0, data, index, v.length); } catch (IndexOutOfBoundsException e) { checkIndex(index); checkIndex(index + v.length - 1); } }
/** * Set a set of consecutive elements. * * @param index Index of first element to be set. * @param v Vector containing the values to set. * @throws OutOfRangeException if the index is inconsistent with the vector * size. */ public void setSubVector(int index, double[] v) throws OutOfRangeException { try { System.arraycopy(v, 0, data, index, v.length); } catch (IndexOutOfBoundsException e) { checkIndex(index); checkIndex(index + v.length - 1); } }
/** {@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; }
/** {@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; }
/** {@inheritDoc} */ @Override public void setSubVector(int index, RealVector v) throws OutOfRangeException { if (v instanceof ArrayRealVector) { setSubVector(index, ((ArrayRealVector) v).data); } else { try { for (int i = index; i < index + v.getDimension(); ++i) { data[i] = v.getEntry(i - index); } } catch (IndexOutOfBoundsException e) { checkIndex(index); checkIndex(index + v.getDimension() - 1); } } }
/** {@inheritDoc} */ @Override public void setSubVector(int index, RealVector v) throws OutOfRangeException { if (v instanceof ArrayRealVector) { setSubVector(index, ((ArrayRealVector) v).data); } else { try { for (int i = index; i < index + v.getDimension(); ++i) { data[i] = v.getEntry(i - index); } } catch (IndexOutOfBoundsException e) { checkIndex(index); checkIndex(index + v.getDimension() - 1); } } }