Method: AppMath::Mat#spr

Defined in:
lib/linalg.rb

#spr(v) ⇒ Object

Scalar product of matrices.



995
996
997
998
999
1000
1001
1002
1003
# File 'lib/linalg.rb', line 995

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