RideDistributor  0.0.1
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
Public Member Functions | List of all members
Tensor< T > Class Template Reference

#include <Tensor.hpp>

Public Member Functions

 Tensor ()
 
 Tensor (const std::vector< unsigned > dims)
 
 Tensor (const std::vector< unsigned > dims, const std::vector< T > data)
 
 Tensor (const std::vector< unsigned > dims, const T &defaultValue)
 
 Tensor (const Tensor< T > &other)
 
T & operator() (const int i) const
 
T & operator() (const int row, const int col) const
 
T & operator() (const int row, const int col, const int offset) const
 
Tensor< T > & operator= (const Tensor< T > &rhs)
 
const unsigned getSize () const
 
const std::vector< unsigned > getDims () const
 

Constructor & Destructor Documentation

template<typename T>
Tensor< T >::Tensor ( )
inline

Creates an empty Tensor.

template<typename T >
Tensor< T >::Tensor ( const std::vector< unsigned >  dims)

Creates a n-dimensional Tensor.

Parameters
[in]dimslist that defines the dimensions of this Tensor
template<typename T>
Tensor< T >::Tensor ( const std::vector< unsigned >  dims,
const std::vector< T >  data 
)

Creates a tensor from an existing array.

Parameters
[in]dimslist that defines the dimensions of this Tensor
[in]datapointer to existing array
template<typename T>
Tensor< T >::Tensor ( const std::vector< unsigned >  dims,
const T &  defaultValue 
)

Creates a n-dimensional Tensor and sets entries to a default Value.

Parameters
[in]dimslist that defines the dimensions of this Tensor
[in]defaultValuedefault value for all entries
template<typename T>
Tensor< T >::Tensor ( const Tensor< T > &  other)

Creates a deep copy of a given Tensor.

Parameters
[in]otherTensor to copy

Member Function Documentation

template<typename T >
const std::vector< unsigned > Tensor< T >::getDims ( ) const

List of dimension of this Tensor.

Returns
std::vector<unsigned> list of dimensions
template<typename T >
const unsigned Tensor< T >::getSize ( ) const

Total number of elements that can be stored in this tensor.

Returns
unsigned size of the internal data structure.
template<typename T >
T & Tensor< T >::operator() ( const int  i) const
inline

One dimensional array access (list index)

Parameters
[in]i
Returns
T& data at given index
template<typename T >
T & Tensor< T >::operator() ( const int  row,
const int  col 
) const
inline

Two dimensional array access (matrix)

Parameters
[in]row
[in]col
Returns
T& data at given position
template<typename T >
T & Tensor< T >::operator() ( const int  row,
const int  col,
const int  offset 
) const
inline

Three dimensional array access (3D matrix)

Parameters
[in]row
[in]col
[in]offset
Returns
T& data at given position
template<typename T>
Tensor< T > & Tensor< T >::operator= ( const Tensor< T > &  rhs)

This operator does NOT copy data but points to the assigned object's data.

Note
Tensor does not check integrity of internal data which could lead logic errors when multiple instances point to the same data
Parameters
rhsobject used to assign to this instance
Returns
Tensor<T>& this instance

The documentation for this class was generated from the following files: