Exponential function in GNU multiple precision arithmetic library (GMP) - gmp

I would like to compute the exponential of a float in the GMP library. Namely, given
mpf_t x
I would like to compte exp(x). I could not find this function in the GMP documentation. Do you know how to do it?

Related

high precision calculation in numpy

How to perform high precision calculation in numpy?
By high precision I mean 100 precision in decimal.
Numpy doesn't have arbitrary floating-point precision. You'll want to use decimal from the standard library, or a third-party library like mpmath. Both of those libraries use C extensions for their internal calculations, so they should be fairly fast.

Is the Pearson correlation coefficient a suitable objective function for quadratic programming solvers?

Is the Pearson correlation coefficient -- with one vector, x, exogenous and another vector, y, as a choice variable -- a suitable quadratic objective function for quadratic programming solvers like Gurobi?
A quick Google search for "Gurobi objective function" shows that Gurobi has an API to set an objective function that accepts a linear or quadratic expression. That is quite expected because quadratic programming is, by definition, an optimization of a quadratic function, with the math behind the methods specifically designed for this class (like, working directly with the Q coefficient matrix and the c vector rather than the raw function).
I didn't look into details too much, but I can see that Pearson product-moment correlation coefficient appears to be not a quadratic but a rational function. So, if your specific case can't be simplified to that, no.
I cannot say anything about other solvers because each one is an independent product and has to be considered separately.
Since your function appears to be piecewise continuous and infinitely differentiable, you're probably interested in general-purpose gradient methods instead.

Solving one-zero linear programming

I have a model about one-zero linear programming, when I use AMPL, I declare variables as binary type, but when I solved it, my results have many numbers not is 0,1.
var X{1..7,1..21,1..4} binary;
I think the type of variable: integer, binary not doing in AMPL
When I solved it, my results such as: X[1,5,6]=0.55555.
You should use a mixed-integer programming solver such as CPLEX or Gurobi to get an integer solution. The default AMPL solver is MINOS which relaxes integrality and issues a warning such as:
MINOS 5.51: ignoring integrality of 10 variables

How do I print a half-precision float using printf in the AMD OpenCL SDK?

The Programming Guide has instructions for doubles (%ld) and vector types (e.g. %v4f), but not half-precision floats.
Normally in C, varargs arguments are automatically promoted to larger datatypes, such as float to double. The OpenCL documentation seems to imply that a similar promotion applies there.
Therefore a simple %f should work also for half-length floats.

Program in GMP Library

In Sage, there is a function 'append'. One example is as follows.
A=[]
for i in range(100):
if(i%2==0):
A.append(i)
In libgmp is there any such kind of function where I can store mpz_t values?
No. GMP just provides the primitives for mpz_t creation, deletion, and mathmatical operations. Support for data structures is provided by the language that is using libgmp. Sage uses Python as its language for gluing together other libraries and your example is just an example of Python code.