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

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

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

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.

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

blitz++ (open source)

ArBB (proprietary)

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

.....

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

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);

`rand(n)`returns an

`n`-by-

`n`matrix containing pseudorandom values drawn from the standard uniform distribution on the open interval (0,1) (this from Matlab docs) -> so you can easily find counterpart in MKL.

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

`A`and

`B`.

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.

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

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.

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