зеркало из https://github.com/github/ruby.git
replace raise method from e2mmap on Scalar class
This commit is contained in:
Родитель
9b950310be
Коммит
5044260dcd
|
@ -1749,7 +1749,7 @@ class Matrix
|
|||
when Numeric
|
||||
Scalar.new(@value + other)
|
||||
when Vector, Matrix
|
||||
Scalar.Raise ErrOperationNotDefined, "+", @value.class, other.class
|
||||
raise ErrOperationNotDefined, ["+", @value.class, other.class]
|
||||
else
|
||||
apply_through_coercion(other, __method__)
|
||||
end
|
||||
|
@ -1760,7 +1760,7 @@ class Matrix
|
|||
when Numeric
|
||||
Scalar.new(@value - other)
|
||||
when Vector, Matrix
|
||||
Scalar.Raise ErrOperationNotDefined, "-", @value.class, other.class
|
||||
raise ErrOperationNotDefined, ["-", @value.class, other.class]
|
||||
else
|
||||
apply_through_coercion(other, __method__)
|
||||
end
|
||||
|
@ -1782,7 +1782,7 @@ class Matrix
|
|||
when Numeric
|
||||
Scalar.new(@value / other)
|
||||
when Vector
|
||||
Scalar.Raise ErrOperationNotDefined, "/", @value.class, other.class
|
||||
raise ErrOperationNotDefined, ["/", @value.class, other.class]
|
||||
when Matrix
|
||||
self * other.inverse
|
||||
else
|
||||
|
@ -1795,10 +1795,10 @@ class Matrix
|
|||
when Numeric
|
||||
Scalar.new(@value ** other)
|
||||
when Vector
|
||||
Scalar.Raise ErrOperationNotDefined, "**", @value.class, other.class
|
||||
raise ErrOperationNotDefined, ["**", @value.class, other.class]
|
||||
when Matrix
|
||||
#other.powered_by(self)
|
||||
Scalar.Raise ErrOperationNotImplemented, "**", @value.class, other.class
|
||||
raise ErrOperationNotImplemented, ["**", @value.class, other.class]
|
||||
else
|
||||
apply_through_coercion(other, __method__)
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче