SyTen
syten::GenericDenseTensorImpl::GenericDenseTensor< rank, Scalar > Struct Template Reference

Implementation for syten::GenericDenseTensor. More...

#include <generic.h>

+ Inheritance diagram for syten::GenericDenseTensorImpl::GenericDenseTensor< rank, Scalar >:

Public Types

using Coord = std::array< Index, rank >
 A set of indices uniquely describing one element. More...
 
using Storage = std::variant< DenseTensor< rank, Scalar >, IdentityDenseTensor< rank, Scalar >, OffsetDenseTensor< rank, Scalar >, CudaDenseTensor< rank, Scalar > >
 Storage class for our various dense tensors. More...
 

Public Member Functions

auto & cuda ()
 If the stored dense tensor is a cuda dense tensor, returns a reference to it, otherwise terminates. More...
 
auto const & cuda () const
 If the stored dense tensor is a cuda dense tensor, returns a constant reference to it, otherwise terminates. More...
 
Index dim (Index which) const
 Returns the dimension of the which-th 1-indexed leg. More...
 
Coord dims () const
 Copy-returns an array of dimensions. More...
 
 GenericDenseTensor ()
 Default-ctor constructs an empty standard dense tensor. More...
 
 GenericDenseTensor (Coord const &dims)
 Standard ctor, again gives an empty standard dense tensor of the supplied size. More...
 
 GenericDenseTensor (GenericDenseTensor &&)=default
 move ctor, defaulted. More...
 
 GenericDenseTensor (GenericDenseTensor const &)=default
 copy ctor, defaulted. More...
 
template<typename T , std::enable_if_t<!std::is_same_v< typename std::decay< T >::type, GenericDenseTensor< rank, Scalar > >, int > = 0>
 GenericDenseTensor (T &&t)
 Constructs from a supplied dense tensor of some kind or a scalar value. More...
 
Coord getDims () const
 Copy-returns an array of dimensions. More...
 
auto & identity ()
 If the stored dense tensor is an identity dense tensor, returns a reference to it, otherwise terminates. More...
 
auto const & identity () const
 If the stored dense tensor is an identity dense tensor, returns a constant reference to it, otherwise terminates. More...
 
bool is_cuda () const
 Returns true if the stored dense tensor is a CudaDenseTensor. More...
 
bool is_identity () const
 Returns true if the stored dense tensor is an identity dense tensor (IdentityDenseTensor). More...
 
bool is_offset () const
 Returns true if the stored dense tensor is an offset dense tensor (OffsetDenseTensor). More...
 
bool is_standard () const
 Returns true if the stored dense tensor is a standard dense tensor (DenseTensor). More...
 
void make_cuda ()
 Transforms the stored dense tensor into a CUDA dense tensor. More...
 
void make_standard ()
 Transforms the stored dense tensor into a standard dense tensor. More...
 
void maybe_make_cuda ()
 Conditionally transforms the stored dense tensor into a CUDA dense tensor if CUDA support is compiled in, at least one CUDA device is enabled and the tensor is larger than the CUDA threshold. More...
 
auto & offset ()
 If the stored dense tensor is an offset dense tensor, returns a reference to it, otherwise terminates. More...
 
auto const & offset () const
 If the stored dense tensor is an offset dense tensor, returns a constant reference to it, otherwise terminates. More...
 
GenericDenseTensoroperator= (GenericDenseTensor &&)=default
 move assignment operator, defaulted. More...
 
GenericDenseTensoroperator= (GenericDenseTensor const &)=default
 copy assignment operator, defaulted. More...
 
GenericDenseTensor return_as_standard () const
 Returns a GenericDenseTensor in standard format representing the same object as *this. More...
 
Size size () const
 Returns the number of stored dense elements. More...
 
auto & standard ()
 If the stored dense tensor is a standard dense tensor, returns a reference to it, otherwise terminates. More...
 
auto const & standard () const
 If the stored dense tensor is a standard dense tensor, returns a constant reference to it, otherwise terminates. More...
 

Static Public Member Functions

static constexpr std::string_view translate_index (Size idx)
 Translate an index into a variant used here to a type name. More...
 

Public Attributes

Storage storage
 Storage space. More...
 

Boost serialisation

static constexpr unsigned int version = 1
 version for this class, bump if storage changes. More...
 
template<typename Archive >
void save (Archive &ar, const unsigned int) const
 Saving to an archive. More...
 
template<typename Archive >
void load (Archive &ar, const unsigned int in_version)
 Loading from an archive. More...
 

Detailed Description

template<Rank rank, typename Scalar = SDef>
struct syten::GenericDenseTensorImpl::GenericDenseTensor< rank, Scalar >

Implementation for syten::GenericDenseTensor.


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