Actions
Bug #2651
closedMatrix#compare_by_row_vectors does not receive array of Vector
Description
=begin
遠藤です。
Matrix#compare_by_row_vectors が、その名前に反して、Vector の配列を
与えても正しく比較してくれません。
require "matrix"
m = Matrix[[1, 2], [3, 4]]
a = [Vector[1, 2], Vector[3, 4]]
p m.compare_by_row_vectors(a) #=> false
配列の配列ならちゃんと動きます。これは意図的でしょうか。
p m.compare_by_row_vectors([[1, 2], [3, 4]]) #=> true
意図的でなければ、以下のパッチはどうでしょうか。
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -427,7 +428,7 @@ class Matrix
return false unless @rows.size == rows.size
@rows.size.times do |i|
-
return false unless @rows[i].send(comparison, rows[i])
-
return false unless @rows[i].send(comparison,
Matrix.convert_to_array(rows[i]))
end
true
end
--
Yusuke ENDOH mame@tsg.ne.jp
=end
Updated by naruse (Yui NARUSE) over 15 years ago
- Priority changed from 3 to Normal
- ruby -v set to ruby 1.9.2dev (2009-11-16 trunk 25792) [i686-linux]
=begin
=end
Updated by marcandre (Marc-Andre Lafortune) over 15 years ago
- Category set to lib
- Status changed from Open to Closed
- Assignee set to marcandre (Marc-Andre Lafortune)
=begin
Matrix#compare_by_row_vectors has been removed
=end
Actions
Like0
Like0Like0