Package cern.colt.matrix

Examples of cern.colt.matrix.DoubleMatrix1D.toArray()


  testSort[3] = Double.NaN;
  testSort[4] = 1;
  DoubleMatrix1D doubleDense = new DenseDoubleMatrix1D(testSort);
  System.out.println("orig = "+doubleDense);
  doubleDense = doubleDense.viewSorted();
  doubleDense.toArray(testSort);
  System.out.println("sort = "+doubleDense);
  System.out.println("done\n");
}
/**
*/
 
View Full Code Here


  testSort[3] = Double.NaN;
  testSort[4] = 1;
  DoubleMatrix1D doubleDense = new DenseDoubleMatrix1D(testSort);
  System.out.println("orig = "+doubleDense);
  doubleDense = doubleDense.viewSorted();
  doubleDense.toArray(testSort);
  System.out.println("sort = "+doubleDense);
  System.out.println("done\n");
}
/**
*/
 
View Full Code Here

  {
    LUDecompositionQuick solver = new LUDecompositionQuick();
    DoubleMatrix2D matrix = toDoubleMatrix2D();
    solver.decompose(matrix);solver.setLU(matrix);
    DoubleMatrix1D result = toDoubleMatrix1D();
    solver.solve(result);result.toArray(j_x);   
  }
 
  /** The following two variables are not currently in use.
   * The amount of memory currently allocated on the solver. Negative will force allocation. This is necessary for initialisation. */
  //private static int currentMaxSize = -1;
View Full Code Here

  {
    LUDecompositionQuick solver = new LUDecompositionQuick();
    DoubleMatrix2D matrix = toDoubleMatrix2D();
    solver.decompose(matrix);solver.setLU(matrix);
    DoubleMatrix1D result = toDoubleMatrix1D();
    solver.solve(result);result.toArray(j_x);   
  }
 
  /** The following two variables are not currently in use.
   * The amount of memory currently allocated on the solver. Negative will force allocation. This is necessary for initialisation. */
  //private static int currentMaxSize = -1;
View Full Code Here

  {
    LUDecompositionQuick solver = new LUDecompositionQuick();
    DoubleMatrix2D matrix = toDoubleMatrix2D();
    solver.decompose(matrix);solver.setLU(matrix);
    DoubleMatrix1D result = toDoubleMatrix1D();
    solver.solve(result);result.toArray(j_x);   
  }
 
  /** The following two variables are not currently in use.
   * The amount of memory currently allocated on the solver. Negative will force allocation. This is necessary for initialisation. */
  //private static int currentMaxSize = -1;
View Full Code Here

  {
    LUDecompositionQuick solver = new LUDecompositionQuick();
    DoubleMatrix2D matrix = toDoubleMatrix2D();
    solver.decompose(matrix);solver.setLU(matrix);
    DoubleMatrix1D result = toDoubleMatrix1D();
    solver.solve(result);result.toArray(j_x);   
  }
 
  /** The following two variables are not currently in use.
   * The amount of memory currently allocated on the solver. Negative will force allocation. This is necessary for initialisation. */
  //private static int currentMaxSize = -1;
View Full Code Here

  {
    LUDecompositionQuick solver = new LUDecompositionQuick();
    DoubleMatrix2D matrix = toDoubleMatrix2D();
    solver.decompose(matrix);solver.setLU(matrix);
    DoubleMatrix1D result = toDoubleMatrix1D();
    solver.solve(result);result.toArray(j_x);   
  }
 
  /** The following two variables are not currently in use.
   * The amount of memory currently allocated on the solver. Negative will force allocation. This is necessary for initialisation. */
  //private static int currentMaxSize = -1;
View Full Code Here

  {
    LUDecompositionQuick solver = new LUDecompositionQuick();
    DoubleMatrix2D matrix = toDoubleMatrix2D();
    solver.decompose(matrix);solver.setLU(matrix);
    DoubleMatrix1D result = toDoubleMatrix1D();
    solver.solve(result);result.toArray(j_x);   
  }
 
  /** The following two variables are not currently in use.
   * The amount of memory currently allocated on the solver. Negative will force allocation. This is necessary for initialisation. */
  //private static int currentMaxSize = -1;
View Full Code Here

    final DoubleMatrix2D wDiag = DoubleFactory2D.sparse.diagonal(DoubleFactory1D.dense.make(w));
    final DoubleMatrix2D transpose = _algebra.transpose(matrix);
    final DoubleMatrix1D betasVector =
        _algebra.mult(_algebra.mult(_algebra.mult(_algebra.inverse(_algebra.mult(transpose, _algebra.mult(wDiag, matrix))), transpose), wDiag), vector);
    final double[] yModel = convertArray(_algebra.mult(matrix, betasVector).toArray());
    final double[] betas = convertArray(betasVector.toArray());
    return getResultWithStatistics(x, convertArray(wDiag.toArray()), y, betas, yModel, transpose, matrix, useIntercept);
  }

  private LeastSquaresRegressionResult getResultWithStatistics(final double[][] x, final double[][] w, final double[] y, final double[] betas,
      final double[] yModel, final DoubleMatrix2D transpose, final DoubleMatrix2D matrix, final boolean useIntercept) {
View Full Code Here

    final DoubleMatrix1D vector = DoubleFactory1D.dense.make(indep);
    final DoubleMatrix2D w = DoubleFactory2D.dense.make(wArray);
    final DoubleMatrix2D transpose = _algebra.transpose(matrix);
    final DoubleMatrix1D betasVector = _algebra.mult(_algebra.mult(_algebra.mult(_algebra.inverse(_algebra.mult(transpose, _algebra.mult(w, matrix))), transpose), w), vector);
    final double[] yModel = convertArray(_algebra.mult(matrix, betasVector).toArray());
    final double[] betas = convertArray(betasVector.toArray());
    return getResultWithStatistics(x, y, betas, yModel, useIntercept);
  }

  private LeastSquaresRegressionResult getResultWithStatistics(final double[][] x, final double[] y, final double[] betas, final double[] yModel, final boolean useIntercept) {
    final int n = x.length;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.