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 return matB;
00025 }
00026
00027
00029 inline _zgematrix operator-(const zhematrix& matA, const _zgematrix& matB)
00030 {
00031 #ifdef CPPL_VERBOSE
00032 std::cerr << "# [MARK] operator-(const zhematrix&, const _zgematrix&)"
00033 << std::endl;
00034 #endif//CPPL_VERBOSE
00035
00036 #ifdef CPPL_DEBUG
00037 if(matA.N!=matB.N || matA.N!=matB.M){
00038 std::cerr << "[ERROR] operator-(zhematrix&, _zgematrix&)" << std::endl
00039 << "These two matrises can not make a subtraction." << std::endl
00040 << "Your input was (" << matA.N << "x" << matA.N << ") - ("
00041 << matB.M << "x" << matB.N << ")." << std::endl;
00042 exit(1);
00043 }
00044 #endif//CPPL_DEBUG
00045
00046 for(long i=0; i<matA.N; i++){ for(long j=0; j<matA.N; j++){
00047 matB(i,j) =matA(i,j)-matB(i,j);
00048 }}
00049
00050 return matB;
00051 }
00052
00053
00055 inline _zgematrix operator*(const zhematrix& matA, const _zgematrix& matB)
00056 {
00057 #ifdef CPPL_VERBOSE
00058 std::cerr << "# [MARK] operator*(const zhematrix&, const _zgematrix&)"
00059 << std::endl;
00060 #endif//CPPL_VERBOSE
00061
00062 #ifdef CPPL_DEBUG
00063 if(matA.N!=matB.M){
00064 std::cerr << "[ERROR] operator*(zhematrix&, _zgematrix&)" << std::endl
00065 << "These two matrises can not make a product." << std::endl
00066 << "Your input was (" << matA.N << "x" << matA.N << ") * ("
00067 << matB.M << "x" << matB.N << ")." << std::endl;
00068 exit(1);
00069 }
00070 #endif//CPPL_DEBUG
00071
00072 zgematrix newmat( matA.N, matB.N );
00073 zhemm_( 'L', 'L', matA.N, matB.N, std::complex<double>(1.0,0.0),
00074 matA.Array, matA.N, matB.Array, matB.M,
00075 std::complex<double>(0.0,0.0), newmat.array, newmat.m );
00076
00077 matB.destroy();
00078 return _(newmat);
00079 }