Go to the documentation of this file.00001
00002
00003 inline zhematrix& zhematrix::operator=(const zhematrix& mat)
00004 {VERBOSE_REPORT;
00005 if(array!=mat.array){
00006 copy(mat);
00007 }
00008 return *this;
00009 }
00010
00011
00012
00013
00014
00015
00016
00017 inline zhematrix& zhematrix::operator+=(const zhematrix& mat)
00018 {VERBOSE_REPORT;
00019 #ifdef CPPL_DEBUG
00020 if(n!=mat.n){
00021 ERROR_REPORT;
00022 std::cerr << "These two matrises can not make a summation." << std::endl
00023 << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl;
00024 exit(1);
00025 }
00026 #endif//CPPL_DEBUG
00027
00028 for(long i=0; i<n; i++){ for(long j=0; j<=i; j++){
00029 operator()(i,j) +=mat(i,j);
00030 }}
00031
00032 return *this;
00033 }
00034
00035
00036
00037 inline zhematrix& zhematrix::operator-=(const zhematrix& mat)
00038 {VERBOSE_REPORT;
00039 #ifdef CPPL_DEBUG
00040 if(n!=mat.n){
00041 ERROR_REPORT;
00042 std::cerr << "These two matrises can not make a sutraction." << std::endl
00043 << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl;
00044 exit(1);
00045 }
00046 #endif//CPPL_DEBUG
00047
00048 for(long i=0; i<n; i++){ for(long j=0; j<=i; j++){
00049 operator()(i,j) -=mat(i,j);
00050 }}
00051
00052 return *this;
00053 }
00054
00055
00056
00057 inline _zhematrix operator+(const zhematrix& matA, const zhematrix& matB)
00058 {VERBOSE_REPORT;
00059 #ifdef CPPL_DEBUG
00060 if(matA.n!=matB.n){
00061 ERROR_REPORT;
00062 std::cerr << "These two matrises can not make a summation." << std::endl
00063 << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
00064 exit(1);
00065 }
00066 #endif//CPPL_DEBUG
00067
00068 long n = matA.n;
00069 zhematrix newmat(n);
00070 for(long i=0; i<n; i++){ for(long j=0; j<=i; j++){
00071 newmat.array[i+n*j] = matA.array[i+n*j] + matB.array[i+n*j];
00072 }}
00073
00074 return _(newmat);
00075 }
00076
00077
00078
00079 inline _zhematrix operator-(const zhematrix& matA, const zhematrix& matB)
00080 {VERBOSE_REPORT;
00081 #ifdef CPPL_DEBUG
00082 if(matA.n!=matB.n){
00083 ERROR_REPORT;
00084 std::cerr << "These two matrises can not make a subtraction." << std::endl
00085 << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
00086 exit(1);
00087 }
00088 #endif//CPPL_DEBUG
00089
00090 long n = matA.n;
00091 zhematrix newmat(n);
00092 for(long i=0; i<n; i++){ for(long j=0; j<=i; j++){
00093 newmat.array[i+n*j] =matA.array[i+n*j]-matB.array[i+n*j];
00094 }}
00095
00096 return _(newmat);
00097 }
00098
00099
00100
00101 inline _zgematrix operator*(const zhematrix& matA, const zhematrix& matB)
00102 {VERBOSE_REPORT;
00103 #ifdef CPPL_DEBUG
00104 if(matA.n!=matB.n){
00105 ERROR_REPORT;
00106 std::cerr << "These two matrises can not make a product." << std::endl
00107 << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
00108 exit(1);
00109 }
00110 #endif//CPPL_DEBUG
00111
00112 matB.complete();
00113 zgematrix newmat( matA.n, matB.n );
00114
00115 zhemm_( 'l', 'l', matA.n, matB.n, comple(1.0,0.0),
00116 matA.array, matA.n, matB.array, matB.n,
00117 comple(0.0,0.0), newmat.array, newmat.m );
00118
00119 return _(newmat);
00120 }