Bug #2649
closedVector can't be coerced into Vector
Description
=begin
遠藤です。
Vector に Vector をかけると Vector can't be coerced into Vector という
例外が出ます。
$ ./ruby -rmatrix -e 'Vector[1, 2, 3] * Vector[4, 5, 6]'
/home/mame/work/ruby/lib/ruby/1.9.1/matrix.rb:1344:in coerce': Vector can't be coerced into Vector (TypeError) from /home/mame/work/ruby/lib/ruby/1.9.1/matrix.rb:1218:in
*'
from -e:1:in `'
Vector に Vector はかけられないので例外になるのは当然ですが、メッセージが
わかりにくいと思います。
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -1214,6 +1209,8 @@ class Vector
Vector.elements(els, false)
when Matrix
Matrix.column_vector(self) * x
- when Vector
-
elseVector.Raise WrongArgType, x.class, "Numeric or Matrix"
s, x = x.coerce(self)
s * x
--
Yusuke ENDOH mame@tsg.ne.jp
=end
Updated by keiju (Keiju Ishitsuka) over 15 years ago
=begin
けいじゅ@いしつかです.
In [ruby-dev:40150] the message: "[ruby-dev:40150] [Bug:trunk] Vector can't be coerced into Vector", on Jan/26 00:22(JST)
Yusuke ENDOH writes:
遠藤です。
Vector に Vector をかけると Vector can't be coerced into Vector という
例外が出ます。$ ./ruby -rmatrix -e 'Vector[1, 2, 3] * Vector[4, 5, 6]'
/home/mame/work/ruby/lib/ruby/1.9.1/matrix.rb:1344:incoerce': Vector can't be coerced into Vector (TypeError) from /home/mame/work/ruby/lib/ruby/1.9.1/matrix.rb:1218:in
*'
from -e:1:in `'Vector に Vector はかけられないので例外になるのは当然ですが、メッセージが
わかりにくいと思います。
おっしゃる通りです.
__
---------------------------------------------------->> 石塚 圭樹 <<---
---------------------------------->> e-mail: keiju@ishitsuka.com <<---
=end
Updated by keiju (Keiju Ishitsuka) over 15 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r26448.
Yusuke, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end