Package mikera.vectorz.impl

Examples of mikera.vectorz.impl.SparseIndexedVector


   
  }
 
  @Test
  public void testIndexed() {
    SparseIndexedVector v=SparseIndexedVector.createLength(10);
   
    assertEquals(0,v.nonZeroCount());

    v.set(1,1);
    assertEquals(1.0,v.elementSum(),0.0);
    assertEquals(1,v.nonZeroCount());
        assertTrue(Arrays.equals(new int[]{1},v.nonZeroIndices()));

        SparseIndexedVector w=v.clone();
        v.add(ZeroVector.create(10));
        assertEquals(w, v);

        SparseIndexedVector empty=SparseIndexedVector.createLength(3);
        SparseIndexedVector nonEmpty=SparseIndexedVector.create(Vector.of(1,0,2));
        empty.add(nonEmpty);
        assertEquals(Vector.of(1,0,2), empty);
  }
View Full Code Here

TOP

Related Classes of mikera.vectorz.impl.SparseIndexedVector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.