libpnicore
|
Modules | |
Internal classes | |
Dimension layout classes | |
Data Structures | |
singleton | pni::core::array_view< ATYPE > |
provides a view on a part of an array More... | |
class | pni::core::mdarray< STORAGE, IMAP, IPA > |
template for a multi-dimensional array class More... | |
class | pni::core::scalar< T > |
Scalar template for scalar values. More... | |
class | pni::core::slice |
index slice More... | |
Typedefs | |
template<typename T > | |
using | pni::core::dynamic_array = mdarray< std::vector< T >, dynamic_cindex_map > |
a dynamic array template More... | |
template<typename T , size_t D> | |
using | pni::core::fixed_dim_array = mdarray< std::vector< T >, fixed_dim_cindex_map< D >> |
array template with fixed dimension More... | |
template<typename T , size_t... NDIMS> | |
using | pni::core::static_array = mdarray< std::array< T, boost::mpl::times< boost::mpl::size_t< 1 >, boost::mpl::size_t< NDIMS >... >::value >, static_cindex_map< NDIMS...> > |
static array template More... | |
Functions | |
template<typename ATYPE > | |
bool | pni::core::operator== (const array_view< ATYPE > &a, const array_view< ATYPE > &b) |
compare two array views More... | |
template<typename ATYPE > | |
bool | pni::core::operator!= (const array_view< ATYPE > &a, const array_view< ATYPE > &b) |
compare two array views More... | |
template<typename ATYPE > | |
std::ostream & | pni::core::operator<< (std::ostream &stream, const array_view< ATYPE > &v) |
output operator for view More... | |
template<typename ATYPE > | |
std::istream & | pni::core::operator>> (std::istream &stream, array_view< ATYPE > &v) |
input operator for view More... | |
template<typename STORAGE , typename IMAP , typename IPA > | |
std::ostream & | pni::core::operator<< (std::ostream &o, const mdarray< STORAGE, IMAP, IPA > &a) |
output operator More... | |
template<typename STORAGE , typename IMAP , typename IPA > | |
std::istream & | pni::core::operator>> (std::istream &is, mdarray< STORAGE, IMAP, IPA > &a) |
input stream operator More... | |
template<typename STORAGE , typename IMAP , typename IPA > | |
bool | pni::core::operator== (const mdarray< STORAGE, IMAP, IPA > &b1, const mdarray< STORAGE, IMAP, IPA > &b2) |
equality comparison operator More... | |
template<typename STORAGE , typename IMAP , typename IPA > | |
bool | pni::core::operator!= (const mdarray< STORAGE, IMAP, IPA > &b1, const mdarray< STORAGE, IMAP, IPA > &b2) |
inequality comparison operator More... | |
template<typename T > | |
bool | pni::core::operator== (const scalar< T > &a, const scalar< T > &b) |
== operator for scalar More... | |
template<typename T > | |
bool | pni::core::operator!= (const scalar< T > &a, const scalar< T > &b) |
!= operator for scalar More... | |
template<typename T > | |
std::ostream & | pni::core::operator<< (std::ostream &os, const scalar< T > &s) |
stream output operator More... | |
template<typename T > | |
std::istream & | pni::core::operator>> (std::istream &is, scalar< T > &s) |
input strema data More... | |
size_t | pni::core::size (const slice &s) |
compute slice size More... | |
size_t | pni::core::span (const slice &s) |
compute total elements spanned More... | |
type_id_t | pni::core::type_id (const array &a) |
get type id More... | |
using pni::core::dynamic_array = typedef mdarray<std::vector<T>,dynamic_cindex_map> |
This template creates a fully dynamic array type. Its rank as well as its number of elements along each dimension (the shape) can be created dynamically. Use this type if all decisions have to be made at runtime.
T | element type |
using pni::core::fixed_dim_array = typedef mdarray<std::vector<T>,fixed_dim_cindex_map<D>> |
This array template fixes the number of dimensions for an array type at compile time. It will be the appropriate type for most applications. The following code defines an image type (we know that images have always 2 dimensions):
T | element data type |
D | number of dimensions |
using pni::core::static_array = typedef mdarray<std::array<T,boost::mpl::times< boost::mpl::size_t<1>, boost::mpl::size_t<NDIMS>... >::value >, static_cindex_map<NDIMS...> > |
This template can be used for static array types. These are types where the number of dimensions as well as the total number of elements along each dimension are known at compile time. A typical application would be matrices and vectors for 3D operations.
Instances of such types usually reside on the stack which makes access to their data elements extremely fast.
T | element data type |
NDIMS | number of elements along each dimension |
bool pni::core::operator!= | ( | const scalar< T > & | a, |
const scalar< T > & | b | ||
) |
Returns true if the two value of a and b are not equal.
T | data type for the scalar instance |
a | lhs value of the operator |
b | rhs value of the operator |
bool pni::core::operator!= | ( | const array_view< ATYPE > & | a, |
const array_view< ATYPE > & | b | ||
) |
Returns false if all elements in a an b are equal. a and b must have equal size, otherwise a size_mismatch_error exception is thrown.
ATYPE | array type for the view |
a | lhs value of the operator |
b | rhs value of the operator |
bool pni::core::operator!= | ( | const mdarray< STORAGE, IMAP, IPA > & | b1, |
const mdarray< STORAGE, IMAP, IPA > & | b2 | ||
) |
Returns true if thwo arrays are not equal.
b1 | array on the lhs of the comparison |
b2 | array on the rhs of the comparison |
std::ostream& pni::core::operator<< | ( | std::ostream & | os, |
const scalar< T > & | s | ||
) |
Write content to output stream.
os | output stream |
s | scalar value |
std::ostream& pni::core::operator<< | ( | std::ostream & | stream, |
const array_view< ATYPE > & | v | ||
) |
Output a view instance to a stream.
ATYPE | array type of the view |
stream | reference to output stream |
v | view instance |
std::ostream& pni::core::operator<< | ( | std::ostream & | o, |
const mdarray< STORAGE, IMAP, IPA > & | a | ||
) |
Writes content of a DArray to an output stream.
o | output stream |
a | array to output |
bool pni::core::operator== | ( | const scalar< T > & | a, |
const scalar< T > & | b | ||
) |
Returns true if the two value of a and b are equal.
T | data type for the scalar instance |
a | lhs value of the operator |
b | rhs value of the operator |
bool pni::core::operator== | ( | const array_view< ATYPE > & | a, |
const array_view< ATYPE > & | b | ||
) |
Returns true if all elements of a an b are equal. The two views must have equal size. Otherwise a size_mismatch_excpetion is thrown.
ATYPE | array type for the view |
a | lhs value of the operator |
b | rhs value of the operator |
bool pni::core::operator== | ( | const mdarray< STORAGE, IMAP, IPA > & | b1, |
const mdarray< STORAGE, IMAP, IPA > & | b2 | ||
) |
Returns true if thwo arrays are equal. This is the case when all element stored in the arrays are equal.
b1 | array on the lhs of the comparison |
b2 | array on the rhs of the comparison |
std::istream& pni::core::operator>> | ( | std::istream & | is, |
scalar< T > & | s | ||
) |
Read content from input stream
is | input stream |
s | scalar |
std::istream& pni::core::operator>> | ( | std::istream & | stream, |
array_view< ATYPE > & | v | ||
) |
Write data from a stream to a view.
ATYPE | array type of the view |
stream | reference to the input stream |
v | reference to the view |
std::istream& pni::core::operator>> | ( | std::istream & | is, |
mdarray< STORAGE, IMAP, IPA > & | a | ||
) |
Read data from an input stream.
is | input stream |
a | array where to store the data |
size_t pni::core::size | ( | const slice & | s | ) |
Computes the number of elements spanned by a slice.
\[ size=\frac{last-first+stride-1}{stride} \]
s | slice object |
size_t pni::core::span | ( | const slice & | s | ) |
Computes the total number of elements spanned by the slice.
\[ span = last-first \]
s | slice for which to compute the span |
type_id_t pni::core::type_id | ( | const array & | a | ) |
Get the type ID of the array stored in an array type erasure.
a | reference to the array |