I guess I don't understand how threading works. Suppose I define a function
f[v__, c__] := v + c;
Here v is intended to be a vector, and c is a scalar::
vec = {a, b, c, d};
f [vec, x]
then yields
{a + x, b + x, c + x, d + x}
Suppose I want to repeat this for a sequence of c's. I would write:
cs = {e, f, g}
Table[ f [vec, cs[[i]] ], {i, Length[cs]}]
I then get
{{a + e, b + e, c + e, d + e}, {a + f, b + f, c + f, d + f}, {a + g, b + g, c + g, d + g}}
Now I'd like to do this same thing in parallel:
Thread[ f [vec, cs], List, {2}]
My understanding of this statement is that I want to evaluate f [vec, c] for each c contained in {e, f, g}.
Instead what I get is:
Thread::tdlen: Objects of unequal length in {a,b,c,d}+{e,f,g} cannot be combined. >>
I attach a pdf version of my Mathematica session. If anyone can clarify this for me, I would appreciate it. Thanks for reading this.
Attachments: