vermaseren / form

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

Transform decode #575

Closed jodavies closed 5 days ago

jodavies commented 1 week ago

As I understand the manual, the following should print the input expression again, but I can't seem to get "decode" to do anything.

CFunction f;

Local test = f(1,0,1,0,1);

Transform f encode(1,last):base=2;
Transform f decode(1,last):base=2;

Print +s;
.end
tueda commented 1 week ago

You need 5 bits to decode 21:

Transform f decode(1,5):base=2;
jodavies commented 1 week ago

OK, now I see what it means. How useful is this really, if you don't know apriori what the arguments are?

vermaseren commented 1 week ago

Usually you know from the encode. It is a great savings when you have to manipulate/sort/process a very large number of very small arguments. You store then temporarily as a single argument and only by the time you need the individual arguments you decode. This made an enormous difference when manipulating MZV’s and constructing the MZV datamine. If you do not know how many arguments there might come, you can specify a number that is too big, and you get leading zeroes. You can strip those if necessary.

On 13 Nov 2024, at 11:03, jodavies @.***> wrote:

OK, now I see what it means. How useful is this really, if you don't know apriori what the arguments are?

— Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/575#issuecomment-2473053979, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCETTQLJDEWZUDZCBAND2AMPXRAVCNFSM6AAAAABRWBY5XSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZTGA2TGOJXHE. You are receiving this because you are subscribed to this thread.

jodavies commented 1 week ago

OK thanks, I will add a test case for it.

Also ZtoH and HtoZ are not currently in the documentation.

vermaseren commented 1 week ago

Maybe one could add a feature to Transform: strip leading zeroes. Not that one can then specify (1,10000) or something silly like that, but a small overestimate is then not a disaster while at the same time not needing a statement like Repeat id f(0,?a) = f(?a); which would be much more expensive.

On 13 Nov 2024, at 11:19, jodavies @.***> wrote:

OK thanks, I will add a test case for it.

Also ZtoH and HtoZ are not currently in the documentation.

— Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/575#issuecomment-2473092874, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCERHLEUQ6RXEEUQIJTL2AMRTLAVCNFSM6AAAAABRWBY5XSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZTGA4TEOBXGQ. You are receiving this because you commented.