MATLAB code library for C++ [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this questionAre there any good sources containg C++ versions of MATLAB functions? I am only looking for some basic 开发者_如何学编程functions i.e. fzero.
fzero
is non trivial.
If your function is polynomial, try GSL http://www.gnu.org/software/gsl/
Try looking at GNU Octave. It's a FLOSS alternative to MATLAB and has a lot of the same functionality. Take a look at its implementation of fzero
, keeping in mind that the code is GPL'ed.
I do a lot of work in C++ for science and engineering applications. One of my favorite references is Numerical Recipes nr.com. Some of the older versions of the book included code that looked like Fortran but was written in C, for example indexes of arrays started at 1. The latest version from 2007 (C++ only 3rd edition) corrected many of the complaints like 1 indexed arrays and confusing namespace. Even if you don’t like the code the simple explanations of the math make the book worth buying. Be warned some people consider the license for the code harsh but compared to Matlab it is a giant leap forward. Other things to try is GSL and Intel Math Kernel Lib. Good luck.
Check out the embedded matlab subset. It allows you to convert matlab scripts into C code. I use it to make libraries out of matlab functions which I link to form C++ projects. It only supports a subset of functions, but fzero is included in the list with some limitations . . .
http://www.mathworks.com/help/toolbox/eml/ug/bq1h2z7-9.html
This allows you to do all of your algorithmic development in the warm and cozy Matlab environment. Matlab will even build the C library. All you have to do is link to it. This is WAY easier than learning a bunch of C++ numerical libraries if you're already familiar with Matlab.
I don't think it contains an fzero equivalent, but Armadillo does have many C++ versions of MATLAB functions (so may do for some instances). See, for example, this conversion table.
精彩评论