C-XSC - A C++ Class Library for Extended Scientific Computing
2.5.4
|
00001 /* 00002 ** CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4) 00003 ** 00004 ** Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik, 00005 ** Universitaet Karlsruhe, Germany 00006 ** (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie 00007 ** Universitaet Wuppertal, Germany 00008 ** 00009 ** This library is free software; you can redistribute it and/or 00010 ** modify it under the terms of the GNU Library General Public 00011 ** License as published by the Free Software Foundation; either 00012 ** version 2 of the License, or (at your option) any later version. 00013 ** 00014 ** This library is distributed in the hope that it will be useful, 00015 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 ** Library General Public License for more details. 00018 ** 00019 ** You should have received a copy of the GNU Library General Public 00020 ** License along with this library; if not, write to the Free 00021 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 */ 00023 00024 /* CVS $Id: cmatrix.cpp,v 1.27 2014/01/30 17:23:44 cxsc Exp $ */ 00025 00026 #define _CXSC_CPP 00027 00028 #include "cmatrix.hpp" 00029 #include "matrix.inl" 00030 #include "cmatrix.inl" 00031 #include "cvecrmat.inl" 00032 00033 #include "cdotk.inl" 00034 00035 #include "idotk.inl" 00036 #include "imatrix.hpp" 00037 #include "ivector.hpp" 00038 00039 namespace cxsc { 00040 00041 //Ostrowskis comparison matrix 00042 rmatrix CompMat ( const cmatrix& A) { 00043 rmatrix M(Lb(A,1), Ub(A,1), Lb(A,2), Ub(A,2)); 00044 00045 for(int i=Lb(A,1) ; i<=Ub(A,1) ; i++) { 00046 for(int j=Lb(A,2) ; j<=Ub(A,2) ; j++) { 00047 if(i-Lb(A,1) == j-Lb(A,2)) 00048 M[i][j] = abs(A[i][j]); 00049 else 00050 M[i][j] = -abs(A[i][j]); 00051 } 00052 } 00053 00054 return M; 00055 } 00056 00057 00058 cmatrix Id ( cmatrix& A ) // Complex identity matrix 00059 { //------------------------- 00060 int i,j; 00061 int lbi = Lb(A,1), ubi = Ub(A,1); 00062 int lbj = Lb(A,2), ubj = Ub(A,2); 00063 cmatrix B(lbi,ubi,lbj,ubj); 00064 00065 for (i = lbi; i <= ubi; i++) 00066 for (j = lbj; j <= ubj; j++) 00067 B[i][j] = complex( (i==j) ? 1.0 : 0.0 ); 00068 return B; 00069 } 00070 00071 cmatrix transp ( const cmatrix& A ) // Transposed matrix 00072 { //------------------ 00073 int n; 00074 cmatrix res(Lb(A,2),Ub(A,2),Lb(A,1),Ub(A,1)); 00075 00076 for (n = Lb(A,1); n <= Ub(A,1); n++) Col(res,n) = Row(A,n); 00077 return res; 00078 } 00079 00080 void DoubleSize ( cmatrix& A ) 00081 { 00082 int n = Lb(A,1); 00083 Resize(A,n,2*Ub(A,1)-n+1,Lb(A,2),Ub(A,2)); 00084 } 00085 00086 void accumulate(cdotprecision &dp, const cmatrix_subv & rv1, const cmatrix_subv &rv2) 00087 #if(CXSC_INDEX_CHECK) 00088 throw(OP_WITH_WRONG_DIM) 00089 #else 00090 throw() 00091 #endif 00092 { 00093 #if(CXSC_INDEX_CHECK) 00094 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cmatrix_subv &, const cmatrix_subv &)")); 00095 #endif 00096 addDot_op(dp,rv1,rv2); 00097 } 00098 00099 void accumulate_approx(cdotprecision &dp, const cmatrix_subv & rv1, const cmatrix_subv &rv2) 00100 { 00101 addDot_op(dp,rv1,rv2); 00102 } 00103 00104 00105 void accumulate(cdotprecision &dp, const cvector & rv1, const cmatrix_subv &rv2) 00106 #if(CXSC_INDEX_CHECK) 00107 throw(OP_WITH_WRONG_DIM) 00108 #else 00109 throw() 00110 #endif 00111 { 00112 #if(CXSC_INDEX_CHECK) 00113 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cvector &, const cmatrix_subv &)")); 00114 #endif 00115 addDot(dp,rv1,rv2); 00116 } 00117 00118 void accumulate_approx(cdotprecision &dp, const cvector & rv1, const cmatrix_subv &rv2) 00119 { 00120 addDot_op(dp,rv1,rv2); 00121 } 00122 00123 00124 void accumulate(cdotprecision &dp, const cmatrix_subv & rv1, const cvector &rv2) 00125 #if(CXSC_INDEX_CHECK) 00126 throw(OP_WITH_WRONG_DIM) 00127 #else 00128 throw() 00129 #endif 00130 { 00131 #if(CXSC_INDEX_CHECK) 00132 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cmatrix_subv &, const cvector &)")); 00133 #endif 00134 addDot(dp,rv1,rv2); 00135 } 00136 00137 void accumulate_approx(cdotprecision &dp, const cmatrix_subv & rv1, const cvector &rv2) 00138 { 00139 addDot_op(dp,rv1,rv2); 00140 } 00141 00142 00143 void accumulate(cdotprecision &dp, const cvector_slice & sl1, const cmatrix_subv &rv2) 00144 #if(CXSC_INDEX_CHECK) 00145 throw(OP_WITH_WRONG_DIM) 00146 #else 00147 throw() 00148 #endif 00149 { 00150 #if(CXSC_INDEX_CHECK) 00151 if(VecLen(sl1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cvector_slice &, const cmatrix_subv &)")); 00152 #endif 00153 addDot(dp,sl1,rv2); 00154 } 00155 00156 void accumulate_approx(cdotprecision &dp, const cvector_slice & sl1, const cmatrix_subv &rv2) 00157 { 00158 addDot_op(dp,sl1,rv2); 00159 } 00160 00161 00162 void accumulate(cdotprecision &dp, const cmatrix_subv & rv1, const cvector_slice &sl2) 00163 #if(CXSC_INDEX_CHECK) 00164 throw(OP_WITH_WRONG_DIM) 00165 #else 00166 throw() 00167 #endif 00168 { 00169 #if(CXSC_INDEX_CHECK) 00170 if(VecLen(rv1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cmatrix_subv &, const cvector_slice &)")); 00171 #endif 00172 addDot(dp,rv1,sl2); 00173 } 00174 00175 void accumulate_approx(cdotprecision &dp, const cmatrix_subv & rv1, const cvector_slice &sl2) 00176 { 00177 addDot_op(dp,rv1,sl2); 00178 } 00179 00180 void accumulate(cidotprecision &dp, const cmatrix_subv & rv1, const cmatrix_subv &rv2) 00181 #if(CXSC_INDEX_CHECK) 00182 throw(OP_WITH_WRONG_DIM) 00183 #else 00184 throw() 00185 #endif 00186 { 00187 #if(CXSC_INDEX_CHECK) 00188 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cmatrix_subv &, const cmatrix_subv &)")); 00189 #endif 00190 cdotprecision tmp(0.0); 00191 tmp.set_k(dp.get_k()); 00192 addDot(tmp,rv1,rv2); 00193 dp += tmp; 00194 } 00195 00196 void accumulate(cidotprecision &dp, const cvector & rv1, const cmatrix_subv &rv2) 00197 #if(CXSC_INDEX_CHECK) 00198 throw(OP_WITH_WRONG_DIM) 00199 #else 00200 throw() 00201 #endif 00202 { 00203 #if(CXSC_INDEX_CHECK) 00204 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector &, const cmatrix_subv &)")); 00205 #endif 00206 cdotprecision tmp(0.0); 00207 tmp.set_k(dp.get_k()); 00208 addDot(tmp,rv1,rv2); 00209 dp += tmp; 00210 } 00211 00212 void accumulate(cidotprecision &dp, const cmatrix_subv & rv1, const cvector &rv2) 00213 #if(CXSC_INDEX_CHECK) 00214 throw(OP_WITH_WRONG_DIM) 00215 #else 00216 throw() 00217 #endif 00218 { 00219 #if(CXSC_INDEX_CHECK) 00220 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cmatrix_subv &, const cvector &)")); 00221 #endif 00222 cdotprecision tmp(0.0); 00223 tmp.set_k(dp.get_k()); 00224 addDot(tmp,rv1,rv2); 00225 dp += tmp; 00226 } 00227 00228 void accumulate(cidotprecision &dp, const cvector_slice & sl1, const cmatrix_subv &rv2) 00229 #if(CXSC_INDEX_CHECK) 00230 throw(OP_WITH_WRONG_DIM) 00231 #else 00232 throw() 00233 #endif 00234 { 00235 #if(CXSC_INDEX_CHECK) 00236 if(VecLen(sl1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector_slice &, const cmatrix_subv &)")); 00237 #endif 00238 cdotprecision tmp(0.0); 00239 tmp.set_k(dp.get_k()); 00240 addDot(tmp,sl1,rv2); 00241 dp += tmp; 00242 } 00243 00244 void accumulate(cidotprecision &dp, const cmatrix_subv & rv1, const cvector_slice &sl2) 00245 #if(CXSC_INDEX_CHECK) 00246 throw(OP_WITH_WRONG_DIM) 00247 #else 00248 throw() 00249 #endif 00250 { 00251 #if(CXSC_INDEX_CHECK) 00252 if(VecLen(rv1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cmatrix_subv &, const cvector_slice &)")); 00253 #endif 00254 cdotprecision tmp(0.0); 00255 tmp.set_k(dp.get_k()); 00256 addDot(tmp,rv1,sl2); 00257 dp += tmp; 00258 } 00259 00260 void accumulate(cdotprecision &dp, const rmatrix_subv & rv1, const cmatrix_subv &rv2) 00261 #if(CXSC_INDEX_CHECK) 00262 throw(OP_WITH_WRONG_DIM) 00263 #else 00264 throw() 00265 #endif 00266 { 00267 #if(CXSC_INDEX_CHECK) 00268 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const rmatrix_subv &, const cmatrix_subv &)")); 00269 #endif 00270 addDot(Re(dp),rv1,Re(rv2)); 00271 addDot(Im(dp),rv1,Im(rv2)); 00272 } 00273 00274 void accumulate_approx(cdotprecision &dp, const rmatrix_subv & rv1, const cmatrix_subv &rv2) 00275 { 00276 addDot_op(Re(dp),rv1,Re(rv2)); 00277 addDot_op(Im(dp),rv1,Im(rv2)); 00278 } 00279 00280 void accumulate(cdotprecision &dp, const rmatrix_subv & rv1, const cvector_slice &rv2) 00281 #if(CXSC_INDEX_CHECK) 00282 throw(OP_WITH_WRONG_DIM) 00283 #else 00284 throw() 00285 #endif 00286 { 00287 #if(CXSC_INDEX_CHECK) 00288 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const rmatrix_subv &, const cvector_slice &)")); 00289 #endif 00290 addDot(Re(dp),rv1,Re(rv2)); 00291 addDot(Im(dp),rv1,Im(rv2)); 00292 } 00293 00294 void accumulate_approx(cdotprecision &dp, const rmatrix_subv & rv1, const cvector_slice &rv2) 00295 { 00296 addDot_op(Re(dp),rv1,Re(rv2)); 00297 addDot_op(Im(dp),rv1,Im(rv2)); 00298 } 00299 00300 00301 void accumulate(cdotprecision &dp, const rmatrix_subv & rv1, const cvector &rv2) 00302 #if(CXSC_INDEX_CHECK) 00303 throw(OP_WITH_WRONG_DIM) 00304 #else 00305 throw() 00306 #endif 00307 { 00308 #if(CXSC_INDEX_CHECK) 00309 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const rmatrix_subv &, const cvector &)")); 00310 #endif 00311 addDot(Re(dp),rv1,Re(rv2)); 00312 addDot(Im(dp),rv1,Im(rv2)); 00313 } 00314 00315 void accumulate_approx(cdotprecision &dp, const rmatrix_subv & rv1, const cvector &rv2) 00316 { 00317 addDot_op(Re(dp),rv1,Re(rv2)); 00318 addDot_op(Im(dp),rv1,Im(rv2)); 00319 } 00320 00321 00322 void accumulate(cdotprecision &dp, const cmatrix_subv & rv1, const rmatrix_subv &rv2) 00323 #if(CXSC_INDEX_CHECK) 00324 throw(OP_WITH_WRONG_DIM) 00325 #else 00326 throw() 00327 #endif 00328 { 00329 #if(CXSC_INDEX_CHECK) 00330 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cmatrix_subv &, const rmatrix_subv &)")); 00331 #endif 00332 addDot(Re(dp),Re(rv1),rv2); 00333 addDot(Im(dp),Im(rv1),rv2); 00334 } 00335 00336 void accumulate_approx(cdotprecision &dp, const cmatrix_subv & rv1, const rmatrix_subv &rv2) 00337 { 00338 addDot_op(Re(dp),Re(rv1),rv2); 00339 addDot_op(Im(dp),Im(rv1),rv2); 00340 } 00341 00342 void accumulate(cdotprecision &dp, const cvector & rv1, const rmatrix_subv &rv2) 00343 #if(CXSC_INDEX_CHECK) 00344 throw(OP_WITH_WRONG_DIM) 00345 #else 00346 throw() 00347 #endif 00348 { 00349 #if(CXSC_INDEX_CHECK) 00350 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cvector &, const rmatrix_subv &)")); 00351 #endif 00352 addDot(Re(dp),Re(rv1),rv2); 00353 addDot(Im(dp),Im(rv1),rv2); 00354 } 00355 00356 void accumulate_approx(cdotprecision &dp, const cvector & rv1, const rmatrix_subv &rv2) 00357 { 00358 addDot_op(Re(dp),Re(rv1),rv2); 00359 addDot_op(Im(dp),Im(rv1),rv2); 00360 } 00361 00362 void accumulate(cdotprecision &dp, const cvector_slice & rv1, const rmatrix_subv &rv2) 00363 #if(CXSC_INDEX_CHECK) 00364 throw(OP_WITH_WRONG_DIM) 00365 #else 00366 throw() 00367 #endif 00368 { 00369 #if(CXSC_INDEX_CHECK) 00370 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cvector_slice &, const rmatrix_subv &)")); 00371 #endif 00372 addDot(Re(dp),Re(rv1),rv2); 00373 addDot(Im(dp),Im(rv1),rv2); 00374 } 00375 00376 void accumulate_approx(cdotprecision &dp, const cvector_slice & rv1, const rmatrix_subv &rv2) 00377 { 00378 addDot_op(Re(dp),Re(rv1),rv2); 00379 addDot_op(Im(dp),Im(rv1),rv2); 00380 } 00381 00382 void accumulate(cdotprecision &dp, const rvector & rv1, const cmatrix_subv &rv2) 00383 #if(CXSC_INDEX_CHECK) 00384 throw(OP_WITH_WRONG_DIM) 00385 #else 00386 throw() 00387 #endif 00388 { 00389 #if(CXSC_INDEX_CHECK) 00390 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const rvector &, const cmatrix_subv &)")); 00391 #endif 00392 addDot(Re(dp),rv1,Re(rv2)); 00393 addDot(Im(dp),rv1,Im(rv2)); 00394 } 00395 00396 void accumulate_approx(cdotprecision &dp, const rvector & rv1, const cmatrix_subv &rv2) 00397 { 00398 addDot_op(Re(dp),rv1,Re(rv2)); 00399 addDot_op(Im(dp),rv1,Im(rv2)); 00400 } 00401 00402 void accumulate(cdotprecision &dp, const cmatrix_subv & rv1, const rvector &rv2) 00403 #if(CXSC_INDEX_CHECK) 00404 throw(OP_WITH_WRONG_DIM) 00405 #else 00406 throw() 00407 #endif 00408 { 00409 #if(CXSC_INDEX_CHECK) 00410 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cmatrix_subv &, const rvector &)")); 00411 #endif 00412 addDot(Re(dp),Re(rv1),rv2); 00413 addDot(Im(dp),Im(rv1),rv2); 00414 } 00415 00416 void accumulate_approx(cdotprecision &dp, const cmatrix_subv & rv1, const rvector &rv2) 00417 { 00418 addDot_op(Re(dp),Re(rv1),rv2); 00419 addDot_op(Im(dp),Im(rv1),rv2); 00420 } 00421 00422 void accumulate(cdotprecision &dp, const rvector_slice & sl1, const cmatrix_subv &rv2) 00423 #if(CXSC_INDEX_CHECK) 00424 throw(OP_WITH_WRONG_DIM) 00425 #else 00426 throw() 00427 #endif 00428 { 00429 #if(CXSC_INDEX_CHECK) 00430 if(VecLen(sl1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const rvector_slice &, const cmatrix_subv &)")); 00431 #endif 00432 addDot(Re(dp),sl1,Re(rv2)); 00433 addDot(Im(dp),sl1,Im(rv2)); 00434 } 00435 00436 void accumulate_approx(cdotprecision &dp, const rvector_slice & sl1, const cmatrix_subv &rv2) 00437 { 00438 addDot_op(Re(dp),sl1,Re(rv2)); 00439 addDot_op(Im(dp),sl1,Im(rv2)); 00440 } 00441 00442 void accumulate(cdotprecision &dp, const cmatrix_subv & rv1, const rvector_slice &sl2) 00443 #if(CXSC_INDEX_CHECK) 00444 throw(OP_WITH_WRONG_DIM) 00445 #else 00446 throw() 00447 #endif 00448 { 00449 #if(CXSC_INDEX_CHECK) 00450 if(VecLen(rv1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cmatrix_subv &, const rvector_slice &)")); 00451 #endif 00452 addDot(Re(dp),Re(rv1),sl2); 00453 addDot(Im(dp),Im(rv1),sl2); 00454 } 00455 00456 void accumulate_approx(cdotprecision &dp, const cmatrix_subv & rv1, const rvector_slice &sl2) 00457 { 00458 addDot_op(Re(dp),Re(rv1),sl2); 00459 addDot_op(Im(dp),Im(rv1),sl2); 00460 } 00461 00462 void accumulate(cidotprecision &dp, const rmatrix_subv & rv1, const cmatrix_subv &rv2) 00463 #if(CXSC_INDEX_CHECK) 00464 throw(OP_WITH_WRONG_DIM) 00465 #else 00466 throw() 00467 #endif 00468 { 00469 #if(CXSC_INDEX_CHECK) 00470 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const rmatrix_subv &, const cmatrix_subv &)")); 00471 #endif 00472 cdotprecision tmp(0.0); 00473 tmp.set_k(dp.get_k()); 00474 addDot(Re(tmp),rv1,Re(rv2)); 00475 addDot(Im(tmp),rv1,Im(rv2)); 00476 dp += tmp; 00477 } 00478 00479 void accumulate(cidotprecision &dp, const cmatrix_subv & rv1, const rmatrix_subv &rv2) 00480 #if(CXSC_INDEX_CHECK) 00481 throw(OP_WITH_WRONG_DIM) 00482 #else 00483 throw() 00484 #endif 00485 { 00486 #if(CXSC_INDEX_CHECK) 00487 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cmatrix_subv &, const rmatrix_subv &)")); 00488 #endif 00489 cdotprecision tmp(0.0); 00490 tmp.set_k(dp.get_k()); 00491 addDot(Re(tmp),Re(rv1),rv2); 00492 addDot(Im(tmp),Im(rv1),rv2); 00493 dp += tmp; 00494 } 00495 00496 void accumulate(cidotprecision &dp, const rvector & rv1, const cmatrix_subv &rv2) 00497 #if(CXSC_INDEX_CHECK) 00498 throw(OP_WITH_WRONG_DIM) 00499 #else 00500 throw() 00501 #endif 00502 { 00503 #if(CXSC_INDEX_CHECK) 00504 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const rvector &, const cmatrix_subv &)")); 00505 #endif 00506 cdotprecision tmp(0.0); 00507 tmp.set_k(dp.get_k()); 00508 addDot(Re(tmp),rv1,Re(rv2)); 00509 addDot(Im(tmp),rv1,Im(rv2)); 00510 dp += tmp; 00511 } 00512 00513 void accumulate(cidotprecision &dp, const cmatrix_subv & rv1, const rvector &rv2) 00514 #if(CXSC_INDEX_CHECK) 00515 throw(OP_WITH_WRONG_DIM) 00516 #else 00517 throw() 00518 #endif 00519 { 00520 #if(CXSC_INDEX_CHECK) 00521 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cmatrix_subv &, const rvector &)")); 00522 #endif 00523 cdotprecision tmp(0.0); 00524 tmp.set_k(dp.get_k()); 00525 addDot(Re(tmp),Re(rv1),rv2); 00526 addDot(Im(tmp),Im(rv1),rv2); 00527 dp += tmp; 00528 } 00529 00530 void accumulate(cidotprecision &dp, const rvector_slice & sl1, const cmatrix_subv &rv2) 00531 #if(CXSC_INDEX_CHECK) 00532 throw(OP_WITH_WRONG_DIM) 00533 #else 00534 throw() 00535 #endif 00536 { 00537 #if(CXSC_INDEX_CHECK) 00538 if(VecLen(sl1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const rvector_slice &, const cmatrix_subv &)")); 00539 #endif 00540 cdotprecision tmp(0.0); 00541 tmp.set_k(dp.get_k()); 00542 addDot(Re(tmp),sl1,Re(rv2)); 00543 addDot(Im(tmp),sl1,Im(rv2)); 00544 dp += tmp; 00545 } 00546 00547 void accumulate(cidotprecision &dp, const cmatrix_subv & rv1, const rvector_slice &sl2) 00548 #if(CXSC_INDEX_CHECK) 00549 throw(OP_WITH_WRONG_DIM) 00550 #else 00551 throw() 00552 #endif 00553 { 00554 #if(CXSC_INDEX_CHECK) 00555 if(VecLen(rv1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cmatrix_subv &, const rvector_slice &)")); 00556 #endif 00557 cdotprecision tmp(0.0); 00558 tmp.set_k(dp.get_k()); 00559 addDot(Re(tmp),Re(rv1),sl2); 00560 addDot(Im(tmp),Im(rv1),sl2); 00561 dp += tmp; 00562 } 00563 00564 void accumulate(cidotprecision &dp, const imatrix_subv & rv1, const cvector &rv2) 00565 #if(CXSC_INDEX_CHECK) 00566 throw(OP_WITH_WRONG_DIM) 00567 #else 00568 throw() 00569 #endif 00570 { 00571 #if(CXSC_INDEX_CHECK) 00572 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const imatrix_subv &, const cvector &)")); 00573 #endif 00574 idotprecision tmp_re(0.0); 00575 idotprecision tmp_im(0.0); 00576 tmp_re.set_k(dp.get_k()); 00577 tmp_im.set_k(dp.get_k()); 00578 addDot(tmp_re,rv1,Re(rv2)); 00579 addDot(tmp_im,rv1,Im(rv2)); 00580 dp += cidotprecision(tmp_re,tmp_im); 00581 } 00582 00583 void accumulate(cidotprecision &dp, const cvector & rv1, const imatrix_subv &rv2) 00584 #if(CXSC_INDEX_CHECK) 00585 throw(OP_WITH_WRONG_DIM) 00586 #else 00587 throw() 00588 #endif 00589 { 00590 #if(CXSC_INDEX_CHECK) 00591 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector &, const imatrix_subv &)")); 00592 #endif 00593 idotprecision tmp_re(0.0); 00594 idotprecision tmp_im(0.0); 00595 tmp_re.set_k(dp.get_k()); 00596 tmp_im.set_k(dp.get_k()); 00597 addDot(tmp_re,Re(rv1),rv2); 00598 addDot(tmp_im,Im(rv1),rv2); 00599 dp += cidotprecision(tmp_re,tmp_im); } 00600 00601 void accumulate(cidotprecision &dp, const imatrix_subv & rv1, const cvector_slice &rv2) 00602 #if(CXSC_INDEX_CHECK) 00603 throw(OP_WITH_WRONG_DIM) 00604 #else 00605 throw() 00606 #endif 00607 { 00608 #if(CXSC_INDEX_CHECK) 00609 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const imatrix_subv &, const cvector_slice &)")); 00610 #endif 00611 idotprecision tmp_re(0.0); 00612 idotprecision tmp_im(0.0); 00613 tmp_re.set_k(dp.get_k()); 00614 tmp_im.set_k(dp.get_k()); 00615 addDot(tmp_re,rv1,Re(rv2)); 00616 addDot(tmp_im,rv1,Im(rv2)); 00617 dp += cidotprecision(tmp_re,tmp_im); 00618 } 00619 00620 void accumulate(cidotprecision &dp, const cvector_slice & rv1, const imatrix_subv &rv2) 00621 #if(CXSC_INDEX_CHECK) 00622 throw(OP_WITH_WRONG_DIM) 00623 #else 00624 throw() 00625 #endif 00626 { 00627 #if(CXSC_INDEX_CHECK) 00628 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector_slice &, const imatrix_subv &)")); 00629 #endif 00630 idotprecision tmp_re(0.0); 00631 idotprecision tmp_im(0.0); 00632 tmp_re.set_k(dp.get_k()); 00633 tmp_im.set_k(dp.get_k()); 00634 addDot(tmp_re,Re(rv1),rv2); 00635 addDot(tmp_im,Im(rv1),rv2); 00636 dp += cidotprecision(tmp_re,tmp_im); 00637 } 00638 00639 void accumulate(cidotprecision &dp, const cmatrix_subv & rv1, const ivector &rv2) 00640 #if(CXSC_INDEX_CHECK) 00641 throw(OP_WITH_WRONG_DIM) 00642 #else 00643 throw() 00644 #endif 00645 { 00646 #if(CXSC_INDEX_CHECK) 00647 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cmatrix_subv &, const ivector &)")); 00648 #endif 00649 idotprecision tmp_re(0.0); 00650 idotprecision tmp_im(0.0); 00651 tmp_re.set_k(dp.get_k()); 00652 tmp_im.set_k(dp.get_k()); 00653 addDot(tmp_re,Re(rv1),rv2); 00654 addDot(tmp_im,Im(rv1),rv2); 00655 dp += cidotprecision(tmp_re,tmp_im); 00656 } 00657 00658 void accumulate(cidotprecision &dp, const ivector & rv1, const cmatrix_subv &rv2) 00659 #if(CXSC_INDEX_CHECK) 00660 throw(OP_WITH_WRONG_DIM) 00661 #else 00662 throw() 00663 #endif 00664 { 00665 #if(CXSC_INDEX_CHECK) 00666 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const ivector &, const cmatrix_subv &)")); 00667 #endif 00668 idotprecision tmp_re(0.0); 00669 idotprecision tmp_im(0.0); 00670 tmp_re.set_k(dp.get_k()); 00671 tmp_im.set_k(dp.get_k()); 00672 addDot(tmp_re,rv1,Re(rv2)); 00673 addDot(tmp_im,rv1,Im(rv2)); 00674 dp += cidotprecision(tmp_re,tmp_im); 00675 } 00676 00677 void accumulate(cidotprecision &dp, const cmatrix_subv & rv1, const ivector_slice &rv2) 00678 #if(CXSC_INDEX_CHECK) 00679 throw(OP_WITH_WRONG_DIM) 00680 #else 00681 throw() 00682 #endif 00683 { 00684 #if(CXSC_INDEX_CHECK) 00685 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cmatrix_subv &, const ivector_slice &)")); 00686 #endif 00687 idotprecision tmp_re(0.0); 00688 idotprecision tmp_im(0.0); 00689 tmp_re.set_k(dp.get_k()); 00690 tmp_im.set_k(dp.get_k()); 00691 addDot(tmp_re,Re(rv1),rv2); 00692 addDot(tmp_im,Im(rv1),rv2); 00693 dp += cidotprecision(tmp_re,tmp_im); 00694 } 00695 00696 void accumulate(cidotprecision &dp, const ivector_slice & rv1, const cmatrix_subv &rv2) 00697 #if(CXSC_INDEX_CHECK) 00698 throw(OP_WITH_WRONG_DIM) 00699 #else 00700 throw() 00701 #endif 00702 { 00703 #if(CXSC_INDEX_CHECK) 00704 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const ivector_slice &, const cmatrix_subv &)")); 00705 #endif 00706 idotprecision tmp_re(0.0); 00707 idotprecision tmp_im(0.0); 00708 tmp_re.set_k(dp.get_k()); 00709 tmp_im.set_k(dp.get_k()); 00710 addDot(tmp_re,rv1,Re(rv2)); 00711 addDot(tmp_im,rv1,Im(rv2)); 00712 dp += cidotprecision(tmp_re,tmp_im); 00713 } 00714 00715 } // namespace cxsc 00716