Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
Robbb
Level II

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?

2 REPLIES 2
Highlighted
Craige_Hales
Staff (Retired)

Re: How to pass a function to Parallel Assign()?

Highlighted
Robbb
Level II

Re: How to pass a function to Parallel Assign()?

Thanks. So with

M = J(2,3,0); Parallel Assign( {F = Function( {x,y}, x+y)}, M[i, j] = F( i, j ) );

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.

Article Labels

    There are no labels assigned to this post.