Package cern.colt.matrix

Examples of cern.colt.matrix.DoubleMatrix2D


  {
    { 1, 2, 3, 4, 5, 6},
    { 2, 3, 4, 5, 6, 7}
  };
 
  DoubleMatrix2D x = new DenseDoubleMatrix2D(data);
  DoubleMatrix2D matrix = f.make(arrMatrix);
 
  DoubleMatrix2D res = matrix.zMult(x,null);

  System.out.println(res);
}
View Full Code Here


/**
*/
public static void doubleTest3() {
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,0,2,3).assign(2); // set [2,1] .. [3,3] to 2
System.out.println("\n"+master);

DoubleMatrix2D flip1 = master.viewColumnFlip();
System.out.println("flip around columns="+flip1);
DoubleMatrix2D flip2 = flip1.viewRowFlip();
System.out.println("further flip around rows="+flip2);

flip2.viewPart(0,0,2,2).assign(3);
System.out.println("master replaced"+master);
System.out.println("flip1 replaced"+flip1);
System.out.println("flip2 replaced"+flip2);


View Full Code Here

  };
 
  double[] x = { 1, 2 };
  double[] y = { 3, 4 };

  DoubleMatrix2D A = new DenseDoubleMatrix2D(data);
  SeqBlas.seqBlas.dger(1,new DenseDoubleMatrix1D(x), new DenseDoubleMatrix1D(y), A);

  System.out.println(A);
}
View Full Code Here

    { 0, 0, 8 },
    { 0, 0, 0 },
    { 0, 0, 0 }
  };
 
  DoubleMatrix2D x = new TridiagonalDoubleMatrix2D(data);
 

  System.out.println("\n\n\n"+x);
  System.out.println("\n"+new DenseDoubleMatrix2D(data));
}
View Full Code Here

    { 0, 0, 0 },
    { 0, 0, 0 }
  };
  */
 
  DoubleMatrix2D x = new DenseDoubleMatrix2D(data);

  System.out.println("\n\n\n"+x);
  System.out.println("\n"+ x.equals(ninf));
}
View Full Code Here

    { 0, 4, 2, 0 },
    { 0, 0, 0, 0 },
    { 0, 0, 0, 0 },
  };
 
  DoubleMatrix2D A = new DenseDoubleMatrix2D(data);
  Property.DEFAULT.generateNonSingular(A);
  DoubleMatrix2D inv = Algebra.DEFAULT.inverse(A);


  System.out.println("\n\n\n"+A);
  System.out.println("\n"+inv);
  DoubleMatrix2D B = A.zMult(inv,null);
  System.out.println(B);
  if (!(B.equals(DoubleFactory2D.dense.identity(A.rows)))) {
    throw new InternalError();
  }
}
View Full Code Here

/**
*/
public static void doubleTest4() {
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
DoubleMatrix2D view = master.viewPart(2,0,2,3).assign(2);
System.out.println("\n"+master);
System.out.println("\n"+view);
Transform.mult(view,3);
System.out.println("\n"+master);
System.out.println("\n"+view);
View Full Code Here

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

int[] indexes = {0,1,3,0,1,2};
DoubleMatrix1D view1 = master.viewRow(0).viewSelection(indexes);
System.out.println("view1="+view1);
DoubleMatrix1D view2 = view1.viewPart(0,3);
System.out.println("view2="+view2);

view2.viewPart(0,2).assign(-1);
View Full Code Here

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

int[] rowIndexes = {0,1,3,0};
int[] columnIndexes = {0,2};
DoubleMatrix2D view1 = master.viewSelection(rowIndexes,columnIndexes);
System.out.println("view1="+view1);
DoubleMatrix2D view2 = view1.viewPart(0,0,2,2);
System.out.println("view2="+view2);

view2.assign(-1);
System.out.println("master replaced"+master);
System.out.println("flip1 replaced"+view1);
System.out.println("flip2 replaced"+view2);

}
View Full Code Here

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

DoubleMatrix2D view1 = master.viewDice();
System.out.println("view1="+view1);
DoubleMatrix2D view2 = view1.viewDice();
System.out.println("view2="+view2);

view2.assign(-1);
System.out.println("master replaced"+master);
System.out.println("flip1 replaced"+view1);
System.out.println("flip2 replaced"+view2);

}
View Full Code Here

TOP

Related Classes of cern.colt.matrix.DoubleMatrix2D

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.