vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
982 stars 118 forks source link

How to make stored expression to be active again? #396

Open FeelUsM opened 2 years ago

FeelUsM commented 2 years ago

I want to write code that will save intermediate results in file, like this:

G G = expr;
#do iter = 1,10
some calculation
.store
save <out`iter'.sav>;
.sort
??? restore ???
#enddo
.end

Or how to do such calculations properly?

tueda commented 2 years ago

Perhaps, something like this?

S x;
.global
G G = x;
.sort
#do iter = 1, 10
* some calculation
  id x = x + 1;
  P;
  .store
* save the stored expression
  Save out`iter'.sav;
* prepare for the next iteration
  G Gtmp = G;
  .sort
  Delete storage;  * this clears all stored expressions
  Drop Gtmp;
  G G = Gtmp;
#enddo
.end

Saved expressions can be used in a different program:

Load out5.sav;  * pick up one of the save files
L F = G;
* some calculation
id x = x^2;
P;
.end
FeelUsM commented 2 years ago

Unfortunately each module that contain Local/Global G = Gtmp; expression executes in 1 (one) thread. So I need to separate this expression in separate module:

Global G = Gtmp;
.sort

But sorting large expressions in one thread needs very much time (more than do calculation and sorting with many threads).

Is there any way to copy expression without sorting?

vermaseren commented 1 year ago

Is looked into. Probably a special case for this can be created.