Method: AppMath::Vec#+

Defined in:
lib/linalg.rb

#+(v) ⇒ Object

Returns self + v, where v is a Vec



156
157
158
159
160
161
162
163
164
# File 'lib/linalg.rb', line 156

def +(v)
  fail "object can't be added to a Vec" unless v.is_a?(Vec)
  fail "dimension mismatch" unless dim == v.dim
  res = clone
  for i in 1..dim
    res[i] += v[i]
  end
  res
end