08-04-2011 06:57 AM
Is this possible with MKL?
I want to rotate a matrix about its center by an arbitrary angle. However, it cannot resize the destination matrix, meaning it should clip and spots in the destination may be blank.
I have this algorithm in use employing TBB. But, I'm not doing an elegant job of optimizing - to the point where I'm hoping MKL can do the job for me. If there is no such thing - I'm going to start playing with Tiling sizes and loop unrolling in hopes of getting better performance out of my current implementation.
//- sina = sin of angle
//- cosa = cos of angle
void operator() ( const tbb::blocked_range2d
r ) const
for ( size_t row = r.rows().begin(); row != r.rows().end(); ++row )
const size_t colBegin = r.cols().begin();
xOffset = -(row * sina) + xHelper + (cosa * colBegin);
yOffset = (row * cosa) + yHelper + (sina * colBegin);
lineOffset = ( row * rowSpan ); //- all col values are offsets of this row
for( size_t col = colBegin; col != r.cols().end(); ++col, xOffset += cosa, yOffset += sina )
srcX = xOffset;
srcY = yOffset;
if( srcX >= 0 && srcX < colSpan && srcY >= 0 && srcY < rowSpan )
destData[col + lineOffset] = srcData[srcX + ( srcY * rowSpan )];
Is this possibly a givens rotation? I'm reading about it, but I'm not sure how to do the equivalent thing in MKL should it be that!
P.S. I've asked this on StackOverflow as well, with perhaps more information about the issue:http://stackoverflow.com/questions/6942909/optimized-matrix-rotation-arbitrary-angle-about-center-of...