PDA

View Full Version : Is it possible to use QTransform for TOMS transpose?



lni
26th March 2009, 00:23
Hi,

I have a float array representing an M x N matrix,
array[0, 1, 2, ..., N x M]

I need to do an in-place (or in-situ) transpose so the new float (or double) array become an N x M matrix, as described here: http://en.wikipedia.org/wiki/In-place_matrix_transposition

I am wondering if QTransform::rotate( 90 ) can be used here, and if so, how fast will it be?

I am thinking of this:

float (or double) array[ MxN ]

QImage image ( (const uchar *)array, N, M, QImage::Format_RGB32 )
QTransform xf;
xf.rotate( 90 );
image = image.transformed( xf );

After that, the array will be an NxM matrix?

However, does image.transformed( xf ) perform in-place transpose? My MxN array can be as big as 30 GB in size, if making a new copy of the data, I won't be thinking of QTransform.

There are some C/Fortran codes available, but I really prefer Qt if it can do it...

Thanks.

lni
26th March 2009, 03:19
Never mind, I will just use the C codes

wysota
26th March 2009, 07:53
Rotation and transposition are not the same. With transposition the top-left cell remains top-left after being transposed, with rotation it becomes the top-right cell.

But regardless of that the answer would still be "no". rotate() doesn't rotate the matrix, it modifies the matrix so that it can serve as a rotation transformation.