Package cern.colt.matrix

Examples of cern.colt.matrix.DoubleMatrix2D.assign()


  }
  */
  System.out.println("\ntesting...");
  if (print) System.out.println(matrix);
  DoubleMatrix2D dense = DoubleFactory2D.dense.make(size,size);
  dense.assign(matrix);
  if (! dense.equals(matrix)) throw new InternalError();
  DoubleMatrix2D ADense = dense.copy();
  DoubleMatrix2D BDense = dense.copy();
  DoubleMatrix2D CDense = dense.copy();
  ADense.zMult(BDense,CDense);
View Full Code Here


    DoubleMatrix2D B = matrix.copy();
    //DoubleMatrix2D C = Basic.product(A,B);
    DoubleMatrix2D C = matrix.copy();
    A.zMult(B,C);
    if (! (C.equals(CDense))) throw new InternalError();
    C.assign(matrix);
    System.out.println("\nNow benchmarking...");
   
    timer3.start();
    for (int i=0; i<runs; i++) {
      A.zMult(B,C);
View Full Code Here

  else throw new RuntimeException("unknown kind");
 
  System.out.println("\nNow filling...");
  //if (kind.equals("sparse")) ((SparseDoubleMatrix2D)matrix).elements.hashCollisions = 0;
  for (int i=0; i<runs; i++) {
    matrix.assign(0);
    matrix.ensureCapacity(initialCapacity);
    if (kind.equals("sparse")) ((SparseDoubleMatrix2D)matrix).ensureCapacity(initialCapacity);
    timer1.start();
    int value = 0;
    for (int row=0; row < rows; row++) {
View Full Code Here

  else if (kind.equals("dense")) matrix = new DenseDoubleMatrix2D(rows,columns);
  //else if (kind.equals("denseArray")) matrix = new DoubleArrayMatrix2D(rows,columns);
  else throw new RuntimeException("unknown kind");
 
  System.out.println("\nNow multiplying...");
  matrix.assign(1);
  //if (kind.equals("sparse")) ((SparseDoubleMatrix2D)matrix).elements.hashCollisions = 0;
  for (int i=0; i<runs; i++) {
    timer1.start();
    cern.colt.matrix.doublealgo.Transform.mult(matrix, 3);
    timer1.stop();
View Full Code Here

    System.out.println("--> "+ ((double)hashCollisions / (rows*columns)) +" hashCollisions/element on average.");
  }
  */
 
  System.out.println("\nNow multiplying2...");
  matrix.assign(1);
  //if (kind.equals("sparse")) ((SparseDoubleMatrix2D)matrix).elements.hashCollisions = 0;
  for (int i=0; i<runs; i++) {
    timer2.start();
    cern.colt.matrix.doublealgo.Transform.mult(matrix,3);
    timer2.stop();
View Full Code Here

public static void doubleTest() {
int rows = 4;
int columns = 5; // make a 4*5 matrix
DoubleMatrix2D master = new DenseDoubleMatrix2D(rows,columns);
System.out.println(master);
master.assign(1); // set all cells to 1
System.out.println("\n"+master);
master.viewPart(2,1,2,3).assign(2); // set [2,1] .. [3,3] to 2
System.out.println("\n"+master);

DoubleMatrix2D copyPart = master.viewPart(2,1,2,3).copy();
View Full Code Here

System.out.println("\n"+master);
master.viewPart(2,1,2,3).assign(2); // set [2,1] .. [3,3] to 2
System.out.println("\n"+master);

DoubleMatrix2D copyPart = master.viewPart(2,1,2,3).copy();
copyPart.assign(3); // modify an independent copy
copyPart.set(0,0,4);
System.out.println("\n"+copyPart); // has changed
System.out.println("\n"+master); // master has not changed

DoubleMatrix2D view1 = master.viewPart(0,3,4,2); // [0,3] .. [3,4]
View Full Code Here

System.out.println("\nview1="+view1);
DoubleMatrix2D view2 = view1.viewPart(1,1,2,2);
System.out.println("\nview2="+view2);
DoubleMatrix2D view3 = view2.viewRowFlip();
System.out.println("\nview3="+view3);
view3.assign(Factory2D.ascending(view3.rows(),view3.columns()));
//Basic.ascending(view3);
System.out.println("\nview3="+view3);

//view2.assign(-1);
System.out.println("\nmaster replaced"+master);
View Full Code Here

*/
public static void doubleTest11() {
int rows = 4;
int columns = 5; // make a 1*1 matrix
DoubleMatrix2D master = new DenseDoubleMatrix2D(1,1);
master.assign(2);
System.out.println("\n"+master);

int[] rowIndexes = new int[rows];
int[] columnIndexes = new int[columns];

View Full Code Here

//System.out.println(a);
//System.out.println(b);
//System.out.println(Basic.product(a,b));
a.assign(0);
b.assign(0);

cern.colt.Timer timer = new cern.colt.Timer().start();
LinearAlgebra.mult(a,b);
timer.stop().display();
}
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.