ndarray
NumPy-friendly multidimensional arrays in C++
Loading...
Searching...
No Matches
Classes | Functions
MainGroup

Classes

struct  ndarray::ArrayTraits< T, N, C >
 Dimension-specialized traits shared by Array and ArrayRef. More...
 
struct  ndarray::ExpressionTraits< Expression_ >
 Traits for expressions. More...
 
class  ndarray::NumericTraits< T, U, is_complex, is_arithmetic >
 Numeric type traits. More...
 
class  ndarray::Promote< T1, T2, winner, is_complex >
 Metafunction to compute numeric promotions. More...
 
struct  ndarray::ApproximatelyEqual< T1, T2 >
 Binary predicate for floating point equality comparison with tolerance. More...
 
struct  ndarray::ApproximatelyEqual< std::complex< U1 >, std::complex< U2 > >
 Binary predicate for complex floating point equality comparison with tolerance. More...
 
class  ndarray::ArrayBase< Derived >
 CRTP implementation for Array and ArrayRef. More...
 
class  ndarray::ExpressionBase< Derived >
 CRTP base class for all multidimensional expressions. More...
 
class  ndarray::FormatOptions
 Options for controlling stream output of ExpressionBase. More...
 

Functions

template<typename T_ , typename T , int N, int C>
Array< T_, N, C > ndarray::const_array_cast (Array< T, N, C > const &array)
 
template<int C_, typename T , int N, int C>
Array< T, N, C_ > ndarray::static_dimension_cast (Array< T, N, C > const &array)
 
template<int C_, typename T , int N, int C>
Array< T, N, C_ > ndarray::dynamic_dimension_cast (Array< T, N, C > const &array)
 
template<typename Array_ >
detail::ComplexExtractor< Array_ >::Result ndarray::getReal (Array_ const &array)
 Return an ArrayRef view into the real part of a complex array.
 
template<typename Array_ >
detail::ComplexExtractor< Array_ >::Result ndarray::getImag (Array_ const &array)
 Return an ArrayRef view into the imaginary part of a complex array.
 
template<int Nf, typename T , int N, int C>
boost::enable_if_c<((C+Nf-N)>=1), ArrayRef< T, Nf,(C+Nf-N)> >::type ndarray::flatten (Array< T, N, C > const &input)
 Create a view into an array with trailing contiguous dimensions merged.
 
template<int Nf, typename T , int N, int C>
boost::enable_if_c<((C+Nf-N)>=1), ArrayRef< T, Nf,(C+Nf-N)> >::type ndarray::flatten (ArrayRef< T, N, C > const &input)
 Create a view into an array with trailing contiguous dimensions merged.
 
template<int N, typename U >
detail::SimpleInitializer< N > ndarray::allocate (Vector< U, N > const &shape)
 Create an expression that allocates uninitialized memory for an array.
 
detail::SimpleInitializer< 1 > ndarray::allocate (Size n)
 Create an expression that allocates uninitialized memory for a 1-d array.
 
detail::SimpleInitializer< 2 > ndarray::allocate (Size n1, Size n2)
 Create an expression that allocates uninitialized memory for a 2-d array.
 
detail::SimpleInitializer< 3 > ndarray::allocate (Size n1, Size n2, Size n3)
 Create an expression that allocates uninitialized memory for a 3-d array.
 
template<typename Derived >
ArrayRef< typename boost::remove_const< typename Derived::Element >::type, Derived::ND::value, Derived::ND::value > ndarray::copy (ExpressionBase< Derived > const &expr)
 Create a new Array by copying an Expression.
 
template<int N>
Vector< Offset, N > ndarray::computeStrides (Vector< Size, N > const &shape, DataOrderEnum order=ROW_MAJOR)
 Compute row- or column-major strides for the given shape.
 
template<typename T , int N, typename U , typename V , typename Owner >
detail::ExternalInitializer< T, N, Owner > ndarray::external (T *data, Vector< U, N > const &shape, Vector< V, N > const &strides, Owner const &owner)
 Create an expression that initializes an Array with externally allocated memory.
 
template<typename T , int N, typename U , typename V >
detail::ExternalInitializer< T, N, detail::NullOwnerndarray::external (T *data, Vector< U, N > const &shape, Vector< V, N > const &strides)
 Create an expression that initializes an Array with externally allocated memory.
 
template<typename T , int N, typename U , typename Owner >
detail::ExternalInitializer< T, N, Owner > ndarray::external (T *data, Vector< U, N > const &shape, DataOrderEnum order, Owner const &owner)
 Create an expression that initializes an Array with externally allocated memory.
 
template<typename T , int N, typename U >
detail::ExternalInitializer< T, N, detail::NullOwnerndarray::external (T *data, Vector< U, N > const &shape, DataOrderEnum order=ROW_MAJOR)
 Create an expression that initializes an Array with externally allocated memory.
 
template<typename Derived >
bool ndarray::any (ExpressionBase< Derived > const &expr)
 Return true if any of the elements of the given expression are true.
 
template<typename Derived >
bool ndarray::all (ExpressionBase< Derived > const &expr)
 Return true if all of the elements of the given expression are true.
 
template<typename Derived >
Derived::Element ndarray::sum (ExpressionBase< Derived > const &expr)
 Return the sum of all elements of the given expression.
 

Detailed Description

Function Documentation

◆ all()

template<typename Derived >
bool ndarray::all ( ExpressionBase< Derived > const &  expr)
inline

Return true if all of the elements of the given expression are true.

◆ allocate() [1/4]

detail::SimpleInitializer< 1 > ndarray::allocate ( Size  n)
inline

Create an expression that allocates uninitialized memory for a 1-d array.

Returns
A temporary object convertible to an Array with fully contiguous row-major strides.

◆ allocate() [2/4]

detail::SimpleInitializer< 2 > ndarray::allocate ( Size  n1,
Size  n2 
)
inline

Create an expression that allocates uninitialized memory for a 2-d array.

Returns
A temporary object convertible to an Array with fully contiguous row-major strides.

◆ allocate() [3/4]

detail::SimpleInitializer< 3 > ndarray::allocate ( Size  n1,
Size  n2,
Size  n3 
)
inline

Create an expression that allocates uninitialized memory for a 3-d array.

Returns
A temporary object convertible to an Array with fully contiguous row-major strides.

◆ allocate() [4/4]

template<int N, typename U >
detail::SimpleInitializer< N > ndarray::allocate ( Vector< U, N > const &  shape)
inline

Create an expression that allocates uninitialized memory for an array.

Returns
A temporary object convertible to an Array with fully contiguous row-major strides.

◆ any()

template<typename Derived >
bool ndarray::any ( ExpressionBase< Derived > const &  expr)
inline

Return true if any of the elements of the given expression are true.

◆ const_array_cast()

template<typename T_ , typename T , int N, int C>
Array< T_, N, C > ndarray::const_array_cast ( Array< T, N, C > const &  array)

Convert an Array with a const data type to an array with a non-const data type.

◆ dynamic_dimension_cast()

template<int C_, typename T , int N, int C>
Array< T, N, C_ > ndarray::dynamic_dimension_cast ( Array< T, N, C > const &  array)

Convert an Array to a type with more guaranteed row-major-contiguous dimensions, if the strides of the array match the desired number of RMC dimensions. If the cast fails, an empty Array is returned.

◆ external() [1/4]

template<typename T , int N, typename U , typename Owner >
detail::ExternalInitializer< T, N, Owner > ndarray::external ( T *  data,
Vector< U, N > const &  shape,
DataOrderEnum  order,
Owner const &  owner 
)
inline

Create an expression that initializes an Array with externally allocated memory.

No checking is done to ensure the shape and data pointers are sensible.

Parameters
[in]dataA raw pointer to the first element of the Array.
[in]shapeA Vector of dimensions for the new Array.
[in]orderWhether the strides are row- or column-major.
[in]ownerA copy-constructable object with an internal reference count that owns the memory pointed at by 'data'.
Returns
A temporary object convertible to an Array.

◆ external() [2/4]

template<typename T , int N, typename U >
detail::ExternalInitializer< T, N, detail::NullOwner > ndarray::external ( T *  data,
Vector< U, N > const &  shape,
DataOrderEnum  order = ROW_MAJOR 
)
inline

Create an expression that initializes an Array with externally allocated memory.

No checking is done to ensure the shape and data pointers are sensible. Memory will not be managed at all; the user must ensure the data pointer remains valid for the lifetime of the array.

Parameters
[in]dataA raw pointer to the first element of the Array.
[in]shapeA Vector of dimensions for the new Array.
[in]orderWhether the strides are row- or column-major.
Returns
A temporary object convertible to an Array.

◆ external() [3/4]

template<typename T , int N, typename U , typename V >
detail::ExternalInitializer< T, N, detail::NullOwner > ndarray::external ( T *  data,
Vector< U, N > const &  shape,
Vector< V, N > const &  strides 
)
inline

Create an expression that initializes an Array with externally allocated memory.

No checking is done to ensure the shape, strides, and data pointers are sensible. Memory will not be managed at all; the user must ensure the data pointer remains valid for the lifetime of the array.

Parameters
[in]dataA raw pointer to the first element of the Array.
[in]shapeA Vector of dimensions for the new Array.
[in]stridesA Vector of strides for the new Array.
Returns
A temporary object convertible to an Array.

◆ external() [4/4]

template<typename T , int N, typename U , typename V , typename Owner >
detail::ExternalInitializer< T, N, Owner > ndarray::external ( T *  data,
Vector< U, N > const &  shape,
Vector< V, N > const &  strides,
Owner const &  owner 
)
inline

Create an expression that initializes an Array with externally allocated memory.

No checking is done to ensure the shape, strides, and data pointers are sensible.

Parameters
[in]dataA raw pointer to the first element of the Array.
[in]shapeA Vector of dimensions for the new Array.
[in]stridesA Vector of strides for the new Array.
[in]ownerA copy-constructable object with an internal reference count that owns the memory pointed at by 'data'.
Returns
A temporary object convertible to an Array.

◆ flatten() [1/2]

template<int Nf, typename T , int N, int C>
boost::enable_if_c<((C+Nf-N)>=1), ArrayRef< T, Nf,(C+Nf-N)> >::type ndarray::flatten ( Array< T, N, C > const &  input)
inline

Create a view into an array with trailing contiguous dimensions merged.

The first template parameter sets the dimension of the output array and must be specified directly. Only row-major contiguous dimensions can be flattened.

◆ flatten() [2/2]

template<int Nf, typename T , int N, int C>
boost::enable_if_c<((C+Nf-N)>=1), ArrayRef< T, Nf,(C+Nf-N)> >::type ndarray::flatten ( ArrayRef< T, N, C > const &  input)
inline

Create a view into an array with trailing contiguous dimensions merged.

The first template parameter sets the dimension of the output array and must be specified directly. Only row-major contiguous dimensions can be flattened.

◆ static_dimension_cast()

template<int C_, typename T , int N, int C>
Array< T, N, C_ > ndarray::static_dimension_cast ( Array< T, N, C > const &  array)

Convert an Array to a type with more guaranteed row-major-contiguous dimensions with no checking.

◆ sum()

template<typename Derived >
Derived::Element ndarray::sum ( ExpressionBase< Derived > const &  expr)
inline

Return the sum of all elements of the given expression.