lapack wrapper dll

This commit is contained in:
madrocketsci committed 2025-05-21 23:38:39 -04:00
commit 4ead223c2a
46 files changed
+1670

No files matched your search

+269
View File
@@ -0,0 +1,269 @@
#include <amslapackdll2/amslapackdll2.h>
#ifdef __cplusplus
extern "C" {
#endif
AMSLAPACKDLL2_API int amscppdlltemplate_exportedtestfn(int a, int b)
{
int ret = a*a-b*b;
}
//zgesv declaration
void zgesv_(
int *N, // number of rows/cols for A
int *NRHS, // number of columns for X, B
double *A, // complex16[NxN]
int *LDA, // int[max(1,N)]
int *IPIV, // int[N] pivot indices that define the permutation matrix P
double *B, // input X, output B
int *LDB, // int[max(1,N)]
int *info // 0 = success, <0 i-th argument is illegal, >0 singular
);
//Computes solution to A*X=B
//A is NxN, X and B are NxNRHS
//Replaces X with B
AMSLAPACKDLL2_API void amslapackdll2_zgesv(
int *N, // number of rows/cols for A
int *NRHS, // number of columns for X, B
double *A, // complex16[NxN]
int *LDA, // int[max(1,N)]
int *IPIV, // int[N] pivot indices that define the permutation matrix P
double *B, // input X, output B
int *LDB, // int[max(1,N)]
int *info // 0 = success, <0 i-th argument is illegal, >0 singular
)
{
zgesv_(N,NRHS,A,LDA,IPIV,B,LDB,info);
return;
//Calling ZGESV
//void zgesv_(int *N, int *NRHS, double *A, int *LDA, int *IPIV, double *B, int *LDB, int *info);
// N - int - Number of rows for A
// NRHS - int - Number of columns for X,B
// A - complex16[N*N] -
// LDA - int[max(1,N)] -
// IPIV - int[N] - pivot indices that define the permutation matrix P
// B - complex16[N*NRHS] - begins with X, ends with B
// LDB - int[max(1,N)] -
// info - int - (0 = success, <0 i-th argument is illegal, >0 singular)
//
//Computes solution to A*X=B
//A is NxN, X and B are NxNRHS
//Replaces X with B
}
void zgetrf_(
int *M,
int *N,
double *A,
int *LDA,
int *ipiv,
int *info
);
//Solves A=P*L*U, P is a permutation matrix,
//L is lower triangular with unit diagonal, U is upper triangular
AMSLAPACKDLL2_API void amslapackdll2_zgetrf(
int *M,
int *N,
double *A,
int *LDA,
int *ipiv,
int *info
)
{
zgetrf_(M,N,A,LDA,ipiv,info);
//calling zgetrf_
//void zgetrf_(int *M, int *N, double *A, int *LDA, int *ipiv, int *info);
//M - int - number of rows in matrix A
//N - int - number of columns in matrix A
//A - complex16[M*N]
//LDA - int[max(1,M)]
//ipiv - int[min(M,N)] - the pivot indices
//info - int - 0-success, <0 -the i'th arg illegl val, >0 - the factorization is singular
//
//Solves A=P*L*U, P is a permutation matrix,
//L is lower triangular with unit diagonal, U is upper triangular
return;
}
void zgeev_(char *jobvl, char *jobvr, int *n, double *A, int *LDA,
double *W, double *VL, int *LVDL, double *VR, int *LVDR,
double *WORK, int *LWORK, double *RWORK, int *info);
//eigenvalue solver for complex matrices
AMSLAPACKDLL2_API void amslapackdll2_zgeev(
char *jobvl,
char *jobvr,
int *n,
double *A,
int *LDA,
double *W,
double *VL,
int *LVDL,
double *VR,
int *LVDR,
double *WORK,
int *LWORK,
double *RWORK,
int *info
)
{
zgeev_(jobvl,jobvr,n,A,LDA,W,VL,LVDL,VR,LVDR,WORK,LWORK,RWORK,info);
//eigenvalue solver for complex matrices is zgeev
//*> ZGEEV computes for an N-by-N complex nonsymmetric matrix A, the
//*> eigenvalues and, optionally, the left and/or right eigenvectors.
//*>
//*> The right eigenvector v(j) of A satisfies
//*> A * v(j) = lambda(j) * v(j)
//*> where lambda(j) is its eigenvalue.
//*> The left eigenvector u(j) of A satisfies
//*> u(j)**H * A = lambda(j) * u(j)**H
//*> where u(j)**H denotes the conjugate transpose of u(j).
//*>
//*> The computed eigenvectors are normalized to have Euclidean norm
//*> equal to 1 and largest component real.
//*> \endverbatim
//*
//* Arguments:
//* ==========
//*
//*> \param[in] JOBVL
//*> \verbatim
//*> JOBVL is CHARACTER*1
//*> = 'N': left eigenvectors of A are not computed;
//*> = 'V': left eigenvectors of are computed.
//*> \endverbatim
//*>
//*> \param[in] JOBVR
//*> \verbatim
//*> JOBVR is CHARACTER*1
//*> = 'N': right eigenvectors of A are not computed;
//*> = 'V': right eigenvectors of A are computed.
//*> \endverbatim
//*>
//*> \param[in] N
//*> \verbatim
//*> N is INTEGER
//*> The order of the matrix A. N >= 0.
//*> \endverbatim
//*>
//*> \param[in,out] A
//*> \verbatim
//*> A is COMPLEX*16 array, dimension (LDA,N)
//*> On entry, the N-by-N matrix A.
//*> On exit, A has been overwritten.
//*> \endverbatim
//*>
//*> \param[in] LDA
//*> \verbatim
//*> LDA is INTEGER
//*> The leading dimension of the array A. LDA >= max(1,N).
//*> \endverbatim
//*>
//*> \param[out] W
//*> \verbatim
//*> W is COMPLEX*16 array, dimension (N)
//*> W contains the computed eigenvalues.
//*> \endverbatim
//*>
//*> \param[out] VL
//*> \verbatim
//*> VL is COMPLEX*16 array, dimension (LDVL,N)
//*> If JOBVL = 'V', the left eigenvectors u(j) are stored one
//*> after another in the columns of VL, in the same order
//*> as their eigenvalues.
//*> If JOBVL = 'N', VL is not referenced.
//*> u(j) = VL(:,j), the j-th column of VL.
//*> \endverbatim
//*>
//*> \param[in] LDVL
//*> \verbatim
//*> LDVL is INTEGER
//*> The leading dimension of the array VL. LDVL >= 1; if
//*> JOBVL = 'V', LDVL >= N.
//*> \endverbatim
//*>
//*> \param[out] VR
//*> \verbatim
//*> VR is COMPLEX*16 array, dimension (LDVR,N)
//*> If JOBVR = 'V', the right eigenvectors v(j) are stored one
//*> after another in the columns of VR, in the same order
//*> as their eigenvalues.
//*> If JOBVR = 'N', VR is not referenced.
//*> v(j) = VR(:,j), the j-th column of VR.
//*> \endverbatim
//*>
//*> \param[in] LDVR
//*> \verbatim
//*> LDVR is INTEGER
//*> The leading dimension of the array VR. LDVR >= 1; if
//*> JOBVR = 'V', LDVR >= N.
//*> \endverbatim
//*>
//*> \param[out] WORK
//*> \verbatim
//*> WORK is COMPLEX*16 array, dimension (MAX(1,LWORK))
//*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
//*> \endverbatim
//*>
//*> \param[in] LWORK
//*> \verbatim
//*> LWORK is INTEGER
//*> The dimension of the array WORK. LWORK >= max(1,2*N).
//*> For good performance, LWORK must generally be larger.
//*>
//*> If LWORK = -1, then a workspace query is assumed; the routine
//*> only calculates the optimal size of the WORK array, returns
//*> this value as the first entry of the WORK array, and no error
//*> message related to LWORK is issued by XERBLA.
//*> \endverbatim
//*>
//*> \param[out] RWORK
//*> \verbatim
//*> RWORK is DOUBLE PRECISION array, dimension (2*N)
//*> \endverbatim
//*>
//*> \param[out] INFO
//*> \verbatim
//*> INFO is INTEGER
//*> = 0: successful exit
//*> < 0: if INFO = -i, the i-th argument had an illegal value.
//*> > 0: if INFO = i, the QR algorithm failed to compute all the
//*> eigenvalues, and no eigenvectors have been computed;
//*> elements and i+1:N of W contain eigenvalues which have
//*> converged.
//*> \endverbatim
//*
//* Authors:
//* ========
//*
//*> \author Univ. of Tennessee
//*> \author Univ. of California Berkeley
//*> \author Univ. of Colorado Denver
//*> \author NAG Ltd.
//*
//*> \date November 2011
//*
//*> \ingroup complex16GEeigen
//calling zgeev_(char jobvl, char jobvr, int N, complex*16[N*N] A, int LDA,
//complex*16[N] W, complex*16[N*N] VL, int LVDL, complex*16[N*N] VR, int LVDR,
//
//zgeev_(&q,&q,&NN,Acpy.data,&NN,W,levs->data,&NN,revs->data,&NN,
// work,&lwork,rwork,&info);
return;
}
#ifdef __cplusplus
}; //end extern "C"
#endif
+8
View File
@@ -0,0 +1,8 @@
#include <amslapackdll2/amslapackdll2.h>
int main(int argc, char* argv[])
{
int ret = 0;
return ret;
}