SparseDoubleVector extends AbstractVector { @Override public IVector duplicate() { return new SparseDoubleVector(this.asArray()); } SparseDoubleVector(final int[] indices, final double[] values, final int dimension);  SparseDoubleVector(final int dimension);  SparseDoubleVector(final double[] data);  SparseDoubleVector(final SparseVector mtjVector); @Override void addVector(final double[] vectorAsArray); @Override void subtractVector(final double[] vectorAsArray); @Override void multiplyByVectorPairwise(final double[] vectorAsArray); @Override void divideByVectorPairwise(final double[] vectorAsArray); @Override double dotProduct(final double[] vectorAsArray); @Override int length(); @Override double getValue(final int index); @Override void setValue(final int index, final double value); @Override void addVector(final IVector vector); @Override void subtractVector(final IVector vector); @Override void multiplyByVectorPairwise(final IVector secondVector); @Override void multiplyByConstant(final double constant); @Override void divideByVectorPairwise(final IVector secondVector); @Override void divideByConstant(final double constant); @Override double dotProduct(final IVector vector); @Override boolean isSparse(); @Override double[] asArray(); @Override DenseDoubleVector toDenseVector(); @Override SparseDoubleVector toSparseVector(); @Override IVector duplicate(); @Override void normalize(); @Override void addConstant(final double constant); @Override void subtractConstant(final double constant); @Override void fillRandomly(); int[] getNonZeroIndices(); @Override IVector kroneckerProduct(final double[] vectorAsArray); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testDuplicate() { double[] data = { 4, 2 }; IVector vector = new SparseDoubleVector(data); IVector vectorCopy = vector.duplicate(); vectorCopy.addConstant(2); assertNotEquals(vector, vectorCopy); }