Method: TwoDMatrix#decompose
- Defined in:
- lib/csrmatrix.rb
#decompose ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/csrmatrix.rb', line 148 def decompose() # decompose the matrix into an array # pre csrmatrix # post array from the csrmartix res = Array.new(@rows) { Array.new(@columns, 0) } row_counter = 0 row_idx = 0 @row_ptr.drop(1).each do |i| #eg. 2 4 7 10 while row_counter < i res[row_idx][@col_ind[row_counter]] = @val[row_counter] row_counter += 1 end row_idx += 1 end return res end |