PSCF v1.4.0
cpu/Reduce.h
1#ifndef PSCF_CPU_REDUCE_H
2#define PSCF_CPU_REDUCE_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2025, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11// Forward declaration
12namespace Util {
13 template <typename T> class Array;
14}
15
16namespace Pscf {
17
18 using namespace Util;
19
31
32 namespace Reduce {
33
34 /*
35 * This file and Reduce.cpp contain declarations and definitions
36 * for reduction functions that operate real arrays. Corresponding
37 * declarations and definitions for reductions of complex-valued
38 * arrays are in files ReduceCx.h and ReduceCx.cpp, respectively.
39 */
40
41 // Summation
42
51 double sum(Array<double> const & in);
52
63 double sum(Array<double> const & in, int begin, int end);
64
72 double sumSq(Array<double> const & in);
73
74 // Summation of products
75
84 double innerProduct(Array<double> const & a,
85 Array<double> const & b);
86
87 // Maxima
88
96 double max(Array<double> const & in);
97
108 double max(Array<double> const & in, int begin, int end);
109
118 double maxAbs(Array<double> const & in);
119
120 // Minima
121
130 double min(Array<double> const & in);
131
142 double min(Array<double> const & in, int begin, int end);
143
152 double minAbs(Array<double> const & in);
153
154 } // namespace Reduce
155} // namespace Pscf
156#endif
Array container class template.
Definition Array.h:40
double minAbs(Array< double > const &in)
Get minimum absolute magnitude of array elements .
Definition Reduce.cpp:229
double min(Array< double > const &in)
Get minimum of array elements .
Definition Reduce.cpp:198
double innerProduct(Array< double > const &a, Array< double > const &b)
Compute Euclidean inner product of two real arrays .
Definition Reduce.cpp:117
double maxAbs(Array< double > const &in)
Get maximum absolute magnitude of array elements .
Definition Reduce.cpp:182
double sumSq(Array< double > const &in)
Compute sum of of squares of array elements (real).
Definition Reduce.cpp:82
double sum(Array< double > const &in)
Compute sum of array elements (real).
Definition Reduce.cpp:20
double max(Array< double > const &in)
Get maximum of array elements (real).
Definition Reduce.cpp:151
Reduction operations performed on a CPU or GPU.
Definition Reduce.cpp:13
PSCF package top-level namespace.
Utility classes for scientific computation.