List of usage examples for org.apache.commons.math.linear Array2DRowRealMatrix getDataRef
public double[][] getDataRef()
From source file:hu.sztaki.incremental.ml.streaming.imsr.MatrixVectorPairSource.java
@Override public void invoke(Collector<Tuple2<double[][], double[][]>> out) throws Exception { File f = new File(path); if (!f.exists()) { System.err.println(path + " does not exist."); System.exit(1);/*w w w.j a va 2s. co m*/ } Scanner s = initCsvScanner(new Scanner(f)); String firstLine = s.nextLine(); Scanner firstLineScanner = initCsvScanner(new Scanner(firstLine)); for (indepDim = 0; firstLineScanner.hasNext(); firstLineScanner.next(), indepDim++) ; indepDim--; while (s.hasNext()) { Array2DRowRealMatrix X = new Array2DRowRealMatrix(batchSize, indepDim); Array2DRowRealMatrix y = new Array2DRowRealMatrix(batchSize, 1); readMatricesSideBySide(s, X, y); out.collect(new Tuple2<double[][], double[][]>(X.getDataRef(), y.getDataRef())); } s.close(); out.close(); }
From source file:gephi.spade.panel.FCSOperations.java
/** * T-distribution between selected nodes and all nodes */// ww w . j ava 2 s . c o m private double tTest(Array2DRowRealMatrix selectedEvents, Array2DRowRealMatrix allEvents, int attribute) { TTestImpl tTest = new TTestImpl(); try { return tTest.t(selectedEvents.getDataRef()[attribute], allEvents.getDataRef()[attribute]); } catch (IllegalArgumentException ex) { //CyLogger.getLogger(FCSOperations.class.getName()).error(null, ex); } return 0.0; }