Hi All,

My application is currently written in Matlab with few very specific and time consuming functions implemented as a MEX extensions in C++. I am thinking about switching to Julia or Python, and here is the problem: how to integrate C++ code with the high-level language like Julia. I presume that a complete example of integration would be interesting for many researchers who need ultimate performance but lack of understanding of low level details.

I would appreciate if somebody provided me with a sample C++ code that implements the following typical scenario:

- Suppose an algorithm is implemented as a function within a shared or static library complied with Julia specific settings and headers (example?).
- The function takes
**dense**and**sparse**matrices as an input and returns the result in, say, a dense matrix. - The function should be able to get matrix sizes and reallocate the output matrix if necessary.
- The function is supposed to be invoked many times and should be able to overwrite the elements of the external, persistent output matrix directly (once it has a correct size) rather than returning a temporary matrix, in order to void extra reallocations.

The most interesting point is how to traverse the elements of Julia dense and sparse matrices.

The sample code could implement a dense matrix times sparse matrix multiplication, for example.

Say, KxM dense matrix times MxN sparse matrix assuming column major layout.

Thank you in advance.