Class ReorderingContext

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class ReorderingContext : public sequant::ExportContext

An export context class that implements functionality for reordering indices in tensors for better cache locality during access, assuming the full tensor will be held in memory and all elements will be iterated over.

In other words, this class will use existing tensor symmetries to move the slot belonging to the largest index space into the slot with highest cache-locality (depending on the chosen memory layout).

Subclassed by sequant::ItfContext

Public Functions

inline explicit ReorderingContext(MemoryLayout layout)
inline ReorderingContext(MemoryLayout layout, assume_real_orbitals)
inline ReorderingContext(MemoryLayout layout, assume_strict_column_permutability)
inline ReorderingContext(MemoryLayout layout, assume_real_orbitals, assume_strict_column_permutability)
inline MemoryLayout memory_layout() const
inline void set_memory_layout(MemoryLayout layout)
inline bool assumes_real_orbitals() const
inline void set_assume_real_orbitals(bool real)
inline bool assumes_strict_column_permutability() const
inline void set_assume_strict_column_permutability(bool permutable)
virtual bool rewrite(Tensor &tensor) const override

Performs necessary (backend-specific) modifications (if any) on the given Tensor in-place

Parameters:

tensor – The Tensor to be modified

Returns:

Whether any modification has been performed

Protected Functions

bool is_less(const IndexSpace &lhs, const IndexSpace &rhs) const
bool is_ordered(const IndexSpace &lhs, const IndexSpace &rhs) const
bool needs_swap(const IndexSpace &lhs, const IndexSpace &rhs) const