L1 constrained Regression in C - c

I need Lasso/L1 constrained Regression Library in C. AFAIK, NAG does not support it. R has a package to do it but I need to do it in C. Any idea?

You could embed R in your application.

Coding l1 stuff yourself should not be too bad. Both ftp://ftp.math.ucla.edu/pub/camreport/cam08-37.pdf and ftp://ftp.math.ucla.edu/pub/camreport/cam08-29.pdf are easy to implement.
If you can use C++ this library might already have what you want:
http://www.di.ens.fr/willow/SPAMS/index.html

Thanks. I wrote my own C function and it worked well.

Related

How to write GMM (Gaussian Mixture Model) in C?

How can I write GMM (Gaussian Mixture Model) in C. There are some implementations in Matlab but I am looking for some documentation about it and example code in C not in C++.
OpenCV has an implementation of a GMM that is used for their GrabCut implementation.
You can find it for example here.
edit: I just noticed you were looking for an implementation in C. The OpenCV implementation is using C++. But maybe you can use it as a starting point.
Here you can find an implementation in C:
https://engineering.purdue.edu/~bouman/software/cluster/
How about the mixture model in Apophenia?
There is a GMM implementation available in vlfeat, a C library for computer vision. https://www.vlfeat.org/api/gmm.html

is it possible to use Eigen with c?

I don't know very much about template programming, and I currently use gsl. I'm interested in seeing if Eigen can be use in C. Has anybody used Eigen in C before? Is there something I can test to find out if it will be easy?
Since Eigen is a C++ template library, it cannot be directly used with C.
Hypothetically, one could wrap the C++ templates into a C API, and use that. However, that's bound to involve a lot of work and would strike me as a bit pointless (one might as well use existing C libraries for linear algebra).
AFAIK, Eigen is a template-only library. C doesn't support templates. So without writing a bunch of wrapper functions that expose a C-style interface, no.

Uniroot function in C

In a C program that gets called from within R, I need to use the 'uniroot' function of R. One way to do this is to invoke R again from C with the 'call_R' function. I am wondering if there is a better way ? Is there a function in 'Rmath.h'to do this ?
As per ?uniroot, the R function is basically a wrapper around some freely available C source code for implementing Richard Brent's root finding algorithm -- it even gives the link. So if you're already programming in C, you don't need to touch R at all for this.
The Rmath library provides a number statistical distribution functions, but no access to R itself.
What you want amounts to embedding R in your C program, which is doable but a little tedious. If you are to C++, you could look at my RInside which makes this pretty painless via C++. It comes with a fairly decent number of examples.

Singular Value Decomposition simple code in c

I am looking for Singular Value Decomposition (SVD) code in C, would you please help me?
I found many sources but I cannot run them, I am looking for a version of SVD code that provide all 3 matrix of S, V and U for me.
You can use the Numerical recipies code for that
svdcmp.c reference. Actually in my case I found more accurate the openCV one, but both work fine.
Use one of the libraries listed at the Wiki page: comparison of linear algebra libraries. Look under the "SVD" column to make sure algorithm is supported (even vast majority of the libraries do support SVD).
Don't write it yourself, don't deal with trying to build someone else's source. Use a library that provides this function for you. There's probably already one available on your target platform.
Specifically, use the industry-standard LAPACK library or use the GSL or whatever other linear algebra library you want. They all have an SVD implementation.

Triple DES algorithm in C?

Does anyone have code snippet for Triple DES algorithm in C ?
Thanks
OpenSSL is written in C and provides a 3DES algorithm. It may not be as simple as some of the other suggestions, but it may be worth checking out.
Check out the Crypto++ library, they implement tons of algorithms including DES.
libtomcrypt is a comprehensive crypto lib written in C, with a 3DES implementation.
Here's a simple implementation in C & C++. Possibly simpler to use than libtomcrypt.
http://www.codeguru.com/cpp/misc/misc/cryptoapi/article.php/c8195

Resources