-(m)
public
Show source
def -(m)
case m
when Numeric
Matrix.Raise ErrOperationNotDefined, "-", self.class, m.class
when Vector
m = Matrix.column_vector(m)
when Matrix
else
return apply_through_coercion(m, __method__)
end
Matrix.Raise ErrDimensionMismatch unless row_size == m.row_size and column_size == m.column_size
rows = Array.new(row_size) {|i|
Array.new(column_size) {|j|
self[i, j] - m[i, j]
}
}
new_matrix rows, column_size
end