BasicObject
Returns element (i
,j
) of the matrix. That is:
row i
, column j
.
# File matrix.rb, line 325 def [](i, j) @rows.fetch(i){return nil}[j] end
Set element or elements of matrix.
# File matrix.rb, line 339 def []=(i, j, v) raise FrozenError, "can't modify frozen Matrix" if frozen? rows = check_range(i, :row) or row = check_int(i, :row) columns = check_range(j, :column) or column = check_int(j, :column) if rows && columns set_row_and_col_range(rows, columns, v) elsif rows set_row_range(rows, column, v) elsif columns set_col_range(row, columns, v) else set_value(row, column, v) end end