0

I want to learn how to do high precision calculations of a (Matlab) function in C++ via mex files – how to define new types if required, and what requirements / installations / makes I need. I am pretty new (again) to C++ and have Windows 7 and g++ / Microsoft SDK 7.1 as C++ compiler, and also Visual Studio 2013.

In detail: In my Matlab code, I want to run a function f, which takes several parameters and arrays as arguments and returns a scalar, for speed in C++ via mex files, and for accuracy with high precision, that is, more than “double”, so up to 50 (enough for now, later maybe up to 80) significant decimal digits. The function f finds the root of another function g, where g finds the roots of a fourth-order polynomial (which are known to be real), does some basic computations (exp, power, mult., div.) with them, and is known to be numerically unstable if not being used with high precision.

I managed to run it through mex files in C++ with “standard” precision. Now, which library or tool could I use to run in C++ - or is it possible without any further tool – and how do I define a new type and how in mex…

I tried gmp but do not see how to install it on Windows (from the manual). Can you show me (best would be instructions) how to?

Futurist
  • 75
  • 1
  • 8
  • GMP would allow you to use higher precision in your calculation, but the in- and output arguments for the calculation are still double precision. Is this sufficient? – Daniel May 31 '15 at 13:03
  • Yes, that is (to my best knowledge) sufficient. – Futurist Jun 01 '15 at 09:32
  • If you don't get gmp working, try some alternative which comes with a documentation for windows. MPIR is one of these alternatives. – Daniel Jun 01 '15 at 09:39
  • For installation of GMP I tried: [https://gmplib.org/list-archives/gmp-discuss/2012-July/005089.html] but upon the configure command the shell always reports "checking [various things...]... checking compiler gcc -02 -pedantic -fomit-frame-pointer -m64 ... no" with gcc also replaced by cc and with other flags, in about 20 statements, and exits with error. But I do have gcc...??? – Futurist Jun 01 '15 at 09:46
  • To complete: The compiler (linker? builder?) exits with "Could not find a working compiler." But I am pretty sure to have gcc (at least g++) - how do I find it and how to put it / what to tell the builder that it compiles? – Futurist Jun 01 '15 at 09:53

0 Answers0