Skip to content

Commit

Permalink
Merge pull request #1189 from andysim/fmtmcscf
Browse files Browse the repository at this point in the history
fmt: clang-format the mcscf module
  • Loading branch information
dgasmith committed Sep 7, 2018
2 parents 59fd0a4 + 9fadc92 commit 2ffec4a
Show file tree
Hide file tree
Showing 37 changed files with 2,233 additions and 2,414 deletions.
40 changes: 18 additions & 22 deletions psi4/src/psi4/mcscf/algebra_interface.cc
Expand Up @@ -29,9 +29,9 @@
#include "psi4/libmoinfo/libmoinfo.h"
#include "algebra_interface.h"

namespace psi{
namespace psi {

namespace mcscf{
namespace mcscf {

/*
** C_DGEMM_12()
Expand All @@ -42,17 +42,15 @@ namespace psi{
** ncb = number of columns in B
** ncc = number of columns in C
*/
void C_DGEMM_12(int m, int n, int k, double alpha,
double *A, int nra, double *B, int ncb, double beta, double *C,
int ncc)
{
// the only strange thing we need to do is reverse everything
// since the stride runs differently in C vs. Fortran
void C_DGEMM_12(int m, int n, int k, double alpha, double *A, int nra, double *B, int ncb, double beta, double *C,
int ncc) {
// the only strange thing we need to do is reverse everything
// since the stride runs differently in C vs. Fortran

/* also, do nothing if a dimension is 0 */
if (m == 0 || n == 0 || k == 0) return;
/* also, do nothing if a dimension is 0 */
if (m == 0 || n == 0 || k == 0) return;

F_DGEMM("t","t",&n,&m,&k,&alpha,B,&ncb,A,&nra,&beta,C,&ncc);
F_DGEMM("t", "t", &n, &m, &k, &alpha, B, &ncb, A, &nra, &beta, C, &ncc);
}

/*
Expand All @@ -64,18 +62,16 @@ void C_DGEMM_12(int m, int n, int k, double alpha,
** ncb = number of columns in B
** ncc = number of columns in C
*/
void C_DGEMM_22(int m, int n, int k, double alpha,
double *A, int nca, double *B, int ncb, double beta, double *C,
int ncc)
{
// the only strange thing we need to do is reverse everything
// since the stride runs differently in C vs. Fortran
void C_DGEMM_22(int m, int n, int k, double alpha, double *A, int nca, double *B, int ncb, double beta, double *C,
int ncc) {
// the only strange thing we need to do is reverse everything
// since the stride runs differently in C vs. Fortran

/* also, do nothing if a dimension is 0 */
if (m == 0 || n == 0 || k == 0) return;
/* also, do nothing if a dimension is 0 */
if (m == 0 || n == 0 || k == 0) return;

F_DGEMM("t","n",&n,&m,&k,&alpha,B,&ncb,A,&nca,&beta,C,&ncc);
F_DGEMM("t", "n", &n, &m, &k, &alpha, B, &ncb, A, &nca, &beta, C, &ncc);
}


}} /* End Namespaces */
} // namespace mcscf
} // namespace psi
47 changes: 21 additions & 26 deletions psi4/src/psi4/mcscf/algebra_interface.h
Expand Up @@ -31,42 +31,37 @@

#include "algebra_interface_mangle.h"

namespace psi{ namespace mcscf{
namespace psi {
namespace mcscf {

extern "C" void F_DAXPY(int *length, double *a, double *x, int *inc_x,
double *y, int *inc_y);
extern "C" void F_DCOPY(int *length, double *x, int *inc_x,
double *y, int *inc_y);
extern "C" void F_DGEMM(const char *transa, const char *transb, int *m, int *n, int *k,
double *alpha, double *A, int *lda, double *B, int *ldb,
double *beta, double *C, int *ldc);
extern "C" void F_DROT(int *ntot,double *x, int *incx,double *y, int *incy,
double *cotheta,double *sintheta);
extern "C" void F_DAXPY(int *length, double *a, double *x, int *inc_x, double *y, int *inc_y);
extern "C" void F_DCOPY(int *length, double *x, int *inc_x, double *y, int *inc_y);
extern "C" void F_DGEMM(const char *transa, const char *transb, int *m, int *n, int *k, double *alpha, double *A,
int *lda, double *B, int *ldb, double *beta, double *C, int *ldc);
extern "C" void F_DROT(int *ntot, double *x, int *incx, double *y, int *incy, double *cotheta, double *sintheta);
extern "C" void F_DSCAL(int *n, double *alpha, double *vec, int *inc);
extern "C" void F_DGEMV(char *transa, int *m, int *n, double *alpha, double *A,
int *lda, double *X, int *inc_x, double *beta,
double *Y, int *inc_y);
extern "C" void F_DGEMV(char *transa, int *m, int *n, double *alpha, double *A, int *lda, double *X, int *inc_x,
double *beta, double *Y, int *inc_y);
extern "C" double F_DDOT(int *n, double *x, int *incx, double *y, int *incy);

void C_DGEMM_12(int m, int n, int k, double alpha,double *A, int nra,
double *B, int ncb, double beta, double *C, int ncc);
void C_DGEMM_22(int m, int n, int k, double alpha,double *A, int nca,
double *B, int ncb, double beta, double *C, int ncc);
void C_DGEMM_12(int m, int n, int k, double alpha, double *A, int nra, double *B, int ncb, double beta, double *C,
int ncc);
void C_DGEMM_22(int m, int n, int k, double alpha, double *A, int nca, double *B, int ncb, double beta, double *C,
int ncc);

// void C_DGEMM_11(int m, int n, int k, double alpha,double *A, int nca,
// double *B, int ncb, double beta, double *C, int ncc);
// void C_DGEMM_21(int m, int n, int k, double alpha,double *A, int nca,
// double *B, int ncb, double beta, double *C, int ncc);

extern "C" void F_DGEEV(const char *jobvl, const char *jobvr, int *n, double *a, int *lda, double *wr, double *wi,
double *vl, int *ldvl, double *vr, int *ldvr, double *work, int *lwork, int *info);
extern "C" void F_DGESV(int *n, int *nrhs, double *A, int *lda, int *ipiv, double *B, int *ldb, int *info);

extern "C" void F_DGEEV(const char *jobvl, const char *jobvr, int *n, double *a, int *lda,
double *wr, double *wi, double *vl, int *ldvl, double *vr,
int *ldvr, double *work, int *lwork, int *info);
extern "C" void F_DGESV(int *n, int *nrhs, double *A, int *lda, int *ipiv,
double *B, int *ldb, int *info);
extern "C" void F_DSYEV(char *JOBZ, char *UPLO, int *N, double *A, int *LDA, double *W, double *WORK, int *LWORK,
int *INFO);

extern "C" void F_DSYEV(char *JOBZ, char *UPLO, int *N, double *A, int *LDA, double *W, double *WORK, int *LWORK, int *INFO );
} // namespace mcscf
} // namespace psi

}}

#endif // _psi_src_bin_mcscf_algebra_interface_h_
#endif // _psi_src_bin_mcscf_algebra_interface_h_
46 changes: 23 additions & 23 deletions psi4/src/psi4/mcscf/algebra_interface_mangle.h
Expand Up @@ -35,82 +35,82 @@

#ifdef USE_FCMANGLE_H
#include "FCMangle.h"
#define F_DAXPY FC_GLOBAL(daxpy, DAXPY)
#define F_DCOPY FC_GLOBAL(dcopy, DCOPY)
#define F_DGEMM FC_GLOBAL(dgemm, DGEMM)
#define F_DROT FC_GLOBAL(drot, DROT)
#define F_DSCAL FC_GLOBAL(dscal, DSCAL)
#define F_DGEMV FC_GLOBAL(dgemv, DGEMV)
#define F_DSPMV FC_GLOBAL(dfpmv, DSPMV)
#define F_DDOT FC_GLOBAL(ddot, DDOT)
#define F_DGEEV FC_GLOBAL(dgeev, DGEEV)
#define F_DGESV FC_GLOBAL(dgesv, DGESV)
#define F_DAXPY FC_GLOBAL(daxpy, DAXPY)
#define F_DCOPY FC_GLOBAL(dcopy, DCOPY)
#define F_DGEMM FC_GLOBAL(dgemm, DGEMM)
#define F_DROT FC_GLOBAL(drot, DROT)
#define F_DSCAL FC_GLOBAL(dscal, DSCAL)
#define F_DGEMV FC_GLOBAL(dgemv, DGEMV)
#define F_DSPMV FC_GLOBAL(dfpmv, DSPMV)
#define F_DDOT FC_GLOBAL(ddot, DDOT)
#define F_DGEEV FC_GLOBAL(dgeev, DGEEV)
#define F_DGESV FC_GLOBAL(dgesv, DGESV)
#define F_DGETRF FC_GLOBAL(dgetrf, DGETRF)
#define F_DGETRI FC_GLOBAL(dgetri, DGETRI)
#define F_DGESVD FC_GLOBAL(dgesvd, DGESVD)
#define F_DSYEV FC_GLOBAL(dsyev, DSYEV)
#else // USE_FCMANGLE_H
#if FC_SYMBOL==2
#define F_DSYEV FC_GLOBAL(dsyev, DSYEV)
#else // USE_FCMANGLE_H
#if FC_SYMBOL == 2
#define F_DAXPY daxpy_
#define F_DCOPY dcopy_
#define F_DGEMM dgemm_
#define F_DROT drot_
#define F_DSCAL dscal_
#define F_DGEMV dgemv_
#define F_DSPMV dspmv_
#define F_DDOT ddot_
#define F_DDOT ddot_
#define F_DGEEV dgeev_
#define F_DGESV dgesv_
#define F_DGETRF dgetrf_
#define F_DGETRI dgetri_
#define F_DGESVD dgesvd_
#define F_DSYEV dsyev_
#elif FC_SYMBOL==1
#elif FC_SYMBOL == 1
#define F_DAXPY daxpy
#define F_DCOPY dcopy
#define F_DGEMM dgemm
#define F_DROT drot
#define F_DSCAL dscal
#define F_DGEMV dgemv
#define F_DSPMV dspmv
#define F_DDOT ddot
#define F_DDOT ddot
#define F_DGEEV dgeev
#define F_DGESV dgesv
#define F_DGETRF dgetrf
#define F_DGETRI dgetri
#define F_DGESVD dgesvd
#define F_DSYEV dsyev
#elif FC_SYMBOL==3
#elif FC_SYMBOL == 3
#define F_DAXPY DAXPY
#define F_DCOPY DCOPY
#define F_DGEMM DGEMM
#define F_DROT DROT
#define F_DSCAL DSCAL
#define F_DGEMV DGEMV
#define F_DSPMV DSPMV
#define F_DDOT DDOT
#define F_DDOT DDOT
#define F_DGEEV DGEEV
#define F_DGESV DGESV
#define F_DGETRF DGETRF
#define F_DGETRI DGETRI
#define F_DGESVD DGESVD
#define F_DSYEV DSYEV
#elif FC_SYMBOL==4
#elif FC_SYMBOL == 4
#define F_DAXPY DAXPY_
#define F_DCOPY DCOPY_
#define F_DGEMM DGEMM_
#define F_DROT DROT_
#define F_DSCAL DSCAL_
#define F_DGEMV DGEMV_
#define F_DSPMV DSPMV_
#define F_DDOT DDOT_
#define F_DDOT DDOT_
#define F_DGEEV DGEEV_
#define F_DGESV DGESV_
#define F_DGETRF DGETRF_
#define F_DGETRI DGETRI_
#define F_DGESVD DGESVD_
#define F_DSYEV DSYEV_
#endif // FC_SYMBOL
#endif // USE_FCMANGLE_H
#endif // FC_SYMBOL
#endif // USE_FCMANGLE_H

#endif // _psi_src_bin_mcscf_algebra_interface_mangle_h_
#endif // _psi_src_bin_mcscf_algebra_interface_mangle_h_

0 comments on commit 2ffec4a

Please sign in to comment.