C-XSC - A C++ Class Library for Extended Scientific Computing 2.5.4
cvector.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: cvector.cpp,v 1.25 2014/01/30 17:23:44 cxsc Exp $ */
25
26#define _CXSC_CPP
27
28#include "cvector.hpp"
29#include "vector.inl"
30#include "cvector.inl"
31
32#include "ivector.hpp"
33
34#include "idotk.inl"
35#include "cdotk.inl"
36
37namespace cxsc {
38
39 void accumulate(cdotprecision &dp, const cvector & rv1, const cvector &rv2)
40#if(CXSC_INDEX_CHECK)
41
42#else
43 noexcept
44#endif
45 {
46#if(CXSC_INDEX_CHECK)
47 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cvector &, const cvector &)"));
48#endif
49 addDot(dp,rv1,rv2);
50 }
51
52 void accumulate_approx(cdotprecision &dp, const cvector & rv1, const cvector &rv2)
53 {
54 addDot_op(dp,rv1,rv2);
55 }
56
57
58 void accumulate(cdotprecision &dp, const cvector_slice & sl, const cvector &rv)
59#if(CXSC_INDEX_CHECK)
60
61#else
62 noexcept
63#endif
64 {
65#if(CXSC_INDEX_CHECK)
66 if(VecLen(sl)!=VecLen(rv)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cvector_slice &, const cvector &)"));
67#endif
68 addDot(dp,sl,rv);
69 }
70
71 void accumulate_approx(cdotprecision &dp, const cvector_slice & sl, const cvector &rv)
72 {
73 addDot_op(dp,sl,rv);
74 }
75
76
77 void accumulate(cdotprecision &dp, const cvector &rv, const cvector_slice &sl)
78#if(CXSC_INDEX_CHECK)
79
80#else
81 noexcept
82#endif
83 {
84#if(CXSC_INDEX_CHECK)
85 if(VecLen(rv)!=VecLen(sl)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cvector &, const cvector_slice &)"));
86#endif
87 addDot(dp,rv,sl);
88 }
89
90 void accumulate_approx(cdotprecision &dp, const cvector &rv, const cvector_slice &sl)
91 {
92 addDot_op(dp,rv,sl);
93 }
94
95
96 void accumulate(cdotprecision &dp, const cvector_slice & sl1, const cvector_slice &sl2)
97#if(CXSC_INDEX_CHECK)
98
99#else
100 noexcept
101#endif
102 {
103#if(CXSC_INDEX_CHECK)
104 if(VecLen(sl1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cvector_slice &, const cvector_slice &)"));
105#endif
106 addDot(dp,sl1,sl2);
107 }
108
110 {
111 addDot_op(dp,sl1,sl2);
112 }
113
114 void accumulate(cidotprecision &dp, const cvector & rv1, const cvector &rv2)
115#if(CXSC_INDEX_CHECK)
116
117#else
118 noexcept
119#endif
120 {
121#if(CXSC_INDEX_CHECK)
122 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector &, const cvector &)"));
123#endif
124 cdotprecision tmp(0.0);
125 tmp.set_k(dp.get_k());
126 addDot(tmp,rv1,rv2);
127 dp += tmp;
128 }
129
130 void accumulate(cidotprecision &dp, const cvector_slice & sl, const cvector &rv)
131#if(CXSC_INDEX_CHECK)
132
133#else
134 noexcept
135#endif
136 {
137#if(CXSC_INDEX_CHECK)
138 if(VecLen(sl)!=VecLen(rv)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector_slice &, const cvector &)"));
139#endif
140 cdotprecision tmp(0.0);
141 tmp.set_k(dp.get_k());
142 addDot(tmp,sl,rv);
143 dp += tmp;
144 }
145
146 void accumulate(cidotprecision &dp, const cvector &rv, const cvector_slice &sl)
147#if(CXSC_INDEX_CHECK)
148
149#else
150 noexcept
151#endif
152 {
153#if(CXSC_INDEX_CHECK)
154 if(VecLen(rv)!=VecLen(sl)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector &, const cvector_slice &)"));
155#endif
156 cdotprecision tmp(0.0);
157 tmp.set_k(dp.get_k());
158 addDot(tmp,rv,sl);
159 dp += tmp;
160 }
161
162 void accumulate(cidotprecision &dp, const cvector_slice & sl1, const cvector_slice &sl2)
163#if(CXSC_INDEX_CHECK)
164
165#else
166 noexcept
167#endif
168 {
169#if(CXSC_INDEX_CHECK)
170 if(VecLen(sl1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector_slice &, const cvector_slice &)"));
171#endif
172 cdotprecision tmp(0.0);
173 tmp.set_k(dp.get_k());
174 addDot(tmp,sl1,sl2);
175 dp += tmp;
176 }
177
178 void accumulate(cdotprecision &dp, const cvector & rv1, const rvector &rv2)
179#if(CXSC_INDEX_CHECK)
180
181#else
182 noexcept
183#endif
184 {
185#if(CXSC_INDEX_CHECK)
186 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cvector &, const rvector &)"));
187#endif
188 addDot(Re(dp), Re(rv1), rv2);
189 addDot(Im(dp), Im(rv1), rv2);
190 }
191
192 void accumulate_approx(cdotprecision &dp, const cvector & rv1, const rvector &rv2)
193 {
194 addDot_op(Re(dp), Re(rv1), rv2);
195 addDot_op(Im(dp), Im(rv1), rv2);
196 }
197
198 void accumulate(cdotprecision &dp, const rvector & rv1, const cvector &rv2)
199#if(CXSC_INDEX_CHECK)
200
201#else
202 noexcept
203#endif
204 {
205#if(CXSC_INDEX_CHECK)
206 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const rvector &, const cvector &)"));
207#endif
208 addDot(Re(dp), rv1, Re(rv2));
209 addDot(Im(dp), rv1, Im(rv2));
210 }
211
212 void accumulate_approx(cdotprecision &dp, const rvector & rv1, const cvector &rv2)
213 {
214 addDot_op(Re(dp), rv1, Re(rv2));
215 addDot_op(Im(dp), rv1, Im(rv2));
216 }
217
218 void accumulate(cdotprecision &dp, const rvector_slice & sl, const cvector &rv)
219#if(CXSC_INDEX_CHECK)
220
221#else
222 noexcept
223#endif
224 {
225#if(CXSC_INDEX_CHECK)
226 if(VecLen(sl)!=VecLen(rv)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const rvector_slice &, const cvector &)"));
227#endif
228 addDot(Re(dp), sl, Re(rv));
229 addDot(Im(dp), sl, Im(rv));
230 }
231
232 void accumulate_approx(cdotprecision &dp, const rvector_slice & sl, const cvector &rv)
233 {
234 addDot_op(Re(dp), sl, Re(rv));
235 addDot_op(Im(dp), sl, Im(rv));
236 }
237
238 void accumulate(cdotprecision &dp,const cvector_slice &sl,const rvector &rv)
239#if(CXSC_INDEX_CHECK)
240
241#else
242 noexcept
243#endif
244 {
245#if(CXSC_INDEX_CHECK)
246 if(VecLen(sl)!=VecLen(rv)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cvector_slice &, const rvector &)"));
247#endif
248 addDot(Re(dp), Re(sl), rv);
249 addDot(Im(dp), Im(sl), rv);
250 }
251
253 {
254 addDot_op(Re(dp), Re(sl), rv);
255 addDot_op(Im(dp), Im(sl), rv);
256 }
257
258 void accumulate(cdotprecision &dp, const rvector &rv, const cvector_slice &sl)
259#if(CXSC_INDEX_CHECK)
260
261#else
262 noexcept
263#endif
264 {
265#if(CXSC_INDEX_CHECK)
266 if(VecLen(rv)!=VecLen(sl)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const rvector &, const cvector_slice &)"));
267#endif
268 addDot(Re(dp), rv, Re(sl));
269 addDot(Im(dp), rv, Im(sl));
270 }
271
272 void accumulate_approx(cdotprecision &dp, const rvector &rv, const cvector_slice &sl)
273 {
274 addDot_op(Re(dp), rv, Re(sl));
275 addDot_op(Im(dp), rv, Im(sl));
276 }
277
278 void accumulate(cdotprecision &dp,const cvector &rv,const rvector_slice &sl)
279#if(CXSC_INDEX_CHECK)
280
281#else
282 noexcept
283#endif
284 {
285#if(CXSC_INDEX_CHECK)
286 if(VecLen(sl)!=VecLen(rv)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cvector &, const rvector_slice &)"));
287#endif
288 addDot(Re(dp), Re(rv), sl);
289 addDot(Im(dp), Im(rv), sl);
290 }
291
293 {
294 addDot_op(Re(dp), Re(rv), sl);
295 addDot_op(Im(dp), Im(rv), sl);
296 }
297
298 void accumulate(cdotprecision &dp, const cvector_slice & sl1, const rvector_slice &sl2)
299#if(CXSC_INDEX_CHECK)
300
301#else
302 noexcept
303#endif
304 {
305#if(CXSC_INDEX_CHECK)
306 if(VecLen(sl1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const cvector_slice &, const rvector_slice &)"));
307#endif
308 addDot(Re(dp), Re(sl1), sl2);
309 addDot(Im(dp), Im(sl1), sl2);
310 }
311
313 {
314 addDot_op(Re(dp), Re(sl1), sl2);
315 addDot_op(Im(dp), Im(sl1), sl2);
316 }
317
318 void accumulate(cdotprecision &dp, const rvector_slice & sl1, const cvector_slice &sl2)
319#if(CXSC_INDEX_CHECK)
320
321#else
322 noexcept
323#endif
324 {
325#if(CXSC_INDEX_CHECK)
326 if(VecLen(sl1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cdotprecision&, const rvector_slice &, const cvector_slice &)"));
327#endif
328 addDot(Re(dp), sl1, Re(sl2));
329 addDot(Im(dp), sl1, Im(sl2));
330 }
331
333 {
334 addDot_op(Re(dp), sl1, Re(sl2));
335 addDot_op(Im(dp), sl1, Im(sl2));
336 }
337
338 void accumulate(cidotprecision &dp, const cvector & rv1, const rvector &rv2)
339#if(CXSC_INDEX_CHECK)
340
341#else
342 noexcept
343#endif
344 {
345#if(CXSC_INDEX_CHECK)
346 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector &, const rvector &)"));
347#endif
348 cdotprecision tmp(0.0);
349 tmp.set_k(dp.get_k());
350 addDot(Re(tmp),Re(rv1),rv2);
351 addDot(Im(tmp),Im(rv1),rv2);
352 dp += tmp;
353 }
354
355 void accumulate(cidotprecision &dp, const rvector & rv1, const cvector &rv2)
356#if(CXSC_INDEX_CHECK)
357
358#else
359 noexcept
360#endif
361 {
362#if(CXSC_INDEX_CHECK)
363 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const rvector &, const cvector &)"));
364#endif
365 cdotprecision tmp(0.0);
366 tmp.set_k(dp.get_k());
367 addDot(Re(tmp),rv1,Re(rv2));
368 addDot(Im(tmp),rv1,Im(rv2));
369 dp += tmp;
370 }
371
372 void accumulate(cidotprecision &dp, const rvector_slice & sl, const cvector &rv)
373#if(CXSC_INDEX_CHECK)
374
375#else
376 noexcept
377#endif
378 {
379#if(CXSC_INDEX_CHECK)
380 if(VecLen(sl)!=VecLen(rv)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const rvector_slice &, const cvector &)"));
381#endif
382 cdotprecision tmp(0.0);
383 tmp.set_k(dp.get_k());
384 addDot(Re(tmp),sl,Re(rv));
385 addDot(Im(tmp),sl,Im(rv));
386 dp += tmp;
387 }
388
389 void accumulate(cidotprecision &dp,const cvector_slice &sl,const rvector &rv)
390#if(CXSC_INDEX_CHECK)
391
392#else
393 noexcept
394#endif
395 {
396#if(CXSC_INDEX_CHECK)
397 if(VecLen(sl)!=VecLen(rv)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector_slice &, const rvector &)"));
398#endif
399 cdotprecision tmp(0.0);
400 tmp.set_k(dp.get_k());
401 addDot(Re(tmp),Re(sl),rv);
402 addDot(Im(tmp),Im(sl),rv);
403 dp += tmp;
404 }
405
406 void accumulate(cidotprecision &dp, const rvector &rv, const cvector_slice &sl)
407#if(CXSC_INDEX_CHECK)
408
409#else
410 noexcept
411#endif
412 {
413#if(CXSC_INDEX_CHECK)
414 if(VecLen(rv)!=VecLen(sl)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const rvector &, const cvector_slice &)"));
415#endif
416 cdotprecision tmp(0.0);
417 tmp.set_k(dp.get_k());
418 addDot(Re(tmp),rv,Re(sl));
419 addDot(Im(tmp),rv,Im(sl));
420 dp += tmp;
421 }
422
423 void accumulate(cidotprecision &dp,const cvector &rv,const rvector_slice &sl)
424#if(CXSC_INDEX_CHECK)
425
426#else
427 noexcept
428#endif
429 {
430#if(CXSC_INDEX_CHECK)
431 if(VecLen(rv)!=VecLen(sl)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector &, const rvector_slice &)"));
432#endif
433 cdotprecision tmp(0.0);
434 tmp.set_k(dp.get_k());
435 addDot(Re(tmp),Re(rv),sl);
436 addDot(Im(tmp),Im(rv),sl);
437 dp += tmp;
438 }
439
440 void accumulate(cidotprecision &dp, const cvector_slice & sl1, const rvector_slice &sl2)
441#if(CXSC_INDEX_CHECK)
442
443#else
444 noexcept
445#endif
446 {
447#if(CXSC_INDEX_CHECK)
448 if(VecLen(sl1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector_slice &, const rvector_slice &)"));
449#endif
450 cdotprecision tmp(0.0);
451 tmp.set_k(dp.get_k());
452 addDot(Re(tmp),Re(sl1),sl2);
453 addDot(Im(tmp),Im(sl1),sl2);
454 dp += tmp;
455 }
456
457 void accumulate(cidotprecision &dp, const rvector_slice & sl1, const cvector_slice &sl2)
458#if(CXSC_INDEX_CHECK)
459
460#else
461 noexcept
462#endif
463 {
464#if(CXSC_INDEX_CHECK)
465 if(VecLen(sl1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const rvector_slice &, const cvector_slice &)"));
466#endif
467 cdotprecision tmp(0.0);
468 tmp.set_k(dp.get_k());
469 addDot(Re(tmp),sl1,Re(sl2));
470 addDot(Im(tmp),sl1,Im(sl2));
471 dp += tmp;
472 }
473
475 void accumulate(cidotprecision &dp, const cvector_slice &sl, const ivector &rv)
476#if(CXSC_INDEX_CHECK)
477
478#else
479 noexcept
480#endif
481 {
482#if(CXSC_INDEX_CHECK)
483 if(VecLen(sl)!=VecLen(rv)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector_slice &, const ivector &)"));
484#endif
485 idotprecision tmp_re(0.0);
486 idotprecision tmp_im(0.0);
487 tmp_re.set_k(dp.get_k());
488 tmp_im.set_k(dp.get_k());
489 addDot(tmp_re,Re(sl),rv);
490 addDot(tmp_im,Im(sl),rv);
491 dp += cidotprecision(tmp_re,tmp_im);
492 }
493
495 void accumulate(cidotprecision &dp, const ivector & rv, const cvector_slice &sl)
496#if(CXSC_INDEX_CHECK)
497
498#else
499 noexcept
500#endif
501 {
502#if(CXSC_INDEX_CHECK)
503 if(VecLen(sl)!=VecLen(rv)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const ivector &, const cvector_slice &)"));
504#endif
505 idotprecision tmp_re(0.0);
506 idotprecision tmp_im(0.0);
507 tmp_re.set_k(dp.get_k());
508 tmp_im.set_k(dp.get_k());
509 addDot(tmp_re,rv,Re(sl));
510 addDot(tmp_im,rv,Im(sl));
511 dp += cidotprecision(tmp_re,tmp_im);
512 }
513
515 void accumulate(cidotprecision &dp, const cvector &rv1, const ivector &rv2)
516#if(CXSC_INDEX_CHECK)
517
518#else
519 noexcept
520#endif
521 {
522#if(CXSC_INDEX_CHECK)
523 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector &, const ivector &)"));
524#endif
525 idotprecision tmp_re(0.0);
526 idotprecision tmp_im(0.0);
527 tmp_re.set_k(dp.get_k());
528 tmp_im.set_k(dp.get_k());
529 addDot(tmp_re,Re(rv1),rv2);
530 addDot(tmp_im,Im(rv1),rv2);
531 dp += cidotprecision(tmp_re,tmp_im);
532 }
533
535 void accumulate(cidotprecision &dp, const ivector &rv1, const cvector &rv2)
536#if(CXSC_INDEX_CHECK)
537
538#else
539 noexcept
540#endif
541 {
542#if(CXSC_INDEX_CHECK)
543 if(VecLen(rv1)!=VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const ivector &, const cvector &)"));
544#endif
545 idotprecision tmp_re(0.0);
546 idotprecision tmp_im(0.0);
547 tmp_re.set_k(dp.get_k());
548 tmp_im.set_k(dp.get_k());
549 addDot(tmp_re,rv1,Re(rv2));
550 addDot(tmp_im,rv1,Im(rv2));
551 dp += cidotprecision(tmp_re,tmp_im);
552 }
553
555 void accumulate(cidotprecision &dp, const ivector_slice &sl, const cvector &rv)
556#if(CXSC_INDEX_CHECK)
557
558#else
559 noexcept
560#endif
561 {
562#if(CXSC_INDEX_CHECK)
563 if(VecLen(sl)!=VecLen(rv)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const ivector_slice &, const cvector &)"));
564#endif
565 idotprecision tmp_re(0.0);
566 idotprecision tmp_im(0.0);
567 tmp_re.set_k(dp.get_k());
568 tmp_im.set_k(dp.get_k());
569 addDot(tmp_re,sl,Re(rv));
570 addDot(tmp_im,sl,Im(rv));
571 dp += cidotprecision(tmp_re,tmp_im);
572 }
573
575 void accumulate(cidotprecision &dp, const cvector &rv, const ivector_slice &sl)
576#if(CXSC_INDEX_CHECK)
577
578#else
579 noexcept
580#endif
581 {
582#if(CXSC_INDEX_CHECK)
583 if(VecLen(sl)!=VecLen(rv)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector &, const ivector_slice &)"));
584#endif
585 idotprecision tmp_re(0.0);
586 idotprecision tmp_im(0.0);
587 tmp_re.set_k(dp.get_k());
588 tmp_im.set_k(dp.get_k());
589 addDot(tmp_re,Re(rv),sl);
590 addDot(tmp_im,Im(rv),sl);
591 dp += cidotprecision(tmp_re,tmp_im);
592 }
593
595 void accumulate(cidotprecision &dp, const cvector_slice &sl1, const ivector_slice &sl2)
596#if(CXSC_INDEX_CHECK)
597
598#else
599 noexcept
600#endif
601 {
602#if(CXSC_INDEX_CHECK)
603 if(VecLen(sl1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const cvector_slice &, const ivector_slice &)"));
604#endif
605 idotprecision tmp_re(0.0);
606 idotprecision tmp_im(0.0);
607 tmp_re.set_k(dp.get_k());
608 tmp_im.set_k(dp.get_k());
609 addDot(tmp_re,Re(sl1),sl2);
610 addDot(tmp_im,Im(sl1),sl2);
611 dp += cidotprecision(tmp_re,tmp_im);
612 }
613
615 void accumulate(cidotprecision &dp, const ivector_slice &sl1, const cvector_slice &sl2)
616#if(CXSC_INDEX_CHECK)
617
618#else
619 noexcept
620#endif
621 {
622#if(CXSC_INDEX_CHECK)
623 if(VecLen(sl1)!=VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM("void accumulate(cidotprecision&, const ivector_slice &, const cvector_slice &)"));
624#endif
625 idotprecision tmp_re(0.0);
626 idotprecision tmp_im(0.0);
627 tmp_re.set_k(dp.get_k());
628 tmp_im.set_k(dp.get_k());
629 addDot(tmp_re,sl1,Re(sl2));
630 addDot(tmp_im,sl1,Im(sl2));
631 dp += cidotprecision(tmp_re,tmp_im);
632 }
633
634 //Summation accumulates
635 void accumulate(cdotprecision &dp, const cvector& v) {
636 addSum(Re(dp),Re(v));
637 addSum(Im(dp),Im(v));
638 }
639
640 void accumulate(cidotprecision &dp, const cvector& v) {
641 idotprecision tmp_re(0.0);
642 idotprecision tmp_im(0.0);
643 tmp_re.set_k(dp.get_k());
644 tmp_im.set_k(dp.get_k());
645 accumulate(tmp_re,Re(v));
646 accumulate(tmp_im,Im(v));
647 dp += cidotprecision(tmp_re,tmp_im);
648 }
649
650
651} // namespace cxsc
652
The Data Type cdotprecision.
Definition cdot.hpp:61
void set_k(unsigned int i)
Set precision for computation of dot products.
Definition cdot.hpp:93
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 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 ivector_slice.
Definition ivector.hpp:963
The Data Type ivector.
Definition ivector.hpp:55
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.
void accumulate_approx(cdotprecision &dp, const cmatrix_subv &rv1, const cmatrix_subv &rv2)
The accurate scalar product of the last two arguments added to the value of the first argument (witho...
Definition cmatrix.cpp:99