Method: AppMath::Vec#spr

Defined in:
lib/linalg.rb

#spr(v) ⇒ Object

Returns the scalar product (self|v). The complex conjugation (which acts trivially on R) affects here the first factor. This is the convention preferred in physics.



238
239
240
241
242
243
244
245
246
# File 'lib/linalg.rb', line 238

def spr(v)
  fail "dimension mismatch" unless dim == v.dim
  return nil if dim.zero?
  s = self[1].conj * v[1] 
  for i in 2..dim
    s += self[i].conj * v[i] 
  end
  s
end