Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Matrix Rotation with MKL?

Randy_Clepper
Beginner
171 Views
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.
Current implementation:
//- sina = sin of angle
//- cosa = cos of angle
void operator() ( const tbb::blocked_range2d r ) const
{
double xOffset;
double yOffset;
int lineOffset;
int srcX;
int srcY;
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!
Thanks!
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...
0 Kudos
1 Reply
Alexander_K_Intel3
171 Views
Hello,

This is Image Rotation. You could find the functionality in Intel IPP: function Rotateand example of it's usage.

Best regards,
Alexander.
Reply