TRIQS/nda 1.3.0
Multi-dimensional array library for C++
|
Various algorithms that can be applied to arrays and views.
We can group the different algorithms into
Functions | |
template<Array A> | |
bool | nda::all (A const &a) |
Do all elements of the array evaluate to true? | |
template<Array A> | |
bool | nda::any (A const &a) |
Does any of the elements of the array evaluate to true? | |
template<Array A, typename F > | |
auto | nda::fold (F f, A const &a) |
The same as nda::fold, except that the initial value is a default constructed value type of the array. | |
template<Array A, typename F , typename R > | |
auto | nda::fold (F f, A const &a, R r) |
Perform a fold operation on the given nda::Array object. | |
template<Array A> | |
auto | nda::max_element (A const &a) |
Find the maximum element of an array. | |
template<Array A> | |
auto | nda::min_element (A const &a) |
Find the minimum element of an array. | |
template<Array A> requires (nda::is_scalar_v<get_value_t<A>>) | |
auto | nda::product (A const &a) |
Multiply all the elements of an nda::Array object. | |
template<Array A> requires (nda::is_scalar_v<get_value_t<A>>) | |
auto | nda::sum (A const &a) |
Sum all the elements of an nda::Array object. | |
bool nda::all | ( | A const & | a | ) |
#include <nda/algorithms.hpp>
Do all elements of the array evaluate to true?
The given nda::Array object can also be some lazy expression that evaluates to a boolean. For example:
A | nda::Array type. |
a | nda::Array object. |
Definition at line 113 of file algorithms.hpp.
bool nda::any | ( | A const & | a | ) |
#include <nda/algorithms.hpp>
Does any of the elements of the array evaluate to true?
The given nda::Array object can also be some lazy expression that evaluates to a boolean. For example:
A | nda::Array type. |
a | nda::Array object. |
Definition at line 92 of file algorithms.hpp.
auto nda::fold | ( | F | f, |
A const & | a, | ||
R | r ) |
#include <nda/algorithms.hpp>
Perform a fold operation on the given nda::Array object.
It calculates the following (where r is an initial value);
A | nda::Array type. |
F | Callable type. |
R | Type of the initial value. |
f | Callable object taking two arguments compatible with the initial value and the array value type. |
a | nda::Array object. |
r | Initial value. |
Definition at line 63 of file algorithms.hpp.
auto nda::max_element | ( | A const & | a | ) |
#include <nda/algorithms.hpp>
Find the maximum element of an array.
It uses nda::fold and std::max
.
A | nda::Array type. |
a | nda::Array object. |
Definition at line 128 of file algorithms.hpp.
auto nda::min_element | ( | A const & | a | ) |
#include <nda/algorithms.hpp>
Find the minimum element of an array.
It uses nda::fold and std::min
.
A | nda::Array type. |
a | nda::Array object. |
Definition at line 147 of file algorithms.hpp.
auto nda::product | ( | A const & | a | ) |
#include <nda/algorithms.hpp>
Multiply all the elements of an nda::Array object.
A | nda::Array type. |
a | nda::Array object. |
Definition at line 196 of file algorithms.hpp.
auto nda::sum | ( | A const & | a | ) |
#include <nda/algorithms.hpp>
Sum all the elements of an nda::Array object.
A | nda::Array type. |
a | nda::Array object. |
Definition at line 182 of file algorithms.hpp.