Actions
Bug #6966
closedVector#norm は複素数ベクトルの正しいノルムを返さない
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"
Updated by nobu (Nobuyoshi Nakada) about 12 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r36887.
5, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
matrix.rb: complex vector
- lib/matrix.rb (Vector#magnitude): accumulate squares of absolute
values to fix for complex vector. [ruby-dev:46100] [Bug #6966]
Actions
Like0
Like0