TRIQS/nda 1.3.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
algorithms.hpp File Reference
#include "./basic_functions.hpp"
#include "./concepts.hpp"
#include "./layout/for_each.hpp"
#include "./layout/range.hpp"
#include "./macros.hpp"
#include "./map.hpp"
#include "./traits.hpp"
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <type_traits>
#include <utility>
#include <vector>

Detailed Description

Provides various algorithms to be used with nda::Array objects.

Definition in file algorithms.hpp.

Go to the source code of this file.

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<ArrayOfRank< 2 > A>
double nda::frobenius_norm (A const &a)
 Calculate the Frobenius norm of a 2-dimensional array.
 
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.