[ruby-dev:46100] [ruby-trunk - Bug #6966][Open] Vector#norm は複素数ベクトルの正しいノルムを返さない

From: "5.5 (5 5)" <redmine@...>
Date: 2012-09-03 01:56:20 UTC
List: ruby-dev #46100
Issue #6966 has been reported by 5.5 (5 5).

----------------------------------------
Bug #6966: Vector#norm は複素数ベクトルの正しいノルムを返さない
https://bugs.ruby-lang.org/issues/6966

Author: 5.5 (5 5)
Status: Open
Priority: Low
Assignee: 
Category: lib
Target version: 1.9.3
ruby -v: ruby 1.9.3p194 (2012-04-20) [i386-mingw32]


Vector#norm は,単に成分の自乗和の正の平方根を取っていますが,これだと成分が複素数のときに正しい値を返しません。成分の絶対値自乗和の正の平方根を取るべきではないでしょうか。

Vector[Complex(0, 1), 1].norm
=> 0.0

Vector[Complex(0, 1), 0].norm
=> Math::DomainError: Numerical argument is out of domain - "sqrt"



-- 
http://bugs.ruby-lang.org/

In This Thread

Prev Next