Package cern.colt.matrix.impl

Examples of cern.colt.matrix.impl.DenseDoubleMatrix1D


* @throws IllegalArgumentException if <tt>A.columns() != y.size() || A.rows() > z.size())</tt>.
*/
public DoubleMatrix1D zMult(DoubleMatrix1D y, DoubleMatrix1D z, double alpha, double beta, boolean transposeA) {
  if (transposeA) return viewDice().zMult(y,z,alpha,beta,false);
  //boolean ignore = (z==null);
  if (z==null) z = new DenseDoubleMatrix1D(this.rows);
  if (columns != y.size() || rows > z.size()) 
    throw new IllegalArgumentException("Incompatible args: "+toStringShort()+", "+y.toStringShort()+", "+z.toStringShort());

  for (int i = rows; --i >= 0; ) {
    double s = 0;
View Full Code Here


*
* @param values The values to be filled into the new matrix.
*/
public DoubleMatrix1D make(double[] values) {
  if (this==sparse) return new SparseDoubleMatrix1D(values);
  else return new DenseDoubleMatrix1D(values);
}
View Full Code Here

/**
* Constructs a matrix with the given shape, each cell initialized with zero.
*/
public DoubleMatrix1D make(int size) {
  if (this==sparse) return new SparseDoubleMatrix1D(size);
  return new DenseDoubleMatrix1D(size);
}
View Full Code Here

String[] formats =         {"%G", "%1.19G"};


// now the processing
int size = formats.length;
DoubleMatrix1D matrix = new DenseDoubleMatrix1D(values);

String[] strings = new String[size];
//String[] javaStrings = new String[size];

for (int i=0; i<size; i++) {
  String format = formats[i];
  strings[i] = new Formatter(format).toString(matrix);
  for (int j=0; j<matrix.size(); j++) {
    System.out.println(String.valueOf(matrix.get(j)));
  }
}

System.out.println("original:\n"+new Formatter().toString(matrix));
View Full Code Here

* Sorts by sinus of cell values.
*/
public static void zdemo3() {
  Sorting sort = quickSort;
  double[] values = {0.5, 1.5, 2.5, 3.5};
  DoubleMatrix1D matrix = new DenseDoubleMatrix1D(values);
  cern.colt.function.DoubleComparator comp = new cern.colt.function.DoubleComparator() {
    public int compare(double a, double b) {
      double as = Math.sin(a); double bs = Math.sin(b);
      return as < bs ? -1 : as == bs ? 0 : 1;
    }
View Full Code Here

* Demonstrates applying functions.
*/
protected static void zdemo4() {
  double[] values1 = {0, 1, 2, 3};
  double[] values2 = {0, 2, 4, 6};
  DoubleMatrix1D matrix1 = new DenseDoubleMatrix1D(values1);
  DoubleMatrix1D matrix2 = new DenseDoubleMatrix1D(values2);
  System.out.println("m1:"+matrix1);
  System.out.println("m2:"+matrix2);
 
  matrix1.assign(matrix2, cern.jet.math.Functions.pow);
 
View Full Code Here

String[] formats =         {"%G", "%1.19G"};


// now the processing
int size = formats.length;
DoubleMatrix1D matrix = new DenseDoubleMatrix1D(values);

String[] strings = new String[size];
//String[] javaStrings = new String[size];

for (int i=0; i<size; i++) {
  String format = formats[i];
  strings[i] = new Formatter(format).toString(matrix);
  for (int j=0; j<matrix.size(); j++) {
    System.out.println(String.valueOf(matrix.get(j)));
  }
}

System.out.println("original:\n"+new Formatter().toString(matrix));
View Full Code Here

* Sorts by sinus of cell values.
*/
public static void zdemo3() {
  Sorting sort = quickSort;
  double[] values = {0.5, 1.5, 2.5, 3.5};
  DoubleMatrix1D matrix = new DenseDoubleMatrix1D(values);
  cern.colt.function.DoubleComparator comp = new cern.colt.function.DoubleComparator() {
    public int compare(double a, double b) {
      double as = Math.sin(a); double bs = Math.sin(b);
      return as < bs ? -1 : as == bs ? 0 : 1;
    }
View Full Code Here

* Demonstrates applying functions.
*/
protected static void zdemo4() {
  double[] values1 = {0, 1, 2, 3};
  double[] values2 = {0, 2, 4, 6};
  DoubleMatrix1D matrix1 = new DenseDoubleMatrix1D(values1);
  DoubleMatrix1D matrix2 = new DenseDoubleMatrix1D(values2);
  System.out.println("m1:"+matrix1);
  System.out.println("m2:"+matrix2);

  matrix1.assign(matrix2, cern.jet.math.Functions.pow);

View Full Code Here

*
* @param values The values to be filled into the new matrix.
*/
public DoubleMatrix1D make(double[] values) {
  if (this==sparse) return new SparseDoubleMatrix1D(values);
  else return new DenseDoubleMatrix1D(values);
}
View Full Code Here

TOP

Related Classes of cern.colt.matrix.impl.DenseDoubleMatrix1D

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.