Replace scratch space by allocations in the factory functions
pass whatever is needed to apply_Xt etc
this will likely make the code a bit less readable in some places but is probably better practice and shouldn't affect performance, additionally it should help avoid non-thread safe stuff
apply_Xt
etcthis will likely make the code a bit less readable in some places but is probably better practice and shouldn't affect performance, additionally it should help avoid non-thread safe stuff