@Test public void testDot() throws Exception { DenseVector vec1 = new DenseVector(new double[]{1, 2, -3}); DenseVector vec2 = new DenseVector(new double[]{3, 2, 1}); Assert.assertEquals(vec1.dot(vec2), 3 + 4 - 3, TOL); }
@Override public double dot(Vector vec) { if (vec instanceof DenseVector) { return BLAS.dot(this, (DenseVector) vec); } else { return ((SparseVector) vec).dot(this); } }
DenseVector extends Vector { @Override public double dot(Vector vec) { if (vec instanceof DenseVector) { return BLAS.dot(this, (DenseVector) vec); } else { return ((SparseVector) vec).dot(this); } } }
DenseVector extends Vector { @Override public double dot(Vector vec) { if (vec instanceof DenseVector) { return BLAS.dot(this, (DenseVector) vec); } else { return ((SparseVector) vec).dot(this); } } DenseVector();  DenseVector(int n);  DenseVector(double[] data); }
DenseVector extends Vector { @Override public double dot(Vector vec) { if (vec instanceof DenseVector) { return BLAS.dot(this, (DenseVector) vec); } else { return ((SparseVector) vec).dot(this); } } DenseVector();  DenseVector(int n);  DenseVector(double[] data); double[] getData(); void setData(double[] data); static DenseVector ones(int n); static DenseVector zeros(int n); static DenseVector rand(int n); @Override DenseVector clone(); @Override String toString(); @Override int size(); @Override double get(int i); @Override void set(int i, double d); @Override void add(int i, double d); @Override double normL1(); @Override double normL2(); @Override double normL2Square(); @Override double normInf(); @Override DenseVector slice(int[] indices); @Override DenseVector prefix(double d); @Override DenseVector append(double d); @Override void scaleEqual(double d); @Override DenseVector plus(Vector other); @Override DenseVector minus(Vector other); @Override DenseVector scale(double d); @Override double dot(Vector vec); @Override void standardizeEqual(double mean, double stdvar); @Override void normalizeEqual(double p); void setEqual(DenseVector other); void plusEqual(Vector other); void minusEqual(Vector other); void plusScaleEqual(Vector other, double alpha); @Override DenseMatrix outer(); DenseMatrix outer(DenseVector other); @Override boolean equals(Object o); @Override int hashCode(); @Override VectorIterator iterator(); }
DenseVector extends Vector { @Override public double dot(Vector vec) { if (vec instanceof DenseVector) { return BLAS.dot(this, (DenseVector) vec); } else { return ((SparseVector) vec).dot(this); } } DenseVector();  DenseVector(int n);  DenseVector(double[] data); double[] getData(); void setData(double[] data); static DenseVector ones(int n); static DenseVector zeros(int n); static DenseVector rand(int n); @Override DenseVector clone(); @Override String toString(); @Override int size(); @Override double get(int i); @Override void set(int i, double d); @Override void add(int i, double d); @Override double normL1(); @Override double normL2(); @Override double normL2Square(); @Override double normInf(); @Override DenseVector slice(int[] indices); @Override DenseVector prefix(double d); @Override DenseVector append(double d); @Override void scaleEqual(double d); @Override DenseVector plus(Vector other); @Override DenseVector minus(Vector other); @Override DenseVector scale(double d); @Override double dot(Vector vec); @Override void standardizeEqual(double mean, double stdvar); @Override void normalizeEqual(double p); void setEqual(DenseVector other); void plusEqual(Vector other); void minusEqual(Vector other); void plusScaleEqual(Vector other, double alpha); @Override DenseMatrix outer(); DenseMatrix outer(DenseVector other); @Override boolean equals(Object o); @Override int hashCode(); @Override VectorIterator iterator();  }