Permalink
Browse files

Merge pull request #1158 from loriab/clangf_fnocc

fmt: clang-format FNOCC module
  • Loading branch information...
dgasmith committed Sep 6, 2018
2 parents 8cf39e7 + 8b1cef7 commit ba459ab30b2be484d7faae89ba5893c638d48def
@@ -26,78 +26,78 @@
* @END LICENSE
*/
#include"blas.h"
#include<stdlib.h>
#include "blas.h"
#include <stdlib.h>
#include "psi4/pragma.h"
namespace psi { namespace fnocc{
namespace psi {
namespace fnocc {
// position in a symmetric packed matrix
long int Position(long int i,long int j){
if (i<j){
return ((j*(j+1))>>1)+i;
}
return ((i*(i+1))>>1)+j;
long int Position(long int i, long int j) {
if (i < j) {
return ((j * (j + 1)) >> 1) + i;
}
return ((i * (i + 1)) >> 1) + j;
}
/**
* fortran-ordered dgemv
*/
void PSI_API F_DGEMV(char trans,integer m,integer n,doublereal alpha,doublereal*A,integer lda,
doublereal*X,integer incx,doublereal beta,doublereal*Y,integer incy){
DGEMV(trans,m,n,alpha,A,lda,X,incx,beta,Y,incy);
void PSI_API F_DGEMV(char trans, integer m, integer n, doublereal alpha, doublereal* A, integer lda, doublereal* X,
integer incx, doublereal beta, doublereal* Y, integer incy) {
DGEMV(trans, m, n, alpha, A, lda, X, incx, beta, Y, incy);
}
/**
* fortran-ordered dgemm
*/
void PSI_API F_DGEMM(char transa,char transb, integer m, integer n, integer k,
doublereal alpha,doublereal*A,integer lda,doublereal*B,integer ldb,
doublereal beta,doublereal*C,integer ldc){
DGEMM(transa,transb,m,n,k,alpha,A,lda,B,ldb,beta,C,ldc);
void PSI_API F_DGEMM(char transa, char transb, integer m, integer n, integer k, doublereal alpha, doublereal* A,
integer lda, doublereal* B, integer ldb, doublereal beta, doublereal* C, integer ldc) {
DGEMM(transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc);
}
/**
* Diagonalize a real symmetric matrix
*/
void Diagonalize(integer N,doublereal*A,doublereal*W){
char JOBZ = 'V';
char UPLO = 'U';
integer LDA = N;
integer LWORK = 3*N-1;
doublereal*WORK=(doublereal*)malloc(LWORK*sizeof(doublereal));
integer INFO=0;
DSYEV(JOBZ,UPLO,N,A,LDA,W,WORK,LWORK,INFO);
free(WORK);
void Diagonalize(integer N, doublereal* A, doublereal* W) {
char JOBZ = 'V';
char UPLO = 'U';
integer LDA = N;
integer LWORK = 3 * N - 1;
doublereal* WORK = (doublereal*)malloc(LWORK * sizeof(doublereal));
integer INFO = 0;
DSYEV(JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, INFO);
free(WORK);
}
void Diagonalize2(integer N,doublereal*AP,doublereal*W,doublereal*Z){
char JOBZ = 'V';
char UPLO = 'U';
integer LDZ = N;
doublereal*WORK=(doublereal*)malloc(3*N*sizeof(doublereal));
integer INFO=0;
DSPEV(JOBZ,UPLO,N,AP,W,Z,LDZ,WORK,INFO);
free(WORK);
void Diagonalize2(integer N, doublereal* AP, doublereal* W, doublereal* Z) {
char JOBZ = 'V';
char UPLO = 'U';
integer LDZ = N;
doublereal* WORK = (doublereal*)malloc(3 * N * sizeof(doublereal));
integer INFO = 0;
DSPEV(JOBZ, UPLO, N, AP, W, Z, LDZ, WORK, INFO);
free(WORK);
}
/**
* General SVD
*/
void SVD(integer M,integer N,doublereal*A,doublereal*U,doublereal*VT,doublereal*S){
char JOBU = 'S'; // all M columns of U are returned in array U
char JOBVT = 'A'; // all N rows of V**T are returned in the array VT
integer LDA = M;
integer LDU = M;
integer LDVT = N;
void SVD(integer M, integer N, doublereal* A, doublereal* U, doublereal* VT, doublereal* S) {
char JOBU = 'S'; // all M columns of U are returned in array U
char JOBVT = 'A'; // all N rows of V**T are returned in the array VT
integer LDA = M;
integer LDU = M;
integer LDVT = N;
integer min = ( M < N ) ? M : N;
integer max = ( M < N ) ? N : M;
integer LWORK = ( 3 * min + max > 5 * min ) ? (3 * min + max) : (5 * min);
doublereal*WORK=(doublereal*)malloc(LWORK*sizeof(doublereal));
integer min = (M < N) ? M : N;
integer max = (M < N) ? N : M;
integer LWORK = (3 * min + max > 5 * min) ? (3 * min + max) : (5 * min);
doublereal* WORK = (doublereal*)malloc(LWORK * sizeof(doublereal));
integer INFO=0;
DGESVD(JOBU,JOBVT,M,N,A,LDA,S,U,LDU,VT,LDVT,WORK,LWORK,INFO);
free(WORK);
integer INFO = 0;
DGESVD(JOBU, JOBVT, M, N, A, LDA, S, U, LDU, VT, LDVT, WORK, LWORK, INFO);
free(WORK);
}
}
}
}}
View
@@ -39,7 +39,8 @@
typedef long int integer;
typedef double doublereal;
namespace psi{ namespace fnocc{
namespace psi {
namespace fnocc {
/**
* fortran-ordered dgemv
@@ -49,116 +50,116 @@ void PSI_API F_DGEMV(char trans, integer m, integer n, doublereal alpha, doubler
/**
* fortran-ordered dgemm
*/
void PSI_API F_DGEMM(char transa,char transb, integer m, integer n, integer k,
doublereal alpha,doublereal*A,integer lda,doublereal*B,integer ldb,
doublereal beta,doublereal*C,integer ldc);
void PSI_API F_DGEMM(char transa, char transb, integer m, integer n, integer k, doublereal alpha, doublereal *A,
integer lda, doublereal *B, integer ldb, doublereal beta, doublereal *C, integer ldc);
/**
* name mangling for fortran-ordered dgemv
*/
extern "C" {
void dgemv(char&trans,integer&m,integer&n,doublereal&alpha,doublereal*A,integer&lda,
doublereal*X,integer&incx,doublereal&beta,doublereal*Y,integer&incy);
void dgemv(char &trans, integer &m, integer &n, doublereal &alpha, doublereal *A, integer &lda, doublereal *X,
integer &incx, doublereal &beta, doublereal *Y, integer &incy);
};
inline void DGEMV(char&trans,integer&m,integer&n,doublereal&alpha,doublereal*A,integer&lda,
doublereal*X,integer&incx,doublereal&beta,doublereal*Y,integer&incy){
dgemv(trans,m,n,alpha,A,lda,X,incx,beta,Y,incy);
inline void DGEMV(char &trans, integer &m, integer &n, doublereal &alpha, doublereal *A, integer &lda, doublereal *X,
integer &incx, doublereal &beta, doublereal *Y, integer &incy) {
dgemv(trans, m, n, alpha, A, lda, X, incx, beta, Y, incy);
}
/**
* name mangling for fortran-ordered dgemm
*/
extern "C" {
void dgemm(char&transa,char&transb,integer&m,integer&n,integer&k,
doublereal&alpha,doublereal*A,integer&lda,doublereal*B,integer&ldb,
doublereal&beta,doublereal*C,integer&ldc);
void dgemm(char &transa, char &transb, integer &m, integer &n, integer &k, doublereal &alpha, doublereal *A,
integer &lda, doublereal *B, integer &ldb, doublereal &beta, doublereal *C, integer &ldc);
};
inline void DGEMM(char&transa,char&transb,integer&m,integer&n,integer&k,
doublereal&alpha,doublereal*A,integer&lda,doublereal*B,integer&ldb,
doublereal&beta,doublereal*C,integer&ldc)
{
dgemm(transa,transb,m,n,k,alpha,A,lda,B,ldb,beta,C,ldc);
inline void DGEMM(char &transa, char &transb, integer &m, integer &n, integer &k, doublereal &alpha, doublereal *A,
integer &lda, doublereal *B, integer &ldb, doublereal &beta, doublereal *C, integer &ldc) {
dgemm(transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc);
};
/**
* name mangling dcopy
*/
extern "C" {
void dcopy(integer&n,doublereal*dx,integer&incx,doublereal*dy,
integer&incy);
void dcopy(integer &n, doublereal *dx, integer &incx, doublereal *dy, integer &incy);
};
inline void DCOPY(integer&n,doublereal*dx,integer&incx,doublereal*dy,
integer&incy){
dcopy(n,dx,incx,dy,incy);
inline void DCOPY(integer &n, doublereal *dx, integer &incx, doublereal *dy, integer &incy) {
dcopy(n, dx, incx, dy, incy);
}
/**
* name mangling dnrm2
*/
extern"C"{
double dnrm2(integer&N,doublereal*X,integer&INCX);
};
inline double DNRM2(integer&N,doublereal*X,integer&INCX){
return dnrm2(N,X,INCX);
extern "C" {
double dnrm2(integer &N, doublereal *X, integer &INCX);
};
inline double DNRM2(integer &N, doublereal *X, integer &INCX) { return dnrm2(N, X, INCX); };
/**
* name mangling dgesv
*/
extern"C" {
void dgesv(integer &N,integer &NRHS,doublereal*A,integer &LDA,integer*IPIV,doublereal*B,integer &LDB,integer &INFO);
extern "C" {
void dgesv(integer &N, integer &NRHS, doublereal *A, integer &LDA, integer *IPIV, doublereal *B, integer &LDB,
integer &INFO);
};
inline void DGESV(integer &N,integer &NRHS,doublereal*A,integer &LDA,integer*IPIV,doublereal*B,integer &LDB,integer &INFO){
dgesv(N,NRHS,A,LDA,IPIV,B,LDB,INFO);
inline void DGESV(integer &N, integer &NRHS, doublereal *A, integer &LDA, integer *IPIV, doublereal *B, integer &LDB,
integer &INFO) {
dgesv(N, NRHS, A, LDA, IPIV, B, LDB, INFO);
};
/**
* name mangling ddot
*/
extern "C" {
double ddot(integer&n,doublereal*dx,integer&incx,doublereal*dy,integer&incy);
double ddot(integer &n, doublereal *dx, integer &incx, doublereal *dy, integer &incy);
};
inline double DDOT(integer&n,doublereal*dx,integer&incx,doublereal*dy,integer&incy){
return ddot(n,dx,incx,dy,incy);
inline double DDOT(integer &n, doublereal *dx, integer &incx, doublereal *dy, integer &incy) {
return ddot(n, dx, incx, dy, incy);
}
/**
* diagonalize a real symmetric matrix
*/
void Diagonalize(integer N,doublereal*A,doublereal*W);
void Diagonalize(integer N, doublereal *A, doublereal *W);
/**
* name mangling dsyev
*/
extern "C" {
void dsyev(char&JOBZ,char&UPLO,integer&N,doublereal*A,integer&LDA,doublereal*W,doublereal*WORK,integer&LWORK,integer&INFO);
void dsyev(char &JOBZ, char &UPLO, integer &N, doublereal *A, integer &LDA, doublereal *W, doublereal *WORK,
integer &LWORK, integer &INFO);
};
inline void DSYEV(char&JOBZ,char&UPLO,integer&N,doublereal*A,integer&LDA,doublereal*W,doublereal*WORK,integer&LWORK,integer&INFO){
dsyev(JOBZ,UPLO,N,A,LDA,W,WORK,LWORK,INFO);
inline void DSYEV(char &JOBZ, char &UPLO, integer &N, doublereal *A, integer &LDA, doublereal *W, doublereal *WORK,
integer &LWORK, integer &INFO) {
dsyev(JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, INFO);
}
/**
* diagonalize a real symmetric packed matrix
*/
void Diagonalize2(integer N,doublereal*AP,doublereal*W,doublereal*Z);
void Diagonalize2(integer N, doublereal *AP, doublereal *W, doublereal *Z);
/**
* name mangling dspev
*/
extern "C" {
void dspev(char&JOBZ,char&UPLO,integer&N,doublereal*AP,doublereal*W,doublereal*Z,integer&LDZ,doublereal*WORK,integer&INFO);
void dspev(char &JOBZ, char &UPLO, integer &N, doublereal *AP, doublereal *W, doublereal *Z, integer &LDZ,
doublereal *WORK, integer &INFO);
};
inline void DSPEV(char&JOBZ,char&UPLO,integer&N,doublereal*AP,doublereal*W,doublereal*Z,integer&LDZ,doublereal*WORK,integer&INFO){
dspev(JOBZ,UPLO,N,AP,W,Z,LDZ,WORK,INFO);
inline void DSPEV(char &JOBZ, char &UPLO, integer &N, doublereal *AP, doublereal *W, doublereal *Z, integer &LDZ,
doublereal *WORK, integer &INFO) {
dspev(JOBZ, UPLO, N, AP, W, Z, LDZ, WORK, INFO);
}
/**
* General SVD
*/
void SVD(integer M,integer N,doublereal*A,doublereal*U,doublereal*VT,doublereal*S);
void SVD(integer M, integer N, doublereal *A, doublereal *U, doublereal *VT, doublereal *S);
/**
* name mangling dgesvd
*/
extern "C" {
void dgesvd(char&JOBU,char&JOBVT,integer&M,integer&N,doublereal*A,integer&LDA,doublereal*S,doublereal*U,integer&LDU,doublereal*VT,integer&LDVT,doublereal*WORK,integer&LWORK,integer&INFO);
void dgesvd(char &JOBU, char &JOBVT, integer &M, integer &N, doublereal *A, integer &LDA, doublereal *S, doublereal *U,
integer &LDU, doublereal *VT, integer &LDVT, doublereal *WORK, integer &LWORK, integer &INFO);
};
inline void DGESVD(char&JOBU,char&JOBVT,integer&M,integer&N,doublereal*A,integer&LDA,doublereal*S,doublereal*U,integer&LDU,doublereal*VT,integer&LDVT,doublereal*WORK,integer&LWORK,integer&INFO){
dgesvd(JOBU,JOBVT,M,N,A,LDA,S,U,LDU,VT,LDVT,WORK,LWORK,INFO);
inline void DGESVD(char &JOBU, char &JOBVT, integer &M, integer &N, doublereal *A, integer &LDA, doublereal *S,
doublereal *U, integer &LDU, doublereal *VT, integer &LDVT, doublereal *WORK, integer &LWORK,
integer &INFO) {
dgesvd(JOBU, JOBVT, M, N, A, LDA, S, U, LDU, VT, LDVT, WORK, LWORK, INFO);
}
}
}
}}
#endif
Oops, something went wrong.

0 comments on commit ba459ab

Please sign in to comment.