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, Array B> requires (nda::get_rank<A> == nda::get_rank<B>) | |
constexpr auto | nda::hadamard (A &&a, B &&b) |
Hadamard product of two nda::Array objects. | |
constexpr auto | nda::hadamard (nda::Scalar auto a, nda::Scalar auto b) |
Hadamard product of two arithmetic types. | |
template<typename T , typename U , size_t R> | |
constexpr auto | nda::hadamard (std::array< T, R > const &a, std::array< U, R > const &b) |
Hadamard product of two std::array objects. | |
template<typename T , typename U > | |
constexpr auto | nda::hadamard (std::vector< T > const &a, std::vector< U > const &b) |
Hadamard product of two std::vector objects. | |
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, typename Value = get_value_t<A>> requires (nda::Scalar<Value> or nda::Array<Value>) | |
auto | nda::product (A const &a) |
Multiply all the elements of an nda::Array object. | |
template<Array A, typename Value = get_value_t<A>> requires (nda::Scalar<Value> or nda::Array<Value>) | |
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 120 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 99 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 69 of file algorithms.hpp.
|
nodiscardconstexpr |
#include <nda/algorithms.hpp>
Hadamard product of two nda::Array objects.
A | nda::Array type. |
B | nda::Array type. |
a | nda::Array object. |
b | nda::Array object. |
Definition at line 228 of file algorithms.hpp.
|
constexpr |
#include <nda/algorithms.hpp>
Hadamard product of two arithmetic types.
T | nda::Scalar type of the first input. |
U | nda::Scalar type of the second input. |
a | First input. |
b | Second input. |
Definition at line 275 of file algorithms.hpp.
|
nodiscardconstexpr |
#include <nda/algorithms.hpp>
Hadamard product of two std::array objects.
T | Value type of the first array. |
U | Value type of the second array. |
R | Size of the arrays. |
a | std::array object. |
b | std::array object. |
Definition at line 243 of file algorithms.hpp.
|
nodiscardconstexpr |
#include <nda/algorithms.hpp>
Hadamard product of two std::vector objects.
T | Value type of the first input vector. |
U | Value type of the second input vector. |
a | std::vector object. |
b | std::vector object. |
Definition at line 257 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 135 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 154 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 207 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 189 of file algorithms.hpp.