TRIQS/nda 1.3.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
array.hpp File Reference
#include <array>
#include <ostream>
#include <sstream>
#include <string>
#include <type_traits>
#include <vector>
#include <utility>

Detailed Description

Provides utility functions for std::array.

Definition in file array.hpp.

Go to the source code of this file.

Functions

template<typename T , auto R, typename U >
constexpr std::array< T, R+1 > nda::stdutil::append (std::array< T, R > const &a, U const &x)
 Make a new std::array by appending one element at the end to an existing std::array.
 
template<typename T , typename U , size_t R>
constexpr auto nda::stdutil::dot_product (std::array< T, R > const &a1, std::array< U, R > const &a2)
 Calculate the dot product of two std::array objects.
 
template<typename T , typename U , size_t R>
constexpr std::array< T, R+1 > nda::stdutil::front_append (std::array< T, R > const &a, U const &x)
 Make a new std::array by prepending one element at the front to an existing std::array.
 
template<int N, typename T , size_t R>
constexpr std::array< T, R - N > nda::stdutil::front_mpop (std::array< T, R > const &a)
 Make a new std::array by popping the first N elements of an existing std::array.
 
template<typename T , size_t R>
constexpr std::array< T, R - 1 > nda::stdutil::front_pop (std::array< T, R > const &a)
 Make a new std::array by popping the first element of an existing std::array.
 
template<typename T , size_t R1, size_t R2>
constexpr std::array< T, R1+R2 > nda::stdutil::join (std::array< T, R1 > const &a1, std::array< T, R2 > const &a2)
 Make a new std::array by joining two existing std::array objects.
 
template<size_t R, typename T >
constexpr std::array< T, R > nda::stdutil::make_initialized_array (T v)
 Create a new std::array object initialized with a specific value.
 
template<typename T , typename U , size_t R>
constexpr std::array< T, R > nda::stdutil::make_std_array (std::array< U, R > const &a)
 Convert a std::array with value type U to a std::array with value type T.
 
template<int N, typename T , size_t R>
constexpr std::array< T, R - N > nda::stdutil::mpop (std::array< T, R > const &a)
 Make a new std::array by popping the last N elements of an existing std::array.
 
template<typename T , typename U , size_t R>
constexpr auto std::operator* (std::array< T, R > const &lhs, std::array< U, R > const &rhs)
 Multiply two std::array objects element-wise.
 
template<typename T , size_t R>
constexpr std::array< T, R > std::operator* (T s, std::array< T, R > const &a)
 Multiply a scalar and a std::array element-wise.
 
template<typename T , size_t R>
constexpr std::array< T, R > std::operator+ (std::array< T, R > const &lhs, std::array< T, R > const &rhs)
 Add two std::array objects element-wise.
 
template<typename T , size_t R>
constexpr std::array< T, R > std::operator- (std::array< T, R > const &a)
 Negate a std::array element-wise (unary minus).
 
template<typename T , size_t R>
constexpr std::array< T, R > std::operator- (std::array< T, R > const &lhs, std::array< T, R > const &rhs)
 Subtract two std::array objects element-wise.
 
template<typename T , size_t R>
std::ostream & std::operator<< (std::ostream &out, std::array< T, R > const &a)
 Write a std::array to an output stream.
 
template<typename T , size_t R>
constexpr std::array< T, R - 1 > nda::stdutil::pop (std::array< T, R > const &a)
 Make a new std::array by popping the last element of an existing std::array.
 
template<typename T , size_t R>
constexpr auto nda::stdutil::product (std::array< T, R > const &a)
 Calculate the product of all elements in a std::array.
 
template<typename T , size_t R>
constexpr auto nda::stdutil::sum (std::array< T, R > const &a)
 Calculate the sum of all elements in a std::array.
 
template<typename T , size_t R>
std::string std::to_string (std::array< T, R > const &a)
 Get a string representation of a std::array.
 
template<typename T , size_t R>
constexpr std::vector< T > nda::stdutil::to_vector (std::array< T, R > const &a)
 Convert a std::array to a std::vector.