At the outset you should recognize that Matlab is an interpreted language with an emphasis on matrix manipulation, whereas Fortran (in which Lapack was written) and C++ are compiled languages. Compiled languages have far fewer verbs (or primitives, if you prefer) than interpreted languages. Any urge to wish that one were more like the other is, therefore, misguided unless one already has much experience with the former.
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.
As mecej4 implies, Fortran has built-in array operations which may resemble matlab, but C++ itself does not. There are C++ class implementations which address this, but you have the (big) initial step of deciding whether you like one or more of those: blitz++ (open source) ArBB (proprietary) C interface to MKL Fortran style functions (both open source and proprietary optimized versions) .....
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:
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).
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.