Works properly with transposed A without MPI.
Works properly with transposed matrices and MPI.

Many thanks to @josecriane for helping me understanding my code.