Method: TwoDMatrix#build_from_array

Defined in:
lib/csrmatrix.rb

#build_from_array(array) ⇒ Object



178
179
180
181
182
183
184
185
186
187
188
# File 'lib/csrmatrix.rb', line 178

def build_from_array(array)
#Contracts: Pre
  if !same_sublength(array)
    raise MatrixDimException.new, "Invalid row/column pairs imported."
    return false
  end
  #END Contracts: Pre
  @val = [] #Allows Invariant Check to Pass for following method call
  @columns, @rows, nonzero_count, @val, @row_ptr, @col_ind = convert_to_csr(array)
  return true
end