TRIQS/nda 1.3.0
Multi-dimensional array library for C++
|
Type traits, concepts and more functionality related to array and view types.
Concepts | |
concept | nda::Array |
Check if a given type satisfies the array concept. | |
concept | nda::MemoryArray |
Check if a given type satisfies the memory array concept. | |
concept | nda::ArrayOfRank |
Check if a given type is an nda::Array of a certain rank. | |
concept | nda::MemoryArrayOfRank |
Check if a given type is an nda::MemoryArray of a certain rank. | |
concept | nda::ArrayOrScalar |
Check if if a given type is either an nda::Array or an nda::Scalar. | |
concept | nda::Matrix |
Check if a given type is a matrix, i.e. an nda::ArrayOfRank<2>. | |
concept | nda::Vector |
Check if a given type is a vector, i.e. an nda::ArrayOfRank<1>. | |
concept | nda::MemoryMatrix |
Check if a given type is a memory matrix, i.e. an nda::MemoryArrayOfRank<2>. | |
concept | nda::MemoryVector |
Check if a given type is a memory vector, i.e. an nda::MemoryArrayOfRank<1>. | |
concept | nda::ArrayInitializer |
Check if a given type satisfies the array initializer concept for a given nda::MemoryArray type. | |
concept | nda::HasValueTypeConstructibleFrom |
Check if a given type is constructible from the value type of a given nda::Array type. | |
Classes | |
class | nda::array_adapter< R, F > |
Adapter that consists of a shape and a callable object, which takes R integers as arguments (just like an nda::basic_array or nda::basic_array_view). More... | |
class | nda::array_iterator< Rank, T, Pointer > |
Iterator for nda::basic_array and nda::basic_array_view types. More... | |
class | nda::array_iterator< 1, T, Pointer > |
Specialization of nda::array_iterator for 1-dimensional grids. More... | |
struct | nda::default_accessor |
Default accessor for various array and view types. More... | |
struct | nda::default_accessor::accessor< T > |
Accessor type of the nda::default_accessor. More... | |
struct | nda::no_alias_accessor |
Accessor for array and view types with no aliasing. More... | |
struct | nda::no_alias_accessor::accessor< T > |
Accessor type of the nda::no_alias_accessor. More... | |
Typedefs | |
template<typename T , typename RT = get_regular_t<T>> | |
using | nda::get_regular_device_t |
Get the type of the nda::basic_array that would be obtained by constructing an array on device memory from a given type. | |
template<typename T , typename RT = get_regular_t<T>> | |
using | nda::get_regular_host_t |
Get the type of the nda::basic_array that would be obtained by constructing an array on host memory from a given type. | |
template<typename T , typename T2 = std::remove_reference_t<T>> | |
using | nda::get_regular_t = decltype(basic_array{std::declval<T>()}) |
Get the type of the nda::basic_array that would be obtained by constructing an array from a given type. | |
template<typename T , typename RT = get_regular_t<T>> | |
using | nda::get_regular_unified_t |
Get the type of the nda::basic_array that would be obtained by constructing an array on unified memory from a given type. | |
template<typename A > | |
using | nda::get_value_t = std::decay_t<decltype(get_first_element(std::declval<A const>()))> |
Get the value type of an array/view or a scalar type. | |
template<typename T , typename T2 = std::remove_reference_t<T>> | |
using | nda::get_view_t = std::remove_reference_t<decltype(basic_array_view{std::declval<T>()})> |
Get the type of the nda::basic_array_view that would be obtained by constructing a view from a given type. | |
Functions | |
template<Array A> | |
long | nda::first_dim (A const &a) |
Get the extent of the first dimension of the array. | |
template<typename A > | |
decltype(auto) | nda::get_first_element (A const &a) |
Get the first element of an array/view or simply return the scalar if a scalar is given. | |
template<typename A > requires (is_regular_or_view_v<A>) | |
std::ostream & | nda::operator<< (std::ostream &sout, A const &a) |
Write an nda::basic_array or nda::basic_array_view to a std::ostream. | |
template<int R, typename F > | |
std::ostream & | nda::operator<< (std::ostream &sout, array_adapter< R, F > const &aa) |
Write an nda::array_adapter to a std::ostream. | |
template<char OP, ArrayOrScalar L, ArrayOrScalar R> | |
std::ostream & | nda::operator<< (std::ostream &sout, expr< OP, L, R > const &ex) |
Write an nda::expr to a std::ostream. | |
template<typename F , typename... As> | |
std::ostream & | nda::operator<< (std::ostream &sout, expr_call< F, As... > const &) |
Write an nda::expr_call to a std::ostream. | |
template<char OP, Array A> | |
std::ostream & | nda::operator<< (std::ostream &sout, expr_unary< OP, A > const &ex) |
Write an nda::expr_unary to a std::ostream. | |
template<ArrayOfRank< 1 > A, std::ranges::contiguous_range R> | |
bool | nda::operator== (A const &a, R const &rg) |
Equal-to comparison operator for a 1-dimensional nda::Array and a std::ranges::contiguous_range . | |
template<Array LHS, Array RHS> | |
bool | nda::operator== (LHS const &lhs, RHS const &rhs) |
Equal-to comparison operator for two nda::Array objects. | |
template<std::ranges::contiguous_range R, ArrayOfRank< 1 > A> | |
bool | nda::operator== (R const &rg, A const &a) |
Equal-to comparison operator for a std::ranges::contiguous_range and a 1-dimensional nda::Array. | |
template<Array A> | |
long | nda::second_dim (A const &a) |
Get the extent of the second dimension of the array. | |
template<typename... Is> | |
constexpr uint64_t | nda::static_extents (int i0, Is... is) |
Encode the given shape into a single integer using the nda::encode function. | |
Variables | |
template<typename A > | |
constexpr char | nda::get_algebra = 'N' |
Constexpr variable that specifies the algebra of a type. | |
template<typename ValueType , int Rank, typename Layout , char Algebra, typename ContainerPolicy > | |
constexpr char | nda::get_algebra< basic_array< ValueType, Rank, Layout, Algebra, ContainerPolicy > > = Algebra |
Specialization of nda::get_algebra for nda::basic_array types. | |
template<typename ValueType , int Rank, typename Layout , char Algebra, typename AccessorPolicy , typename OwningPolicy > | |
constexpr char | nda::get_algebra< basic_array_view< ValueType, Rank, Layout, Algebra, AccessorPolicy, OwningPolicy > > = Algebra |
Specialization of nda::get_algebra for nda::basic_array_view types. | |
template<char OP, typename L , typename R > | |
constexpr char | nda::get_algebra< expr< OP, L, R > > = expr<OP, L, R>::algebra |
Specialization of nda::get_algebra for nda::expr types. | |
template<typename F , Array... As> | |
constexpr char | nda::get_algebra< expr_call< F, As... > > = detail::_impl_find_common_algebra(get_algebra<As>...) |
Get the resulting algebra of a function call expression involving arrays/views. | |
template<char OP, Array A> | |
constexpr char | nda::get_algebra< expr_unary< OP, A > > = get_algebra<A> |
Specialization of nda::get_algebra for nda::expr_unary types. | |
template<typename ValueType , int Rank, typename Layout , char Algebra, typename ContainerPolicy > | |
constexpr layout_info_t | nda::get_layout_info< basic_array< ValueType, Rank, Layout, Algebra, ContainerPolicy > > |
Specialization of nda::get_layout_info for nda::basic_array types. | |
template<typename ValueType , int Rank, typename Layout , char Algebra, typename AccessorPolicy , typename OwningPolicy > | |
constexpr layout_info_t | nda::get_layout_info< basic_array_view< ValueType, Rank, Layout, Algebra, AccessorPolicy, OwningPolicy > > |
Specialization of nda::get_layout_info for nda::basic_array_view types. | |
template<char OP, typename L , typename R > | |
constexpr layout_info_t | nda::get_layout_info< expr< OP, L, R > > = expr<OP, L, R>::compute_layout_info() |
Specialization of nda::get_layout_info for nda::expr types. | |
template<char OP, Array A> | |
constexpr layout_info_t | nda::get_layout_info< expr_unary< OP, A > > = get_layout_info<A> |
Specialization of nda::get_layout_info for nda::expr_unary types. | |
template<typename A > | |
constexpr int | nda::get_rank |
Constexpr variable that specifies the rank of an nda::Array or of a contiguous 1-dimensional range. | |
template<typename A0 , typename... As> | |
constexpr bool | nda::have_same_rank_v = ((get_rank<A0> == get_rank<As>)and... and true) |
Constexpr variable that is true if all types in As have the same rank as A0 . | |
template<typename A0 , typename... As> | |
constexpr bool | nda::have_same_value_type_v = (std::is_same_v<get_value_t<A0>, get_value_t<As>> and ... and true) |
Constexpr variable that is true if all types in As have the same value type as A0 . | |
template<typename A > | |
constexpr bool | nda::is_matrix_or_view_v = is_regular_or_view_v<A> and (get_algebra<A> == 'M') and (get_rank<A> == 2) |
Constexpr variable that is true if type A is a regular matrix or a view of a matrix. | |
template<typename A > | |
constexpr bool | nda::is_regular_or_view_v = is_regular_v<A> or is_view_v<A> |
Constexpr variable that is true if type A is either a regular array or a view. | |
template<typename A > | |
constexpr bool | nda::is_regular_v = false |
Constexpr variable that is true if type A is a regular array, i.e. an nda::basic_array. | |
template<typename ValueType , int Rank, typename Layout , char Algebra, typename ContainerPolicy > | |
constexpr bool | nda::is_regular_v< basic_array< ValueType, Rank, Layout, Algebra, ContainerPolicy > > = true |
Specialization of nda::is_regular_v for nda::basic_array. | |
template<typename A > | |
constexpr bool | nda::is_view_v = false |
Constexpr variable that is true if type A is a view, i.e. an nda::basic_array_view. | |
template<typename ValueType , int Rank, typename Layout , char Algebra, typename AccessorPolicy , typename OwningPolicy > | |
constexpr bool | nda::is_view_v< basic_array_view< ValueType, Rank, Layout, Algebra, AccessorPolicy, OwningPolicy > > = true |
Specialization of nda::is_view_v for nda::basic_array_view. | |
using nda::get_regular_device_t |
#include <nda/declarations.hpp>
Get the type of the nda::basic_array that would be obtained by constructing an array on device memory from a given type.
T | Type to construct an array from. |
Definition at line 381 of file declarations.hpp.
using nda::get_regular_host_t |
#include <nda/declarations.hpp>
Get the type of the nda::basic_array that would be obtained by constructing an array on host memory from a given type.
T | Type to construct an array from. |
Definition at line 369 of file declarations.hpp.
using nda::get_regular_t = decltype(basic_array{std::declval<T>()}) |
#include <nda/declarations.hpp>
Get the type of the nda::basic_array that would be obtained by constructing an array from a given type.
T | Type to construct an array from. |
Definition at line 360 of file declarations.hpp.
using nda::get_regular_unified_t |
#include <nda/declarations.hpp>
Get the type of the nda::basic_array that would be obtained by constructing an array on unified memory from a given type.
T | Type to construct an array from. |
Definition at line 393 of file declarations.hpp.
using nda::get_value_t = std::decay_t<decltype(get_first_element(std::declval<A const>()))> |
#include <nda/traits.hpp>
Get the value type of an array/view or a scalar type.
A | Array/View/Scalar type. |
Definition at line 192 of file traits.hpp.
using nda::get_view_t = std::remove_reference_t<decltype(basic_array_view{std::declval<T>()})> |
#include <nda/declarations.hpp>
Get the type of the nda::basic_array_view that would be obtained by constructing a view from a given type.
T | Type to construct a view from. |
Definition at line 353 of file declarations.hpp.
long nda::first_dim | ( | A const & | a | ) |
#include <nda/basic_functions.hpp>
Get the extent of the first dimension of the array.
Equivalent to a.extent(0)
and a.shape()[0]
.
A | nda::Array type. |
a | nda::Array object. |
Definition at line 204 of file basic_functions.hpp.
decltype(auto) nda::get_first_element | ( | A const & | a | ) |
#include <nda/traits.hpp>
Get the first element of an array/view or simply return the scalar if a scalar is given.
A | Array/View/Scalar type. |
a | Input array/view/scalar. |
Definition at line 177 of file traits.hpp.
std::ostream & nda::operator<< | ( | std::ostream & | sout, |
A const & | a ) |
#include <nda/print.hpp>
Write an nda::basic_array or nda::basic_array_view to a std::ostream.
A | Type of the nda::basic_array or nda::basic_array_view. |
sout | std::ostream object. |
a | nda::basic_array or nda::basic_array_view object. |
std::ostream & nda::operator<< | ( | std::ostream & | sout, |
array_adapter< R, F > const & | aa ) |
#include <nda/print.hpp>
Write an nda::array_adapter to a std::ostream.
R | Rank of the nda::array_adapter. |
F | Callable type of the nda::array_adapter. |
sout | std::ostream object. |
aa | nda::array_adapter object. |
std::ostream & nda::operator<< | ( | std::ostream & | sout, |
expr< OP, L, R > const & | ex ) |
#include <nda/print.hpp>
Write an nda::expr to a std::ostream.
OP | Binary operator. |
L | nda::ArrayOrScalar type of left hand side. |
R | nda::ArrayOrScalar type of right hand side. |
sout | std::ostream object. |
ex | nda::expr object. |
std::ostream & nda::operator<< | ( | std::ostream & | sout, |
expr_call< F, As... > const & | ) |
#include <nda/print.hpp>
Write an nda::expr_call to a std::ostream.
F | Callable type. |
As | Argument types. |
sout | std::ostream object. |
std::ostream & nda::operator<< | ( | std::ostream & | sout, |
expr_unary< OP, A > const & | ex ) |
#include <nda/print.hpp>
Write an nda::expr_unary to a std::ostream.
OP | Unary operator. |
A | nda::Array type. |
sout | std::ostream object. |
ex | nda::expr_unary object. |
bool nda::operator== | ( | A const & | a, |
R const & | rg ) |
#include <nda/basic_functions.hpp>
Equal-to comparison operator for a 1-dimensional nda::Array and a std::ranges::contiguous_range
.
A | nda::Array type of left hand side. |
R | std::ranges::contiguous_range type of right hand side. |
a | Left hand side array operand. |
rg | Right hand side range operand. |
Definition at line 503 of file basic_functions.hpp.
bool nda::operator== | ( | LHS const & | lhs, |
RHS const & | rhs ) |
#include <nda/basic_functions.hpp>
Equal-to comparison operator for two nda::Array objects.
LHS | nda::Array type of left hand side. |
RHS | nda::Array type of right hand side. |
lhs | Left hand side array operand. |
rhs | Right hand side array operand. |
Definition at line 480 of file basic_functions.hpp.
bool nda::operator== | ( | R const & | rg, |
A const & | a ) |
#include <nda/basic_functions.hpp>
Equal-to comparison operator for a std::ranges::contiguous_range
and a 1-dimensional nda::Array.
R | std::ranges::contiguous_range type of left hand side. |
A | nda::Array type of right hand side. |
rg | Left hand side range operand. |
a | Right hand side array operand. |
Definition at line 518 of file basic_functions.hpp.
long nda::second_dim | ( | A const & | a | ) |
#include <nda/basic_functions.hpp>
Get the extent of the second dimension of the array.
Equivalent to a.extent(1)
and a.shape()[1]
.
A | nda::Array type. |
a | nda::Array object. |
Definition at line 219 of file basic_functions.hpp.
|
constexpr |
#include <nda/declarations.hpp>
Encode the given shape into a single integer using the nda::encode function.
Is | Integer sequence describing the shape. |
i0 | Size of the first dimension. |
is | Sizes of the other dimensions. |
uint64_t
encoded shape. Definition at line 187 of file declarations.hpp.
|
inlineconstexpr |
#include <nda/traits.hpp>
Constexpr variable that specifies the algebra of a type.
The possible values are:
The algebra defines the behavior of objects in certain situations, e.g. matrix multiplication of two matrices ('M' algebra) vs. element-wise multiplication of two arrays ('A' algebra).
A | Type to get the algebra of. |
Definition at line 126 of file traits.hpp.
|
constexpr |
#include <nda/map.hpp>
Get the resulting algebra of a function call expression involving arrays/views.
If one of the algebras of the arguments is different, the resulting algebra is 'N'.
F | Callable object of the expression. |
As | nda::Array argument types. |