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 #1

Updated by nobu (Nobuyoshi Nakada) over 11 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

Also available in: Atom PDF

Like0
Like0