Tensorium
Loading...
Searching...
No Matches
Allocator.hpp File Reference
#include "SIMD.hpp"
#include <iostream>
#include <cmath>
#include <vector>
Include dependency graph for Allocator.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  AlignedAllocator< T, Alignment >
 Aligned memory allocator for high-performance computing. More...
 
struct  AlignedAllocator< T, Alignment >::rebind< U >
 Rebinding structure for allocator traits. More...
 

Typedefs

template<typename K >
using aligned_vector = std::vector<K, AlignedAllocator<K, ALIGN>>
 Type alias for a std::vector with aligned memory allocation.
 

Functions

template<typename T , std::size_t Alignment>
bool operator== (const AlignedAllocator< T, Alignment > &, const AlignedAllocator< T, Alignment > &) noexcept
 Equality operator for AlignedAllocator.
 
template<typename T , std::size_t Alignment>
bool operator!= (const AlignedAllocator< T, Alignment > &, const AlignedAllocator< T, Alignment > &) noexcept
 Inequality operator for AlignedAllocator.
 

Typedef Documentation

◆ aligned_vector

template<typename K >
using aligned_vector = std::vector<K, AlignedAllocator<K, ALIGN>>

Type alias for a std::vector with aligned memory allocation.

This provides an aligned vector container compatible with SIMD usage. The alignment used is determined by the macro ALIGN, typically set based on the SIMD instruction set width (e.g., 16 for SSE, 32 for AVX, 64 for AVX-512).

Template Parameters
KType of the elements.

Function Documentation

◆ operator!=()

template<typename T , std::size_t Alignment>
bool operator!= ( const AlignedAllocator< T, Alignment > & ,
const AlignedAllocator< T, Alignment > &  )
noexcept

Inequality operator for AlignedAllocator.

Always returns false, as there are no distinguishing stateful properties.

Template Parameters
TType of allocated elements.
AlignmentAlignment in bytes.
Returns
false

◆ operator==()

template<typename T , std::size_t Alignment>
bool operator== ( const AlignedAllocator< T, Alignment > & ,
const AlignedAllocator< T, Alignment > &  )
noexcept

Equality operator for AlignedAllocator.

Always returns true as the allocator is stateless and does not manage any per-instance resources.

Template Parameters
TType of allocated elements.
AlignmentAlignment in bytes.
Returns
true