Reputation: 111
dgesvd
seems to be a LAPACKE_dgesvd
with the layout LAPACK_COL_MAJOR
, but looking at the examples for dgesvd
and LAPACKE_dgesvd
it seems there is an extra step in the dgesvd
example where an optimal workspace is queried and allocated.
Is it correct to assume that this step is to figure out if the input matrix is COL_MAJOR
or ROW_MAJOR
?
Is it correct to assume that once the optimal workspace is figured out, 'dgesvd' internally calls LAPACKE_dgesvd
with the appropriate layout?
If I already know the matrix layout to be COL_MAJOR
is using LAPACKE_dgesvd
better (faster/less expensive) than dgesvd
?
Upvotes: 1
Views: 607
Reputation: 1588
We have two functions here which refer to two different interfaces:
i. dgesvd : calls fortran interface
ii. LAPACKE_dgesvd : calls C interface
For detail see this.
dgesvd
the value of lwork
is set to -1
which as documented here is used for just calculating the size of lwork
. So if you already know about the size of lwork
you don't need to call it twice. Input matrix has to be LAPACK_COL_MAJOR
for dgesvd
as this is default for fortran. Also there is no way to calculate if the matrix is row major or column major.dgesvd
is the fortran
interface which was implemented first. For matrix layout infotmation see this. Here is the technical paper for C interface
Upvotes: 1