C-XSC - A C++ Class Library for Extended Scientific Computing 2.5.4
cimatrix.cpp
1/*
2** CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4)
3**
4** Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik,
5** Universitaet Karlsruhe, Germany
6** (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie
7** Universitaet Wuppertal, Germany
8**
9** This library is free software; you can redistribute it and/or
10** modify it under the terms of the GNU Library General Public
11** License as published by the Free Software Foundation; either
12** version 2 of the License, or (at your option) any later version.
13**
14** This library is distributed in the hope that it will be useful,
15** but WITHOUT ANY WARRANTY; without even the implied warranty of
16** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17** Library General Public License for more details.
18**
19** You should have received a copy of the GNU Library General Public
20** License along with this library; if not, write to the Free
21** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22*/
23
24/* CVS $Id: cimatrix.cpp,v 1.30 2014/01/30 17:23:43 cxsc Exp $ */
25
26#define _CXSC_CPP
27
28#include "cimatrix.hpp"
29#include "matrix.inl"
30#include "cimatrix.inl"
31#include "civecrmat.inl"
32#include "civeccmat.inl"
33#include "civecimat.inl"
34
35// they should also be included here
36#include "cvecimat.inl"
37#include "iveccmat.inl"
38#include "cmatimat.inl"
39
40#include "cidotk.inl"
41
42namespace cxsc {
43
44//Ostrowskis comparison matrix
46 rmatrix M(Lb(A,1), Ub(A,1), Lb(A,2), Ub(A,2));
47
48 for(int i=Lb(A,1) ; i<=Ub(A,1) ; i++) {
49 for(int j=Lb(A,2) ; j<=Ub(A,2) ; j++) {
50 if(i-Lb(A,1) == j-Lb(A,2))
51 M[i][j] = Inf(abs(A[i][j]));
52 else
53 M[i][j] = -Sup(abs(A[i][j]));
54 }
55 }
56
57 return M;
58}
59
60
61cimatrix Id ( const cimatrix& A ) // Interval identity matrix
62{ //-------------------------
63 int i,j;
64 int lbi = Lb(A,1), ubi = Ub(A,1);
65 int lbj = Lb(A,2), ubj = Ub(A,2);
66 cimatrix B(lbi,ubi,lbj,ubj);
67
68 for (i = lbi; i <= ubi; i++)
69 for (j = lbj; j <= ubj; j++)
70 B[i][j] = cinterval( (i==j) ? 1.0 : 0.0 );
71 return B;
72}
73
74cimatrix transp ( const cimatrix& A ) // Transposed matrix
75{ //------------------
76 int n;
77 cimatrix res(Lb(A,2),Ub(A,2),Lb(A,1),Ub(A,1));
78
79 for (n = Lb(A,1); n <= Ub(A,1); n++) Col(res,n) = Row(A,n);
80 return res;
81}
82
84{
85 int n = Lb(A,1);
86 Resize(A,n,2*Ub(A,1)-n+1,Lb(A,2),Ub(A,2));
87}
88
89
90 void accumulate(cidotprecision &dp, const cimatrix_subv & rv1, const cimatrix_subv &rv2)
91#if(CXSC_INDEX_CHECK)
92
93#else
94 noexcept
95#endif
96 {
97#if(CXSC_INDEX_CHECK)
98 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cimatrix_subv &, const cimatrix_subv &)"));
99#endif
100 addDot(dp,rv1,rv2);
101 }
102
103 void accumulate(cidotprecision &dp, const civector & rv1, const cimatrix_subv &rv2)
104#if(CXSC_INDEX_CHECK)
105
106#else
107 noexcept
108#endif
109 {
110#if(CXSC_INDEX_CHECK)
111 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const civector &, const cimatrix_subv &)"));
112#endif
113 addDot(dp,rv1,rv2);
114 }
115
116 void accumulate(cidotprecision &dp, const cimatrix_subv & rv1, const civector &rv2)
117#if(CXSC_INDEX_CHECK)
118
119#else
120 noexcept
121#endif
122 {
123#if(CXSC_INDEX_CHECK)
124 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cimatrix_subv &, const civector &)"));
125#endif
126 addDot(dp,rv1,rv2);
127 }
128
129 void accumulate(cidotprecision &dp, const civector_slice & sl1, const cimatrix_subv &rv2)
130#if(CXSC_INDEX_CHECK)
131
132#else
133 noexcept
134#endif
135 {
136#if(CXSC_INDEX_CHECK)
137 if(VecLen(sl1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const civector_slice &, const cimatrix_subv &)"));
138#endif
139 addDot(dp,sl1,rv2);
140 }
141
142 void accumulate(cidotprecision &dp, const cimatrix_subv & rv1, const civector_slice &sl2)
143#if(CXSC_INDEX_CHECK)
144
145#else
146 noexcept
147#endif
148 {
149#if(CXSC_INDEX_CHECK)
150 if(VecLen(rv1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cimatrix_subv &, const civector_slice &)"));
151#endif
152 addDot(dp,rv1,sl2);
153 }
154
155 void accumulate(cidotprecision &dp, const cimatrix_subv & rv1, const rmatrix_subv &rv2)
156#if(CXSC_INDEX_CHECK)
157
158#else
159 noexcept
160#endif
161 {
162#if(CXSC_INDEX_CHECK)
163 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cimatrix_subv &, const rmatrix_subv &)"));
164#endif
165 idotprecision tmp_re(0.0);
166 idotprecision tmp_im(0.0);
167 tmp_re.set_k(dp.get_k());
168 tmp_im.set_k(dp.get_k());
169 addDot(tmp_re,Re(rv1),rv2);
170 addDot(tmp_im,Im(rv1),rv2);
171 dp += cidotprecision(tmp_re,tmp_im);
172 }
173
174 void accumulate(cidotprecision &dp, const cimatrix_subv & rv1, const rvector_slice &sl2)
175#if(CXSC_INDEX_CHECK)
176
177#else
178 noexcept
179#endif
180 {
181#if(CXSC_INDEX_CHECK)
182 if(VecLen(rv1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cimatrix_subv &, const rvector_slice &)"));
183#endif
184 idotprecision tmp_re(0.0);
185 idotprecision tmp_im(0.0);
186 tmp_re.set_k(dp.get_k());
187 tmp_im.set_k(dp.get_k());
188 addDot(tmp_re,Re(rv1),sl2);
189 addDot(tmp_im,Im(rv1),sl2);
190 dp += cidotprecision(tmp_re,tmp_im);
191 }
192
193 void accumulate(cidotprecision &dp, const cimatrix_subv & rv1, const rvector &rv2)
194#if(CXSC_INDEX_CHECK)
195
196#else
197 noexcept
198#endif
199 {
200#if(CXSC_INDEX_CHECK)
201 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cimatrix_subv &, const rvector &)"));
202#endif
203 idotprecision tmp_re(0.0);
204 idotprecision tmp_im(0.0);
205 tmp_re.set_k(dp.get_k());
206 tmp_im.set_k(dp.get_k());
207 addDot(tmp_re,Re(rv1),rv2);
208 addDot(tmp_im,Im(rv1),rv2);
209 dp += cidotprecision(tmp_re,tmp_im);
210 }
211
212 void accumulate(cidotprecision &dp, const rmatrix_subv & rv1, const cimatrix_subv &rv2)
213#if(CXSC_INDEX_CHECK)
214
215#else
216 noexcept
217#endif
218 {
219#if(CXSC_INDEX_CHECK)
220 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const rmatrix_subv &, const cimatrix_subv &)"));
221#endif
222 idotprecision tmp_re(0.0);
223 idotprecision tmp_im(0.0);
224 tmp_re.set_k(dp.get_k());
225 tmp_im.set_k(dp.get_k());
226 addDot(tmp_re,rv1,Re(rv2));
227 addDot(tmp_im,rv1,Im(rv2));
228 dp += cidotprecision(tmp_re,tmp_im);
229 }
230
231 void accumulate(cidotprecision &dp, const rvector_slice & sl1, const cimatrix_subv &rv2)
232#if(CXSC_INDEX_CHECK)
233
234#else
235 noexcept
236#endif
237 {
238#if(CXSC_INDEX_CHECK)
239 if(VecLen(sl1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const rvector_slice &, const cimatrix_subv &)"));
240#endif
241 idotprecision tmp_re(0.0);
242 idotprecision tmp_im(0.0);
243 tmp_re.set_k(dp.get_k());
244 tmp_im.set_k(dp.get_k());
245 addDot(tmp_re,sl1,Re(rv2));
246 addDot(tmp_im,sl1,Im(rv2));
247 dp += cidotprecision(tmp_re,tmp_im);
248 }
249
250 void accumulate(cidotprecision &dp, const rvector & rv1, const cimatrix_subv &rv2)
251#if(CXSC_INDEX_CHECK)
252
253#else
254 noexcept
255#endif
256 {
257#if(CXSC_INDEX_CHECK)
258 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const rvector &, const cimatrix_subv &)"));
259#endif
260 idotprecision tmp_re(0.0);
261 idotprecision tmp_im(0.0);
262 tmp_re.set_k(dp.get_k());
263 tmp_im.set_k(dp.get_k());
264 addDot(tmp_re,rv1,Re(rv2));
265 addDot(tmp_im,rv1,Im(rv2));
266 dp += cidotprecision(tmp_re,tmp_im);
267 }
268
269// complex
270 void accumulate(cidotprecision &dp, const cimatrix_subv & rv1, const cmatrix_subv &rv2)
271#if(CXSC_INDEX_CHECK)
272
273#else
274 noexcept
275#endif
276 {
277#if(CXSC_INDEX_CHECK)
278 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cimatrix_subv &, const cmatrix_subv &)"));
279#endif
280 addDot(dp,rv1,rv2);
281 }
282
283 void accumulate(cidotprecision &dp, const cimatrix_subv & rv1, const cvector_slice &sl2)
284#if(CXSC_INDEX_CHECK)
285
286#else
287 noexcept
288#endif
289 {
290#if(CXSC_INDEX_CHECK)
291 if(VecLen(rv1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cimatrix_subv &, const cvector_slice &)"));
292#endif
293 addDot(dp,rv1,sl2);
294 }
295
296 void accumulate(cidotprecision &dp, const cimatrix_subv & rv1, const cvector &rv2)
297#if(CXSC_INDEX_CHECK)
298
299#else
300 noexcept
301#endif
302 {
303#if(CXSC_INDEX_CHECK)
304 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cimatrix_subv &, const cvector &)"));
305#endif
306 addDot(dp,rv1,rv2);
307 }
308
309 void accumulate(cidotprecision &dp, const cmatrix_subv & rv1, const cimatrix_subv &rv2)
310#if(CXSC_INDEX_CHECK)
311
312#else
313 noexcept
314#endif
315 {
316#if(CXSC_INDEX_CHECK)
317 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cmatrix_subv &, const cimatrix_subv &)"));
318#endif
319 addDot(dp,rv1,rv2);
320 }
321
322 void accumulate(cidotprecision &dp, const cvector_slice & sl1, const cimatrix_subv &rv2)
323#if(CXSC_INDEX_CHECK)
324
325#else
326 noexcept
327#endif
328 {
329#if(CXSC_INDEX_CHECK)
330 if(VecLen(sl1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector_slice &, const cimatrix_subv &)"));
331#endif
332 addDot(dp,sl1,rv2);
333 }
334
335 void accumulate(cidotprecision &dp, const cvector & rv1, const cimatrix_subv &rv2)
336#if(CXSC_INDEX_CHECK)
337
338#else
339 noexcept
340#endif
341 {
342#if(CXSC_INDEX_CHECK)
343 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector &, const cimatrix_subv &)"));
344#endif
345 addDot(dp,rv1,rv2);
346 }
347
348// interval
349 void accumulate(cidotprecision &dp, const cimatrix_subv & rv1, const imatrix_subv &rv2)
350#if(CXSC_INDEX_CHECK)
351
352#else
353 noexcept
354#endif
355 {
356#if(CXSC_INDEX_CHECK)
357 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cimatrix_subv &, const imatrix_subv &)"));
358#endif
359 idotprecision tmp_re(0.0);
360 idotprecision tmp_im(0.0);
361 tmp_re.set_k(dp.get_k());
362 tmp_im.set_k(dp.get_k());
363 addDot(tmp_re,Re(rv1),rv2);
364 addDot(tmp_im,Im(rv1),rv2);
365 dp += cidotprecision(tmp_re,tmp_im);
366 }
367
368 void accumulate(cidotprecision &dp, const cimatrix_subv & rv1, const ivector_slice &sl2)
369#if(CXSC_INDEX_CHECK)
370
371#else
372 noexcept
373#endif
374 {
375#if(CXSC_INDEX_CHECK)
376 if(VecLen(rv1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cimatrix_subv &, const ivector_slice &)"));
377#endif
378 idotprecision tmp_re(0.0);
379 idotprecision tmp_im(0.0);
380 tmp_re.set_k(dp.get_k());
381 tmp_im.set_k(dp.get_k());
382 addDot(tmp_re,Re(rv1),sl2);
383 addDot(tmp_im,Im(rv1),sl2);
384 dp += cidotprecision(tmp_re,tmp_im);
385 }
386
387 void accumulate(cidotprecision &dp, const cimatrix_subv & rv1, const ivector &rv2)
388#if(CXSC_INDEX_CHECK)
389
390#else
391 noexcept
392#endif
393 {
394#if(CXSC_INDEX_CHECK)
395 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cimatrix_subv &, const ivector &)"));
396#endif
397 idotprecision tmp_re(0.0);
398 idotprecision tmp_im(0.0);
399 tmp_re.set_k(dp.get_k());
400 tmp_im.set_k(dp.get_k());
401 addDot(tmp_re,Re(rv1),rv2);
402 addDot(tmp_im,Im(rv1),rv2);
403 dp += cidotprecision(tmp_re,tmp_im);
404 }
405
406 void accumulate(cidotprecision &dp, const imatrix_subv & rv1, const cimatrix_subv &rv2)
407#if(CXSC_INDEX_CHECK)
408
409#else
410 noexcept
411#endif
412 {
413#if(CXSC_INDEX_CHECK)
414 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const imatrix_subv &, const cimatrix_subv &)"));
415#endif
416 idotprecision tmp_re(0.0);
417 idotprecision tmp_im(0.0);
418 tmp_re.set_k(dp.get_k());
419 tmp_im.set_k(dp.get_k());
420 addDot(tmp_re,rv1,Re(rv2));
421 addDot(tmp_im,rv1,Im(rv2));
422 dp += cidotprecision(tmp_re,tmp_im);
423 }
424
425 void accumulate(cidotprecision &dp, const ivector_slice & sl1, const cimatrix_subv &rv2)
426#if(CXSC_INDEX_CHECK)
427
428#else
429 noexcept
430#endif
431 {
432#if(CXSC_INDEX_CHECK)
433 if(VecLen(sl1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const ivector_slice &, const cimatrix_subv &)"));
434#endif
435 idotprecision tmp_re(0.0);
436 idotprecision tmp_im(0.0);
437 tmp_re.set_k(dp.get_k());
438 tmp_im.set_k(dp.get_k());
439 addDot(tmp_re,sl1,Re(rv2));
440 addDot(tmp_im,sl1,Im(rv2));
441 dp += cidotprecision(tmp_re,tmp_im);
442 }
443
444 void accumulate(cidotprecision &dp, const ivector & rv1, const cimatrix_subv &rv2)
445#if(CXSC_INDEX_CHECK)
446
447#else
448 noexcept
449#endif
450 {
451#if(CXSC_INDEX_CHECK)
452 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const ivector &, const cimatrix_subv &)"));
453#endif
454 idotprecision tmp_re(0.0);
455 idotprecision tmp_im(0.0);
456 tmp_re.set_k(dp.get_k());
457 tmp_im.set_k(dp.get_k());
458 addDot(tmp_re,rv1,Re(rv2));
459 addDot(tmp_im,rv1,Im(rv2));
460 dp += cidotprecision(tmp_re,tmp_im);
461 }
462
463 void accumulate(cidotprecision &dp, const rmatrix_subv & rv1, const civector &rv2)
464#if(CXSC_INDEX_CHECK)
465
466#else
467 noexcept
468#endif
469 {
470#if(CXSC_INDEX_CHECK)
471 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const rmatrix_subv &, const civector &)"));
472#endif
473 idotprecision tmp_re(0.0);
474 idotprecision tmp_im(0.0);
475 tmp_re.set_k(dp.get_k());
476 tmp_im.set_k(dp.get_k());
477 addDot(tmp_re,rv1,Re(rv2));
478 addDot(tmp_im,rv1,Im(rv2));
479 dp += cidotprecision(tmp_re,tmp_im);
480 }
481
482 void accumulate(cidotprecision &dp, const civector & rv1, const rmatrix_subv &rv2)
483#if(CXSC_INDEX_CHECK)
484
485#else
486 noexcept
487#endif
488 {
489#if(CXSC_INDEX_CHECK)
490 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const civector &, const rmatrix_subv &)"));
491#endif
492 idotprecision tmp_re(0.0);
493 idotprecision tmp_im(0.0);
494 tmp_re.set_k(dp.get_k());
495 tmp_im.set_k(dp.get_k());
496 addDot(tmp_re,Re(rv1),rv2);
497 addDot(tmp_im,Im(rv1),rv2);
498 dp += cidotprecision(tmp_re,tmp_im);
499 }
500
501// void accumulate(cidotprecision &dp, const rmatrix_subv & rv1, const civector_slice &rv2)
502// #if(CXSC_INDEX_CHECK)
503//
504// #else
505// noexcept
506// #endif
507// {
508// #if(CXSC_INDEX_CHECK)
509// if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const rmatrix_subv &, const civector_slice &)"));
510// #endif
511// idotprecision tmp_re(0.0);
512// idotprecision tmp_im(0.0);
513// tmp_re.set_k(dp.get_k());
514// tmp_im.set_k(dp.get_k());
515// addDot(tmp_re,rv1,Re(rv2));
516// addDot(tmp_im,rv1,Im(rv2));
517// dp += cidotprecision(tmp_re,tmp_im);
518// }
519//
520// void accumulate(cidotprecision &dp, const civector_slice & rv1, const rmatrix_subv &rv2)
521// #if(CXSC_INDEX_CHECK)
522//
523// #else
524// noexcept
525// #endif
526// {
527// #if(CXSC_INDEX_CHECK)
528// if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const civector_slice &, const rmatrix_subv &)"));
529// #endif
530// idotprecision tmp_re(0.0);
531// idotprecision tmp_im(0.0);
532// tmp_re.set_k(dp.get_k());
533// tmp_im.set_k(dp.get_k());
534// addDot(tmp_re,Re(rv1),rv2);
535// addDot(tmp_im,Im(rv1),rv2);
536// dp += cidotprecision(tmp_re,tmp_im);
537// }
538
539 void accumulate(cidotprecision &dp, const imatrix_subv & rv1, const civector &rv2)
540#if(CXSC_INDEX_CHECK)
541
542#else
543 noexcept
544#endif
545 {
546#if(CXSC_INDEX_CHECK)
547 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const imatrix_subv &, const civector &)"));
548#endif
549 idotprecision tmp_re(0.0);
550 idotprecision tmp_im(0.0);
551 tmp_re.set_k(dp.get_k());
552 tmp_im.set_k(dp.get_k());
553 addDot(tmp_re,rv1,Re(rv2));
554 addDot(tmp_im,rv1,Im(rv2));
555 dp += cidotprecision(tmp_re,tmp_im);
556 }
557
558 void accumulate(cidotprecision &dp, const civector & rv1, const imatrix_subv &rv2)
559#if(CXSC_INDEX_CHECK)
560
561#else
562 noexcept
563#endif
564 {
565#if(CXSC_INDEX_CHECK)
566 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const civector &, const imatrix_subv &)"));
567#endif
568 idotprecision tmp_re(0.0);
569 idotprecision tmp_im(0.0);
570 tmp_re.set_k(dp.get_k());
571 tmp_im.set_k(dp.get_k());
572 addDot(tmp_re,Re(rv1),rv2);
573 addDot(tmp_im,Im(rv1),rv2);
574 dp += cidotprecision(tmp_re,tmp_im);
575 }
576
577
578 void accumulate(cidotprecision &dp, const imatrix_subv & rv1, const civector_slice &rv2)
579#if(CXSC_INDEX_CHECK)
580
581#else
582 noexcept
583#endif
584 {
585#if(CXSC_INDEX_CHECK)
586 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const civector_slice &, const rmatrix_subv &)"));
587#endif
588 idotprecision tmp_re(0.0);
589 idotprecision tmp_im(0.0);
590 tmp_re.set_k(dp.get_k());
591 tmp_im.set_k(dp.get_k());
592 addDot(tmp_re,rv1,Re(rv2));
593 addDot(tmp_im,rv1,Im(rv2));
594 dp += cidotprecision(tmp_re,tmp_im);
595 }
596
597 void accumulate(cidotprecision &dp, const civector_slice & rv1, const imatrix_subv &rv2)
598#if(CXSC_INDEX_CHECK)
599
600#else
601 noexcept
602#endif
603 {
604#if(CXSC_INDEX_CHECK)
605 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const civector_slice &, const imatrix_subv &)"));
606#endif
607 idotprecision tmp_re(0.0);
608 idotprecision tmp_im(0.0);
609 tmp_re.set_k(dp.get_k());
610 tmp_im.set_k(dp.get_k());
611 addDot(tmp_re,Re(rv1),rv2);
612 addDot(tmp_im,Im(rv1),rv2);
613 dp += cidotprecision(tmp_re,tmp_im);
614 }
615
616 void accumulate(cidotprecision &dp, const cmatrix_subv & rv1, const civector &rv2)
617#if(CXSC_INDEX_CHECK)
618
619#else
620 noexcept
621#endif
622 {
623#if(CXSC_INDEX_CHECK)
624 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cmatrix_subv &, const civector &)"));
625#endif
626 addDot(dp,rv1,rv2);
627 }
628
629 void accumulate(cidotprecision &dp, const civector & rv1, const cmatrix_subv &rv2)
630#if(CXSC_INDEX_CHECK)
631
632#else
633 noexcept
634#endif
635 {
636#if(CXSC_INDEX_CHECK)
637 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const civector &, const cmatrix_subv &)"));
638#endif
639 addDot(dp,rv1,rv2);
640 }
641
642 void accumulate(cidotprecision &dp, const cmatrix_subv & rv1, const civector_slice &rv2)
643#if(CXSC_INDEX_CHECK)
644
645#else
646 noexcept
647#endif
648 {
649#if(CXSC_INDEX_CHECK)
650 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cmatrix_subv &, const civector_slice &)"));
651#endif
652 addDot(dp,rv1,rv2);
653 }
654
655 void accumulate(cidotprecision &dp, const civector_slice & rv1, const cmatrix_subv &rv2)
656#if(CXSC_INDEX_CHECK)
657
658#else
659 noexcept
660#endif
661 {
662#if(CXSC_INDEX_CHECK)
663 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const civector_slice &, const cmatrix_subv &)"));
664#endif
665 addDot(dp,rv1,rv2);
666 }
667
668 void accumulate(cidotprecision &dp, const cmatrix_subv & rv1, const imatrix_subv &rv2)
669#if(CXSC_INDEX_CHECK)
670
671#else
672 noexcept
673#endif
674 {
675#if(CXSC_INDEX_CHECK)
676 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cmatrix_subv &, const imatrix_subv &)"));
677#endif
678 idotprecision idot(0.0);
679 idot.set_k(dp.get_k());
680
681 addDot(idot,Re(rv1),rv2);
682 SetRe(dp,Re(dp)+idot);
683
684 idot = 0.0;
685 addDot(idot,Im(rv1),rv2);
686 SetIm(dp,Im(dp)+idot);
687 }
688
689 void accumulate(cidotprecision &dp, const imatrix_subv & rv1, const cmatrix_subv &rv2)
690#if(CXSC_INDEX_CHECK)
691
692#else
693 noexcept
694#endif
695 {
696#if(CXSC_INDEX_CHECK)
697 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const imatrix_subv &, const cmatrix_subv &)"));
698#endif
699 idotprecision idot(0.0);
700 idot.set_k(dp.get_k());
701
702 addDot(idot,rv1,Re(rv2));
703 SetRe(dp,Re(dp)+idot);
704
705 idot = 0.0;
706 addDot(idot,rv1,Im(rv2));
707 SetIm(dp,Im(dp)+idot);
708 }
709
710} // namespace cxsc
711
The Data Type cidotprecision.
Definition cidot.hpp:58
int get_k() const
Get currently set precision for computation of dot products.
Definition cidot.hpp:89
The Data Type cimatrix_subv.
Definition cimatrix.hpp:68
The Data Type cimatrix.
Definition cimatrix.hpp:908
The Scalar Type cinterval.
Definition cinterval.hpp:55
The Data Type civector_slice.
The Data Type civector.
Definition civector.hpp:57
The Data Type cmatrix_subv.
Definition cmatrix.hpp:54
The Data Type cvector_slice.
Definition cvector.hpp:845
The Data Type cvector.
Definition cvector.hpp:58
The Data Type idotprecision.
Definition idot.hpp:48
void set_k(unsigned int i)
Set precision for computation of dot products.
Definition idot.hpp:88
The Data Type imatrix_subv.
Definition imatrix.hpp:56
The Data Type ivector_slice.
Definition ivector.hpp:963
The Data Type ivector.
Definition ivector.hpp:55
The Data Type rmatrix_subv.
Definition rmatrix.hpp:54
The Data Type rmatrix.
Definition rmatrix.hpp:471
The Data Type rvector_slice.
Definition rvector.hpp:1064
The Data Type rvector.
Definition rvector.hpp:58
The namespace cxsc, providing all functionality of the class library C-XSC.
Definition cdot.cpp:29
int VecLen(const scimatrix_subv &S)
Returns the length of the subvector.
cimatrix_subv Col(cimatrix &m, const int &i) noexcept
Returns one column of the matrix as a vector.
Definition cimatrix.inl:242
rmatrix CompMat(const cimatrix &A)
Returns Ostrowski's comparison matrix.
Definition cimatrix.cpp:45
cimatrix transp(const cimatrix &A)
Returns the transposed matrix.
Definition cimatrix.cpp:74
int Ub(const cimatrix &rm, const int &i) noexcept
Returns the upper bound index.
cimatrix_subv Row(cimatrix &m, const int &i) noexcept
Returns one row of the matrix as a vector.
Definition cimatrix.inl:231
void DoubleSize(cimatrix &A)
Doubles the size of the matrix.
Definition cimatrix.cpp:83
cimatrix Id(const cimatrix &A)
Returns the Identity matrix.
Definition cimatrix.cpp:61
ivector abs(const cimatrix_subv &mv) noexcept
Returns the absolute value of the matrix.
Definition cimatrix.inl:737
void Resize(cimatrix &A) noexcept
Resizes the matrix.
int Lb(const cimatrix &rm, const int &i) noexcept
Returns the lower bound index.