Project

General

Profile

Actions

Bug #6967

closed

Vector#inner_product は複素数ベクトルのとき不適切

Added by 5.5 (5 5) about 12 years ago. Updated almost 12 years ago.

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

Description

#6966 に関連して,Vector#inner_product は成分の単なる積和ですが,複素数ベクトル v については v.inner_product(v) が非負性を破るので,内積の定義に当てはまりません。

複素数ベクトルでは内積といえばエルミート内積(<u,v> = Σ u_i v_i*)なので(* は複素共役),inner_product の定義を

p = 0
each2(v) {|v1, v2|
  p += v1 * v2.conj
}
p

のようにするか,あるいは self や引数が実でないときは例外を出すことにし,inner_product とは別に hermitian_inner_product を導入しては如何でしょうか。

Updated by marcandre (Marc-Andre Lafortune) about 12 years ago

  • Assignee set to marcandre (Marc-Andre Lafortune)

Updated by usa (Usaku NAKAMURA) almost 12 years ago

  • Status changed from Open to Assigned

Updated by marcandre (Marc-Andre Lafortune) almost 12 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Fixed with r38983 (not sure why redmine didn't link the commit & close the issue).

ありがとうございます。

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0