Package mikera.matrixx.impl

Examples of mikera.matrixx.impl.SparseRowMatrix.replaceRow()


      double[] data=new double[DSIZE];
      for (int j=0; j<DSIZE; j++) {
        data[j]=Rand.nextDouble();
      }
      Index indy=Indexz.createRandomChoice(DSIZE, SIZE);
      m.replaceRow(i,SparseIndexedVector.create(SIZE, indy, data));
    }
   
    printTime("Construct sparse matrix: ");
   
    // System.out.println("First row sum = "+m.getRow(0).elementSum());
View Full Code Here


      double[] data=new double[DSIZE];
      for (int j=0; j<DSIZE; j++) {
        data[j]=Rand.nextDouble();
      }
      Index indy=Indexz.createRandomChoice(DSIZE, SSIZE);
      M.replaceRow(i,SparseIndexedVector.create(SSIZE, indy, data));
    }
   
    printTime("Construct small sparse matrix: ");

   
View Full Code Here

 
  public static SparseRowMatrix createMatrix() {
    SparseRowMatrix sm=SparseRowMatrix.create(SIZE,SIZE);
   
    for (int i=0; i<1000; i++) {
      sm.replaceRow(r.nextInt(SIZE), createRow());
    }
    return sm;
  }
 
  public static void main(String[] args) {
View Full Code Here

    int rowCount = indexes.length;
    if (rowCount != weights.length)
      throw new IllegalArgumentException("Length of indexes array must match length of weights array");
    SparseRowMatrix sm=SparseRowMatrix.create(rowCount, columnCount);
    for (int i = 0; i < rowCount; i++) {
      sm.replaceRow(i, SparseIndexedVector.wrap(columnCount, indexes[i].clone(), weights[i].toDoubleArray()));
    }
    return sm;
  }

  /**
 
View Full Code Here

    int cc=a.getShape(1);
    SparseRowMatrix m=SparseRowMatrix.create(rc,cc);
    for (int i=0; i<rc; i++) {
      AVector v=a.slice(i).sparseClone().asVector();
      if (!v.isZero()) {
        m.replaceRow(i, v);
      }
    }
    return m;
  }
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.