00001
00003 inline _zgematrix operator+(const _zhematrix& matA, const _zgematrix& matB)
00004 {
00005 #ifdef CPPL_VERBOSE
00006 std::cerr << "# [MARK] operator+(const _zhematrix&, const _zgematrix&)"
00007 << std::endl;
00008 #endif//CPPL_VERBOSE
00009
00010 #ifdef CPPL_DEBUG
00011 if(matA.N!=matB.N || matA.N!=matB.M){
00012 std::cerr << "[ERROR] operator+(_zhematrix&, zgematrix&)" << std::endl
00013 << "These two matrises can not make a summation." << std::endl
00014 << "Your input was (" << matA.N << "x" << matA.N << ") + ("
00015 << matB.M << "x" << matB.N << ")." << std::endl;
00016 exit(1);
00017 }
00018 #endif//CPPL_DEBUG
00019
00020 for(long i=0; i<matA.N; i++){ for(long j=0; j<matA.N; j++){
00021 matB(i,j)+=matA(i,j);
00022 }}
00023
00024 matA.destroy();
00025 return matB;
00026 }
00027
00028
00030 inline _zgematrix operator-(const _zhematrix& matA, const _zgematrix& matB)
00031 {
00032 #ifdef CPPL_VERBOSE
00033 std::cerr << "# [MARK] operator-(const _zhematrix&, const _zgematrix&)"
00034 << std::endl;
00035 #endif//CPPL_VERBOSE
00036
00037 #ifdef CPPL_DEBUG
00038 if(matA.N!=matB.N || matA.N!=matB.M){
00039 std::cerr << "[ERROR] operator-(_zhematrix&, zgematrix&)" << std::endl
00040 << "These two matrises can not make a subtraction." << std::endl
00041 << "Your input was (" << matA.N << "x" << matA.N << ") - ("
00042 << matB.M << "x" << matB.N << ")." << std::endl;
00043 exit(1);
00044 }
00045 #endif//CPPL_DEBUG
00046
00047 for(long i=0; i<matA.N; i++){ for(long j=0; j<matA.N; j++){
00048 matB(i,j) =matA(i,j)-matB(i,j);
00049 }}
00050
00051 matA.destroy();
00052 return matB;
00053 }
00054
00055
00057 inline _zgematrix operator*(const _zhematrix& matA, const _zgematrix& matB)
00058 {
00059 #ifdef CPPL_VERBOSE
00060 std::cerr << "# [MARK] operator*(const _zhematrix&, const _zgematrix&)"
00061 << std::endl;
00062 #endif//CPPL_VERBOSE
00063
00064 #ifdef CPPL_DEBUG
00065 if(matA.N!=matB.M){
00066 std::cerr << "[ERROR] operator*(_zhematrix&, zgematrix&)" << std::endl
00067 << "These two matrises can not make a product." << std::endl
00068 << "Your input was (" << matA.N << "x" << matA.N << ") * ("
00069 << matB.M << "x" << matB.N << ")." << std::endl;
00070 exit(1);
00071 }
00072 #endif//CPPL_DEBUG
00073
00074 zgematrix newmat( matA.N, matB.N );
00075 zhemm_( 'L', 'L', matA.N, matB.N, std::complex<double>(1.0,0.0),
00076 matA.Array, matA.N, matB.Array, matB.M,
00077 std::complex<double>(0.0,0.0), newmat.array, newmat.m );
00078
00079 matA.destroy();
00080 matB.destroy();
00081 return _(newmat);
00082 }