- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi, all

I am working on my C++ project, in which SVD (mainly use zgesvd) is one key step. Intel oneAPI provides great SVD functions with high precision and processing speed.

But I feel comfused cause I do not finger out the difference between the two C interface called **LAKPCE_zgesvd** and **zgesvd**, both provided correct results.

So please anyone can explain **the difference between the two fuctions**, and the best scenario for each function interface call? Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi LinkDeng,

Thanks for posting in Intel communities.

Intel oneAPI provides great SVD functions with high precision and processing speed.

>> Thank you for the positive feedback!!!

Regarding the query about the significance of the routines mentioned by you, you could refer to the below description. You could see, that the implementations of the routines were a bit different considering matrix layouts, etc., and the corresponding interface being used.

1. zgesvd: This is the standard LAPACK function which corresponds to the Fortran interface implementation of c code.

You could refer to the zgesvd.c source code under the MKL_examples path below.

<MKL path>\2023.2.0\examples\examples_core_c.zip\c\lapack\source

2. LAKPCE_zgesvd: LAPACKE is a C interface to LAPACK, allowing users to call LAPACK routines from C/C++ code. LAPACKE_zgesvd is a C wrapper function for zgesvd. It provides an interface that is more accessible and convenient for C and C++ programmers.

The C interfaces are implemented for most of the Intel oneAPI Math Kernel Library (oneMKL) LAPACK driver and computational routines.

In contrast to the Fortran interface, the LAPACK C interface omits workspace parameters because workspace is allocated during runtime and released upon completion of the function operation.

Intel® oneAPI Math Kernel Library (oneMKL) supports four distinct floating-point precisions. Each corresponding prototype looks similar, usually differing only in the data type. C interface LAPACK function names follow the form<?><name>[_64], where <?> is:

LAPACKE_s for float

LAPACKE_d for double

LAPACKE_c for lapack_complex_float

LAPACKE_z for lapack_complex_double

You could refer to the lapacke_zgesvd_col.c or lapacke_zgesvd_row.c source codes under the MKL_examples path below.

<MKL path>\2023.2.0\examples\examples_core_c.zip\c\lapack\source

In addition, you could go through the below link for more details regarding the syntax, description, parameters etc. regarding the API.

https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2023-2/gesvd.htmlt

C convention LAPACK_DECL: mkl_lapacke.h

lapack_int LAPACKE_zgesvd( int matrix_layout, char jobu, char jobvt,

lapack_int m, lapack_int n, lapack_complex_double* a,

lapack_int lda, double* s, lapack_complex_double* u,

lapack_int ldu, lapack_complex_double* vt,

lapack_int ldvt, double* superb );

Fortran convention zgesvd declaration: mkl_lapack.h

void zgesvd( const char* jobu, const char* jobvt, const MKL_INT* m,

const MKL_INT* n, MKL_Complex16* a, const MKL_INT* lda, double* s,

MKL_Complex16* u, const MKL_INT* ldu, MKL_Complex16* vt,

const MKL_INT* ldvt, MKL_Complex16* work, const MKL_INT* lwork,

double* rwork, MKL_INT* info ) NOTHROW;

In addition to all the information mentioned above, you could go through the below link for more details on C and Fortran interfaces.

Best Regards,

Shanmukh.SS

Link Copied

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi LinkDeng,

Thanks for posting in Intel communities.

Intel oneAPI provides great SVD functions with high precision and processing speed.

>> Thank you for the positive feedback!!!

Regarding the query about the significance of the routines mentioned by you, you could refer to the below description. You could see, that the implementations of the routines were a bit different considering matrix layouts, etc., and the corresponding interface being used.

1. zgesvd: This is the standard LAPACK function which corresponds to the Fortran interface implementation of c code.

You could refer to the zgesvd.c source code under the MKL_examples path below.

<MKL path>\2023.2.0\examples\examples_core_c.zip\c\lapack\source

2. LAKPCE_zgesvd: LAPACKE is a C interface to LAPACK, allowing users to call LAPACK routines from C/C++ code. LAPACKE_zgesvd is a C wrapper function for zgesvd. It provides an interface that is more accessible and convenient for C and C++ programmers.

The C interfaces are implemented for most of the Intel oneAPI Math Kernel Library (oneMKL) LAPACK driver and computational routines.

In contrast to the Fortran interface, the LAPACK C interface omits workspace parameters because workspace is allocated during runtime and released upon completion of the function operation.

Intel® oneAPI Math Kernel Library (oneMKL) supports four distinct floating-point precisions. Each corresponding prototype looks similar, usually differing only in the data type. C interface LAPACK function names follow the form<?><name>[_64], where <?> is:

LAPACKE_s for float

LAPACKE_d for double

LAPACKE_c for lapack_complex_float

LAPACKE_z for lapack_complex_double

You could refer to the lapacke_zgesvd_col.c or lapacke_zgesvd_row.c source codes under the MKL_examples path below.

<MKL path>\2023.2.0\examples\examples_core_c.zip\c\lapack\source

In addition, you could go through the below link for more details regarding the syntax, description, parameters etc. regarding the API.

https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2023-2/gesvd.htmlt

C convention LAPACK_DECL: mkl_lapacke.h

lapack_int LAPACKE_zgesvd( int matrix_layout, char jobu, char jobvt,

lapack_int m, lapack_int n, lapack_complex_double* a,

lapack_int lda, double* s, lapack_complex_double* u,

lapack_int ldu, lapack_complex_double* vt,

lapack_int ldvt, double* superb );

Fortran convention zgesvd declaration: mkl_lapack.h

void zgesvd( const char* jobu, const char* jobvt, const MKL_INT* m,

const MKL_INT* n, MKL_Complex16* a, const MKL_INT* lda, double* s,

MKL_Complex16* u, const MKL_INT* ldu, MKL_Complex16* vt,

const MKL_INT* ldvt, MKL_Complex16* work, const MKL_INT* lwork,

double* rwork, MKL_INT* info ) NOTHROW;

In addition to all the information mentioned above, you could go through the below link for more details on C and Fortran interfaces.

Best Regards,

Shanmukh.SS

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thanks for your detailed reply, which answered my question very well.

Best regards,

Deng

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi LinkDeng,

It’s great to know that the issue has been resolved, in case you run into any other issues please feel free to create a new thread.

Best Regards,

Shanmukh.SS

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page