build(row_count, column_count = row_count)
Class Public methods
Creates a matrix of size row_count
x
column_count
. It fills the values by calling the given block,
passing the current row and column. Returns an enumerator if no block is
given.
1 2 3 4 | m = Matrix.build( 2 , 4 ) {|row, col| col - row } => Matrix[[ 0 , 1 , 2 , 3 ], [- 1 , 0 , 1 , 2 ]] m = Matrix.build( 3 ) { rand } => a 3x3 matrix with random elements |
Please login to continue.