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
- MATLAB element-wise product

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

bcor

Beginner

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

02-28-2011
04:55 AM

122 Views

MATLAB element-wise product

first, i am a newbie here, therefore sorry for any inconvenient or inappropriate content of this message.

i am trying to convert some matlab+simulink program to c++ and searching for the functions coming with MATLAB in MKL.

my project uses matrices and i couldnt find how to convert the following expression from matlab:

"A=rand(10);

B=rand(10);

C= A.*B;"

is this a special matlab function or is there an implementation for this in mkl?

i have the same problem also with the function/block in simulink; "weighted moving average"

i searched the documents and the forum, but couldnt find information.

would be pleased to solve

thanks in advance

Link Copied

4 Replies

mecej4

Black Belt

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

02-28-2011
06:12 AM

122 Views

Fortran is endowed with few standard procedures for mathematical tasks, but has the features needed to build such procedures into, e.g., a library such as MKL. You will have to look in the MKL documentation MKL and find routines which when assembled together will fulfil your needs.

Matlab is proprietary, whereas C and Fortran are covered by international standards.

TimP

Black Belt

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

02-28-2011
06:36 AM

122 Views

blitz++ (open source)

ArBB (proprietary)

C interface to MKL Fortran style functions (both open source and proprietary optimized versions)

.....

ArturGuzik

Valued Contributor I

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

02-28-2011
07:45 PM

122 Views

apart from options mentioned so far, you can also try to use Python (numpy lib) and its implementation which uses MKL for high efficiency (not quite sure why you convert the code, speed? avoiding Matlab?). Everything depends on your experience and how big the code is.

And for the record:

A=rand(10);

B=rand(10);

C= A.*B is element wise (is the element-by-element) product of the arrays

As far as "weighted moving average" routine goes. The easiest way is just to open matlab *.m or Octave file containing the code and see how they implement it (at the end of the day is just multiplication and summation).

A.

bcor

Beginner

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

03-01-2011
12:40 AM

122 Views

i created a project using matlab+simulink, and now the second part of it is to write it on C++ using ms visual studio 2008. Therefore, although there is nothing to do with speed or convenience, i just have to convert it.

Beside, doing this i want to use already validaded and verified libraries. Thats why i hesitate implementing the functions on my own.

There are some other libraries (blitz, lapack++ etc..) which can use MKL behind, and have the the same syntax with matlab. At first i didnt want to use many different libraries, make it complex and had questions about the performance. But now i think i should use them.

i have also heard about armadillo and boost. Maybe i should test them all initially then choose the best performance+convenient syntax.

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