akreon-linalg
Fixed-size linear algebra and numerical methods in C++26.
Loading...
Searching...
No Matches
linalg::Vector< T, N > Struct Template Reference

Owning, fixed-size vector container. More...

#include <vector.hpp>

Public Member Functions

template<typename... Coords>
requires (sizeof...(coords) == N)
constexpr Vector (Coords... coords)
 Construct from exactly N coordinate values.
 
constexpr Vector ()
 Construct a value-initialized vector.
 
constexpr auto begin () const
 Const iterator to the first coordinate.
 
constexpr auto end () const
 Const iterator one past the final coordinate.
 
constexpr const T & operator() (std::size_t idx) const
 Read a coordinate at a zero-based index.
 
constexpr T & operator() (std::size_t idx)
 Read or modify a coordinate at a zero-based index.
 
constexpr bool operator== (const Vector &other) const
 Compare coordinates for exact element-wise equality.
 
constexpr bool operator!= (const Vector &other) const
 Compare coordinates for element-wise inequality.
 
constexpr auto view ()
 Obtain a mutable fixed-extent view of contiguous coordinate storage.
 
constexpr auto size () const
 Return the compile-time coordinate count N.
 

Detailed Description

template<typename T, std::size_t N>
struct linalg::Vector< T, N >

Owning, fixed-size vector container.

Forward declaration of the owning fixed-size vector container.

Vector stores exactly N values inline in a std::array; its dimension is part of the type and no dynamic allocation occurs. The container is intentionally generic over T. Field-based algorithms opt in separately through FieldVector, while std::array remains available for arbitrary non-mathematical fixed-size data.

Coordinates use zero-based vector(index) access guarded by AK_ASSERT. Default construction value-initializes every coordinate. Iteration is const, while mutable contiguous access is available through view().

Template Parameters
TStored coordinate type.
NCompile-time coordinate count.

Definition at line 36 of file vector.hpp.

Constructor & Destructor Documentation

◆ Vector() [1/2]

template<typename T , std::size_t N>
template<typename... Coords>
requires (sizeof...(coords) == N)
constexpr linalg::Vector< T, N >::Vector ( Coords...  coords)
inlineconstexpr

Construct from exactly N coordinate values.

Parameters
coordsCoordinates in increasing index order.

Definition at line 43 of file vector.hpp.

References linalg::mat_rows_v.

◆ Vector() [2/2]

template<typename T , std::size_t N>
constexpr linalg::Vector< T, N >::Vector ( )
inlineconstexpr

Construct a value-initialized vector.

Definition at line 48 of file vector.hpp.

Member Function Documentation

◆ begin()

template<typename T , std::size_t N>
constexpr auto linalg::Vector< T, N >::begin ( ) const
inlineconstexpr

Const iterator to the first coordinate.

Definition at line 51 of file vector.hpp.

◆ end()

template<typename T , std::size_t N>
constexpr auto linalg::Vector< T, N >::end ( ) const
inlineconstexpr

Const iterator one past the final coordinate.

Definition at line 54 of file vector.hpp.

◆ operator!=()

template<typename T , std::size_t N>
constexpr bool linalg::Vector< T, N >::operator!= ( const Vector< T, N > &  other) const
inlineconstexpr

Compare coordinates for element-wise inequality.

Parameters
otherShape-compatible vector to compare.

Definition at line 88 of file vector.hpp.

References linalg::mat_rows_v.

◆ operator()() [1/2]

template<typename T , std::size_t N>
constexpr T & linalg::Vector< T, N >::operator() ( std::size_t  idx)
inlineconstexpr

Read or modify a coordinate at a zero-based index.

Parameters
idxCoordinate index in [0, N).
Returns
Mutable reference to the stored coordinate.

Definition at line 71 of file vector.hpp.

References AK_ASSERT, and linalg::mat_rows_v.

◆ operator()() [2/2]

template<typename T , std::size_t N>
constexpr const T & linalg::Vector< T, N >::operator() ( std::size_t  idx) const
inlineconstexpr

Read a coordinate at a zero-based index.

Parameters
idxCoordinate index in [0, N).
Returns
Const reference to the stored coordinate.

Definition at line 61 of file vector.hpp.

References AK_ASSERT, and linalg::mat_rows_v.

◆ operator==()

template<typename T , std::size_t N>
constexpr bool linalg::Vector< T, N >::operator== ( const Vector< T, N > &  other) const
inlineconstexpr

Compare coordinates for exact element-wise equality.

Parameters
otherShape-compatible vector to compare.

Definition at line 80 of file vector.hpp.

References linalg::mat_rows_v.

◆ size()

template<typename T , std::size_t N>
constexpr auto linalg::Vector< T, N >::size ( ) const
inlineconstexpr

Return the compile-time coordinate count N.

Definition at line 98 of file vector.hpp.

◆ view()

template<typename T , std::size_t N>
constexpr auto linalg::Vector< T, N >::view ( )
inlineconstexpr

Obtain a mutable fixed-extent view of contiguous coordinate storage.

Definition at line 95 of file vector.hpp.


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