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

const correctness

Fabian_K
Beginner
369 Views
Hi,

I wrote a modular PDE-solver in C++ which makes heavy use of PARDISO and CRS-matrix-vector-multiplication. Everything works fine so far and PARDISO is really a great solver for a huge class of PDEs. The declaration for the multiplication-subroutine in the MKL is as follow
[cpp]void mkl_dcsrgemv(char *transa, int *m, double *a, int *ia, int *ja, double *x, double *y);
[/cpp]
Although nothing is affected by calling mkl_dsrgemv except *y, there are no const modifiers. A better declaration should be like
[cpp]void mkl_dcsrgemv(char *transa, int *m, const double *a, const int *ia, const int *ja, const double *x, double *y);
[/cpp]
This would allow better and more correct coding, since there is no need to const-cast-away modifiers or declare friend classes. Debugging or proving correctness of code could be more easier. Same for the PARDISO-Interface, of course.

Anyway, thanks for the nice tools!
Fabian
0 Kudos
0 Replies
Reply