Tenncor
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
teq::Shape Struct Referencefinal

#include <shape.hpp>

Public Types

using iterator = ShapeT::iterator
 Type of iterator used to iterate through internal array. More...
 
using const_iterator = ShapeT::const_iterator
 Type of constant iterator used to iterate through internal array. More...
 

Public Member Functions

 Shape (void)
 
 Shape (std::vector< DimT > dims)
 
 Shape (const Shape &other)=default
 
Shapeoperator= (const Shape &other)=default
 
Shapeoperator= (const std::vector< DimT > &dims)
 
 Shape (Shape &&other)
 
Shapeoperator= (Shape &&other)
 
DimT at (RankT idx) const
 Return DimT element at idx for any index in range [0:rank_cap) More...
 
NElemT n_elems (void) const
 Return the total number of elements represented by the shape. More...
 
bool compatible_before (const Shape &other, RankT idx) const
 
bool compatible_after (const Shape &other, RankT idx) const
 
std::string to_string (void) const
 Return string representation of shape. More...
 
iterator begin (void)
 Return begin iterator of internal array. More...
 
iterator end (void)
 Return end iterator of internal array. More...
 
const_iterator begin (void) const
 Return begin constant iterator of internal array. More...
 
const_iterator end (void) const
 Return end constant iterator of internal array. More...
 

Private Member Functions

void vector_assign (const std::vector< DimT > &dims)
 
void move_helper (Shape &&other)
 

Private Attributes

ShapeT dims_
 Array of dimension values. More...
 

Detailed Description

Models an aligned shape using an array of DimT values For each DimT at index i, DimT value is number of elements at dimension i For example, shape={3, 2} can model tensor [[x, y, z], [u, v, w]] (In cartesian coordinate, we treat values along the X-axis as dimension 0)

Member Typedef Documentation

◆ const_iterator

using teq::Shape::const_iterator = ShapeT::const_iterator

Type of constant iterator used to iterate through internal array.

◆ iterator

using teq::Shape::iterator = ShapeT::iterator

Type of iterator used to iterate through internal array.

Constructor & Destructor Documentation

◆ Shape() [1/4]

teq::Shape::Shape ( void  )
inline

◆ Shape() [2/4]

teq::Shape::Shape ( std::vector< DimT dims)
inline

◆ Shape() [3/4]

teq::Shape::Shape ( const Shape other)
default

◆ Shape() [4/4]

teq::Shape::Shape ( Shape &&  other)
inline

Member Function Documentation

◆ at()

DimT teq::Shape::at ( RankT  idx) const
inline

Return DimT element at idx for any index in range [0:rank_cap)

◆ begin() [1/2]

iterator teq::Shape::begin ( void  )
inline

Return begin iterator of internal array.

◆ begin() [2/2]

const_iterator teq::Shape::begin ( void  ) const
inline

Return begin constant iterator of internal array.

◆ compatible_after()

bool teq::Shape::compatible_after ( const Shape other,
RankT  idx 
) const
inline

Return true if this->dims_[idx:rank_cap) is equal to other.dims_[idx:rank_cap), otherwise return false Set idx to 0 to compare entire shape

◆ compatible_before()

bool teq::Shape::compatible_before ( const Shape other,
RankT  idx 
) const
inline

Return true if this->dims_[0:idx) is equal to other.dims_[0:idx), otherwise return false

◆ end() [1/2]

iterator teq::Shape::end ( void  )
inline

Return end iterator of internal array.

◆ end() [2/2]

const_iterator teq::Shape::end ( void  ) const
inline

Return end constant iterator of internal array.

◆ move_helper()

void teq::Shape::move_helper ( Shape &&  other)
inlineprivate

◆ n_elems()

NElemT teq::Shape::n_elems ( void  ) const
inline

Return the total number of elements represented by the shape.

◆ operator=() [1/3]

Shape& teq::Shape::operator= ( const Shape other)
default

◆ operator=() [2/3]

Shape& teq::Shape::operator= ( const std::vector< DimT > &  dims)
inline

◆ operator=() [3/3]

Shape& teq::Shape::operator= ( Shape &&  other)
inline

◆ to_string()

std::string teq::Shape::to_string ( void  ) const
inline

Return string representation of shape.

◆ vector_assign()

void teq::Shape::vector_assign ( const std::vector< DimT > &  dims)
inlineprivate

Member Data Documentation

◆ dims_

ShapeT teq::Shape::dims_
private

Array of dimension values.


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