Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Vector< T, NumType > Class Template Reference

Sparse vector implementation with domain-based indexing. More...

#include <al-vector.H>

Inheritance diagram for Aleph::Vector< T, NumType >:
[legend]
Collaboration diagram for Aleph::Vector< T, NumType >:
[legend]

Classes

struct  Iterator
 
class  Proxy
 

Public Types

using Domain = AlDomain< T >
 
using DomainPtr = std::shared_ptr< Domain >
 
using Map = Aleph::HashMap< T, NumType, MapODhash >
 
using Item_Type = std::pair< T, NumType >
 
using Pair = std::pair< T, NumType >
 

Public Member Functions

const NumTypeget_epsilon () const noexcept
 Get the epsilon value used for zero comparisons.
 
void set_epsilon (const NumType &e) noexcept
 Set the epsilon value for zero comparisons.
 
const Domainget_domain () const noexcept
 Get the domain over which this vector is defined.
 
const DomainPtrget_domain_ptr () const noexcept
 Return the shared pointer to the domain.
 
 Vector (DomainPtr d, const NumType &zero=default_epsilon)
 Construct a vector over a given domain (shared_ptr version)
 
 Vector (const Domain &d, const NumType &zero=default_epsilon)
 Construct a vector over a given domain (reference version)
 
 Vector (const Vector &v)
 Copy constructor.
 
 Vector (Vector &&v) noexcept
 Move constructor.
 
 Vector (DomainPtr d, const DynList< NumType > &l, const NumType &zero=default_epsilon)
 Construct vector from domain and list of values (shared_ptr version)
 
 Vector (const Domain &d, const DynList< NumType > &l, const NumType &zero=default_epsilon)
 Construct vector from domain and list of values (reference version)
 
Vectoroperator= (const Vector &v)
 Copy assignment operator.
 
Vectoroperator= (Vector &&v)
 Move assignment operator.
 
void set_entry (const T &i, const NumType &value)
 Set a vector entry at given index.
 
void set_entries (std::initializer_list< T > ld, std::initializer_list< NumType > lr)
 Set multiple entries using initializer lists.
 
template<template< typename > class Container = DynList>
void set_entries (const Container< T > &c, std::initializer_list< NumType > lr)
 Set multiple entries using container and initializer list.
 
NumType get_entry (const T &i)
 Get vector entry at given index (non-const version)
 
NumType get_entry (const T &i) const noexcept
 Get vector entry at given index (const version)
 
NumTypesearch_entry (const T &i) const noexcept
 Search for an entry and return pointer to its value.
 
bool are_equal (const NumType &n1, const NumType &n2) const noexcept
 Check if two numeric values are equal within epsilon.
 
bool equal_to (const Vector &other) const noexcept
 Check if this vector equals another within epsilon tolerance.
 
bool operator== (const Vector &v) const noexcept
 
bool operator!= (const Vector &v) const noexcept
 
Vectoroperator+= (const Vector &v)
 
Vectoroperator-= (const Vector &v)
 
Vector operator+ (const Vector &r) const
 
Vector operator- (const Vector &r) const
 
Vectorproduct_by_scalar (const NumType &scalar) noexcept
 
Vector operator* (const NumType &scalar) const
 
Vectordivide_by_scalar (const NumType &scalar)
 
Vector operator/ (const NumType &scalar) const
 
Vector operator- () const
 
NumType scalar_product (const Vector &v) const
 
NumType operator* (const Vector &v) const
 
DynList< NumTypeto_list () const
 
void print () const
 
std::string to_str () const
 
Proxy operator[] (const T &k) const noexcept
 
Proxy operator[] (const T &k) noexcept
 
Proxy operator() (const T &k) const noexcept
 
Proxy operator() (const T &k) noexcept
 
Iterator get_itor () const noexcept
 
Iterator get_it () const noexcept
 
- Public Member Functions inherited from Aleph::TraverseMixin< Vector< T, NumType >, std::pair< T, NumType > >
bool traverse (Operation &operation) const
 Traverse all elements, applying an operation to each.
 
bool traverse (Operation &operation)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool traverse (Operation and operation=Operation()) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool traverse (Operation and operation=Operation())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
- Public Member Functions inherited from Aleph::LocateMixin< Vector< T, NumType >, std::pair< T, NumType > >
std::pair< T, NumType > & nth (const size_t n) const
 Access the n-th element (bounds-checked).
 
std::pair< T, NumType > & nth_ne (const size_t n) const noexcept
 Access the n-th element (unchecked).
 
std::pair< T, NumType > * find_ptr (Operation &operation)
 Find the first element satisfying a predicate.
 
std::pair< T, NumType > * find_ptr (Operation &operation) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
std::pair< T, NumType > * find_ptr (Operation and operation=Operation()) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
std::pair< T, NumType > * find_ptr (Operation and operation=Operation())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
std::tuple< bool, std::pair< T, NumType > > find_item (Operation &operation)
 Find element with success flag.
 
std::tuple< bool, std::pair< T, NumType > > find_item (Operation &operation) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
std::tuple< bool, std::pair< T, NumType > > find_item (Operation &&operation=Operation())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
std::tuple< bool, std::pair< T, NumType > > find_item (Operation &&operation=Operation()) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
- Public Member Functions inherited from Aleph::FunctionalMixin< Vector< T, NumType >, std::pair< T, NumType > >
auto for_each (Operation &operation) const -> decltype(self())
 Apply an operation to each element (read-only).
 
auto for_each (Operation &operation) -> decltype(self())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
auto for_each (Operation &&operation=Operation()) const -> decltype(self())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
auto for_each (Operation &&operation=Operation()) -> decltype(self())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
auto mutable_for_each (Operation &operation) -> decltype(self())
 Apply an operation to each element (mutable).
 
auto mutable_for_each (Operation &&operation=Operation()) -> decltype(self())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool all (Operation &operation) const
 Test if all elements satisfy a predicate.
 
bool all (Operation &&operation=Operation()) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool forall (Operation &operation) const
 Alias for all().
 
bool forall (Operation &&operation=Operation()) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool exists (Operation &operation) const
 Test if any element satisfies a predicate.
 
bool exists (Operation &&operation=Operation()) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
Container< __Type > maps (Operation &operation) const
 Transform elements using a mapping function.
 
Container< __Type > maps (Operation &&operation=Operation()) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
__Type foldl (const __Type &init, std::function< __Type(const __Type &, const std::pair< T, NumType > &)> operation) const
 Left fold (reduce) with initial value.
 
__Type fold_left (std::function< __Type(const __Type &, const std::pair< T, NumType > &)> operation, const __Type &init) const
 Left fold with operation first (alternative signature).
 
std::pair< T, NumType > fold (const std::pair< T, NumType > &init, Operation &operation) const
 Simple fold with same type for accumulator and elements.
 
std::pair< T, NumType > fold (const std::pair< T, NumType > &init, Operation &&operation=Operation()) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
DynList< std::pair< T, NumType > > filter (Operation &operation) const
 Filter elements by a predicate.
 
DynList< std::pair< T, NumType > > filter (Operation &&operation=Operation()) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
DynList< std::tuple< std::pair< T, NumType >, size_t > > pfilter (Operation &operation) const
 Filter with position information.
 
DynList< std::tuple< std::pair< T, NumType >, size_t > > pfilter (Operation &&operation=Operation()) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
std::pair< DynList< std::pair< T, NumType > >, DynList< std::pair< T, NumType > > > partition (Operation &op) const
 Partition elements by a predicate.
 
std::pair< DynList< std::pair< T, NumType > >, DynList< std::pair< T, NumType > > > partition (Operation &&op=Operation()) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
std::tuple< DynList< std::pair< T, NumType > >, DynList< std::pair< T, NumType > > > tpartition (Operation &op) const
 Partition returning tuple instead of pair.
 
std::tuple< DynList< std::pair< T, NumType > >, DynList< std::pair< T, NumType > > > tpartition (Operation &&op=Operation()) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
size_t length () const noexcept
 Count the number of elements.
 
Container< std::pair< T, NumType > > rev () const
 Create a reversed copy.
 
Container< std::pair< T, NumType > > take (const size_t n) const
 Take the first n elements.
 
Container< std::pair< T, NumType > > drop (const size_t n) const
 Skip the first n elements.
 
std::pair< T, NumType > sum (const std::pair< T, NumType > &init=std::pair< T, NumType > {}) const
 Compute the sum of all elements.
 
std::pair< T, NumType > product (const std::pair< T, NumType > &init) const
 Compute the product of all elements.
 
const std::pair< T, NumType > * min () const
 Find the minimum element.
 
const std::pair< T, NumType > * max () const
 Find the maximum element.
 
const std::pair< T, NumType > * min_by (Compare cmp) const
 Find the minimum element using a custom comparator.
 
const std::pair< T, NumType > * max_by (Compare cmp) const
 Find the maximum element using a custom comparator.
 
bool has_value (const std::pair< T, NumType > &val) const
 Check if container has a value.
 
bool none (Predicate &pred) const
 Check if no element satisfies a predicate.
 
bool none (Predicate &&pred) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
size_t count_if (Predicate pred) const
 Count elements satisfying a predicate.
 
const std::pair< T, NumType > * first () const
 Get the first element.
 
std::pair< T, NumType > first_or (const std::pair< T, NumType > &default_val) const
 Get the first element or a default value.
 
const std::pair< T, NumType > * last () const
 Get the last element.
 
std::pair< T, NumType > last_or (const std::pair< T, NumType > &default_val) const
 Get the last element or a default value.
 
Container< std::pair< size_t, std::pair< T, NumType > > > enumerate () const
 Enumerate elements with their indices.
 
size_t find_index (Predicate pred) const
 Find the index of the first element satisfying a predicate.
 
size_t index_of (const std::pair< T, NumType > &val) const
 Find the index of a specific value.
 
Container< std::pair< T, NumType > > unique () const
 Remove consecutive duplicate elements.
 
Container< std::pair< T, NumType > > unique_by (EqPred eq) const
 Remove consecutive duplicates using a custom equality predicate.
 
Container< std::pair< T, NumType > > intersperse (const std::pair< T, NumType > &sep) const
 Intersperse a separator between elements.
 
Container< Container< std::pair< T, NumType > > > chunk (size_t n) const
 Split into chunks of fixed size.
 
Container< Container< std::pair< T, NumType > > > sliding (size_t size, size_t step=1) const
 Create sliding windows of fixed size.
 
std::vector< std::pair< T, NumType > > to_vector () const
 Convert to std::vector.
 
DynListType to_dynlist () const
 Convert container to DynList.
 
StringType join (const StringType &sep=StringType{", "}) const
 Join elements into a string with separator.
 
std::string join_str (const std::string &sep=", ") const
 Join string elements with separator.
 
Container< std::pair< std::pair< T, NumType >, typename Other::Item_Type > > zip_with (const Other &other) const
 Zip with another container.
 

Private Member Functions

bool is_zero (const NumType &val) const noexcept
 

Static Private Member Functions

static NumType abs (const NumType &val) noexcept
 
static bool test_epsilon (const NumType &e) noexcept
 

Private Attributes

DomainPtr domain_ptr = nullptr
 
NumType epsilon = default_epsilon
 
Map entries
 

Static Private Attributes

static const NumType default_epsilon = 1e-7
 

Additional Inherited Members

- Protected Member Functions inherited from Aleph::TraverseMixin< Vector< T, NumType >, std::pair< T, NumType > >
const Vector< T, NumType > & self () const noexcept
 Access the derived class (const version).
 
Vector< T, NumType > & self () noexcept
 Access the derived class (mutable version).
 
- Protected Member Functions inherited from Aleph::LocateMixin< Vector< T, NumType >, std::pair< T, NumType > >
const Vector< T, NumType > & self () const noexcept
 
Vector< T, NumType > & self () noexcept
 
- Protected Member Functions inherited from Aleph::FunctionalMixin< Vector< T, NumType >, std::pair< T, NumType > >
const Vector< T, NumType > & self () const noexcept
 
Vector< T, NumType > & self () noexcept
 

Detailed Description

template<typename T, typename NumType>
class Aleph::Vector< T, NumType >

Sparse vector implementation with domain-based indexing.

This class implements a mathematical vector with sparse storage, where only non-zero entries are stored. The vector is defined over a domain of type T, and entries have values of type NumType.

The vector uses epsilon-based comparison for numerical tolerance, automatically removing entries that become close to zero.

Template Parameters
TType of domain elements (default: int)
NumTypeNumeric type for vector entries (default: double)
Author
Leandro Rabindranath Leon

Definition at line 84 of file al-vector.H.

Member Typedef Documentation

◆ Domain

Definition at line 89 of file al-vector.H.

◆ DomainPtr

template<typename T , typename NumType >
using Aleph::Vector< T, NumType >::DomainPtr = std::shared_ptr<Domain>

Definition at line 90 of file al-vector.H.

◆ Item_Type

Definition at line 92 of file al-vector.H.

◆ Map

Definition at line 91 of file al-vector.H.

◆ Pair

template<typename T , typename NumType >
using Aleph::Vector< T, NumType >::Pair = std::pair<T, NumType>

Definition at line 131 of file al-vector.H.

Constructor & Destructor Documentation

◆ Vector() [1/6]

Construct a vector over a given domain (shared_ptr version)

Parameters
dShared pointer to domain for the vector indices
zeroEpsilon value for zero comparisons (default: 1e-7)

Definition at line 147 of file al-vector.H.

◆ Vector() [2/6]

template<typename T , typename NumType >
Aleph::Vector< T, NumType >::Vector ( const Domain d,
const NumType zero = default_epsilon 
)
inline

Construct a vector over a given domain (reference version)

Parameters
dDomain for the vector indices (will be wrapped in shared_ptr)
zeroEpsilon value for zero comparisons (default: 1e-7)
Note
Creates a non-owning shared_ptr; caller must ensure domain outlives vector

Definition at line 159 of file al-vector.H.

◆ Vector() [3/6]

template<typename T , typename NumType >
Aleph::Vector< T, NumType >::Vector ( const Vector< T, NumType > &  v)
inline

Copy constructor.

Parameters
vVector to copy from

Definition at line 169 of file al-vector.H.

◆ Vector() [4/6]

template<typename T , typename NumType >
Aleph::Vector< T, NumType >::Vector ( Vector< T, NumType > &&  v)
inlinenoexcept

Move constructor.

Parameters
vVector to move from

Definition at line 179 of file al-vector.H.

◆ Vector() [5/6]

Construct vector from domain and list of values (shared_ptr version)

Parameters
dShared pointer to domain for the vector indices
lList of values (must match domain size)
zeroEpsilon value for zero comparisons (default: 1e-7)
Exceptions
ah_length_errorif list size doesn't match domain size

Definition at line 193 of file al-vector.H.

References ah_length_error_if, Aleph::Vector< T, NumType >::domain_ptr, l, Aleph::FunctionalMixin< Vector< T, NumType >, std::pair< T, NumType > >::maps(), Aleph::Vector< T, NumType >::set_entry(), Aleph::HTList::size(), and Aleph::zip_it().

◆ Vector() [6/6]

template<typename T , typename NumType >
Aleph::Vector< T, NumType >::Vector ( const Domain d,
const DynList< NumType > &  l,
const NumType zero = default_epsilon 
)
inline

Construct vector from domain and list of values (reference version)

Parameters
dDomain for the vector indices (will be wrapped in shared_ptr)
lList of values (must match domain size)
zeroEpsilon value for zero comparisons (default: 1e-7)
Exceptions
ah_length_errorif list size doesn't match domain size
Note
Creates a non-owning shared_ptr; caller must ensure domain outlives vector

Definition at line 215 of file al-vector.H.

Member Function Documentation

◆ abs()

template<typename T , typename NumType >
static NumType Aleph::Vector< T, NumType >::abs ( const NumType val)
inlinestaticprivatenoexcept

Definition at line 101 of file al-vector.H.

Referenced by Aleph::Vector< T, NumType >::is_zero().

◆ are_equal()

template<typename T , typename NumType >
bool Aleph::Vector< T, NumType >::are_equal ( const NumType n1,
const NumType n2 
) const
inlinenoexcept

Check if two numeric values are equal within epsilon.

Parameters
n1First value
n2Second value
Returns
true if |n1 - n2| <= epsilon

Definition at line 395 of file al-vector.H.

References Aleph::Vector< T, NumType >::is_zero().

Referenced by Aleph::Vector< T, NumType >::equal_to(), and TEST_F().

◆ divide_by_scalar()

◆ equal_to()

template<typename T , typename NumType >
bool Aleph::Vector< T, NumType >::equal_to ( const Vector< T, NumType > &  other) const
inlinenoexcept

Check if this vector equals another within epsilon tolerance.

Parameters
otherVector to compare with (must have same domain)
Returns
true if all corresponding entries are within epsilon

Definition at line 405 of file al-vector.H.

References Aleph::Vector< T, NumType >::are_equal(), Aleph::Vector< T, NumType >::domain_ptr, Aleph::Vector< T, NumType >::entries, Aleph::Vector< T, NumType >::get_entry(), and Aleph::FunctionalMixin< Vector< T, NumType >, std::pair< T, NumType > >::maps().

◆ get_domain()

template<typename T , typename NumType >
const Domain & Aleph::Vector< T, NumType >::get_domain ( ) const
inlinenoexcept

Get the domain over which this vector is defined.

Returns
Reference to the domain

Definition at line 137 of file al-vector.H.

References Aleph::Vector< T, NumType >::domain_ptr.

Referenced by Aleph::outer_product(), TEST_F(), and TEST_F().

◆ get_domain_ptr()

template<typename T , typename NumType >
const DomainPtr & Aleph::Vector< T, NumType >::get_domain_ptr ( ) const
inlinenoexcept

Return the shared pointer to the domain.

Definition at line 140 of file al-vector.H.

References Aleph::Vector< T, NumType >::domain_ptr.

◆ get_entry() [1/2]

◆ get_entry() [2/2]

template<typename T , typename NumType >
NumType Aleph::Vector< T, NumType >::get_entry ( const T i) const
inlinenoexcept

Get vector entry at given index (const version)

Parameters
iIndex (must be in domain)
Returns
Value at index (0 if not set)

Definition at line 362 of file al-vector.H.

References Aleph::Vector< T, NumType >::domain_ptr, Aleph::Vector< T, NumType >::entries, and Aleph::FunctionalMixin< Vector< T, NumType >, std::pair< T, NumType > >::maps().

◆ get_epsilon()

template<typename T , typename NumType >
const NumType & Aleph::Vector< T, NumType >::get_epsilon ( ) const
inlinenoexcept

Get the epsilon value used for zero comparisons.

Returns
Current epsilon value

Definition at line 119 of file al-vector.H.

References Aleph::Vector< T, NumType >::epsilon.

Referenced by demo_epsilon(), TEST_F(), TEST_F(), and TEST_F().

◆ get_it()

◆ get_itor()

template<typename T , typename NumType >
Iterator Aleph::Vector< T, NumType >::get_itor ( ) const
inlinenoexcept

Definition at line 699 of file al-vector.H.

◆ is_zero()

◆ operator!=()

◆ operator()() [1/2]

◆ operator()() [2/2]

◆ operator*() [1/2]

◆ operator*() [2/2]

template<typename T , typename NumType >
NumType Aleph::Vector< T, NumType >::operator* ( const Vector< T, NumType > &  v) const
inline

Definition at line 533 of file al-vector.H.

References Aleph::Vector< T, NumType >::scalar_product().

◆ operator+()

◆ operator+=()

◆ operator-() [1/2]

◆ operator-() [2/2]

◆ operator-=()

◆ operator/()

◆ operator=() [1/2]

Copy assignment operator.

Parameters
vVector to copy from
Returns
Reference to this vector
Exceptions
std::domain_errorif domains are different (not the same object)
Note
Vectors must share the same domain (pointer equality) for assignment

Definition at line 227 of file al-vector.H.

References ah_domain_error_if, Aleph::Vector< T, NumType >::domain_ptr, Aleph::Vector< T, NumType >::entries, and Aleph::Vector< T, NumType >::epsilon.

◆ operator=() [2/2]

template<typename T , typename NumType >
Vector & Aleph::Vector< T, NumType >::operator= ( Vector< T, NumType > &&  v)
inline

Move assignment operator.

Parameters
vVector to move from
Returns
Reference to this vector
Exceptions
std::domain_errorif domains are different (not the same object)
Note
Vectors must share the same domain (pointer equality) for assignment

Definition at line 248 of file al-vector.H.

References ah_domain_error_if, Aleph::Vector< T, NumType >::domain_ptr, Aleph::Vector< T, NumType >::entries, and Aleph::Vector< T, NumType >::epsilon.

◆ operator==()

template<typename T , typename NumType >
bool Aleph::Vector< T, NumType >::operator== ( const Vector< T, NumType > &  v) const
inlinenoexcept

Definition at line 419 of file al-vector.H.

◆ operator[]() [1/2]

◆ operator[]() [2/2]

◆ print()

◆ product_by_scalar()

◆ scalar_product()

◆ search_entry()

template<typename T , typename NumType >
NumType * Aleph::Vector< T, NumType >::search_entry ( const T i) const
inlinenoexcept

Search for an entry and return pointer to its value.

Parameters
iIndex (must be in domain)
Returns
Pointer to value if exists, nullptr otherwise

Definition at line 378 of file al-vector.H.

References Aleph::Vector< T, NumType >::domain_ptr, Aleph::Vector< T, NumType >::entries, and Aleph::FunctionalMixin< Vector< T, NumType >, std::pair< T, NumType > >::maps().

Referenced by TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ set_entries() [1/2]

template<typename T , typename NumType >
template<template< typename > class Container = DynList>
void Aleph::Vector< T, NumType >::set_entries ( const Container< T > &  c,
std::initializer_list< NumType lr 
)
inline

Set multiple entries using container and initializer list.

Template Parameters
ContainerContainer type (default: DynList)
Parameters
cContainer of domain indices
lrList of corresponding values
Exceptions
ah_range_errorif container and list have different sizes
ah_domain_errorif any index not in domain

Definition at line 318 of file al-vector.H.

References ah_domain_error_if, ah_range_error_if, Aleph::Vector< T, NumType >::domain_ptr, Aleph::FunctionalMixin< Vector< T, NumType >, std::pair< T, NumType > >::maps(), and Aleph::Vector< T, NumType >::set_entry().

◆ set_entries() [2/2]

template<typename T , typename NumType >
void Aleph::Vector< T, NumType >::set_entries ( std::initializer_list< T ld,
std::initializer_list< NumType lr 
)
inline

Set multiple entries using initializer lists.

Parameters
ldList of domain indices
lrList of corresponding values
Exceptions
ah_range_errorif lists have different sizes
ah_domain_errorif any index not in domain

Definition at line 293 of file al-vector.H.

References ah_domain_error_if, ah_range_error_if, Aleph::Vector< T, NumType >::domain_ptr, Aleph::FunctionalMixin< Vector< T, NumType >, std::pair< T, NumType > >::maps(), and Aleph::Vector< T, NumType >::set_entry().

Referenced by TEST_F(), TEST_F(), and TEST_F().

◆ set_entry()

◆ set_epsilon()

template<typename T , typename NumType >
void Aleph::Vector< T, NumType >::set_epsilon ( const NumType e)
inlinenoexcept

Set the epsilon value for zero comparisons.

Parameters
eNew epsilon value (must be >= 0)
Note
Values with absolute value <= epsilon are considered zero

Definition at line 126 of file al-vector.H.

References Aleph::Vector< T, NumType >::epsilon.

Referenced by demo_epsilon(), and TEST_F().

◆ test_epsilon()

template<typename T , typename NumType >
static bool Aleph::Vector< T, NumType >::test_epsilon ( const NumType e)
inlinestaticprivatenoexcept

Definition at line 112 of file al-vector.H.

◆ to_list()

◆ to_str()

Member Data Documentation

◆ default_epsilon

template<typename T , typename NumType >
const NumType Aleph::Vector< T, NumType >::default_epsilon = 1e-7
staticprivate

Definition at line 95 of file al-vector.H.

◆ domain_ptr

◆ entries

◆ epsilon


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