Closed RobinHankin closed 3 years ago
The bug can be fixed by adding if(is.zero(S)){return(S)}
to the first line of include_perms()
. . .
. . . but the code is inefficient because the for()
loop in include_perms()
repeatedly adds spray
objects to spray
objects, and checking for repeated rows (which is done by the C
back-end of spray
) takes a long time. It should be possible to use the fact that no repeated rows can possibly occur [because include_perms()
is sent the output of consolidate()
which guarantees that no row is a permutation of any other row]. We would then build the index and coefficients using ordinary matrix replacement methods.
Even if called directly, we can still streamline the code by returning spray(out)
which would coalesce repeated rows but only once.
automated email from Brian Ripley:
The problem is triggered as follows:
The problem is triggered in the final line of
Alt()
, vizktensor(include_perms(consolidate(out))/factorial(ncol(index(out))))
. The issue is thatconsolidate(out)
is the zero spray object (this is because of a peculiar cancellation in the terms above). Functioninclude_perms()
does not like it: