*(m)
public
Show source
def *(m)
case(m)
when Numeric
rows = @rows.collect {
|row|
row.collect {
|e|
e * m
}
}
return Matrix.rows(rows, false)
when Vector
m = Matrix.column_vector(m)
r = self * m
return r.column(0)
when Matrix
Matrix.Raise ErrDimensionMismatch if column_size != m.row_size
rows = (0 .. row_size - 1).collect {
|i|
(0 .. m.column_size - 1).collect {
|j|
vij = 0
0.upto(column_size - 1) do
|k|
vij += self[i, k] * m[k, j]
end
vij
}
}
return Matrix.rows(rows, false)
else
x, y = m.coerce(self)
return x * y
end
end