algebra_interface.cc

00001 /***************************************************************************
00002  *  PSIMRCC : Copyright (C) 2007 by Francesco Evangelista and Andrew Simmonett
00003  *  frank@ccc.uga.edu   andysim@ccc.uga.edu
00004  *  A multireference coupled cluster code
00005  ***************************************************************************/
00006 
00007 #include "algebra_interface.h"
00008 #include "moinfo.h"
00009 
00010 extern FILE *infile, *outfile;
00011 
00012 namespace psi{ namespace psimrcc{
00013 
00014 /*
00015 ** C_DGEMM_12()
00016 **
00017 ** This function calculates C(m,n)=alpha*A(k,m)*B(n,k)+ beta*C(m,n)
00018 **
00019 ** nra = number of rows in A
00020 ** ncb = number of columns in B
00021 ** ncc = number of columns in C
00022 */
00023 void C_DGEMM_12(int m, int n, int k, double alpha,
00024            double *A, int nra, double *B, int ncb, double beta, double *C,
00025            int ncc)
00026 {
00027   //  the only strange thing we need to do is reverse everything
00028   //  since the stride runs differently in C vs. Fortran
00029 
00030   /* also, do nothing if a dimension is 0 */
00031   if (m == 0 || n == 0 || k == 0) return;
00032 
00033   F_DGEMM("t","t",&n,&m,&k,&alpha,B,&ncb,A,&nra,&beta,C,&ncc);
00034 }
00035 
00036 /*
00037 ** C_DGEMM_22()
00038 **
00039 ** This function calculates C(m,n)=alpha*A(m,k)*B(n,k)+ beta*C(m,n)
00040 **
00041 ** nra = number of columns in A
00042 ** ncb = number of columns in B
00043 ** ncc = number of columns in C
00044 */
00045 void C_DGEMM_22(int m, int n, int k, double alpha,
00046            double *A, int nca, double *B, int ncb, double beta, double *C,
00047            int ncc)
00048 {
00049   //  the only strange thing we need to do is reverse everything
00050   //  since the stride runs differently in C vs. Fortran
00051 
00052   /* also, do nothing if a dimension is 0 */
00053   if (m == 0 || n == 0 || k == 0) return;
00054 
00055   F_DGEMM("t","n",&n,&m,&k,&alpha,B,&ncb,A,&nca,&beta,C,&ncc);
00056 }
00057 
00058 
00059 }} /* End Namespaces */

Generated on Wed Feb 13 16:35:39 2008 for PSI by  doxygen 1.5.4