[Bug:trunk] Vector can't be coerced into Vector

e$B1sF#$G$9!#e(B

Vector e$B$Ke(B Vector e$B$r$+$1$k$He(B Vector can’t be coerced into
Vector e$B$H$$$&e(B
e$BNc30$,=P$^$9!#e(B

$ ./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 e$B$Ke(B Vector
e$B$O$+$1$i$l$J$$$N$GNc30$K$J$k$N$OEvA3$G$9$,!"%a%C%;!<%8$,e(B
e$B$o$+$j$K$/$$$H;W$$$^$9!#e(B

— 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
  •  Vector.Raise WrongArgType, x.class, "Numeric or Matrix"
    
    else
    s, x = x.coerce(self)
    s * x

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

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 e$B$Ke(B Vector e$B$O$+$1$i$l$J$$$N$GNc30$K$J$k$N$OEvA3$G$9$,!"%a%C%;!<%8$,e(B
e$B$o$+$j$K$/$$$H;W$$$^$9!#e(B

e$B$*$C$7$c$kDL$j$G$9e(B.

__
---------------------------------------------------->> e$B@PDMe(B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

e$B:XF#$H?=$7$^$9!#e(B

On Tue, 26 Jan 2010 00:22:54 +0900
Yusuke ENDOH [email protected] wrote:

   s * x

e$B$3$l$@$H<B:]$KNc30$,>e$,$C$?;~$K!"e(BNumerice$B$+e(BMatrixe$B$,e(B
e$B!&EO$5$l$?$+$i%(%i!<$J$N$+e(B
e$B!&EO$5$l$J$+$C$?$+$i%(%i!<$J$N$+e(B
e$BJ,$+$i$J$$$H;W$&$N$G!“e(B"should be” e$B$H$+e(B “needed”
e$B$H$+$r$D$1$?J}$,?F@Z$@$H;W$$$^$9!#e(B

e$B%A%1%C%He(B #2649 e$B$,99?7$5$l$^$7$?!#e(B (by Keiju Ishitsuka)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

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.


http://redmine.ruby-lang.org/issues/show/2649