Question: Thread-Safe Alternative to indets for Processing Millions of Expressions?

Hello,

I was wondering whether there is a way to achieve the same result as the code below, but using threads instead of Grid.

The problem is the following. Given a very large list of models (the example below contains only two models), I would like to return a set of sets using a simpler notation for the alpha parameters.


Example

models:=[[y^2*z*alpha[1, 17], z^3*alpha[2, 19], x*z^2*alpha[3, 15] + z^3*alpha[3, 19]], [y^2*z*alpha[1, 17], z^3*alpha[2, 19], x*z^2*alpha[3, 15] + y*z^2*alpha[3, 18]]]:

Desired output

{{[1, 17], [2, 19], [3, 15], [3, 18]}, {[1, 17], [2, 19], [3, 15], [3, 19]}}

The order of the elements does not matter, but the final result should be a set of sets.

The code I am currently using is

svars:={x,y,z}:
Grid:-Set('svars'):
convert(Grid:-Map(w->map(v->[op](v),indets(w,name) minus svars),models),set)

Unfortunately, indets is not listed as thread-safe, so I cannot simply replace Grid:-Map with Threads:-Map.

Is there a thread-safe alternative (or a completely new way of doing the same thing) that would achieve the same result?

Many thanks.

Please Wait...