tesseract++ 0.0.1
N-dimensional tensor library for embedded systems
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
PermutedViewConstExpr< Tensor, Perm > Class Template Reference

Compile-time permuted view over a tensor. More...

#include <permuted_view_constexpr.h>

Inheritance diagram for PermutedViewConstExpr< Tensor, Perm >:
Inheritance graph
[legend]
Collaboration diagram for PermutedViewConstExpr< Tensor, Perm >:
Collaboration graph
[legend]

Public Types

using value_type = typename Tensor::value_type
 
using PadPolicy = typename Tensor::AccessPolicy::PadPolicy
 
using Layout = StridedLayoutConstExpr< PadPolicy, Perm... >
 

Public Member Functions

 PermutedViewConstExpr (const Tensor &t) noexcept
 
 PermutedViewConstExpr (const PermutedViewConstExpr &)=delete
 
PermutedViewConstExproperator= (const PermutedViewConstExpr &)=delete
 
 PermutedViewConstExpr (PermutedViewConstExpr &&)=delete
 
PermutedViewConstExproperator= (PermutedViewConstExpr &&)=delete
 
template<typename Output >
bool may_alias (const Output &output) const noexcept
 
template<typename... Indices>
requires (sizeof...(Indices) == NumDims)
FORCE_INLINE const value_typeoperator() (Indices... indices) const TESSERACT_CONDITIONAL_NOEXCEPT
 
FORCE_INLINE const value_typeoperator() (my_size_t(&indices)[NumDims]) const TESSERACT_CONDITIONAL_NOEXCEPT
 
FORCE_INLINE const value_typeoperator() (const my_size_t *indices) const TESSERACT_CONDITIONAL_NOEXCEPT
 
template<typename T , my_size_t Bits, typename Arch >
FORCE_INLINE Microkernel< T, Bits, Arch >::VecType evalu (my_size_t logical_flat) const noexcept
 SIMD EVALUATION — logical flat, K::gather.
 
template<typename T , my_size_t Bits, typename Arch >
FORCE_INLINE Microkernel< T, Bits, Arch >::VecType logical_evalu (my_size_t logical_flat) const noexcept
 
void printLayoutInfo () const
 
FORCE_INLINE const Tensor & transpose () const noexcept
 
std::string getShape () const
 
FORCE_INLINE constexpr const value_typedata () const noexcept
 
FORCE_INLINE constexpr value_typedata () noexcept
 
- Public Member Functions inherited from BaseExpr< PermutedViewConstExpr< Tensor, Perm... > >
const PermutedViewConstExpr< Tensor, Perm... > & derived () const
 

Static Public Member Functions

static FORCE_INLINE constexpr my_size_t getDim (my_size_t i) TESSERACT_CONDITIONAL_NOEXCEPT
 
static FORCE_INLINE constexpr my_size_t getStride (my_size_t i) TESSERACT_CONDITIONAL_NOEXCEPT
 
static FORCE_INLINE constexpr my_size_t getNumDims () noexcept
 
static FORCE_INLINE constexpr my_size_t getTotalSize () noexcept
 

Static Public Attributes

static constexpr my_size_t NumDims = Layout::NumDims
 
static constexpr my_size_t Dim [] = {Tensor::Dim[Perm]...}
 
static constexpr my_size_t TotalSize = Tensor::TotalSize
 

Detailed Description

template<typename Tensor, my_size_t... Perm>
class PermutedViewConstExpr< Tensor, Perm >

Compile-time permuted view over a tensor.

Does not own or copy data — references the underlying tensor's physical buffer. Permutation is applied entirely at compile time through StridedLayoutConstExpr.

The permuted layout reinterprets the same physical memory with permuted logical dimensions and strides:

Source A[2,3] padded to [2,4]: Physical: [a b c 0 | d e f 0] Layout: LogicalDims=[2,3], Strides=[4,1]

Transposed view (Perm = 1,0): Same physical buffer Layout: LogicalDims=[3,2], Strides=[1,4]

view(0,0) → 0*1 + 0*4 = offset 0 → 'a' view(0,1) → 0*1 + 1*4 = offset 4 → 'd' view(1,0) → 1*1 + 0*4 = offset 1 → 'b' view(2,1) → 2*1 + 1*4 = offset 6 → 'f'

Template Parameters
TensorThe underlying tensor type (e.g., FusedTensorND<double, 2, 3>)
PermCompile-time permutation indices

Member Typedef Documentation

◆ Layout

template<typename Tensor , my_size_t... Perm>
using PermutedViewConstExpr< Tensor, Perm >::Layout = StridedLayoutConstExpr<PadPolicy, Perm...>

◆ PadPolicy

template<typename Tensor , my_size_t... Perm>
using PermutedViewConstExpr< Tensor, Perm >::PadPolicy = typename Tensor::AccessPolicy::PadPolicy

◆ value_type

template<typename Tensor , my_size_t... Perm>
using PermutedViewConstExpr< Tensor, Perm >::value_type = typename Tensor::value_type

Constructor & Destructor Documentation

◆ PermutedViewConstExpr() [1/3]

template<typename Tensor , my_size_t... Perm>
PermutedViewConstExpr< Tensor, Perm >::PermutedViewConstExpr ( const Tensor &  t)
inlineexplicitnoexcept

◆ PermutedViewConstExpr() [2/3]

template<typename Tensor , my_size_t... Perm>
PermutedViewConstExpr< Tensor, Perm >::PermutedViewConstExpr ( const PermutedViewConstExpr< Tensor, Perm > &  )
delete

◆ PermutedViewConstExpr() [3/3]

template<typename Tensor , my_size_t... Perm>
PermutedViewConstExpr< Tensor, Perm >::PermutedViewConstExpr ( PermutedViewConstExpr< Tensor, Perm > &&  )
delete

Member Function Documentation

◆ data() [1/2]

template<typename Tensor , my_size_t... Perm>
FORCE_INLINE constexpr const value_type * PermutedViewConstExpr< Tensor, Perm >::data ( ) const
inlineconstexprnoexcept

◆ data() [2/2]

template<typename Tensor , my_size_t... Perm>
FORCE_INLINE constexpr value_type * PermutedViewConstExpr< Tensor, Perm >::data ( )
inlineconstexprnoexcept

◆ evalu()

template<typename Tensor , my_size_t... Perm>
template<typename T , my_size_t Bits, typename Arch >
FORCE_INLINE Microkernel< T, Bits, Arch >::VecType PermutedViewConstExpr< Tensor, Perm >::evalu ( my_size_t  logical_flat) const
inlinenoexcept

SIMD EVALUATION — logical flat, K::gather.

Consecutive logical flat indices map to non-contiguous physical offsets through the permuted layout, so gather is required.

Example: transposed [3,2] view of [2,3] source: logical_flat 0 → coords(0,0) → physical 0 logical_flat 1 → coords(0,1) → physical 4 logical_flat 2 → coords(1,0) → physical 1 logical_flat 3 → coords(1,1) → physical 5 → gather from offsets [0, 4, 1, 5]

Template Parameters
TThe value type for evaluation (e.g., float, double)
BitsNumber of bits for the microkernel (e.g., 256 for AVX2)
ArchThe target architecture for the microkernel (e.g., AVX2, AVX-512)
Parameters
logical_flatThe logical flat index to evaluate from
Returns
Microkernel vector type containing the evaluated values for the SIMD width
Here is the call graph for this function:

◆ getDim()

template<typename Tensor , my_size_t... Perm>
static FORCE_INLINE constexpr my_size_t PermutedViewConstExpr< Tensor, Perm >::getDim ( my_size_t  i)
inlinestaticconstexpr
Here is the call graph for this function:

◆ getNumDims()

template<typename Tensor , my_size_t... Perm>
static FORCE_INLINE constexpr my_size_t PermutedViewConstExpr< Tensor, Perm >::getNumDims ( )
inlinestaticconstexprnoexcept

◆ getShape()

template<typename Tensor , my_size_t... Perm>
std::string PermutedViewConstExpr< Tensor, Perm >::getShape ( ) const
inline
Here is the call graph for this function:

◆ getStride()

template<typename Tensor , my_size_t... Perm>
static FORCE_INLINE constexpr my_size_t PermutedViewConstExpr< Tensor, Perm >::getStride ( my_size_t  i)
inlinestaticconstexpr
Here is the call graph for this function:

◆ getTotalSize()

template<typename Tensor , my_size_t... Perm>
static FORCE_INLINE constexpr my_size_t PermutedViewConstExpr< Tensor, Perm >::getTotalSize ( )
inlinestaticconstexprnoexcept

◆ logical_evalu()

template<typename Tensor , my_size_t... Perm>
template<typename T , my_size_t Bits, typename Arch >
FORCE_INLINE Microkernel< T, Bits, Arch >::VecType PermutedViewConstExpr< Tensor, Perm >::logical_evalu ( my_size_t  logical_flat) const
inlinenoexcept

◆ may_alias()

template<typename Tensor , my_size_t... Perm>
template<typename Output >
bool PermutedViewConstExpr< Tensor, Perm >::may_alias ( const Output &  output) const
inlinenoexcept

◆ operator()() [1/3]

template<typename Tensor , my_size_t... Perm>
FORCE_INLINE const value_type & PermutedViewConstExpr< Tensor, Perm >::operator() ( const my_size_t indices) const
inline
Here is the call graph for this function:

◆ operator()() [2/3]

template<typename Tensor , my_size_t... Perm>
template<typename... Indices>
requires (sizeof...(Indices) == NumDims)
FORCE_INLINE const value_type & PermutedViewConstExpr< Tensor, Perm >::operator() ( Indices...  indices) const
inline
Here is the call graph for this function:

◆ operator()() [3/3]

template<typename Tensor , my_size_t... Perm>
FORCE_INLINE const value_type & PermutedViewConstExpr< Tensor, Perm >::operator() ( my_size_t(&)  indices[NumDims]) const
inline
Here is the call graph for this function:

◆ operator=() [1/2]

template<typename Tensor , my_size_t... Perm>
PermutedViewConstExpr & PermutedViewConstExpr< Tensor, Perm >::operator= ( const PermutedViewConstExpr< Tensor, Perm > &  )
delete

◆ operator=() [2/2]

template<typename Tensor , my_size_t... Perm>
PermutedViewConstExpr & PermutedViewConstExpr< Tensor, Perm >::operator= ( PermutedViewConstExpr< Tensor, Perm > &&  )
delete

◆ printLayoutInfo()

template<typename Tensor , my_size_t... Perm>
void PermutedViewConstExpr< Tensor, Perm >::printLayoutInfo ( ) const
inline
Here is the call graph for this function:

◆ transpose()

template<typename Tensor , my_size_t... Perm>
FORCE_INLINE const Tensor & PermutedViewConstExpr< Tensor, Perm >::transpose ( ) const
inlinenoexcept

Member Data Documentation

◆ Dim

template<typename Tensor , my_size_t... Perm>
constexpr my_size_t PermutedViewConstExpr< Tensor, Perm >::Dim[] = {Tensor::Dim[Perm]...}
staticconstexpr

◆ NumDims

template<typename Tensor , my_size_t... Perm>
constexpr my_size_t PermutedViewConstExpr< Tensor, Perm >::NumDims = Layout::NumDims
staticconstexpr

◆ TotalSize

template<typename Tensor , my_size_t... Perm>
constexpr my_size_t PermutedViewConstExpr< Tensor, Perm >::TotalSize = Tensor::TotalSize
staticconstexpr

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