[m-users.] array2d in column-major order

Fabrice Nicol fabrnicol at gmail.com
Tue Feb 8 17:52:58 AEDT 2022

As this did not seem to exist, I finally wrote the lib, called it 
array2d2 by analogy with array2d and uploaded to GitHub 

This is basically a fork of array2d, and acknowledged as such.

I tried to abide by copyright requirements, if anything went wrong 
there, I'll be grateful to the Mercury team for advice on how to put 
things straight.

In addition to array2d functions and predicates, I added a transpose 
utility, which I think was lacking in the original array2d library. This 
utility works for both array2d and array2d2 arrays.

I also added conversion functions (which transform array2d into array2d2 
and vice versa).

The rest is just a straightforward rewrite of array2d.


> Hi all,
> I was going to write a redesign of the array2d library module in 
> column-major order
> array2d is currently designed with data stored in row-major order, 
> this is not ideal for a fairly large class of applications (and beyond 
> a certain load, transposing becomes a performance issue).
> The coding is fairly straightforward as far as I can assess it 
> (overall, swap Column and Row variables in array2d code) but a bit 
> tedious.
> Would this happen to be openly available somewhere ready-made?
> Otherwise I'll proceed with the rewrite.
> Fabrice

More information about the users mailing list