@Test public void testViewPart() throws Exception { Vector part = test.viewPart(1, 2); assertEquals("part size", 2, part.getNumNondefaultElements()); for (int i = 0; i < part.size(); i++) { assertEquals("part[" + i + ']', values[OFFSET + i + 1], part.get(i), EPSILON); } }
@Override public Vector viewPart(int offset, int length) { if (offset < 0) { throw new IndexException(offset, size()); } if (offset + length > size()) { throw new IndexException(offset + length, size()); } return new VectorView(vector, offset + this.offset, length); }
VectorView extends AbstractVector { @Override public Vector viewPart(int offset, int length) { if (offset < 0) { throw new IndexException(offset, size()); } if (offset + length > size()) { throw new IndexException(offset + length, size()); } return new VectorView(vector, offset + this.offset, length); } }
VectorView extends AbstractVector { @Override public Vector viewPart(int offset, int length) { if (offset < 0) { throw new IndexException(offset, size()); } if (offset + length > size()) { throw new IndexException(offset + length, size()); } return new VectorView(vector, offset + this.offset, length); } VectorView();  VectorView(Vector vector, int offset, int cardinality); }
VectorView extends AbstractVector { @Override public Vector viewPart(int offset, int length) { if (offset < 0) { throw new IndexException(offset, size()); } if (offset + length > size()) { throw new IndexException(offset + length, size()); } return new VectorView(vector, offset + this.offset, length); } VectorView();  VectorView(Vector vector, int offset, int cardinality); @Override Vector clone(); @Override boolean isDense(); @Override boolean isSequentialAccess(); @Override VectorView like(); @Override Vector like(int cardinality); @Override double getQuick(int index); @Override void setQuick(int index, double value); @Override int getNumNondefaultElements(); @Override Vector viewPart(int offset, int length); @Override Iterator<Element> iterateNonZero(); @Override Iterator<Element> iterator(); @Override double getLengthSquared(); @Override double getDistanceSquared(Vector v); @Override double getLookupCost(); @Override double getIteratorAdvanceCost(); @Override boolean isAddConstantTime(); @Override void mergeUpdates(OrderedIntDoubleMapping updates); }
VectorView extends AbstractVector { @Override public Vector viewPart(int offset, int length) { if (offset < 0) { throw new IndexException(offset, size()); } if (offset + length > size()) { throw new IndexException(offset + length, size()); } return new VectorView(vector, offset + this.offset, length); } VectorView();  VectorView(Vector vector, int offset, int cardinality); @Override Vector clone(); @Override boolean isDense(); @Override boolean isSequentialAccess(); @Override VectorView like(); @Override Vector like(int cardinality); @Override double getQuick(int index); @Override void setQuick(int index, double value); @Override int getNumNondefaultElements(); @Override Vector viewPart(int offset, int length); @Override Iterator<Element> iterateNonZero(); @Override Iterator<Element> iterator(); @Override double getLengthSquared(); @Override double getDistanceSquared(Vector v); @Override double getLookupCost(); @Override double getIteratorAdvanceCost(); @Override boolean isAddConstantTime(); @Override void mergeUpdates(OrderedIntDoubleMapping updates);  }