TRIQS/nda 1.3.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
basic_functions.hpp File Reference
#include "./clef/clef.hpp"
#include "./declarations.hpp"
#include "./exceptions.hpp"
#include "./layout/for_each.hpp"
#include "./mem/address_space.hpp"
#include "./traits.hpp"
#include <itertools/itertools.hpp>
#include <array>
#include <concepts>
#include <optional>
#include <random>
#include <tuple>
#include <type_traits>
#include <utility>

Detailed Description

Provides basic functions to create and manipulate arrays and views.

Definition in file basic_functions.hpp.

Go to the source code of this file.

Functions

template<std::integral Int = long>
auto nda::arange (long first, long last, long step=1)
 Make a 1-dimensional integer array and initialize it with values of a given nda::range.
 
template<std::integral Int = long>
auto nda::arange (long last)
 Make a 1-dimensional integer array and initialize it with values of a given nda::range with a step size of 1 and a starting value of 0.
 
template<Array A, typename F >
void nda::clef_auto_assign (A &&a, F &&f)
 Overload of nda::clef::clef_auto_assign function for nda::Array objects.
 
template<size_t Axis = 0, Array A0, Array... As>
auto nda::concatenate (A0 const &a0, As const &...as)
 Join a sequence of nda::Array types along an existing axis.
 
template<Array A>
long nda::first_dim (A const &a)
 Get the extent of the first dimension of the array.
 
template<MemoryArray A>
auto nda::get_block_layout (A const &a)
 Check if a given nda::MemoryArray has a block-strided layout.
 
template<typename T , int R, typename LP , char A, typename CP >
auto nda::make_array_const_view (basic_array< T, R, LP, A, CP > const &a)
 Make an nda::array_const_view of a given nda::basic_array.
 
template<typename T , int R, typename LP , char A, typename AP , typename OP >
auto nda::make_array_const_view (basic_array_view< T, R, LP, A, AP, OP > const &a)
 Make an nda::array_const_view of a given nda::basic_array_view.
 
template<typename T , int R, typename LP , char A, typename CP >
auto nda::make_array_view (basic_array< T, R, LP, A, CP > const &a)
 Make an nda::array_view of a given nda::basic_array.
 
template<typename T , int R, typename LP , char A, typename AP , typename OP >
auto nda::make_array_view (basic_array_view< T, R, LP, A, AP, OP > const &a)
 Make an nda::array_view of a given nda::basic_array_view.
 
template<typename T , int R, typename LP , char A, typename CP >
auto nda::make_const_view (basic_array< T, R, LP, A, CP > const &a)
 Make an nda::basic_array_view with a const value type from a given nda::basic_array.
 
template<typename T , int R, typename LP , char A, typename AP , typename OP >
auto nda::make_const_view (basic_array_view< T, R, LP, A, AP, OP > const &a)
 Make an nda::basic_array_view with a const value type from a given nda::basic_array_view.
 
template<typename T , int R, typename LP , char A, typename CP >
auto nda::make_matrix_view (basic_array< T, R, LP, A, CP > const &a)
 Make an nda::matrix_view of a given nda::basic_array.
 
template<typename T , int R, typename LP , char A, typename AP , typename OP >
auto nda::make_matrix_view (basic_array_view< T, R, LP, A, AP, OP > const &a)
 Make an nda::matrix_view of a given nda::basic_array_view.
 
template<typename A , typename A_t = std::decay_t<A>>
decltype(auto) nda::make_regular (A &&a)
 Make a given object regular.
 
template<typename T , std::integral... Ints>
auto nda::ones (Ints... is)
 Make an array with the given dimensions and one-initialize it.
 
template<typename T , std::integral Int, auto Rank>
requires (nda::is_scalar_v<T>)
auto nda::ones (std::array< Int, Rank > const &shape)
 Make an array of the given shape and one-initialize it.
 
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<typename RealType = double, std::integral... Ints>
auto nda::rand (Ints... is)
 Make an array of the given dimensions and initialize it with random values from the uniform distribution over [0, 1).
 
template<typename RealType = double, std::integral Int, auto Rank>
requires (std::is_floating_point_v<RealType>)
auto nda::rand (std::array< Int, Rank > const &shape)
 Make an array of the given shape and initialize it with random values from the uniform distribution over [0, 1).
 
template<typename A >
requires (is_regular_or_view_v<A>)
void nda::resize_or_check_if_view (A &a, std::array< long, A::rank > const &sha)
 Resize a given regular array to the given shape or check if a given view as the correct shape.
 
template<Array A>
long nda::second_dim (A const &a)
 Get the extent of the second dimension of the array.
 
template<MemoryArray A>
decltype(auto) nda::to_device (A &&a)
 Convert an nda::MemoryArray to its regular type on device memory.
 
template<MemoryArray A>
decltype(auto) nda::to_host (A &&a)
 Convert an nda::MemoryArray to its regular type on host memory.
 
template<MemoryArray A>
decltype(auto) nda::to_unified (A &&a)
 Convert an nda::MemoryArray to its regular type on unified memory.
 
template<typename T , mem::AddressSpace AdrSp = mem::Host, std::integral... Ints>
auto nda::zeros (Ints... is)
 Make an array of the given shape on the given address space and zero-initialize it.
 
template<typename T , mem::AddressSpace AdrSp = mem::Host, std::integral Int, auto Rank>
auto nda::zeros (std::array< Int, Rank > const &shape)
 Make an array of the given shape on the given address space and zero-initialize it.