Package cern.colt.matrix

Examples of cern.colt.matrix.DoubleMatrix2D


*/
public static void doubleTest10() {
int rows = 6;
int columns = 7; // make a 4*5 matrix
//DoubleMatrix2D master = new DenseDoubleMatrix2D(rows,columns);
DoubleMatrix2D master = Factory2D.ascending(rows,columns);
//Basic.ascending(master);
//master.assign(1); // set all cells to 1
Transform.mult(master,Math.sin(0.3));
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,2,3};
int[] columnIndexes = {0,1,2,3};

int[] rowIndexes2 = {3,0,3};
int[] columnIndexes2 = {3,0,3};
DoubleMatrix2D view1 = master.viewPart(1,1,4,5).viewSelection(rowIndexes,columnIndexes);
System.out.println("\nview1="+view1);
DoubleMatrix2D view9 = view1.viewStrides(2,2).viewStrides(2,1);
System.out.println("\nview9="+view9);
view1 = view1.viewSelection(rowIndexes2,columnIndexes2);
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];

DoubleMatrix2D view1 = master.viewSelection(rowIndexes,columnIndexes);
System.out.println(view1);

master.assign(1);
System.out.println("\n"+master);
System.out.println(view1);
View Full Code Here

System.out.println(view1);
}
/**
*/
public static void doubleTest12() {
DoubleMatrix2D A,B,C,D,E,F,G,H,I,J;
A = Factory2D.make(2,3,9);
B = Factory2D.make(4,3,8);
C = Factory2D.appendRows(A,B);
System.out.println("\nA="+A);
System.out.println("\nB="+B);
View Full Code Here

}
/**
*/
public static void doubleTest14(int r1, int c, int r2) {
double[] values = {0, 1, 2, 3};
DoubleMatrix2D a = DoubleFactory2D.dense.ascending(r1,c);
DoubleMatrix2D b = Transform.mult(DoubleFactory2D.dense.ascending(c,r2), -1);


//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

  { 2, 6, 10 },
  { 3, 7, 11 }
};

//DoubleMatrix2D A = Factory2D.make(values);
DoubleMatrix2D A = Factory2D.make(size,size);
double value = 5;
for (int i=size; --i >= 0; ) {
  A.setQuick(i,i, value);
}
A.viewRow(0).assign(value);

//DoubleMatrix2D A = Factory2D.makeIdentity(size,size);


//DoubleMatrix2D A = Factory2D.makeAscending(size,size).assign(new cern.jet.random.engine.MersenneTwister());
cern.colt.Timer timer = new cern.colt.Timer().start();
DoubleMatrix2D inv = null;
for (int run=0; run<runs; run++) {
   inv = LinearAlgebra.inverse(A);
}
timer.stop().display();
View Full Code Here

*/
public static void doubleTest17(int size) {
System.out.println("\n\n");

//DoubleMatrix2D A = Factory2D.make(values);
DoubleMatrix2D A = Factory2D.ascending(3,4);
DoubleMatrix2D B = Factory2D.ascending(2,3);
DoubleMatrix2D C = Factory2D.ascending(1,2);
B.assign(F.plus(A.zSum()));
C.assign(F.plus(B.zSum()));


/*
System.out.println("\n"+A);
System.out.println("\n"+B);
 
View Full Code Here

public static void doubleTest18(int size) {
System.out.println("\n\n");
int s = 2;

//DoubleMatrix2D A = Factory2D.make(values);
DoubleMatrix2D A00, A01, A02, A10, A11, A12, A20, A21, A22, empty;
empty = Factory2D.make(0,0);

A00 = Factory2D.ascending(s,s);
//A01 = empty;
A01 = Factory2D.ascending(s,s).assign(F.plus(A00.getQuick(s-1,s-1)));
A02 = Factory2D.ascending(s,s).assign(F.plus(A01.getQuick(s-1,s-1)));
A10 = Factory2D.ascending(s,s).assign(F.plus(A02.getQuick(s-1,s-1)));
A11 = null;
//A11 = Factory2D.ascending(s,s).assign(F.plus(A10.getQuick(s-1,s-1)));
A12 = Factory2D.ascending(s,s).assign(F.plus(A10.getQuick(s-1,s-1)));
View Full Code Here

}
/**
*/
public static void doubleTest19() {
System.out.println("\n\n");
DoubleMatrix2D A;
int k;
int uk;
int lk;

double[][] values5 =
View Full Code Here

public static void doubleTest19(int size) {
System.out.println("\n\n");
int s = 2;

//DoubleMatrix2D A = Factory2D.make(values);
DoubleMatrix2D A00, A01, A02, A10, A11, A12, A20, A21, A22, empty;
empty = Factory2D.make(0,0);

A00 = Factory2D.ascending(s,s);
//A01 = empty;
A01 = Factory2D.ascending(s,s).assign(F.plus(A00.getQuick(s-1,s-1)));
A02 = Factory2D.ascending(s,s).assign(F.plus(A01.getQuick(s-1,s-1)));
A10 = Factory2D.ascending(s,s).assign(F.plus(A02.getQuick(s-1,s-1)));
A11 = null;
//A11 = Factory2D.ascending(s,s).assign(F.plus(A10.getQuick(s-1,s-1)));
A12 = Factory2D.ascending(s,s).assign(F.plus(A10.getQuick(s-1,s-1)));
View Full Code Here

}
/**
*/
public static void doubleTest20() {
System.out.println("\n\n");
DoubleMatrix2D A;
int k;
int uk;
int lk;

double[][] values1 =
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.