BlackCat_Tensors
A GPU-supported autograd and linear algebra library, designed for neural network construction
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
bc::Dim< N > Struct Template Reference

#include <dim.h>

Public Types

using value_type = bc::size_t
 
using size_t = bc::size_t
 

Public Member Functions

BCINLINE value_type size () const
 
BCINLINE Dimfill (bc::size_t value)
 
BCINLINE const value_typedata () const
 
BCINLINE value_typedata ()
 
BCINLINE const value_typeoperator[] (int i) const
 unchecked version of dim More...
 
BCINLINE value_typeoperator[] (int i)
 
BCINLINE value_type dim (size_t i, size_t default_value=1) const
 
BCINLINE value_type outer_dim () const
 
BCINLINE bool operator== (const Dim &other) const
 
BCINLINE bool operator!= (const Dim &other) const
 
template<int X>
BCINLINE bool operator== (const Dim< X > &other) const
 
template<int X>
BCINLINE bool operator!= (const Dim< X > &other) const
 
template<class... Ints, class = std::enable_if_t< bc::traits::sequence_of_v<bc::size_t, Ints...>>>
BCINLINE auto concat (Ints... value) const
 
template<int X>
BCINLINE Dim< N+X > concat (const Dim< X > &other) const
 
BCINLINE auto begin () const
 
BCINLINE auto end () const
 
BCINLINE auto begin ()
 
BCINLINE auto end ()
 
Dim operator+ (const Dim &other) const
 
Dim operator+= (const Dim &other)
 
Dim operator- (const Dim &other) const
 
Dim operator-= (const Dim &other)
 
Dim operator/ (const Dim &other) const
 
Dim operator/= (const Dim &other)
 
Dim operator* (const Dim &other) const
 
Dim operator*= (const Dim &other)
 
Dim operator< (const Dim &other) const
 
Dim operator<= (const Dim &other) const
 
Dim operator> (const Dim &other) const
 
Dim operator>= (const Dim &other) const
 
BCINLINE bool all (size_t start, size_t end) const
 
BCINLINE bool all (size_t end=N) const
 
BCINLINE value_type sum (size_t start, size_t end) const
 
BCINLINE value_type sum (size_t end=N) const
 
BCINLINE value_type prod (size_t start, size_t end) const
 
BCINLINE value_type prod (size_t end=N) const
 
BCINLINE Dim reversed () const
 
template<int Start, int End = N>
BCINLINE Dim< End-Start > subdim () const
 
std::string to_string (int begin, int end) const
 
std::string to_string (int end=N) const
 

Public Attributes

bc::size_t m_index [N] = { 0 }
 

Static Public Attributes

static constexpr int tensor_dim = N
 

Friends

Dim operator+ (const Dim &dim, const value_type &scalar)
 
Dim operator+ (const value_type &scalar, const Dim &dim)
 
Dim operator+= (Dim &dim, const value_type &scalar)
 
Dim operator- (const Dim &dim, const value_type &scalar)
 
Dim operator- (const value_type &scalar, const Dim &dim)
 
Dim operator-= (Dim &dim, const value_type &scalar)
 
Dim operator/ (const Dim &dim, const value_type &scalar)
 
Dim operator/ (const value_type &scalar, const Dim &dim)
 
Dim operator/= (Dim &dim, const value_type &scalar)
 
Dim operator* (const Dim &dim, const value_type &scalar)
 
Dim operator* (const value_type &scalar, const Dim &dim)
 
Dim operator*= (Dim &dim, const value_type &scalar)
 
Dim operator< (const Dim &dim, const value_type &scalar)
 
Dim operator< (const value_type &scalar, const Dim &dim)
 
Dim operator<= (const Dim &dim, const value_type &scalar)
 
Dim operator<= (const value_type &scalar, const Dim &dim)
 
Dim operator> (const Dim &dim, const value_type &scalar)
 
Dim operator> (const value_type &scalar, const Dim &dim)
 
Dim operator>= (const Dim &dim, const value_type &scalar)
 
Dim operator>= (const value_type &scalar, const Dim &dim)
 
std::ostream & operator<< (std::ostream &os, const Dim &self)
 

Member Typedef Documentation

◆ size_t

template<int N>
using bc::Dim< N >::size_t = bc::size_t

◆ value_type

template<int N>
using bc::Dim< N >::value_type = bc::size_t

Member Function Documentation

◆ all() [1/2]

template<int N>
BCINLINE bool bc::Dim< N >::all ( size_t  start,
size_t  end 
) const
inline

◆ all() [2/2]

template<int N>
BCINLINE bool bc::Dim< N >::all ( size_t  end = N) const
inline

◆ begin() [1/2]

template<int N>
BCINLINE auto bc::Dim< N >::begin ( ) const
inline

◆ begin() [2/2]

template<int N>
BCINLINE auto bc::Dim< N >::begin ( )
inline

◆ concat() [1/2]

template<int N>
template<class... Ints, class = std::enable_if_t< bc::traits::sequence_of_v<bc::size_t, Ints...>>>
BCINLINE auto bc::Dim< N >::concat ( Ints...  value) const
inline

◆ concat() [2/2]

template<int N>
template<int X>
BCINLINE Dim<N+X> bc::Dim< N >::concat ( const Dim< X > &  other) const
inline

◆ data() [1/2]

template<int N>
BCINLINE const value_type* bc::Dim< N >::data ( ) const
inline

◆ data() [2/2]

template<int N>
BCINLINE value_type* bc::Dim< N >::data ( )
inline

◆ dim()

template<int N>
BCINLINE value_type bc::Dim< N >::dim ( size_t  i,
size_t  default_value = 1 
) const
inline

◆ end() [1/2]

template<int N>
BCINLINE auto bc::Dim< N >::end ( ) const
inline

◆ end() [2/2]

template<int N>
BCINLINE auto bc::Dim< N >::end ( )
inline

◆ fill()

template<int N>
BCINLINE Dim& bc::Dim< N >::fill ( bc::size_t  value)
inline

◆ operator!=() [1/2]

template<int N>
BCINLINE bool bc::Dim< N >::operator!= ( const Dim< N > &  other) const
inline

◆ operator!=() [2/2]

template<int N>
template<int X>
BCINLINE bool bc::Dim< N >::operator!= ( const Dim< X > &  other) const
inline

◆ operator*()

template<int N>
Dim bc::Dim< N >::operator* ( const Dim< N > &  other) const
inline

◆ operator*=()

template<int N>
Dim bc::Dim< N >::operator*= ( const Dim< N > &  other)
inline

◆ operator+()

template<int N>
Dim bc::Dim< N >::operator+ ( const Dim< N > &  other) const
inline

◆ operator+=()

template<int N>
Dim bc::Dim< N >::operator+= ( const Dim< N > &  other)
inline

◆ operator-()

template<int N>
Dim bc::Dim< N >::operator- ( const Dim< N > &  other) const
inline

◆ operator-=()

template<int N>
Dim bc::Dim< N >::operator-= ( const Dim< N > &  other)
inline

◆ operator/()

template<int N>
Dim bc::Dim< N >::operator/ ( const Dim< N > &  other) const
inline

◆ operator/=()

template<int N>
Dim bc::Dim< N >::operator/= ( const Dim< N > &  other)
inline

◆ operator<()

template<int N>
Dim bc::Dim< N >::operator< ( const Dim< N > &  other) const
inline

◆ operator<=()

template<int N>
Dim bc::Dim< N >::operator<= ( const Dim< N > &  other) const
inline

◆ operator==() [1/2]

template<int N>
BCINLINE bool bc::Dim< N >::operator== ( const Dim< N > &  other) const
inline

◆ operator==() [2/2]

template<int N>
template<int X>
BCINLINE bool bc::Dim< N >::operator== ( const Dim< X > &  other) const
inline

◆ operator>()

template<int N>
Dim bc::Dim< N >::operator> ( const Dim< N > &  other) const
inline

◆ operator>=()

template<int N>
Dim bc::Dim< N >::operator>= ( const Dim< N > &  other) const
inline

◆ operator[]() [1/2]

template<int N>
BCINLINE const value_type& bc::Dim< N >::operator[] ( int  i) const
inline

unchecked version of dim

◆ operator[]() [2/2]

template<int N>
BCINLINE value_type& bc::Dim< N >::operator[] ( int  i)
inline

◆ outer_dim()

template<int N>
BCINLINE value_type bc::Dim< N >::outer_dim ( ) const
inline

◆ prod() [1/2]

template<int N>
BCINLINE value_type bc::Dim< N >::prod ( size_t  start,
size_t  end 
) const
inline

◆ prod() [2/2]

template<int N>
BCINLINE value_type bc::Dim< N >::prod ( size_t  end = N) const
inline

◆ reversed()

template<int N>
BCINLINE Dim bc::Dim< N >::reversed ( ) const
inline

◆ size()

template<int N>
BCINLINE value_type bc::Dim< N >::size ( ) const
inline

◆ subdim()

template<int N>
template<int Start, int End = N>
BCINLINE Dim<End-Start> bc::Dim< N >::subdim ( ) const
inline

◆ sum() [1/2]

template<int N>
BCINLINE value_type bc::Dim< N >::sum ( size_t  start,
size_t  end 
) const
inline

◆ sum() [2/2]

template<int N>
BCINLINE value_type bc::Dim< N >::sum ( size_t  end = N) const
inline

◆ to_string() [1/2]

template<int N>
std::string bc::Dim< N >::to_string ( int  begin,
int  end 
) const
inline

◆ to_string() [2/2]

template<int N>
std::string bc::Dim< N >::to_string ( int  end = N) const
inline

Friends And Related Function Documentation

◆ operator* [1/2]

template<int N>
Dim operator* ( const Dim< N > &  dim,
const value_type scalar 
)
friend

◆ operator* [2/2]

template<int N>
Dim operator* ( const value_type scalar,
const Dim< N > &  dim 
)
friend

◆ operator*=

template<int N>
Dim operator*= ( Dim< N > &  dim,
const value_type scalar 
)
friend

◆ operator+ [1/2]

template<int N>
Dim operator+ ( const Dim< N > &  dim,
const value_type scalar 
)
friend

◆ operator+ [2/2]

template<int N>
Dim operator+ ( const value_type scalar,
const Dim< N > &  dim 
)
friend

◆ operator+=

template<int N>
Dim operator+= ( Dim< N > &  dim,
const value_type scalar 
)
friend

◆ operator- [1/2]

template<int N>
Dim operator- ( const Dim< N > &  dim,
const value_type scalar 
)
friend

◆ operator- [2/2]

template<int N>
Dim operator- ( const value_type scalar,
const Dim< N > &  dim 
)
friend

◆ operator-=

template<int N>
Dim operator-= ( Dim< N > &  dim,
const value_type scalar 
)
friend

◆ operator/ [1/2]

template<int N>
Dim operator/ ( const value_type scalar,
const Dim< N > &  dim 
)
friend

◆ operator/ [2/2]

template<int N>
Dim operator/ ( const Dim< N > &  dim,
const value_type scalar 
)
friend

◆ operator/=

template<int N>
Dim operator/= ( Dim< N > &  dim,
const value_type scalar 
)
friend

◆ operator< [1/2]

template<int N>
Dim operator< ( const Dim< N > &  dim,
const value_type scalar 
)
friend

◆ operator< [2/2]

template<int N>
Dim operator< ( const value_type scalar,
const Dim< N > &  dim 
)
friend

◆ operator<<

template<int N>
std::ostream& operator<< ( std::ostream &  os,
const Dim< N > &  self 
)
friend

◆ operator<= [1/2]

template<int N>
Dim operator<= ( const value_type scalar,
const Dim< N > &  dim 
)
friend

◆ operator<= [2/2]

template<int N>
Dim operator<= ( const Dim< N > &  dim,
const value_type scalar 
)
friend

◆ operator> [1/2]

template<int N>
Dim operator> ( const value_type scalar,
const Dim< N > &  dim 
)
friend

◆ operator> [2/2]

template<int N>
Dim operator> ( const Dim< N > &  dim,
const value_type scalar 
)
friend

◆ operator>= [1/2]

template<int N>
Dim operator>= ( const value_type scalar,
const Dim< N > &  dim 
)
friend

◆ operator>= [2/2]

template<int N>
Dim operator>= ( const Dim< N > &  dim,
const value_type scalar 
)
friend

Member Data Documentation

◆ m_index

template<int N>
bc::size_t bc::Dim< N >::m_index[N] = { 0 }

◆ tensor_dim

template<int N>
constexpr int bc::Dim< N >::tensor_dim = N
static

The documentation for this struct was generated from the following file: