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

Remove the hard limit due to EATTENSOR #490

Closed tueda closed 8 months ago

tueda commented 8 months ago

Try to fix #268.

I'm still not sure why EATTENSOR is called so (maybe there was a certain reason 21 years ago).

jodavies commented 8 months ago

I don't follow this. Why does EATTENSOR need "passing in" at all? The define is active inside these functions of course.

Shouldn't https://github.com/vermaseren/form/pull/490/commits/f5c061e1c944577e1953bd68210d73d664c4dba3#diff-dfad395d67eb6654e019817a74f727d798e04807b660529206715a8f3b141503R1565 just be if (newnumber) now?

tueda commented 8 months ago

There exist calls of CheckWild()/AddWild() with ARGTOARG and ARGTOARG|EATTENSOR. We need both. I guess ARGTOARG is for ?a and ARGTOARG with EATTENSOR is for nargs_.

jodavies commented 8 months ago

OK I see, I misinterpreted it as some kind of limit on the number of arguments that can be in the pattern.

tueda commented 8 months ago

Added 2 tests for https://github.com/vermaseren/form/issues/268.

jodavies commented 6 months ago

This one has caused a regression actually, here is an example which is the first thing color.h does (we should put a variety of color.h tests in the CI...):

Symbol NA;
Dimension NA;
AutoDeclare Index cOli,cOlj,cOlk,cOln;
Tensor T;
Index j5,j7,ii1;

Local test = T(j5,j7,ii1)*T(j7,j5,ii1);

repeat id T(cOli1?,cOli2?,?a)*T(cOli2?,cOli3?,?b) = T(cOli1,cOli3,?a,?b);

.end

This terminates with

Illegal substitution of argument field in tensor
tueda commented 6 months ago

Good catch, thanks!

A somewhat minimized example that gives Vargrind errors is:

T t;
I i1,i2;
L F = t(i1,i2)*t;
id t(i1?,?a) * t(i2?,?b) = 1;
.end
==199135== Conditional jump or move depends on uninitialised value(s)
==199135==    at 0x239D62: AddWild (wildcard.c:1571)
==199135==    by 0x15BDCC: MatchFunction (function.c:1056)
==199135==    by 0x15D77C: ScanFunctions (function.c:1775)
==199135==    by 0x15967E: FindRest (findpat.c:1133)
==199135==    by 0x1ACCCE: TestMatch (pattern.c:346)
==199135==    by 0x1E00F5: Generator (proces.c:3964)
==199135==    by 0x1E093C: Generator (proces.c:4216)
==199135==    by 0x1E1FCA: Processor (proces.c:406)
==199135==    by 0x150E42: DoExecute (execute.c:858)
==199135==    by 0x17C558: ExecModule (module.c:291)
==199135==    by 0x1D6C1F: PreProcessor (pre.c:1041)
==199135==    by 0x21451B: main (startup.c:1690)
==199135==
==199135== Conditional jump or move depends on uninitialised value(s)                                                                       ==199135==    at 0x239D52: AddWild (wildcard.c:1571)
==199135==    by 0x15BDCC: MatchFunction (function.c:1056)
==199135==    by 0x15D77C: ScanFunctions (function.c:1775)
==199135==    by 0x15967E: FindRest (findpat.c:1133)
==199135==    by 0x1ACCCE: TestMatch (pattern.c:346)
==199135==    by 0x1E00F5: Generator (proces.c:3964)
==199135==    by 0x1E093C: Generator (proces.c:4216)
==199135==    by 0x1E1FCA: Processor (proces.c:406)
==199135==    by 0x150E42: DoExecute (execute.c:858)
==199135==    by 0x17C558: ExecModule (module.c:291)
==199135==    by 0x1D6C1F: PreProcessor (pre.c:1041)
==199135==    by 0x21451B: main (startup.c:1690)
tueda commented 6 months ago

I really don't understand why I overlooked this line.

https://github.com/vermaseren/form/blob/e58ebd3f344ad3a6e3ae5393be3f20d17a79192f/sources/function.c#L1056

Definitely, we need more tests... color.h is a good candidate, indeed.