@Test public void testNonZeroCount() { AVector v = Vectorz.createUniformRandomVector(5); v.add(1); assertEquals(v.length(), v.nonZeroCount()); v.scale(0.0); assertEquals(0, v.nonZeroCount()); }
@Test public void testOuterProducts() { AVector v = Vectorz.createUniformRandomVector(5); INDArray a = v.outerProduct(v); assertTrue(a instanceof AMatrix); AMatrix m = (AMatrix) a; AVector v2 = v.clone(); v2.square(); assertEquals(v2, m.getLeadingDiagonal()); }