DenseDoubleVector extends AbstractVector { @Override public void addVector(final IVector vector) { if (!(vector instanceof AbstractVector)) { throw new UnsupportedOperationException("Not implemented for non-AbstractVector vectors."); } this.internalVector = this.internalVector.add(((AbstractVector) vector).toDenseVector().internalVector); } DenseDoubleVector(final int numberOfDimensions);  DenseDoubleVector(final double[] data);  DenseDoubleVector(final no.uib.cipr.matrix.Vector vector);  DenseDoubleVector(final int size, final double value); @Override int length(); @Override double getValue(final int index); @Override void setValue(final int index, final double value); @Override void addConstant(final double constant); @Override void addVector(final IVector vector); @Override void subtractConstant(final double constant); @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 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 IVector duplicate(); @Override void normalize(); @Override void fillRandomly(); @Override DenseDoubleVector toDenseVector(); @Override SparseDoubleVector toSparseVector(); @Override IVector kroneckerProduct(final double[] vectorAsArray);  }
@Test public void testAddVectorFromArrayWithoutCopy() { double[] data = { 2, 2 }; IVector vector = new DenseDoubleVector(data); vector.addVector(data); this.assertResultVectorIs4(vector); }
@Test public void testAddVectorWithoutCopy() { double[] data = { 2, 2 }; IVector toAdd = new DenseDoubleVector(data); IVector vector = new DenseDoubleVector(data); vector.addVector(toAdd); this.assertResultVectorIs4(vector); }