public static double [ ] [ ] matrixFromRange ( double [ ] lower , double [ ] upper , int rows ) { // Get the number of columns: final int cols = lower . length ; // Initialize the return value: final double [ ] [ ] matrix = new double [ rows ] [ cols ] ; // Iterate over columns and fill the array: for ( int col = 0 ; col < cols ; col ++ ) { // Get the sequence: final double [ ] sequence = DMatrixUtils . sequence ( lower [ col ] , upper [ col ] , rows ) ; // Assign to each row in the column: for ( int row = 0 ; row < sequence . length ; row ++ ) { matrix [ row ] [ col ] = sequence [ row ] ; } } // Done, return the populated matrix: return matrix ; }
Creates a matrix from the provided range for columns with the given number of rows .