Complex Digamma Function - c++

Do you know a c++ library where the Digamma Function (http://en.wikipedia.org/wiki/Digamma_function) is implemented with complex arguments?

I did not find a library, but google found this for me:
GammaFunctions.c++
However I did not check the validity of this code.

Try one of these:
GSL - GNU Scientific Library contains gsl_sf_complex_psi_e.
http://www.ensta-paristech.fr/~lunevill/doc_melina++_v039/src/special_functions/GammaFunctions.c++.html
http://www.mathworks.com/matlabcentral/fileexchange/978-special-functions-math-library/content/psi.m - You'll need to convert this to C++.
http://www.netlib.no/netlib/slatec/fnlib/cpsi.f - You'll need to convert this to C++.

Related

How to find a pointer to a function by string

I have a list of functions in a text file that I'd like to expose to LLVM for its execution engine at run time, I'm wondering if its possible to find pointers to the functions at runtime rather than hard code in all the GlobalMappings by hand as I'd probably like to add in more later. For example:
// File: InternalFunctions.txt
PushScreen
PopScreen
TopScreen
// File: ExposeEngine.cpp
// Somehow figure out the address of the function specified in a string
void* addy = magicAddress("PushScreen");
jit->addGlobalMapping(llvmfunction, addy);
If this is possible I love to know how to do it, as I am trying to write my game engine by jit-ing c++. I was able to create some results earlier, but I had to hard-code in the mappings. I noticed that Gtk uses something along the lines of what I'm asking. When you use glade and provide a signal handler, the program you build in c will automatically find the function in your executable referenced by the string provided in the glade file. If getting results requires me to look into this Gtk thing I'd be more than happy to, but I don't know what feature or part of the api deals with that - I've already tried to look it up. I'd love to hear suggestions or advice.
Yes, you can do this. Look at the man pages for dlopen() and dlsym(): these functions are standard on *nix systems and let you look up symbols (functions or variables) by name. There is one significant issue, which is that C++ function names are usually "mangled" to encode type information. A typical way around this is to define a set of wrapper functions in an extern "C" {} block: these will be non-member, C-style functions which can then call into your C++ code. Their names will not be mangled, making them easy to look up using dlsym().
This is a pretty standard way that some plugin architectures work. Or at least used to work, before everyone started using interpreted languages!

Pass complex numbers to and from a DLL in LabVIEW

I am trying to interface this C++ code -- which implements functions necessary to calculate a Voigt line shape -- with LabVIEW (I'm currently running LV2009). I successfully compiled the code into a DLL, and I set up the Call Library Function Node to point to the DLL. However, the function expects a vector of type complex double and returns a vector of type complex double. Complex double is not, however, one of my choices for data type when setting up the function prototype.
Unfortunately, I do not speak C/C++, so I don't have any idea how I would go about modifying the code to get and return real doubles only. I have compiled the code into a MEX file to use with MATLAB, and pass complex numbers in and out with no problem, so I know the code works.
Is there a way to trick LabVIEW 2009 into passing complex numbers in and out of DLL functions? If not, will I gain this ability if I upgrade to the newest release? If not, is there a good basic guide to C++ that will teach me how to modify the function to accept and return the real and imaginary parts as separate vectors?
LabVIEW doesn't allow interfacing with C++ code, only C (or if it's C++, it has to have the extern "C" declaration and use Plain Old Types).
I see that your library has C wrappers, but they use the new C99 complex type, which LabVIEW doesn't understand.
However LabVIEW can pass complex data type to a function, to see how it's done open the example named "Call DLL.vi" and select complex data-type to see function prototype and VI. Your chance might be that the C99 complex has the same binary representation than the LabVIEW one. I didn't dig for the info, but it might be very possible.
If it's the case, go to church and be grateful to your Lord, and use the C wrapper to interface to it.
If it's not, find a tutorial about making a DLL for your compiler, it's not difficult, just takes time. The DLL will take two double for each complex, and make the appropriate call to the real function.

C++ library - Using Quadprog++ and Array.hh

I'm trying to use the Quadprog++ library (http://quadprog.sourceforge.net/) but there is no documentation about it. In particular I'm trying to do the exponential of a matrix with the function of Array.hh (http://bit.ly/Za0k1J) but I have no idea how to write it. I thought to write in this way:
Matrix<double> A;
A.resize(4,4);
A=A^2;
But it doesn't work.
Thanks a lot for the help!

in-built C++ function that makes case insensitive comparision of two strings

Is there any in-built function in C++ library that is able to make case insensitive comparision of two strings ? I am aware of simple approaches like using toupper/tolower,writing function ourselves.I want to know if there is anything in string.h library or other which is able to meet above objective.Here,
strcasecmp of C don't support strings,so not much of help in C++.It only works with char *.
Any help would be very thankful.
P.S. Boost libraries won't be of much help.
Thanks.
If you are willing to call strcasecmp, then you can call it in C++ too:
int cmp_result = strcasecmp(s1.c_str(), s2.c_str());
There is none. C++ does not provide any meaningful textual support beyond simply storing it. You will have to look to ICU.

What bignum libraries work with D?

I'm in need of a bignum library for representing large integers. What options do I have with the D programming language? Are there, for instance, GMP bindings?
Update:
I'm trying to use the inbuilt BigInt as described below but it appears it's not available with the GDC.
import std.bigint;
import std.stdio;
void main()
{
BigInt n = "123";
writefln(n);
}
When I try to compile this code with gdc main.d I'm told it can't find bigint.d. Does gdc only implement some of the library or am I doing something wrong?
If what you're looking for is a big integer type, then there's BigInt in the standard library. On the other hand, if you're specifically looking to use GMP, then all you have to do is have extern(C) declarations for the appropriate types and functions in GMP that you need, and you can call them directly from D. Check out out this page for more details on how to use C code in D.
Paul Anderson is working on a BigFloat abstraction for the standard library.