Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28385 Discussions

Why does the same function have multiple different function?

Hongyizhao
Beginner
389 Views

Say, for the function ssyevd, there are the following calling methods based on the document here:

Syntax
 call ssyevd(jobz, uplo, n, a, lda, w, work, lwork, iwork, liwork, info)
 call dsyevd(jobz, uplo, n, a, lda, w, work, lwork, iwork, liwork, info)
 call syevd(a, w [,jobz] [,uplo] [,info])

As you can see, there are multiple different names for the same function. For this case, the first two have exactly the same syntax expect the subtle difference in function name. Any hints/comments/explanations for this phenomenon will he highly appreciated.

 

Regards,

HY

0 Kudos
1 Solution
mecej4
Honored Contributor III
356 Views

See the Netlib documentation.

In general, Lapack and BLAS routines come in four varieties, distinguished by the type and precision of those arguments that are real or complex.. The prefix 'S' is for single precision real, 'D' for double precision real, 'C' for single precision complex, 'Z' for double precision complex.

This was the situation before Fortran 90/95 came along. Now, you may call a single name regardless of the types of arguments, and the compiler will examine the types of the arguments and call the S,D,C or Z variant based on the type. 

Furthermore, the Fortran-95 style calls can have optional arguments and arguments passed by keyword rather than position. Workspace arrays need not be passed explicitly by the user, since in modern Fortran such arrays can be allocated dynamically in the callee.

View solution in original post

2 Replies
mecej4
Honored Contributor III
357 Views

See the Netlib documentation.

In general, Lapack and BLAS routines come in four varieties, distinguished by the type and precision of those arguments that are real or complex.. The prefix 'S' is for single precision real, 'D' for double precision real, 'C' for single precision complex, 'Z' for double precision complex.

This was the situation before Fortran 90/95 came along. Now, you may call a single name regardless of the types of arguments, and the compiler will examine the types of the arguments and call the S,D,C or Z variant based on the type. 

Furthermore, the Fortran-95 style calls can have optional arguments and arguments passed by keyword rather than position. Workspace arrays need not be passed explicitly by the user, since in modern Fortran such arrays can be allocated dynamically in the callee.

Hongyizhao
Beginner
350 Views
0 Kudos
Reply