I don't think you'd want to reorder matrix multiplications as that can change the results by an arbitrary amount. Here's an example where multiplication on one side cancels but not on the other side.
(+/ .*&.>/ , +/ .*&.>~/@:|.) 1e6 1e7;(1e13+=i.2);1 _1 ┌────────┬──────────┐ │_9000000│_8.99482e6│ └────────┴──────────┘ Marshall On Mon, Jan 09, 2023 at 01:45:32PM -0500, Henry Rich wrote: > If f is known to be associative, f/\ proceeds from start to end in linear > time. Elijah has thoughts about how you could inform the interpreter that a > function is associative. Till that is implemented, you can use f/\.&.|. > which has linear time, or you can use Fold. > > Henry Rich > > On 1/9/2023 1:23 PM, Omar Antolín Camarena wrote: > > Am I right in thinking that the J interpreter does use a linear time > > algorithm for u/\ for some u including + and *? If so, maybe the case of +/ > > . * is worth adding. > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm