transpose_blocks#

caput.util.mpitools.transpose_blocks(row_array: numpy.typing.NDArray, shape: collections.abc.Sequence[int], comm: mpi4py.MPI.Comm | None = _comm) numpy.ndarray[source]#

Swap 2D matrix split from row-wise to columnwise.

Take a 2D matrix which is split between processes row-wise and split it column wise between processes.

Parameters:
row_arrayarray_like

The local section of the global array (split row wise).

shapeSequence[int]

The shape of the global array

commMPI.Comm | None, optional

MPI communicator that array is distributed over. Default is MPI.COMM_WORLD.

Returns:
transposedndarray

Local section of the global array (split column wise).