minor(*param)
public
Returns a section of the matrix. The parameters are either:
Matrix.diagonal(9, 5, -3).minor(0..1, 0..2)
=> 9 0 0
0 5 0
Show source
def minor(*param)
case param.size
when 2
from_row = param[0].first
size_row = param[0].end - from_row
size_row += 1 unless param[0].exclude_end?
from_col = param[1].first
size_col = param[1].end - from_col
size_col += 1 unless param[1].exclude_end?
when 4
from_row = param[0]
size_row = param[1]
from_col = param[2]
size_col = param[3]
else
Matrix.Raise ArgumentError, param.inspect
end
rows = @rows[from_row, size_row].collect{
|row|
row[from_col, size_col]
}
Matrix.rows(rows, false)
end