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 copy expression without sorting? #403

Open FeelUsM opened 2 years ago

FeelUsM commented 2 years ago

When I save intermediate results or when I load it I need copy expression from stored to global area.

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 2 years ago

To my knowledge, there is no way to do this currently. It is known to be a weak point. I have it on the list of practise exercises for a future course on the inner workings of Form. That would involve the creation of a #copy(old,new) without any sorting, after which one can continue with the new expression. I am not sure about the syntax. Maybe #copy(new,old) is better. That would then be equivalent to L new=old; At a later stage you can always still say: Global new; if you need it to be global. The tricky part in the implementation is to get everything correct in all the informative structs and the scratch files.

Jos

On 27 Dec 2021, at 07:09, Feel @.***> wrote:

When I save intermediate results or when I load it I need copy expression from stored to global area.

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?

— Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/403, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCEUV7LIUIC45722LLDTUS77KZANCNFSM5KZZFVBA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you are subscribed to this thread.

FeelUsM commented 2 years ago

May be also would be useful #move(new,old) to rename expression and to move from stored to active area (not only without sorting but also without copying)...

vermaseren commented 2 years ago

To ‘unstore’ an expression requires much more work. Whereas the #copy itself is just copying from file to file (or buffer to buffer), unstoring requires potential replace operations, because a stored expression has its own list of variables. This could/should be distributed over the workers. Of course, it can be built in, but it is work that somebody should do.

On 27 Dec 2021, at 18:34, Feel @.***> wrote:

May be also would be useful #move(new,old) to rename expression and to move from stored to active area...

— Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/403#issuecomment-1001670427, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCEUOMEDI72DPWWHI5QDUTCPRHANCNFSM5KZZFVBA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.