Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

c++ Project - where to start?

I'm new to this forum and have just "discovered" IMKL. Up to now I have only used eigen 3 ( ), which was really easy to handle, but because of performance issues I had to look for alternatives and I guess the IMKL is a very good library.

Unfortunately I didn't find much information in the manual of the IMKL on how to use it and I have some basic questions:
- I want to start simple, so I guess there is no "Matrix" Class or anything like that in IMKL, so I primarily just call functions - that's it?

- With what kind types do I have to call the IMKL functions - e.g. is a Matrix just a two-dimensional array?

- Can I perform basic math operations on my matrices like deleting rows/columns and so on?

- How are sparse matrices that are compatible to the IMKL defined and can you recommend me maybe a predefined class that I can use?

- Are there any basic c++ examples available? (Didn't find any myself)

Thanks for your help!
0 Kudos
3 Replies
Hi Matse,
For the moment, MKL is a library providing C/Fortran interfaces only. It means that you can call MKL functions from your C++ program, but MKL doesn't provide any classes to deal with matrices. Instead, it operates with data arrays which represents matrices and other input/output data.
If we talk about dense matrices - they are represented as one-dimensional array (pointer to float/doubles) which stores the matrix in column-major order (column-by-column in memory).
Re sparse matrices MKL provides a variety of standard sparse formats like CSR/CSC/COO etc.
For more details, please refer to online-documentation:
Hi Konstantin,
thanks for your helpfull reply!
I have just one more question: Do you know c++ libraries that performs just these basic actions (filling matrix, deleting rows / columns of the matrix) so that I can do the rest with MKL?
The thing is I didn't find such a class (couldn't believe it - this should definetly exist already...) and I don't want to write such a basic class if there exists already one that performs good. So do you know what people generally use for creating matrices when working with MKL from c++?
Thanks for your help,
Hello everybody,
I just want to make an addition to this thread just in case anybody has the same "question" and finds this thread.
So I've found a really great c++ library, called "Flens", you can find it here:
This is exactly what I was looking for, you can create simply (dense and sparse) matrices and it has a nice concept of "viewing" just single parts of a matrix, which is even better in my case then deleting rows / columns completely.
And the intention of the authors is to give a kind of interface to BLAS or MKL, so the matrix types are compatible with it. It even has an implementation of basic functions like vector / matrix multiplication, which calls BLAS/MKL functions under the hood. And you can compile flens directly against MKL so it uses MKL for these implemented functions.
Really great, I think that's a wonderful thing. The tutorial is really nice, the documentation is even better and it's *free* (as in freedom) ;), it's under BSD license.
So enough of this advertising now...