How to write GMM (Gaussian Mixture Model) in C? - 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

Related

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.

Do dictionaries exist in C?

In C, can you create a dictionary? I come from a Objective-C background so I would like to know if there is anything similar to NSDictionary.
You can create anything you want in C. You just won't have native language support for most of it.
You can create a dictionary in C, but there is no dictionary built in to the standard C library.
A quick search on Google code shows that there are open-source (and generously licensed) C dictionary implementations here and here.
Posix does have a limited hash table -- see hcreate(), hsearch() and hdestroy() that can be used by a C program.
A discussion of the limitations appears in this stackoverflow question.
Without OOP and templates, it would be hard to implement a hash table or a balanced tree that is truly general, easy to use and performant, and therefore worthy to be in the run-time library that comes with the language.
That being said, you can always implement your own, or just use C++ (see unordered_map or map).

HAT-trie in ANSI C implementation?

I am looking for ANSI C HAT-trie implementation released under some free license. I have not found one. Can you point me to some standalone implementation or a program that uses
HAT-tries to get at least slight idea how to implement it the roght way, please?
The original paper on HAT-trie can be found here:
http://crpit.com/confpapers/CRPITV62Askitis.pdf
PS: In case faster cache-conscious data structured well-suited for strings evolved since
the time the above paper was written, please point me to the papers or example source codes rather.
Someone is implementing it in C++ over on github
https://github.com/chris-vaszauskas/hat-trie
If you need a plain C implementation, this would be a good base to start from.
Java is also fairly readable for a C programmer
http://www.stochasticgeometry.ie/2008/05/06/implementing-hat-tries-in-java/
Please see the HAT-trie implementation site at code.google.com/p/hat-trie for implementation notes and source code.

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

Recursive Descent Parser for C

I'm looking for a parser for C. Here is what I need:
Written in C (not C++).
Handwritten (not generated).
BSD or similarly permissive license.
Capable of nontrivially parsing itself (can be a subset of C).
It can be part of a project as long as it's decoupled so that I can pull out the parser.
Is there an existing parser that fulfills these requirements?
If you don't need C99, then lcc is a slam dunk:
It is documented in a very clear, well-written book.
Techniques used for recursive-descent parsing of operators with precedence are well documented in an article and technical report by Dave Hanson.
Clear, handwritten ANSI C code.
One potential downside is that the lcc parser does not build an abstract-syntax treeā€”it goes straight from parsing to intermediate code.
If you must have C99 then I think tinycc (tcc) is your best bet.
How about Sparse?
You could try TCC. It's licensed under the Lesser GPL.
It seems that nwcc sufficiently agrees with your requirements.
Good c compiler is present at this location. Simple and accessible.
https://github.com/rui314/8cc
GCC has one in gcc/c-parser.c.
Check elsa, it uses the Generalized LR algorithm.
Its main use is for C++, but it also parses C code.
Check on its page, on the section called "How much C can Elsa parse?" which says it can parse most C programs, including the Linux kernel.
It's released under a BSD license.
Here is a recursive descent parser I ported to C:
http://www.gabotronics.com/resources/recursive-descent-parser.htm

Resources