Turn on suggestions

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® Integrated Performance Primitives
- the best way to get a "normalized" 2D vector

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

eliosh

Beginner

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

05-11-2010
08:56 AM

87 Views

the best way to get a "normalized" 2D vector

I would like to speed up some MATLAB application by replacing a bottleneck section with a short C file.

At some stage I have to "normalize" a long complex array z. In MATLAB, complex array are kept as two separate arrays storing the real and imaginary parts. Hence, the problem is equivalent to computing a unit length 2D vector from an arbitrary length one.

Of course, it can be accomplished by the following simple code (MATLAB)

z_unit = z./abs(z);

This code is prone to problems when you get some zero vectors in your input. Hence, I use the following code

phase = angle(z);

z_unit = exp(i * phase);

which is quite slow.

I tried to replace the angle function with my own implementation (based on atan2 from IPP) which immediately provided some improvement, but the following exp() is still expensive to compute.

I noticed there are Cartesian->polar conversion functions, however their precision is questionable.

I tested 'phase' function which is faster than atan2 but its precision is worse.

Will be glad to get any advice here.

Thank you.

P.S.

Computing the absolute value abs(z) is also important.

Link Copied

1 Reply

Vladimir_Dudnik

Employee

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

05-13-2010
03:00 AM

87 Views

IPP vector math domain library contains some transcedental math functions with specified (means guaranteed)accuracy, please check if that will helpful in your case. You can check ippvm.h file and IPP documentation, volume 1, signal processing.

Regards,

Vladimir

Topic Options

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