Template Class TensorBase

Class Documentation

template<class PrecisionT, class Derived>
class TensorBase

CRTP-enabled base class for tensor.

Template Parameters
  • PrecisionT – Floating point precision.

  • Derived – Derived class to instantiate using CRTP.

Public Functions

inline explicit TensorBase(std::size_t rank, const std::vector<std::size_t> &modes, const std::vector<std::size_t> &extents)
inline explicit TensorBase(const std::vector<std::size_t> &extents)

Construct a tensor object with given extents.

Parameters

extents – Extents of a tensor object.

inline ~TensorBase()
inline auto getRank() const -> std::size_t

Return the rank of a tensor object.

Returns

std::size_t Rank of a tensor object.

inline auto getExtents() const -> const std::vector<std::size_t>&

Return the extents of a tensor object.

Returns

std::vector<std::size_t> Extents of a tensor object.

inline auto getModes() const -> const std::vector<std::size_t>&

Return the modes of a tensor object.

Returns

std::vector<std::size_t> Modes of a tensor object.

inline std::size_t getLength() const

Return the number of elements of a tensor object.

Returns

std::size_t Number of elements of a tensor object.