Project

General

Profile

Actions

Bug #6966

closed

Vector#norm は複素数ベクトルの正しいノルムを返さない

Added by 5.5 (5 5) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
Backport:
[ruby-dev:46100]

Description

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"

Actions

Also available in: Atom PDF

Like0
Like0