PSCF v1.4.0

Functions that perform array reductions on a CPU. More...

Functions

double Pscf::Reduce::sum (Array< double > const &in)
 Compute sum of array elements (real).
double Pscf::Reduce::sum (Array< double > const &in, int begin, int end)
 Compute sum of elements of an array slice (real).
double Pscf::Reduce::sumSq (Array< double > const &in)
 Compute sum of of squares of array elements (real).
double Pscf::Reduce::innerProduct (Array< double > const &a, Array< double > const &b)
 Compute Euclidean inner product of two real arrays .
double Pscf::Reduce::max (Array< double > const &in)
 Get maximum of array elements (real).
double Pscf::Reduce::max (Array< double > const &in, int begin, int end)
 Get value of maximum element in an array slice (real).
double Pscf::Reduce::maxAbs (Array< double > const &in)
 Get maximum absolute magnitude of array elements .
double Pscf::Reduce::min (Array< double > const &in)
 Get minimum of array elements .
double Pscf::Reduce::min (Array< double > const &in, int begin, int end)
 Get value of minimum element in an array slice (real).
double Pscf::Reduce::minAbs (Array< double > const &in)
 Get minimum absolute magnitude of array elements .
std::complex< double > Pscf::Reduce::sum (Array< fftw_complex > const &a)
 Compute sum of all elements of an array (complex).
std::complex< double > Pscf::Reduce::sum (Array< fftw_complex > const &a, int begin, int end)
 Compute sum of elements of an array slice (complex).
std::complex< double > Pscf::Reduce::sumSq (Array< fftw_complex > const &a)
 Compute sum of squares of elements of a complex array.
std::complex< double > Pscf::Reduce::sumProduct (Array< fftw_complex > const &a, Array< fftw_complex > const &b)
 Compute sum of complex products of elements of two arrays (complex).

Detailed Description

Functions that perform array reductions on a CPU.

A reduction is any operation that involves reducing all of the elements of an array or set of arrays to a single scalar.
Examples include taking the sum or finding the maximum of all array elements, or taking an inner product of two arrays.

Function Documentation

◆ sum() [1/4]

◆ sum() [2/4]

double Pscf::Reduce::sum ( Array< double > const & in,
int begin,
int end )

Compute sum of elements of an array slice (real).

Parameters
ininput array
beginindex of first element in slice
endindex one past the last in slice
Returns
sum of elements with indices [begin, end-1]

Definition at line 50 of file Reduce.cpp.

References Util::Array< Data >::capacity(), sum(), and UTIL_CHECK.

◆ sumSq() [1/2]

double Pscf::Reduce::sumSq ( Array< double > const & in)

Compute sum of of squares of array elements (real).

Parameters
ininput array

Definition at line 82 of file Reduce.cpp.

References Util::Array< Data >::capacity(), sum(), and UTIL_CHECK.

Referenced by Pscf::Rp::EinsteinCrystalPerturbation< D, T >::hamiltonian().

◆ innerProduct()

double Pscf::Reduce::innerProduct ( Array< double > const & a,
Array< double > const & b )

Compute Euclidean inner product of two real arrays .

Parameters
afirst input array
bsecond input array

Definition at line 117 of file Reduce.cpp.

References Util::Array< Data >::capacity(), sum(), and UTIL_CHECK.

Referenced by Pscf::Rp::Propagator< D, T >::computeQ(), Pscf::Rpg::FilmFieldGenExt< D >::stress(), and Pscf::Rpg::FilmFieldGenMask< D >::stress().

◆ max() [1/2]

double Pscf::Reduce::max ( Array< double > const & in)

Get maximum of array elements (real).

Parameters
ininput array

Definition at line 151 of file Reduce.cpp.

References Util::Array< Data >::capacity(), max(), and UTIL_CHECK.

Referenced by max(), max(), max(), max(), maxAbs(), and maxAbs().

◆ max() [2/2]

double Pscf::Reduce::max ( Array< double > const & in,
int begin,
int end )

Get value of maximum element in an array slice (real).

Parameters
ininput array
beginindex of first element in slice
endindex one past the last in slice
Returns
maximum of elements with indices [begin, end-1]

Definition at line 165 of file Reduce.cpp.

References Util::Array< Data >::capacity(), max(), and UTIL_CHECK.

◆ maxAbs()

double Pscf::Reduce::maxAbs ( Array< double > const & in)

Get maximum absolute magnitude of array elements .

Parameters
ininput array
Returns
maximum absolute value

Definition at line 182 of file Reduce.cpp.

References Util::Array< Data >::capacity(), max(), and UTIL_CHECK.

◆ min() [1/2]

double Pscf::Reduce::min ( Array< double > const & in)

Get minimum of array elements .

Parameters
ininput array
Returns
value of minimum element

Definition at line 198 of file Reduce.cpp.

References Util::Array< Data >::capacity(), min(), and UTIL_CHECK.

Referenced by min(), min(), min(), min(), minAbs(), and minAbs().

◆ min() [2/2]

double Pscf::Reduce::min ( Array< double > const & in,
int begin,
int end )

Get value of minimum element in an array slice (real).

Parameters
ininput array
beginindex of first element in slice
endindex one past the last in slice
Returns
minimum of elements with indices [begin, end-1]

Definition at line 212 of file Reduce.cpp.

References Util::Array< Data >::capacity(), min(), and UTIL_CHECK.

◆ minAbs()

double Pscf::Reduce::minAbs ( Array< double > const & in)

Get minimum absolute magnitude of array elements .

Parameters
ininput array
Returns
value of minimum absolute value of all elements

Definition at line 229 of file Reduce.cpp.

References Util::Array< Data >::capacity(), min(), and UTIL_CHECK.

◆ sum() [3/4]

std::complex< double > Pscf::Reduce::sum ( Array< fftw_complex > const & a)

Compute sum of all elements of an array (complex).

Parameters
ainput array
Returns
sum of all elements of complex array a

Definition at line 17 of file ReduceCx.cpp.

References Util::Array< Data >::capacity(), sum(), and UTIL_CHECK.

◆ sum() [4/4]

std::complex< double > Pscf::Reduce::sum ( Array< fftw_complex > const & a,
int begin,
int end )

Compute sum of elements of an array slice (complex).

Parameters
ainput array
beginindex of first element of slice
endindex one past the last element
Returns
sum of elements with indices [begin, end-1]

Definition at line 34 of file ReduceCx.cpp.

References Util::Array< Data >::capacity(), sum(), and UTIL_CHECK.

◆ sumSq() [2/2]

std::complex< double > Pscf::Reduce::sumSq ( Array< fftw_complex > const & a)

Compute sum of squares of elements of a complex array.

Parameters
ainput array
Returns
complex sum of squares of elements of array a

Definition at line 55 of file ReduceCx.cpp.

References Util::Array< Data >::capacity(), sum(), and UTIL_CHECK.

◆ sumProduct()

std::complex< double > Pscf::Reduce::sumProduct ( Array< fftw_complex > const & a,
Array< fftw_complex > const & b )

Compute sum of complex products of elements of two arrays (complex).

Parameters
afirst input array
bsecond input array
Returns
sum of elementwise complex products a[i]*b[i]

Definition at line 75 of file ReduceCx.cpp.

References Util::Array< Data >::capacity(), sum(), and UTIL_CHECK.