How to pass a function to Parallel Assign()?Hi everybody,
I am trying to pass a function to the local memory space of the Parallel Assign function:
F = Function( {x,y}, x+y);
M = J(2,3,0);
Parallel Assign({F=F},M[i,j]=F(i,j));
M;It does not work because JMP tells me F has 2 parameters but 0 were given. How can I fix this?
Of course it is a boiled down problem of a much longer script. I could define F inside Parallel Assign, but it is unnecessary to define one and the same function in each of my n execution (n is large). Is there a way to hand over a function to Parallel Assign?
Re: How to pass a function to Parallel Assign()?See example and explanation https://community.jmp.com/t5/Discussions/Multithreading-troubleshooting-using-Parallel-Assign/m-p/230644#M45738
Re: How to pass a function to Parallel Assign()?Thanks. So with
Parallel Assign( {F <SPAN class="token operator">=</SPAN> <SPAN class="token function">Function</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">{</SPAN>x<SPAN class="token punctuation">,</SPAN>y<SPAN class="token punctuation">}</SPAN><SPAN class="token punctuation">,</SPAN> x<SPAN class="token operator">+</SPAN>y<SPAN class="token punctuation">)</SPAN>}, M[i, j] = F( i, j ) );<CODE class=" language-jsl">M <SPAN class="token operator">=</SPAN> <SPAN class="token function">J</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token number">2</SPAN><SPAN class="token punctuation">,</SPAN><SPAN class="token number">3</SPAN><SPAN class="token punctuation">,</SPAN><SPAN class="token number">0</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>I can define a function once for Parallel Assign. But is it possible to do it outside the Parallel Assign statement? What if I want to use one and the same function inside and outside Parallel Assign? Do I really have to define it twice?
In general, if I have a function F, is it possible to assign the same function to G (of course without redefining it)? G=F does not work, since JMP expects the parameters of F.