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