Package cern.colt.matrix

Examples of cern.colt.matrix.DoubleFactory2D


    public static void main(String args[]) {

       // For COLT
       DoubleMatrix2D xmatrix,ymatrix,zmatrix;

       DoubleFactory2D myfactory;
       myfactory = DoubleFactory2D.dense;
       xmatrix = myfactory.make(8,2);
       ymatrix = myfactory.make(8,1);

       xmatrix.set(0,0,1);
       xmatrix.set(1,0,1);
       xmatrix.set(2,0,1);
       xmatrix.set(3,0,1);
View Full Code Here


  { 1, 2, 3 },
  { 2, 4, 6 },
  { 3, 6, 9 },
  { 4, -8, -10 }
};
DoubleFactory2D factory = DoubleFactory2D.dense;
DoubleMatrix2D A = factory.make(values);
System.out.println("\n\nmatrix="+A);
System.out.println("\ncovar1="+covariance(A));
//System.out.println(correlation(covariance(A)));
//System.out.println(distance(A,EUCLID));
View Full Code Here

/**
* Demonstrates usage of this class.
*/
public static void demo2(int rows, int columns, boolean print) {
System.out.println("\n\ninitializing...");
DoubleFactory2D factory = DoubleFactory2D.dense;
DoubleMatrix2D A = factory.ascending(rows,columns);
//double value = 1;
//DoubleMatrix2D A = factory.make(rows,columns);
//A.assign(value);

System.out.println("benchmarking correlation...");
View Full Code Here

  { 1.53451660.02135884},
  {-1.13415420.20388430}
};

System.out.println("\n\ninitializing...");
DoubleFactory2D factory = DoubleFactory2D.dense;
DoubleMatrix2D A = factory.make(values).viewDice();

System.out.println("\nA="+A.viewDice());
System.out.println("\ndist="+distance(A,norm).viewDice());
}
View Full Code Here

*/
public static void doubleTest24(int runs, int size, boolean dense) {
System.out.println("\n\n");
System.out.println("initializing...");
DoubleMatrix2D A;
DoubleFactory2D factory;
if (dense)
  factory = Factory2D.dense;
else
  factory = Factory2D.sparse;
 
double value = 2;
double omega = 1.25;
final double alpha = omega * 0.25;
final double beta = 1-omega;
A = factory.make(size,size,value);

cern.colt.function.Double9Function function = new cern.colt.function.Double9Function() {
  public final double apply(double a00, double a01, double a02, double a10, double a11, double a12, double a20, double a21, double a22) {
    return alpha*a11 + beta*(a01+a10+a12+a21);
  }
};
cern.colt.Timer timer = new cern.colt.Timer().start();

System.out.println("benchmarking stencil...");
for (int i=0; i<runs; i++) {
  A.zAssign8Neighbors(A,function);
}
//A.zSum4Neighbors(A,alpha,beta,runs);
timer.stop().display();
//System.out.println("A="+A);
A=null;

double[][] B =  factory.make(size,size,value).toArray();
timer.reset().start();

System.out.println("benchmarking stencil scimark...");
for (int i=0; i<runs; i++) {
//  jnt.scimark2.SOR.execute(omega, B, runs);
View Full Code Here

 
System.out.println("\n\n");
System.out.println("initializing...");
boolean dense = true;
DoubleMatrix2D A;
DoubleFactory2D factory;
if (dense)
  factory = Factory2D.dense;
else
  factory = Factory2D.sparse;
 
double value = 0.5;
A = factory.make(size,size,value);
Property.generateNonSingular(A);
cern.colt.Timer timer = new cern.colt.Timer().start();

System.out.println(A);
System.out.println(Algebra.ZERO.inverse(A));
View Full Code Here

 
System.out.println("\n\n");
System.out.println("initializing...");
boolean dense = true;
DoubleMatrix2D A;
DoubleFactory2D factory;
if (dense)
  factory = Factory2D.dense;
else
  factory = Factory2D.sparse;
 
double value = 0.5;
A = factory.make(size,size,value);
Property.generateNonSingular(A);
cern.colt.Timer timer = new cern.colt.Timer().start();

DoubleMatrix2DComparator fun = new DoubleMatrix2DComparator() {
  public int compare(DoubleMatrix2D a, DoubleMatrix2D b) {
View Full Code Here

  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);
View Full Code Here

  }


  public static double fun_MDETERM( double[] _squareMatrix, int _sideLength )
  {
    final DoubleFactory2D factory2D = DoubleFactory2D.dense;
    final DoubleMatrix2D matrix2D = factory2D.make( _squareMatrix, _sideLength );
    return Algebra.DEFAULT.det( matrix2D );
  }
View Full Code Here

      double v = 1.0 / Math.pow(2.0, s);
      if (v <= 0)
          throw new IllegalArgumentException ("   v <= 0");
      B.assign (F.mult(v));

      DoubleFactory2D fac = DoubleFactory2D.dense;
      final DoubleMatrix2D B0 = fac.identity(n);    // B^0 = I
      final DoubleMatrix2D B2 = alge.mult(B, B);    // B^2
      final DoubleMatrix2D B4 = alge.mult(B2, B2)// B^4

      DoubleMatrix2D T = B2.copy();          // T = work matrix
      DoubleMatrix2D W = B4.copy();          // W = work matrix
View Full Code Here

TOP

Related Classes of cern.colt.matrix.DoubleFactory2D

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.