Go to the documentation of this file.00001
00002
00003 inline _zgematrix operator+(const _zhematrix& matA, const zgematrix& matB)
00004 {VERBOSE_REPORT;
00005 #ifdef CPPL_DEBUG
00006 if(matA.n!=matB.n || matA.n!=matB.m){
00007 ERROR_REPORT;
00008 std::cerr << "These two matrises can not make a summation." << std::endl
00009 << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
00010 exit(1);
00011 }
00012 #endif//CPPL_DEBUG
00013
00014 zgematrix newmat(matA.n, matA.n);
00015 for(long i=0; i<matA.n; i++){ for(long j=0; j<matA.n; j++){
00016 newmat(i,j) =matA(i,j)+matB(i,j);
00017 }}
00018
00019 matA.destroy();
00020 return _(newmat);
00021 }
00022
00023
00024
00025 inline _zgematrix operator-(const _zhematrix& matA, const zgematrix& matB)
00026 {VERBOSE_REPORT;
00027 #ifdef CPPL_DEBUG
00028 if(matA.n!=matB.n || matA.n!=matB.m){
00029 ERROR_REPORT;
00030 std::cerr << "These two matrises can not make a subtraction." << std::endl
00031 << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
00032 exit(1);
00033 }
00034 #endif//CPPL_DEBUG
00035
00036 zgematrix newmat(matA.n, matA.n);
00037 for(long i=0; i<matA.n; i++){
00038 for(long j=0; j<matA.n; j++){
00039 newmat(i,j) =matA(i,j)-matB(i,j);
00040 }
00041 }
00042
00043 matA.destroy();
00044 return _(newmat);
00045 }
00046
00047
00048
00049 inline _zgematrix operator*(const _zhematrix& matA, const zgematrix& matB)
00050 {VERBOSE_REPORT;
00051 #ifdef CPPL_DEBUG
00052 if(matA.n!=matB.m){
00053 ERROR_REPORT;
00054 std::cerr << "These two matrises can not make a product." << std::endl
00055 << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
00056 exit(1);
00057 }
00058 #endif//CPPL_DEBUG
00059
00060 zgematrix newmat( matA.n, matB.n );
00061 zhemm_( 'l', 'l', matA.n, matB.n, comple(1.0,0.0),
00062 matA.array, matA.n, matB.array, matB.m,
00063 comple(0.0,0.0), newmat.array, newmat.m );
00064
00065 matA.destroy();
00066 return _(newmat);
00067 }