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