use of cern.colt.matrix.DoubleMatrix2D in project tdq-studio-se by Talend.
the class TestMatrix2D method doubleTest30.
/**
*/
public static void doubleTest30() {
double[][] data = { { 6, 5 }, { 7, 6 } };
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);
}
use of cern.colt.matrix.DoubleMatrix2D in project tdq-studio-se by Talend.
the class TestMatrix2D method doubleTest18.
/**
*/
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)));
// 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 doubleTest32.
/**
*/
public static void doubleTest32() {
double[][] data = { { 1, 4, 0 }, { 6, 2, 5 }, { 0, 7, 3 }, { 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));
}
use of cern.colt.matrix.DoubleMatrix2D in project tdq-studio-se by Talend.
the class TestMatrix2D method doubleTest34.
/**
*/
public static void doubleTest34() {
double[][] data = { { 3, 0, 0, 0 }, { 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();
}
}
use of cern.colt.matrix.DoubleMatrix2D in project tdq-studio-se by Talend.
the class TestMatrix2D method doubleTest3.
/**
*/
public static void doubleTest3() {
int rows = 4;
// make a 4*5 matrix
int columns = 5;
DoubleMatrix2D master = new DenseDoubleMatrix2D(rows, columns);
System.out.println(master);
// set all cells to 1
master.assign(1);
System.out.println("\n" + master);
// set [2,1] .. [3,3] to 2
master.viewPart(2, 0, 2, 3).assign(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);
/*
DoubleMatrix2D copyPart = master.copyPart(2,1,2,3);
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]
DoubleMatrix2D view2 = view1.viewPart(0,0,4,1); // a view from a view
System.out.println("\n"+view1);
System.out.println("\n"+view2);
*/
}
Aggregations