+(m)
public
Show source
def +(m)
case m
when Numeric
Matrix.Raise ErrOperationNotDefined, "+"
when Vector
m = Matrix.column_vector(m)
when Matrix
else
x, y = m.coerce(self)
return x + y
end
Matrix.Raise ErrDimensionMismatch unless row_size == m.row_size and column_size == m.column_size
rows = (0 .. row_size - 1).collect {
|i|
(0 .. column_size - 1).collect {
|j|
self[i, j] + m[i, j]
}
}
Matrix.rows(rows, false)
end