Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- Matrix Rotation with MKL?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Randy_Clepper

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-04-2011
06:57 AM

85 Views

Matrix Rotation 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...

Link Copied

1 Reply

Alexander_K_Intel3

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-08-2011
01:35 AM

85 Views

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.