I've thought in the past that it would be nice to have a mode for reproducible fp, but there is none yet (try +/ vs ([+])/). But it is moot in this case, as the matrices in question were integral.

(I don't think strict interpretation per se is necessary; just something reliable and consistent. EG I imagine picking and committing to a way of associating +/ which requires log space but admits efficient implementation on any sort of parallel architecture.)

On Mon, 9 Jan 2023, Marshall Lochbaum wrote:

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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to