PSCF v1.4.0
VecOpCx.cpp
1/*
2* PSCF - Polymer Self-Consistent Field
3*
4* Copyright 2015 - 2025, The Regents of the University of Minnesota
5* Distributed under the terms of the GNU General Public License.
6*/
7
8#include "VecOpCx.h"
9#include <util/containers/Array.h>
10#include <cmath>
11
12#include <fftw3.h>
13
14namespace Pscf {
15namespace VecOp {
16
17 using namespace Util;
18
19 // Real and imaginary parts
20
21 /*
22 * Copy real part of a complex array to a real array.
23 */
25 {
26 const int n = a.capacity();
27 UTIL_CHECK(n > 0);
28 UTIL_CHECK(b.capacity() == n);
29 for (int i = 0; i < n; ++i) {
30 a[i] = b[i][0];
31 }
32 }
33
34 /*
35 * Copy imaginary part of a complex array to a real array.
36 */
38 {
39 const int n = a.capacity();
40 UTIL_CHECK(n > 0);
41 UTIL_CHECK(b.capacity() == n);
42 for (int i = 0; i < n; ++i) {
43 a[i] = b[i][1];
44 }
45 }
46
47 // Assignment
48
49 /*
50 * Vector assignment, a[i] = b[i] (complex).
51 */
53 {
54 const int n = a.capacity();
55 UTIL_CHECK(n > 0);
56 UTIL_CHECK(b.capacity() == n);
57 for (int i = 0; i < n; ++i) {
58 a[i][0] = b[i][0];
59 a[i][1] = b[i][1];
60 }
61 }
62
63 /*
64 * Vector assignment, a[i] = (b[i], c[i]) (complex, real and imaginary).
65 */
67 Array<double> const & b,
68 Array<double> const & c)
69 {
70 const int n = a.capacity();
71 UTIL_CHECK(n > 0);
72 UTIL_CHECK(b.capacity() == n);
73 UTIL_CHECK(c.capacity() == n);
74 for (int i = 0; i < n; ++i) {
75 a[i][0] = b[i];
76 a[i][1] = c[i];
77 }
78 }
79
80 /*
81 * Vector assignment, a[i] = b[i] (mixed).
82 */
84 {
85 const int n = a.capacity();
86 UTIL_CHECK(n > 0);
87 UTIL_CHECK(b.capacity() == n);
88 for (int i = 0; i < n; ++i) {
89 a[i][0] = b[i];
90 a[i][1] = 0.0;
91 }
92 }
93
94 /*
95 * Vector-scalar assignment, a[i][0] = b (complex).
96 */
97 void eqS(Array<fftw_complex> & a, fftw_complex b)
98 {
99 const int n = a.capacity();
100 UTIL_CHECK(n > 0);
101 for (int i = 0; i < n; ++i) {
102 a[i][0] = b[0];
103 a[i][1] = b[1];
104 }
105 }
106
107 /*
108 * Vector-scalar assignment, a[i] = b (mixed).
109 */
110 void eqS(Array<fftw_complex> & a, double b)
111 {
112 const int n = a.capacity();
113 UTIL_CHECK(n > 0);
114 for (int i = 0; i < n; ++i) {
115 a[i][0] = b;
116 a[i][1] = 0.0;
117 }
118 }
119
120 // Addition
121
122 /*
123 * Vector addition, a[i] = b[i] + c[i] (complex).
124 */
126 Array<fftw_complex> const & b,
127 Array<fftw_complex> const & c)
128 {
129 const int n = a.capacity();
130 UTIL_CHECK(n > 0);
131 UTIL_CHECK(b.capacity() == n);
132 UTIL_CHECK(c.capacity() == n);
133 for (int i = 0; i < n; ++i) {
134 a[i][0] = b[i][0] + c[i][0];
135 a[i][1] = b[i][1] + c[i][1];
136 }
137 }
138
139 /*
140 * Vector addition, a[i] = b[i] + c[i] (mixed).
141 */
143 Array<fftw_complex> const & b,
144 Array<double> const & c)
145 {
146 const int n = a.capacity();
147 UTIL_CHECK(n > 0);
148 UTIL_CHECK(b.capacity() == n);
149 UTIL_CHECK(c.capacity() == n);
150 for (int i = 0; i < n; ++i) {
151 a[i][0] = b[i][0] + c[i];
152 a[i][1] = b[i][1];
153 }
154 }
155
156 /*
157 * Vector-scalar addition, a[i][0] = b[i][0] + c (complex).
158 */
160 Array<fftw_complex> const & b,
161 fftw_complex c)
162 {
163 const int n = a.capacity();
164 UTIL_CHECK(n > 0);
165 UTIL_CHECK(b.capacity() == n);
166
167 for (int i = 0; i < n; ++i) {
168 a[i][0] = b[i][0] + c[0];
169 a[i][1] = b[i][1] + c[1];
170 }
171 }
172
173 /*
174 * Vector-scalar addition, a[i][0] = b[i][0] + c (mixed).
175 */
177 Array<fftw_complex> const & b,
178 double c)
179 {
180 const int n = a.capacity();
181 UTIL_CHECK(n > 0);
182 UTIL_CHECK(b.capacity() == n);
183 for (int i = 0; i < n; ++i) {
184 a[i][0] = b[i][0] + c;
185 a[i][1] = b[i][1];
186 }
187 }
188
189 // Subtraction
190
191 /*
192 * Vector subtraction, a[i] = b[i] - c[i] (complex).
193 */
195 Array<fftw_complex> const & b,
196 Array<fftw_complex> const & c)
197 {
198 const int n = a.capacity();
199 UTIL_CHECK(n > 0);
200 UTIL_CHECK(b.capacity() == n);
201 UTIL_CHECK(c.capacity() == n);
202 for (int i = 0; i < n; ++i) {
203 a[i][0] = b[i][0] - c[i][0];
204 a[i][1] = b[i][1] - c[i][1];
205 }
206 }
207
208 /*
209 * Vector subtraction, a[i] = b[i] - c[i] (mixed).
210 */
212 Array<fftw_complex> const & b,
213 Array<double> const & c)
214 {
215 const int n = a.capacity();
216 UTIL_CHECK(n > 0);
217 UTIL_CHECK(b.capacity() == n);
218 UTIL_CHECK(c.capacity() == n);
219 for (int i = 0; i < n; ++i) {
220 a[i][0] = b[i][0] - c[i];
221 a[i][1] = b[i][1];
222 }
223 }
224
225 /*
226 * Vector-scalar subtraction, a[i] = b[i] - c (complex).
227 */
229 Array<fftw_complex> const & b,
230 fftw_complex c)
231 {
232 const int n = a.capacity();
233 UTIL_CHECK(n > 0);
234 UTIL_CHECK(b.capacity() == n);
235 for (int i = 0; i < n; ++i) {
236 a[i][0] = b[i][0] - c[0];
237 a[i][1] = b[i][1] - c[1];
238 }
239 }
240
241 /*
242 * Vector-scalar subtraction, a[i] = b[i] - c (mixed).
243 */
245 Array<fftw_complex> const & b,
246 double c)
247 {
248 const int n = a.capacity();
249 UTIL_CHECK(n > 0);
250 UTIL_CHECK(b.capacity() == n);
251 for (int i = 0; i < n; ++i) {
252 a[i][0] = b[i][0] - c;
253 a[i][1] = b[i][1];
254 }
255 }
256
257 // Multiplication
258
259 /*
260 * Vector multiplication, a[i] = b[i] * c[i] (complex).
261 */
263 Array<fftw_complex> const & b,
264 Array<fftw_complex> const & c)
265 {
266 const int n = a.capacity();
267 UTIL_CHECK(n > 0);
268 UTIL_CHECK(b.capacity() == n);
269 UTIL_CHECK(c.capacity() == n);
270 for (int i = 0; i < n; ++i) {
271 a[i][0] = b[i][0]*c[i][0] - b[i][1]*c[i][1];
272 a[i][1] = b[i][0]*c[i][1] + b[i][1]*c[i][0];
273 }
274 }
275
276 /*
277 * Vector multiplication, a[i] = b[i] * c[i] (mixed).
278 */
280 Array<fftw_complex> const & b,
281 Array<double> const & c)
282 {
283 const int n = a.capacity();
284 UTIL_CHECK(n > 0);
285 UTIL_CHECK(b.capacity() == n);
286 UTIL_CHECK(c.capacity() == n);
287 for (int i = 0; i < n; ++i) {
288 a[i][0] = b[i][0]*c[i];
289 a[i][1] = b[i][1]*c[i];
290 }
291 }
292
293 /*
294 * Vector-scalar multiplication, a[i] = b[i] * c (complex)
295 */
297 Array<fftw_complex> const & b,
298 fftw_complex c)
299 {
300 const int n = a.capacity();
301 UTIL_CHECK(n > 0);
302 UTIL_CHECK(b.capacity() == n);
303 for (int i = 0; i < n; ++i) {
304 a[i][0] = b[i][0]*c[0] - b[i][1]*c[1];
305 a[i][1] = b[i][0]*c[1] + b[i][1]*c[0];
306 }
307 }
308
309 /*
310 * Vector-scalar multiplication, a[i] = b[i] * c (mixed).
311 */
313 Array<fftw_complex> const & b,
314 double c)
315 {
316 const int n = a.capacity();
317 UTIL_CHECK(n > 0);
318 UTIL_CHECK(b.capacity() == n);
319 for (int i = 0; i < n; ++i) {
320 a[i][0] = b[i][0]*c;
321 a[i][1] = b[i][1]*c;
322 }
323 }
324
325 // Division
326
327 /*
328 * Vector division, a[i] = b[i] / c[i] (complex).
329 */
331 Array<fftw_complex> const & b,
332 Array<fftw_complex> const & c)
333 {
334 const int n = a.capacity();
335 UTIL_CHECK(n > 0);
336 UTIL_CHECK(b.capacity() == n);
337 UTIL_CHECK(c.capacity() == n);
338 double cr, ci, cSq;
339 for (int i = 0; i < n; ++i) {
340 cr = c[i][0];
341 ci = c[i][1];
342 cSq = cr*cr + ci*ci;
343 a[i][0] = (b[i][0]*cr + b[i][1]*ci)/cSq;
344 a[i][1] = (b[i][1]*cr - b[i][0]*ci)/cSq;
345 }
346 }
347
348 /*
349 * Vector division, a[i] = b[i] / c[i] (mixed).
350 */
352 Array<fftw_complex> const & b,
353 Array<double> const & c)
354 {
355 const int n = a.capacity();
356 UTIL_CHECK(n > 0);
357 UTIL_CHECK(b.capacity() == n);
358 UTIL_CHECK(c.capacity() == n);
359 for (int i = 0; i < n; ++i) {
360 a[i][0] = b[i][0] / c[i];
361 a[i][1] = b[i][1] / c[i];
362 }
363 }
364
365 /*
366 * Vector-scalar division, a[i][0] = b[i][0] / c (complex).
367 */
369 Array<fftw_complex> const & b,
370 fftw_complex c)
371 {
372 const int n = a.capacity();
373 UTIL_CHECK(n > 0);
374 UTIL_CHECK(b.capacity() == n);
375 double cr = c[0];
376 double ci = c[1];
377 double cSq = cr * cr + ci * ci;
378 for (int i = 0; i < n; ++i) {
379 a[i][0] = (b[i][0]*cr + b[i][1]*ci)/cSq;
380 a[i][1] = (b[i][1]*cr - b[i][0]*ci)/cSq;
381 }
382 }
383
384 /*
385 * Vector-scalar division, a[i] = b[i] / c (mixed).
386 */
388 Array<fftw_complex> const & b,
389 double c)
390 {
391 const int n = a.capacity();
392 UTIL_CHECK(n > 0);
393 UTIL_CHECK(b.capacity() == n);
394 for (int i = 0; i < n; ++i) {
395 a[i][0] = b[i][0] / c;
396 a[i][1] = b[i][1] / c;
397 }
398 }
399
400 // In-place addition
401
402 /*
403 * Vector in-place addition, a[i] += b[i] (complex).
404 */
406 Array<fftw_complex> const & b)
407 {
408 const int n = a.capacity();
409 UTIL_CHECK(n > 0);
410 UTIL_CHECK(b.capacity() == n);
411 for (int i = 0; i < n; ++i) {
412 a[i][0] += b[i][0];
413 a[i][1] += b[i][1];
414 }
415 }
416
417 /*
418 * Vector in-place addition, a[i] += (b[i], c[i]) (complex, real/imag).
419 */
421 Array<double> const & b,
422 Array<double> const & c)
423 {
424 const int n = a.capacity();
425 UTIL_CHECK(n > 0);
426 UTIL_CHECK(b.capacity() == n);
427 UTIL_CHECK(c.capacity() == n);
428 for (int i = 0; i < n; ++i) {
429 a[i][0] += b[i];
430 a[i][1] += c[i];
431 }
432 }
433
434 /*
435 * Vector in-place addition, a[i] += b[i] (mixed, b real).
436 */
437 void addEqV(Array<fftw_complex> & a, Array<double> const & b)
438 {
439 const int n = a.capacity();
440 UTIL_CHECK(n > 0);
441 UTIL_CHECK(b.capacity() == n);
442 for (int i = 0; i < n; ++i) {
443 a[i][0] += b[i];
444 }
445 }
446
447 /*
448 * Vector-scalar in-place addition, a[i] += b (complex).
449 */
450 void addEqS(Array<fftw_complex>& a, fftw_complex b)
451 {
452 const int n = a.capacity();
453 UTIL_CHECK(n > 0);
454 for (int i = 0; i < n; ++i) {
455 a[i][0] += b[0];
456 a[i][1] += b[1];
457 }
458 }
459
460 /*
461 * Vector-scalar in-place addition, a[i] += b (mixed, b real).
462 */
463 void addEqS(Array<fftw_complex>& a, double b)
464 {
465 const int n = a.capacity();
466 UTIL_CHECK(n > 0);
467 for (int i = 0; i < n; ++i) {
468 a[i][0] += b;
469 }
470 }
471
472 // In-place subtraction
473
474 /*
475 * Vector in-place subtraction, a[i] -= b[i] (complex).
476 */
478 {
479 const int n = a.capacity();
480 UTIL_CHECK(n > 0);
481 UTIL_CHECK(b.capacity() == n);
482 for (int i = 0; i < n; ++i) {
483 a[i][0] -= b[i][0];
484 a[i][1] -= b[i][1];
485 }
486 }
487
488 /*
489 * Vector in-place subtraction, a[i] -= b[i] (mixed).
490 */
492 {
493 const int n = a.capacity();
494 UTIL_CHECK(n > 0);
495 UTIL_CHECK(b.capacity() == n);
496 for (int i = 0; i < n; ++i) {
497 a[i][0] -= b[i];
498 }
499 }
500
501 /*
502 * Vector-scalar in-place subtraction, a[i] -= b (complex).
503 */
504 void subEqS(Array<fftw_complex>& a, fftw_complex b)
505 {
506 const int n = a.capacity();
507 UTIL_CHECK(n > 0);
508 for (int i = 0; i < n; ++i) {
509 a[i][0] -= b[0];
510 a[i][1] -= b[1];
511 }
512 }
513
514 /*
515 * Vector-scalar in-place subtraction, a[i][0] -= b (mixed).
516 */
517 void subEqS(Array<fftw_complex>& a, double b)
518 {
519 const int n = a.capacity();
520 UTIL_CHECK(n > 0);
521 for (int i = 0; i < n; ++i) {
522 a[i][0] -= b;
523 }
524 }
525
526 // In-place multiplication
527
528 /*
529 * Vector in-place multiplication, a[i] *= b[i] (complex).
530 */
532 {
533 const int n = a.capacity();
534 UTIL_CHECK(n > 0);
535 UTIL_CHECK(b.capacity() == n);
536 double x, y;
537 for (int i = 0; i < n; ++i) {
538 x = a[i][0] * b[i][0] - a[i][1] * b[i][1];
539 y = a[i][0] * b[i][1] + a[i][1] * b[i][0];
540 a[i][0] = x;
541 a[i][1] = y;
542 }
543 }
544
545 /*
546 * Vector in-place multiplication, a[i] *= b[i] (mixed, b real).
547 */
549 {
550 const int n = a.capacity();
551 UTIL_CHECK(n > 0);
552 UTIL_CHECK(b.capacity() == n);
553 for (int i = 0; i < n; ++i) {
554 a[i][0] *= b[i];
555 a[i][1] *= b[i];
556 }
557 }
558
559 /*
560 * Vector-scalar in-place multiplication, a[i] *= b[i] (complex).
561 */
562 void mulEqS(Array<fftw_complex>& a, fftw_complex const & b)
563 {
564 const int n = a.capacity();
565 UTIL_CHECK(n > 0);
566 double x, y;
567 for (int i = 0; i < n; ++i) {
568 x = a[i][0] * b[0] - a[i][1] * b[1];
569 y = a[i][0] * b[1] + a[i][1] * b[0];
570 a[i][0] = x;
571 a[i][1] = y;
572 }
573 }
574
575 /*
576 * Vector-scalar in-place multiplication, a[i] *= b (mixed, b real)
577 */
578 void mulEqS(Array<fftw_complex>& a, double b)
579 {
580 const int n = a.capacity();
581 UTIL_CHECK(n > 0);
582 for (int i = 0; i < n; ++i) {
583 a[i][0] *= b;
584 a[i][1] *= b;
585 }
586 }
587
588 // In-place division
589
590 /*
591 * Vector in-place division, a[i] /= b[i] (complex).
592 */
594 {
595 const int n = a.capacity();
596 UTIL_CHECK(n > 0);
597 UTIL_CHECK(b.capacity() == n);
598 double br, bi, bSq, x, y;
599 for (int i = 0; i < n; ++i) {
600 br = b[i][0];
601 bi = b[i][1];
602 bSq = br*br + bi*bi;
603 x = (a[i][0] * br + a[i][1] * bi)/bSq;
604 y = (a[i][1] * br - a[i][0] * bi)/bSq;
605 a[i][0] = x;
606 a[i][1] = y;
607 }
608 }
609
610 /*
611 * Vector in-place division, a[i] /= b[i] (mixed, b real).
612 */
614 {
615 const int n = a.capacity();
616 UTIL_CHECK(n > 0);
617 UTIL_CHECK(b.capacity() == n);
618 for (int i = 0; i < n; ++i) {
619 a[i][0] /= b[i];
620 a[i][1] /= b[i];
621 }
622 }
623
624 /*
625 * Vector-scalar in-place division, a[i] /= b (complex).
626 */
627 void divEqS(Array<fftw_complex>& a, fftw_complex b)
628 {
629 const int n = a.capacity();
630 UTIL_CHECK(n > 0);
631 double br = b[0];
632 double bi = b[1];
633 double bSq = br*br + bi*bi;
634 double x, y;
635 for (int i = 0; i < n; ++i) {
636 x = (a[i][0] * br + a[i][1] * bi) / bSq;
637 y = (a[i][1] * br - a[i][0] * bi) / bSq;
638 a[i][0] = x;
639 a[i][1] = y;
640 }
641 }
642
643 /*
644 * Vector-scalar in-place division, a[i] /= b (mixed, b real).
645 */
646 void divEqS(Array<fftw_complex>& a, double b)
647 {
648 const int n = a.capacity();
649 UTIL_CHECK(n > 0);
650 for (int i = 0; i < n; ++i) {
651 a[i][0] /= b;
652 a[i][1] /= b;
653 }
654 }
655
656 // Exponentiation
657
658 /*
659 * Vector exponentiation, a[i] = exp(b[i]) (complex).
660 */
662 {
663 const int n = a.capacity();
664 UTIL_CHECK(n > 0);
665 UTIL_CHECK(b.capacity() == n);
666 double rex;
667 for (int i = 0; i < n; ++i) {
668 rex = std::exp(b[i][0]);
669 a[i][0] = rex * cos(b[i][1]);
670 a[i][1] = rex * sin(b[i][1]);
671 }
672 }
673
674 // Complex square
675
676 /*
677 * Elementwise complex square, a[i] = b[i] * b[i] (complex).
678 */
680 {
681 const int n = a.capacity();
682 UTIL_CHECK(n > 0);
683 UTIL_CHECK(b.capacity() == n);
684 double br, bi;
685 for (int i = 0; i < n; ++i) {
686 br = b[i][0];
687 bi = b[i][1];
688 a[i][0] = br * br - bi * bi;
689 a[i][1] = 2.0 * br * bi;
690 }
691 }
692
693 // Even powers of complex absolute magnitude
694
695 /*
696 * Square absolute magnitude, a[i] = |b[i]|^2 (complex).
697 */
699 {
700 const int n = a.capacity();
701 UTIL_CHECK(n > 0);
702 UTIL_CHECK(b.capacity() == n);
703 double br, bi;
704 for (int i = 0; i < n; ++i) {
705 br = b[i][0];
706 bi = b[i][1];
707 a[i] = br * br + bi * bi;
708 }
709 }
710
711 /*
712 * Fourth power of absolute magnitude, a[i] = |b[i]|^4 (complex).
713 */
715 {
716 const int n = a.capacity();
717 UTIL_CHECK(n > 0);
718 UTIL_CHECK(b.capacity() == n);
719 double br, bi, sq;
720 for (int i = 0; i < n; ++i) {
721 br = b[i][0];
722 bi = b[i][1];
723 sq = br * br + bi * bi;
724 a[i] = sq*sq;
725 }
726 }
727
728 // Combined operations
729
730 void divEqVc(Array<fftw_complex>& a, Array<double> const & b, double c)
731 {
732 const int n = a.capacity();
733 UTIL_CHECK(n > 0);
734 UTIL_CHECK(b.capacity() == n);
735 for (int i = 0; i < n; ++i) {
736 a[i][0] /= (b[i]*c);
737 a[i][1] /= (b[i]*c);
738 }
739 }
740
741} // namespace VecOp
742} // namespace Pscf
Array container class template.
Definition Array.h:40
int capacity() const
Return allocated size.
Definition Array.h:144
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
void divEqS(Array< double > &a, double b)
Vector-scalar in-place division, a[i] /= b.
Definition VecOp.cpp:292
void addEqV(Array< double > &a, Array< double > const &b)
Vector-vector in-place addition, a[i] += b[i] (real).
Definition VecOp.cpp:198
void divEqV(Array< double > &a, Array< double > const &b)
Vector-vector in-place division, a[i] /= b[i].
Definition VecOp.cpp:279
void addEqS(Array< double > &a, double b)
Vector-scalar in-place addition, a[i] += b (real).
Definition VecOp.cpp:211
void sqV(Array< double > &a, Array< double > const &b)
Vector element-wise square, a[i] = b[i]*b[i] (real).
Definition VecOp.cpp:334
void mulEqV(Array< double > &a, Array< double > const &b)
Vector-vector in-place multiplication, a[i] *= b[i] (real).
Definition VecOp.cpp:252
void eqV(Array< double > &a, Array< double > const &b, const int beginIdA, const int beginIdB, const int n)
Vector assignment, a[i] = b[i] (real, slice).
Definition VecOp.cpp:21
void sqAbsV(Array< double > &a, Array< fftw_complex > const &b)
Square of absolute magnitude, a[i] = |b[i]|^2 (complex).
Definition VecOpCx.cpp:698
void imag(Array< double > &a, Array< fftw_complex > const &b)
Copy imaginary part of a complex array to a real array.
Definition VecOpCx.cpp:37
void sqSqAbsV(Array< double > &a, Array< fftw_complex > const &b)
Fourth power of absolute magnitude, a[i] = |b[i]|^4 (complex).
Definition VecOpCx.cpp:714
void mulEqS(Array< double > &a, double b)
Vector-scalar in-place multiplication, a[i] *= b (real).
Definition VecOp.cpp:265
void subVV(Array< double > &a, Array< double > const &b, Array< double > const &c)
Vector-vector subtraction, a[i] = b[i] - c[i] (real)
Definition VecOp.cpp:95
void expV(Array< double > &a, Array< double > const &b)
Vector exponentiation, a[i] = exp(b[i]) (real).
Definition VecOp.cpp:306
void divVS(Array< double > &a, Array< double > const &b, double c)
Vector-scalar division, a[i] = b[i] / c (real).
Definition VecOp.cpp:170
void eqS(Array< double > &a, double b)
Vector assignment, a[i] = b (real).
Definition VecOp.cpp:50
void mulVV(Array< double > &a, Array< double > const &b, Array< double > const &c)
Vector-vector multiplication, a[i] = b[i] * c[i] (real).
Definition VecOp.cpp:125
void subVS(Array< double > &a, Array< double > const &b, double c)
Vector-scalar subtraction, a[i] = b[i] - c (real).
Definition VecOp.cpp:110
void subEqV(Array< double > &a, Array< double > const &b)
Vector-vector in-place subtraction, a[i] -= b[i] (real).
Definition VecOp.cpp:225
void addVV(Array< double > &a, Array< double > const &b, Array< double > const &c)
Vector-vector addition, a[i] = b[i] + c[i] (real)
Definition VecOp.cpp:64
void real(Array< double > &a, Array< fftw_complex > const &b)
Copy real part of a complex array to a real array.
Definition VecOpCx.cpp:24
void addVS(Array< double > &a, Array< double > const &b, double c)
Vector-scalar addition, a[i] = b[i] + c (real).
Definition VecOp.cpp:79
void divEqVc(Array< fftw_complex > &a, Array< double > const &b, double c)
Vector division in-place w/ coeff., a[i] /= (b[i] * c).
Definition VecOpCx.cpp:730
void divVV(Array< double > &a, Array< double > const &b, Array< double > const &c)
Vector-vector division, a[i] = b[i] / c[i] (real).
Definition VecOp.cpp:155
void subEqS(Array< double > &a, double b)
Vector-scalar subtraction in-place, a[i] -= b (real).
Definition VecOp.cpp:238
void mulVS(Array< double > &a, Array< double > const &b, double c)
Vector-scalar multiplication, a[i] = b[i] * c (real).
Definition VecOp.cpp:140
Vector operations on GPU or CPU.
Definition VecOp.cpp:14
PSCF package top-level namespace.