Add a vector to a list of vectors
I recommend using Transpose
twice since it is more efficient than other approaches. Moreover Plus
has the Listable
attribute, thus one need not map Plus
over a list (vector).
Transpose[v1 + Transpose[v2]]
{{a + d, b + e, c + f}, {a + g, b + h, c + i}, {a + j, b + k, c + l}}
Having said that remember that one can rewrite it very concisely in the Front-End: Esc tr Esc
:
To achieve what you need requires to distribute the sum over v2:
(v1 + # &) /@ v2
which is a short form of:
Map[ v1 + # &, v2 ]
Alternative method using the magic that is Inner
:
Inner[Plus, {a, b, c}, Transpose@{{d, e, f}, {g, h, i}, {j, k, l}}, List]