Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
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 2 years ago.
Improve this question
I want to implement the Bessel functions of first and second kindDescription of bessel functions for complex numbers in C++. Now I am looking for possibilities to introduce them in my source code. Since math.h only contains bessel functions for real numbers, I would be interested in seeing any kind of possibility.
I haven't found that Boost is compatible with complex arguments (though it may a mistake on my part).
The FORTRAN code developed by D.E. Amos (the code used by MATLAB and others) is in the public domain and can be used by anybody. I have been developing a C++ interface to the library, extending it to the case of negative orders. You can check it out on GitHub.
The Boost library implements ordinary Bessel functions of the first and second kind and modified Bessel functions of the first and second kind for both real and complex numbers (see documentation about Bessel functions).
Don't try to reinvent the wheel, just use the Boost implementation which is far superior to anything you could write yourself.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
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 10 months ago.
Improve this question
I am trying to implement scipy.signal.filtfilt function in c++ and I am wondering if there is already an implementation available of this?
I know its a long time. but maybe you find this repository useful:
FiltFilt in C++
filtfilt applies an IIR filter twice, once going forward, once going backward. The nontrivial part is how to initialize the IIR filter at the boundaries.
As a starting point, look at how scipy.signal.filtfilt does it. Here is the code:
https://github.com/scipy/scipy/blob/master/scipy/signal/signaltools.py#L3870
You might also find it useful to look at the source code for Octave's filtfilt (M code):
https://sourceforge.net/p/octave/signal/ci/default/tree/inst/filtfilt.m
To reproduce filtfilt in C++, you need a C++ implementation of IIR filtering to take the role of scipy's lfilter plus some boundary handling logic. I don't know about an existing C++ implementation of filtfilt, but at least for the default method='pad' logic, the core computation seems simple enough to consider porting directly.
Scipy's filtfilt is similar to Matlab's filtfilt.
A question for MATLAB's filtfilt was previously asked
An implementation for the same was previously shared on Stackoverflow by #darien-pardinas
Do note I say similar because as mentioned by #paco-wong
The difference is in the default padding length. In matlab's filtfilt, it is 3*(max(len(a), len(b)) - 1), and in scipy's filtfilt, it is 3*max(len(a), len(b)).
So you will have to account for that
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
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 7 years ago.
Improve this question
Is there an implementation callable from C or C++ that allows the evaluation of the generalized hypergeometric function pFq(a1,...,ap; b1,...,bp; x)?
I tried GSL and Boost, but I don't think the generalized function is available in either of those libraries.
I believe the Arb library, a C library for arbitrary-precision floating-point ball arithmetic developed by the creator of mpmath, now provides an implementation.
I would suggest using this python library for the functions you need. It seems like it has it.
The trick however is you need to be able to call a python script from C++. For that you can use a boost component.
This seems like the easiest solution, even if it is possibly inefficient.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
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 7 years ago.
Improve this question
I cannot use gsl_matrix because my app is closed source and, according to this question, if I used GPL code directly, I'd have to make my app open source. And that's a no-no from the higher ups.
So... Does Boost, or even better, TR1, have a library with classes equivalent to gsl_matrix, gsl_vector and other types from the GNU Scientific Library? If there are such classes, how are they called?
Edit: I need to:
Perform dense matrix-vector products and sums (like gsl_blas_dgemv and gsl_blas_dgemm do)
Optionally, solve quadratic programming models.
First of all, there is C interface for BLAS/LAPACK. Some people find it 'hard' to deal with the call signatures which directly mirror the original BLAS ones.
If you're more into fancier side of things, there's Boost uBLAS interface, there's Armadillo, to name just two. Performance-wise, your mileage may vary.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
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 8 years ago.
Improve this question
I am looking for a C++ library, and I am dealing with convex objective and constraint functions.
I am guessing your problem is non-linear. Where i work, we use SNOPT, Ipopt and another proprietary solver (not for sale). We have also tried and heard good things about Knitro.
As long as your problem is convex, all these solvers work well.
They all have their own API, but they all ask for the same information : values, first and second derivatives.
Assuming your problems are nonlinear, you can use free and open-sourced OPT++, available from Sandia Lab. I have used it in one project in C++ and it was easy to use and worked well.
From what I know, the CPLEX solver is the best convex optimization solver. Its the state of the art in LP solvers. Does convex optimization really well. While looking for it, I see that its IBM's software now. You can find it here : http://www-01.ibm.com/software/integration/optimization/cplex/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
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 7 years ago.
Improve this question
Can anyone point out a good C++ library that can do 2D numerical integration. It needs to be able to accept a 2D array of known values, and the spacing between the points can be assumed to be constant (for a start).
It is preferable that it have a license which allows modifying the code as needed.
It's actually a C library, but if the GPL licensing terms work for you try:
http://www.gnu.org/software/gsl/
You will want to check out the Monte Carlo integration options outlined here:
http://www.gnu.org/software/gsl/manual/html_node/Monte-Carlo-Integration.html
This Fortran library is easy to link to from C++ and is in public domain:
http://gams.nist.gov/cgi-bin/serve.cgi/Module/CMLIB/ADAPT/2967
It's single precision but it's quite easy to modify the sources (get "full sources" and go through every function) to switch to double precision.
http://itpp.sourceforge.net/current/
Try this. It can do what you ask for and more! And you can modify the code as much as you like.
I've read somewhere that you can extract libraries out of GNU Octave's code and use the C++ code in your own applications. I'm not sure if that's an easy task, but you can give it a try if you have the time.