@Override final public double dotProduct( final Vector other) { this.assertSameDimensionality(other); if (other instanceof SparseVector) { return this.dotProduct((SparseVector) other); } else if (other instanceof DenseVector) { return dotProduct((DenseVector) other); } else { return super.dotProduct(other); } }
@Override final public double getValue() { return vector.get(this.index); }
@Override final public boolean hasNext() { return this.index < this.vector.getDimensionality(); }
@Override final public double euclideanDistanceSquared( final Vector other) { this.assertSameDimensionality(other); if (other instanceof SparseVector) { return euclideanDistanceSquared((SparseVector) other); } else if (other instanceof DenseVector) { return this.euclideanDistanceSquared((DenseVector) other); } else { return super.euclideanDistanceSquared(other); } }
@Override final public void dotTimesEquals( final Vector other) { this.assertSameDimensionality(other); if (other instanceof SparseVector) { dotTimesEquals((SparseVector) other); } else if (other instanceof DenseVector) { this.dotTimesEquals((DenseVector) other); } else { super.dotTimesEquals(other); } }
@Override final public void minusEquals( final Vector other) { this.assertSameDimensionality(other); if (other instanceof SparseVector) { minusEquals((SparseVector) other); } else if (other instanceof DenseVector) { this.minusEquals((DenseVector) other); } else { super.minusEquals(other); } }
@Override final public void plusEquals( final Vector other) { this.assertSameDimensionality(other); if (other instanceof SparseVector) { plusEquals((SparseVector) other); } else if (other instanceof DenseVector) { this.plusEquals((DenseVector) other); } else { super.plusEquals(other); } }
@Override final public void scaledPlusEquals( final double scaleFactor, final Vector other) { this.assertSameDimensionality(other); if (other instanceof SparseVector) { scaledPlusEquals((SparseVector) other, scaleFactor); } else if (other instanceof DenseVector) { this.scaledPlusEquals((DenseVector) other, scaleFactor); } else { super.scaledPlusEquals(scaleFactor, other); } }
@Override final public DenseVector clone() { final DenseVector result = (DenseVector) super.clone(); result.values = ArrayUtil.copy(this.values); return result; }
@Override final public Matrix outerProduct( final Vector other) { if (other instanceof SparseVector) { return outerProduct((SparseVector) other); } else if (other instanceof DenseVector) { return this.outerProduct((DenseVector) other); } else { return super.outerProduct(other); } }
@Override final public double euclideanDistanceSquared( final Vector other) { this.assertSameDimensionality(other); if (other instanceof SparseVector) { return euclideanDistanceSquared((SparseVector) other); } else if (other instanceof DenseVector) { return this.euclideanDistanceSquared((DenseVector) other); } else { return super.euclideanDistanceSquared(other); } }
@Override final public void dotTimesEquals( final Vector other) { this.assertSameDimensionality(other); if (other instanceof SparseVector) { dotTimesEquals((SparseVector) other); } else if (other instanceof DenseVector) { this.dotTimesEquals((DenseVector) other); } else { super.dotTimesEquals(other); } }
@Override final public void minusEquals( final Vector other) { this.assertSameDimensionality(other); if (other instanceof SparseVector) { minusEquals((SparseVector) other); } else if (other instanceof DenseVector) { this.minusEquals((DenseVector) other); } else { super.minusEquals(other); } }
@Override final public void plusEquals( final Vector other) { this.assertSameDimensionality(other); if (other instanceof SparseVector) { plusEquals((SparseVector) other); } else if (other instanceof DenseVector) { this.plusEquals((DenseVector) other); } else { super.plusEquals(other); } }
@Override final public void scaledPlusEquals( final double scaleFactor, final Vector other) { this.assertSameDimensionality(other); if (other instanceof SparseVector) { scaledPlusEquals((SparseVector) other, scaleFactor); } else if (other instanceof DenseVector) { this.scaledPlusEquals((DenseVector) other, scaleFactor); } else { super.scaledPlusEquals(scaleFactor, other); } }
@Override final public DenseVector clone() { final DenseVector result = (DenseVector) super.clone(); result.values = ArrayUtil.copy(this.values); return result; }
@Override final public Matrix outerProduct( final Vector other) { if (other instanceof SparseVector) { return outerProduct((SparseVector) other); } else if (other instanceof DenseVector) { return this.outerProduct((DenseVector) other); } else { return super.outerProduct(other); } }
@Override final public double dotProduct( final Vector other) { this.assertSameDimensionality(other); if (other instanceof SparseVector) { return this.dotProduct((SparseVector) other); } else if (other instanceof DenseVector) { return dotProduct((DenseVector) other); } else { return super.dotProduct(other); } }
@Override final public double euclideanDistanceSquared( final Vector other) { this.assertSameDimensionality(other); if (other instanceof SparseVector) { return euclideanDistanceSquared((SparseVector) other); } else if (other instanceof DenseVector) { return this.euclideanDistanceSquared((DenseVector) other); } else { return super.euclideanDistanceSquared(other); } }
@Override final public void dotTimesEquals( final Vector other) { this.assertSameDimensionality(other); if (other instanceof SparseVector) { dotTimesEquals((SparseVector) other); } else if (other instanceof DenseVector) { this.dotTimesEquals((DenseVector) other); } else { super.dotTimesEquals(other); } }