00001
00003 inline dgematrix& dgematrix::operator=(const dsymatrix& mat)
00004 {
00005 #ifdef CPPL_VERBOSE
00006 std::cerr << "# [MARK] dgematrix::operator=(const dsymatrix&)"
00007 << std::endl;
00008 #endif//CPPL_VERBOSE
00009
00010 resize(mat.N, mat.N);
00011 for(long i=0; i<mat.N; i++){
00012 for(long j=0; j<mat.N; j++){
00013 operator()(i,j) =mat(i,j);
00014 }
00015 }
00016
00017 return *this;
00018 }
00019
00023
00024
00026 inline dgematrix& dgematrix::operator+=(const dsymatrix& mat)
00027 {
00028 #ifdef CPPL_VERBOSE
00029 std::cerr << "# [MARK] dgematrix::operator+=(const dsymatrix&)"
00030 << std::endl;
00031 #endif//CPPL_VERBOSE
00032
00033 #ifdef CPPL_DEBUG
00034 if(N!=mat.N || M!=mat.N){
00035 std::cerr << "[ERROR] dgematrix::operator+=(dsymatrix&)" << std::endl
00036 << "These two matrises can not make a summation." << std::endl
00037 << "Your input was (" << M << "x" << N << ") += ("
00038 << mat.N << "x" << mat.N << ")." << std::endl;
00039 exit(1);
00040 }
00041 #endif//CPPL_DEBUG
00042
00043 for(long i=0; i<M; i++){
00044 for( long j=0; j<N; j++){
00045 operator() (i,j) += mat(i,j);
00046 }
00047 }
00048
00049 return *this;
00050 }
00051
00052
00054 inline dgematrix& dgematrix::operator-=(const dsymatrix& mat)
00055 {
00056 #ifdef CPPL_VERBOSE
00057 std::cerr << "# [MARK] dgematrix::operator-=(const dsymatrix&)"
00058 << std::endl;
00059 #endif//CPPL_VERBOSE
00060
00061 #ifdef CPPL_DEBUG
00062 if(N!=mat.N || M!=mat.N){
00063 std::cerr << "[ERROR] dgematrix::operator-=(dsymatrix&)" << std::endl
00064 << "These two matrises can not make a sutraction." << std::endl
00065 << "Your input was (" << M << "x" << N << ") -= ("
00066 << mat.N << "x" << mat.N << ")." << std::endl;
00067 exit(1);
00068 }
00069 #endif//CPPL_DEBUG
00070
00071 for(long i=0; i<M; i++){
00072 for(long j=0; j<N; j++){
00073 operator() (i,j) -= mat(i,j);
00074 }
00075 }
00076
00077 return *this;
00078 }
00079
00080
00082 inline dgematrix& dgematrix::operator*=(const dsymatrix& mat)
00083 {
00084 #ifdef CPPL_VERBOSE
00085 std::cerr << "# [MARK] dgematrix::operator*=(const dsymatrix&)"
00086 << std::endl;
00087 #endif//CPPL_VERBOSE
00088
00089 #ifdef CPPL_DEBUG
00090 if(N!=mat.N){
00091 std::cerr << "[ERROR] dgematrix::operator*=(dsymatrix&)" << std::endl
00092 << "These two matrises can not make a product." << std::endl
00093 << "Your input was (" << M << "x" << N << ") *= ("
00094 << mat.N << "x" << mat.N << ")." << std::endl;
00095 exit(1);
00096 }
00097 #endif//CPPL_DEBUG
00098
00099 dgematrix newmat( M, mat.N );
00100 dsymm_( 'R', 'L', mat.N, N, 1.0, mat.Array, mat.N,
00101 Array, M, 0.0, newmat.Array, newmat.M );
00102
00103 swap(*this,newmat);
00104 return *this;
00105 }
00106
00110
00111
00113 inline _dgematrix operator+(const dgematrix& matA, const dsymatrix& matB)
00114 {
00115 #ifdef CPPL_VERBOSE
00116 std::cerr << "# [MARK] operator+(const dgematrix&, const dsymatrix&)"
00117 << std::endl;
00118 #endif//CPPL_VERBOSE
00119
00120 #ifdef CPPL_DEBUG
00121 if(matA.N!=matB.N || matA.M!=matB.N){
00122 std::cerr << "[ERROR] operator+(const dgematrix&, const dsymatrix&)"
00123 << std::endl
00124 << "These two matrises can not make a summation." << std::endl
00125 << "Your input was (" << matA.M << "x" << matA.N << ") + ("
00126 << matB.N << "x" << matB.N << ")." << std::endl;
00127 exit(1);
00128 }
00129 #endif//CPPL_DEBUG
00130
00131 dgematrix newmat(matA);
00132 for(long i=0; i<matA.M; i++){
00133 for(long j=0; j<matA.N; j++){
00134 newmat(i,j) += matB(i,j);
00135 }
00136 }
00137
00138 return _(newmat);
00139 }
00140
00141
00143 inline _dgematrix operator-(const dgematrix& matA, const dsymatrix& matB)
00144 {
00145 #ifdef CPPL_VERBOSE
00146 std::cerr << "# [MARK] operator-(const dgematrix&, const dsymatrix&)"
00147 << std::endl;
00148 #endif//CPPL_VERBOSE
00149
00150 #ifdef CPPL_DEBUG
00151 if(matA.N!=matB.N || matA.M!=matB.N){
00152 std::cerr << "[ERROR] operator-(const dgematrix&, const dsymatrix&)"
00153 << std::endl
00154 << "These two matrises can not make a subtraction." << std::endl
00155 << "Your input was (" << matA.M << "x" << matA.N << ") - ("
00156 << matB.N << "x" << matB.N << ")." << std::endl;
00157 exit(1);
00158 }
00159 #endif//CPPL_DEBUG
00160
00161 dgematrix newmat(matA);
00162 for(long i=0; i<matA.M; i++){
00163 for(long j=0; j<matA.N; j++){
00164 newmat(i,j) -= matB(i,j);
00165 }
00166 }
00167
00168 return _(newmat);
00169 }
00170
00171
00173 inline _dgematrix operator*(const dgematrix& matA, const dsymatrix& matB)
00174 {
00175 #ifdef CPPL_VERBOSE
00176 std::cerr << "# [MARK] operator*(const dgematrix&, const dsymatrix&)"
00177 << std::endl;
00178 #endif//CPPL_VERBOSE
00179
00180 #ifdef CPPL_DEBUG
00181 if(matA.N!=matB.N){
00182 std::cerr << "[ERROR] operator*(const dgematrix&, const dsymatrix&)"
00183 << std::endl
00184 << "These two matrises can not make a product." << std::endl
00185 << "Your input was (" << matA.M << "x" << matA.N << ") * ("
00186 << matB.N << "x" << matB.N << ")." << std::endl;
00187 exit(1);
00188 }
00189 #endif//CPPL_DEBUG
00190
00191 dgematrix newmat( matA.N, matB.N );
00192 dsymm_( 'R', 'L', matB.N, matA.N, 1.0, matB.Array, matB.N,
00193 matA.Array, matA.M, 0.0, newmat.Array, newmat.M );
00194
00195 return _(newmat);
00196 }