use of cern.colt.matrix.DoubleMatrix2D in project tdq-studio-se by Talend.
the class TestMatrix2D method doubleTest17.
/**
*/
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);
System.out.println("\n"+C);
System.out.println("\n"+Factory2D.diag(A,B,C));
*/
// System.out.println("\n"+cern.colt.matrixpattern.Converting.toHTML(A.toString()));
// System.out.println("\n"+cern.colt.matrixpattern.Converting.toHTML(B.toString()));
// System.out.println("\n"+cern.colt.matrixpattern.Converting.toHTML(C.toString()));
// System.out.println("\n"+cern.colt.matrixpattern.Converting.toHTML(Factory2D.diagonal(A,B,C).toString()));
}
use of cern.colt.matrix.DoubleMatrix2D in project tdq-studio-se by Talend.
the class TestMatrix2D method doubleTest19.
/**
*/
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)));
// A12 = Factory2D.ascending(s,s).assign(F.plus(A11.getQuick(s-1,s-1)));
A20 = Factory2D.ascending(s, s).assign(F.plus(A12.getQuick(s - 1, s - 1)));
A21 = empty;
// A21 = Factory2D.ascending(s,s).assign(F.plus(A20.getQuick(s-1,s-1)));
A22 = Factory2D.ascending(s, s).assign(F.plus(A20.getQuick(s - 1, s - 1)));
// A22 = Factory2D.ascending(s,s).assign(F.plus(A21.getQuick(s-1,s-1)));
// B.assign(F.plus(A.zSum()));
// C.assign(F.plus(B.zSum()));
System.out.println("\n" + A00);
System.out.println("\n" + A01);
System.out.println("\n" + A02);
System.out.println("\n" + A10);
System.out.println("\n" + A11);
System.out.println("\n" + A12);
System.out.println("\n" + A20);
System.out.println("\n" + A21);
System.out.println("\n" + A22);
// System.out.println("\n"+Factory2D.make33(A00,A01,A02,A10,A11,A12,A20,A21,A22));
/*
System.out.println("\n"+cern.colt.matrixpattern.Converting.toHTML(A00.toString()));
System.out.println("\n"+cern.colt.matrixpattern.Converting.toHTML(A01.toString()));
System.out.println("\n"+cern.colt.matrixpattern.Converting.toHTML(A02.toString()));
System.out.println("\n"+cern.colt.matrixpattern.Converting.toHTML(A10.toString()));
System.out.println("\n"+cern.colt.matrixpattern.Converting.toHTML(A11.toString()));
System.out.println("\n"+cern.colt.matrixpattern.Converting.toHTML(A12.toString()));
System.out.println("\n"+cern.colt.matrixpattern.Converting.toHTML(A20.toString()));
System.out.println("\n"+cern.colt.matrixpattern.Converting.toHTML(A21.toString()));
System.out.println("\n"+cern.colt.matrixpattern.Converting.toHTML(A22.toString()));
System.out.println("\n"+cern.colt.matrixpattern.Converting.toHTML(Factory2D.make33(A00,A01,A02,A10,A11,A12,A20,A21,A22).toString()));
*/
}
use of cern.colt.matrix.DoubleMatrix2D in project tdq-studio-se by Talend.
the class TestMatrix2D method doubleTest11.
/**
*/
public static void doubleTest11() {
int rows = 4;
// make a 1*1 matrix
int columns = 5;
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);
}
use of cern.colt.matrix.DoubleMatrix2D in project tdq-studio-se by Talend.
the class TestMatrix2D method doubleTest.
/**
*/
public static void doubleTest(int rows, int columns, int initialCapacity, double minLoadFactor, double maxLoadFactor) {
DoubleMatrix2D matrix = new SparseDoubleMatrix2D(rows, columns, initialCapacity, minLoadFactor, maxLoadFactor);
System.out.println(matrix);
System.out.println("adding...");
int i = 0;
for (int column = 0; column < columns; column++) {
for (int row = 0; row < rows; row++) {
// if (i%1000 == 0) {
matrix.set(row, column, i);
// }
i++;
}
}
System.out.println(matrix);
System.out.println("removing...");
for (int column = 0; column < columns; column++) {
for (int row = 0; row < rows; row++) {
// if (i%1000 == 0) {
matrix.set(row, column, 0);
// }
}
}
System.out.println(matrix);
System.out.println("bye bye.");
}
use of cern.colt.matrix.DoubleMatrix2D in project tdq-studio-se by Talend.
the class TestMatrix2D method doubleTest28.
/**
*/
public static void doubleTest28() {
double[] data = { 1, 2, 3, 4, 5, 6 };
double[][] arrMatrix = { { 1, 2, 3, 4, 5, 6 }, { 2, 3, 4, 5, 6, 7 } };
DoubleFactory2D f = DoubleFactory2D.dense;
DoubleMatrix1D vector = new DenseDoubleMatrix1D(data);
DoubleMatrix2D matrix = f.make(arrMatrix);
DoubleMatrix1D res = vector.like(matrix.rows());
matrix.zMult(vector, res);
System.out.println(res);
}
Aggregations