Package mikera.vectorz

Examples of mikera.vectorz.AVector.elementSum()


   
    startTimer();
   
    for (int i=0; i<SIZE; i++) {
      AVector row=m.getRow(i);
      double sum=row.elementSum();
      if (sum>0) {
        row.divide(sum);
      } else {
        m.setRow(i, RepeatedElementVector.create(SIZE,1.0/SIZE));
      }
View Full Code Here



  private void testAsVector(INDArray a) {
    AVector v = a.asVector();
    assertEquals(a.elementCount(), v.length());
    assertEquals(a.elementSum(), v.elementSum(),0.00000001);

    if (a.isMutable() && (v.length() > 0)) {
      assertTrue(v.isMutable());
      // assertTrue((a==v)||(v.isView())); not always...
    } else {
View Full Code Here

  private void doVectorTest(AMatrix m) {
    m=m.clone();
    AVector v=m.asVector();
    assertEquals(v,m.toVector());
   
    assertEquals(m.elementSum(),v.elementSum(),0.000001);
   
    AMatrix m2=Matrixx.createFromVector(v, m.rowCount(), m.columnCount());
   
    assertEquals(m,m2);
    assertEquals(v,m2.asVector());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.