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

Posted by 5.5 (5 5) (Guest)
on 2012-09-03 03:56
(Received via mailing list)
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"
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.