Module: Matrix::MMatrix
- Defined in:
- lib/extendmatrix.rb
Overview
a hided module of Matrix
Class Method Summary collapse
- .default_block(block) ⇒ Object
-
.id_vect_range(args, l) ⇒ Object
Returns: 1) the index of row/column and 2) the values Vector for changing the row/column and 3) the range of changes.
Class Method Details
.default_block(block) ⇒ Object
553 554 555 |
# File 'lib/extendmatrix.rb', line 553 def self.default_block(block) block ? lambda { |i| block.call(i) } : lambda {|i| i } end |
.id_vect_range(args, l) ⇒ Object
Returns: 1) the index of row/column and 2) the values Vector for changing the row/column and 3) the range of changes
563 564 565 566 567 568 569 570 571 572 573 |
# File 'lib/extendmatrix.rb', line 563 def self.id_vect_range(args, l) i = args[0] # the column(/the row) to be change vect = args[1] # the values vector case args.size when 3 then range = args[2] # the range of the elements to be change when 4 then range = args[2]..args[3] #the range by borders else range = 0...l end return i, vect, range end |