alpaqa 1.0.0a19
Nonconvex constrained optimization
Loading...
Searching...
No Matches
Namespaces | Classes | Concepts | Typedefs | Functions
alpaqa::util Namespace Reference

Namespaces

namespace  detail
 

Classes

class  bad_type_erased_constness
 
class  bad_type_erased_type
 
struct  BasicVTable
 Struct that stores the size of a polymorphic object, as well as pointers to functions to copy, move or destroy the object. More...
 
struct  class_from_member_ptr_impl
 
struct  class_from_member_ptr_impl< Ret(C::*)(Args...) const >
 
struct  class_from_member_ptr_impl< Ret(C::*)(Args...)>
 
struct  copyable_unique_ptr
 
struct  enumerate_t
 
struct  first_type_or_void
 
struct  first_type_or_void< First, Pack... >
 
struct  first_type_or_void<>
 
struct  invalid_duration_units
 
struct  invalid_duration_value
 
struct  iter_range_adapter
 
struct  join_opt
 
struct  join_quote_opt
 
struct  last_type
 
struct  last_type< Only >
 
struct  noop_delete
 Deleter for std::unique_ptr that just destructs the object, without deallocating. More...
 
struct  set_intersection_iterable
 
struct  Timed
 
class  TypeErased
 Class for polymorphism through type erasure. More...
 

Concepts

concept  derived_from_TypeErased
 
concept  no_leading_allocator
 

Typedefs

template<class NewAlias , class... PossibleAliases>
using possible_alias_t = std::conditional_t< detail::any_is_same< NewAlias, PossibleAliases... >(), detail::dummy< NewAlias, PossibleAliases... >, NewAlias >
 If NewAlias is not the same type as any of PossibleAliases, the result is NewAlias.
 
template<class M >
using class_from_member_ptr_impl_t = typename class_from_member_ptr_impl< M >::type
 
template<auto M>
using class_from_member_ptr_t = class_from_member_ptr_impl_t< decltype(M)>
 
template<class... Pack>
using last_type_t = typename last_type< Pack... >::type
 
template<class... Pack>
using first_type_or_void_t = typename first_type_or_void< Pack... >::type
 

Functions

template<class V >
void check_dim_msg (const V &v, auto sz, std::string msg)
 
template<class V >
void check_dim_msg (std::optional< V > &v, auto sz, std::string msg)
 
template<class V >
void check_dim (std::string name, V &&v, auto sz)
 
template<class M >
void check_dim_msg (const M &m, auto rows, auto cols, std::string msg)
 
template<class M >
void check_dim (std::string name, M &&m, auto rows, auto cols)
 
template<class Rep , class Period >
std::string_view parse_single_duration (std::chrono::duration< Rep, Period > &t, std::string_view s)
 Adds the first duration in the string s to the duration t.
 
template<class Rep , class Period >
void parse_duration (std::chrono::duration< Rep, Period > &t, std::string_view s)
 Adds the sum of the durations in the string s to the duration t.
 
template<class Rng >
auto enumerate (Rng &&rng)
 
template<class T >
requires ( false)
std::from_chars_result from_chars (const char *first, const char *last, T &value, std::chars_format fmt=std::chars_format::general)
 
template<class T >
requires ( false)
std::from_chars_result from_chars (const char *first, const char *last, T &value, int base=10)
 
template<class T , class... Args>
requires ( std::floating_point<T> || false)
std::from_chars_result from_chars (const char *first, const char *last, T &value, std::chars_format fmt=std::chars_format::general)
 
template<class T , class... Args>
requires ( std::integral<T> || false)
std::from_chars_result from_chars (const char *first, const char *last, T &value, int base=10)
 
template<class T >
requires std::is_trivially_copyable_v<T>
Tstart_lifetime_as_array (void *p, size_t n) noexcept
 
template<class T >
requires std::is_trivially_copyable_v<T>
const Tstart_lifetime_as_array (const void *p, size_t n) noexcept
 
template<class T >
requires std::is_trivially_copyable_v<T>
Tstart_lifetime_as (void *p) noexcept
 
template<class T >
requires std::is_trivially_copyable_v<T>
const Tstart_lifetime_as (const void *p) noexcept
 
template<std::ranges::viewable_range R1, std::ranges::viewable_range R2, class Comp = std::ranges::less, class Proj1 = std::identity, class Proj2 = std::identity>
set_intersection_iterable< std::ranges::views::all_t< R1 >, std::ranges::views::all_t< R2 >, Comp, Proj1, Proj2iter_set_intersection (R1 &&r1, R2 &&r2, Comp comp={}, Proj1 proj1={}, Proj2 proj2={})
 
template<class SpMat , class Mat , class MaskVec >
void sparse_add_masked (const SpMat &R_full, Mat &&R, const MaskVec &mask)
 R += R_full(mask,mask)
 
template<class SpMat , class Mat , class MaskVec >
void sparse_add_masked_rows (const SpMat &S_full, Mat &&S, const MaskVec &mask)
 S += S_full(mask,:)
 
template<class SpMat , class CVec , class Vec , class MaskVec >
void sparse_matvec_add_masked_rows_cols (const SpMat &R, const CVec &v, Vec &&out, const MaskVec &mask_J, const MaskVec &mask_K)
 out += R(mask_J,mask_K) * v(mask_K);
 
template<class SpMat , class CVec , class Vec , class MaskVec >
void sparse_matvec_add_transpose_masked_rows (const SpMat &S, const CVec &v, Vec &&out, const MaskVec &mask)
 out += S(mask,:)ᵀ * v(mask);
 
auto split (std::string_view full, std::string_view tok)
 Split the string full on the first occurrence of tok.
 
auto split_second (std::string_view full, std::string_view tok)
 Split the string s on the first occurrence of tok.
 
std::string join (std::ranges::input_range auto strings, join_opt opt={})
 Join the list of strings into a single string, using the separator given by opt.
 
std::string join_quote (std::ranges::input_range auto strings, join_quote_opt opt={})
 Join the list of strings into a single string, using the separator given by opt.
 
void sort_case_insensitive (auto &range)
 Sort the given range of strings in-place in a case-insensitive manner.
 
template<class Class , auto Method, class... ExtraArgs>
constexpr auto type_erased_wrapped ()
 Returns a function that accepts a void pointer, casts it to the class type of the member function Method, launders it, and then invokes Method with it, passing on the arguments to Method.
 
template<class VTable , class Allocator >
constexpr size_t default_te_buffer_size ()
 
template<class... Types>
constexpr size_t required_te_buffer_size_for ()
 
std::shared_ptr< voidload_lib (const std::filesystem::path &so_filename)
 
voidload_func (void *handle, const std::string &name)
 

Class Documentation

◆ alpaqa::util::class_from_member_ptr_impl

struct alpaqa::util::class_from_member_ptr_impl
+ Collaboration diagram for class_from_member_ptr_impl< M >:

◆ alpaqa::util::class_from_member_ptr_impl< Ret(C::*)(Args...) const >

struct alpaqa::util::class_from_member_ptr_impl< Ret(C::*)(Args...) const >
+ Collaboration diagram for class_from_member_ptr_impl< Ret(C::*)(Args...) const >:
Class Members
typedef add_const_t< C > type

◆ alpaqa::util::class_from_member_ptr_impl< Ret(C::*)(Args...)>

struct alpaqa::util::class_from_member_ptr_impl< Ret(C::*)(Args...)>
+ Collaboration diagram for class_from_member_ptr_impl< Ret(C::*)(Args...)>:
Class Members
typedef C type

◆ alpaqa::util::first_type_or_void

struct alpaqa::util::first_type_or_void
+ Collaboration diagram for first_type_or_void< Pack >:

◆ alpaqa::util::first_type_or_void< First, Pack... >

struct alpaqa::util::first_type_or_void< First, Pack... >
+ Collaboration diagram for first_type_or_void< First, Pack... >:
Class Members
typedef First type

◆ alpaqa::util::first_type_or_void<>

struct alpaqa::util::first_type_or_void<>
+ Collaboration diagram for first_type_or_void<>:
Class Members
typedef void type

◆ alpaqa::util::join_opt

struct alpaqa::util::join_opt
+ Collaboration diagram for join_opt:
Class Members
string_view sep = ", "
string_view empty = "∅"

◆ alpaqa::util::join_quote_opt

struct alpaqa::util::join_quote_opt
+ Collaboration diagram for join_quote_opt:
Class Members
string_view sep = ", "
string_view empty = "∅"
string_view quote_left = "\""
string_view quote_right = "\""

◆ alpaqa::util::last_type

struct alpaqa::util::last_type
+ Collaboration diagram for last_type< First, Pack >:
Class Members
typedef typename type type

◆ alpaqa::util::last_type< Only >

struct alpaqa::util::last_type< Only >
+ Collaboration diagram for last_type< Only >:
Class Members
typedef Only type

Typedef Documentation

◆ possible_alias_t

template<class NewAlias , class... PossibleAliases>
using possible_alias_t = std::conditional_t<detail::any_is_same<NewAlias, PossibleAliases...>(), detail::dummy<NewAlias, PossibleAliases...>, NewAlias>

If NewAlias is not the same type as any of PossibleAliases, the result is NewAlias.

If NewAlias is not distinct from PossibleAliases, the result is a dummy type, uniquely determined by NewAlias and PossibleAliases.

Definition at line 26 of file possible-alias.hpp.

◆ class_from_member_ptr_impl_t

Definition at line 23 of file type-traits.hpp.

◆ class_from_member_ptr_t

Definition at line 27 of file type-traits.hpp.

◆ last_type_t

template<class... Pack>
using last_type_t = typename last_type<Pack...>::type

Definition at line 38 of file type-traits.hpp.

◆ first_type_or_void_t

template<class... Pack>
using first_type_or_void_t = typename first_type_or_void<Pack...>::type

Definition at line 51 of file type-traits.hpp.

Function Documentation

◆ check_dim_msg() [1/3]

template<class V >
void check_dim_msg ( const V v,
auto  sz,
std::string  msg 
)

Definition at line 11 of file check-dim.hpp.

+ Here is the caller graph for this function:

◆ check_dim_msg() [2/3]

template<class V >
void check_dim_msg ( std::optional< V > &  v,
auto  sz,
std::string  msg 
)

Definition at line 23 of file check-dim.hpp.

◆ check_dim() [1/2]

template<class V >
void check_dim ( std::string  name,
V &&  v,
auto  sz 
)

Definition at line 37 of file check-dim.hpp.

+ Here is the call graph for this function:

◆ check_dim_msg() [3/3]

template<class M >
void check_dim_msg ( const M m,
auto  rows,
auto  cols,
std::string  msg 
)

Definition at line 43 of file check-dim.hpp.

◆ check_dim() [2/2]

template<class M >
void check_dim ( std::string  name,
M &&  m,
auto  rows,
auto  cols 
)

Definition at line 59 of file check-dim.hpp.

+ Here is the call graph for this function:

◆ parse_single_duration()

template<class Rep , class Period >
std::string_view parse_single_duration ( std::chrono::duration< Rep, Period > &  t,
std::string_view  s 
)

Adds the first duration in the string s to the duration t.

Definition at line 27 of file duration-parse.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_duration()

template<class Rep , class Period >
void parse_duration ( std::chrono::duration< Rep, Period > &  t,
std::string_view  s 
)

Adds the sum of the durations in the string s to the duration t.

Definition at line 70 of file duration-parse.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enumerate()

template<class Rng >
auto enumerate ( Rng &&  rng)

Definition at line 66 of file enumerate.hpp.

+ Here is the caller graph for this function:

◆ from_chars() [1/4]

template<class T >
requires ( false)
std::from_chars_result from_chars ( const char first,
const char last,
T value,
std::chars_format  fmt = std::chars_format::general 
)

Definition at line 46 of file from_chars-wrapper.hpp.

+ Here is the caller graph for this function:

◆ from_chars() [2/4]

template<class T >
requires ( false)
std::from_chars_result from_chars ( const char first,
const char last,
T value,
int  base = 10 
)

Definition at line 57 of file from_chars-wrapper.hpp.

◆ from_chars() [3/4]

template<class T , class... Args>
requires ( std::floating_point<T> || false)
std::from_chars_result from_chars ( const char first,
const char last,
T value,
std::chars_format  fmt = std::chars_format::general 
)

Definition at line 68 of file from_chars-wrapper.hpp.

◆ from_chars() [4/4]

template<class T , class... Args>
requires ( std::integral<T> || false)
std::from_chars_result from_chars ( const char first,
const char last,
T value,
int  base = 10 
)

Definition at line 104 of file from_chars-wrapper.hpp.

◆ start_lifetime_as_array() [1/2]

template<class T >
requires std::is_trivially_copyable_v<T>
T * start_lifetime_as_array ( void p,
size_t  n 
)
noexcept

Definition at line 21 of file lifetime.hpp.

◆ start_lifetime_as_array() [2/2]

template<class T >
requires std::is_trivially_copyable_v<T>
const T * start_lifetime_as_array ( const void p,
size_t  n 
)
noexcept

Definition at line 29 of file lifetime.hpp.

◆ start_lifetime_as() [1/2]

template<class T >
requires std::is_trivially_copyable_v<T>
T * start_lifetime_as ( void p)
noexcept

Definition at line 39 of file lifetime.hpp.

◆ start_lifetime_as() [2/2]

template<class T >
requires std::is_trivially_copyable_v<T>
const T * start_lifetime_as ( const void p)
noexcept

Definition at line 44 of file lifetime.hpp.

◆ iter_set_intersection()

template<std::ranges::viewable_range R1, std::ranges::viewable_range R2, class Comp = std::ranges::less, class Proj1 = std::identity, class Proj2 = std::identity>
set_intersection_iterable< std::ranges::views::all_t< R1 >, std::ranges::views::all_t< R2 >, Comp, Proj1, Proj2 > iter_set_intersection ( R1 &&  r1,
R2 &&  r2,
Comp  comp = {},
Proj1  proj1 = {},
Proj2  proj2 = {} 
)

Definition at line 114 of file set-intersection.hpp.

+ Here is the caller graph for this function:

◆ sparse_add_masked()

template<class SpMat , class Mat , class MaskVec >
void sparse_add_masked ( const SpMat R_full,
Mat &&  R,
const MaskVec mask 
)

R += R_full(mask,mask)

Definition at line 83 of file sparse-ops.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sparse_add_masked_rows()

template<class SpMat , class Mat , class MaskVec >
void sparse_add_masked_rows ( const SpMat S_full,
Mat &&  S,
const MaskVec mask 
)

S += S_full(mask,:)

Definition at line 93 of file sparse-ops.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sparse_matvec_add_masked_rows_cols()

template<class SpMat , class CVec , class Vec , class MaskVec >
void sparse_matvec_add_masked_rows_cols ( const SpMat R,
const CVec v,
Vec &&  out,
const MaskVec mask_J,
const MaskVec mask_K 
)

out += R(mask_J,mask_K) * v(mask_K);

Definition at line 104 of file sparse-ops.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sparse_matvec_add_transpose_masked_rows()

template<class SpMat , class CVec , class Vec , class MaskVec >
void sparse_matvec_add_transpose_masked_rows ( const SpMat S,
const CVec v,
Vec &&  out,
const MaskVec mask 
)

out += S(mask,:)ᵀ * v(mask);

Definition at line 117 of file sparse-ops.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ split()

auto split ( std::string_view  full,
std::string_view  tok 
)
inline

Split the string full on the first occurrence of tok.

Returns (s, "") if tok was not found.

Definition at line 14 of file string-util.hpp.

+ Here is the caller graph for this function:

◆ split_second()

auto split_second ( std::string_view  full,
std::string_view  tok 
)
inline

Split the string s on the first occurrence of tok.

Returns ("", s) if tok was not found.

Definition at line 30 of file string-util.hpp.

◆ join()

std::string join ( std::ranges::input_range auto  strings,
join_opt  opt = {} 
)

Join the list of strings into a single string, using the separator given by opt.

See also
join_opt

Definition at line 53 of file string-util.hpp.

+ Here is the caller graph for this function:

◆ join_quote()

std::string join_quote ( std::ranges::input_range auto  strings,
join_quote_opt  opt = {} 
)

Join the list of strings into a single string, using the separator given by opt.

Each original string is quoted using the quote strings specified by opt

See also
join_quote_opt

Definition at line 80 of file string-util.hpp.

+ Here is the caller graph for this function:

◆ sort_case_insensitive()

void sort_case_insensitive ( auto range)

Sort the given range of strings in-place in a case-insensitive manner.

Definition at line 102 of file string-util.hpp.

+ Here is the caller graph for this function:

◆ type_erased_wrapped()

template<class Class , auto Method, class... ExtraArgs>
constexpr auto type_erased_wrapped ( )
constexpr

Returns a function that accepts a void pointer, casts it to the class type of the member function Method, launders it, and then invokes Method with it, passing on the arguments to Method.

The function can also accept additional arguments at the end, of type ExtraArgs.

Definition at line 165 of file type-erasure.hpp.

◆ default_te_buffer_size()

template<class VTable , class Allocator >
constexpr size_t default_te_buffer_size ( )
inlineconstexpr

Definition at line 170 of file type-erasure.hpp.

◆ required_te_buffer_size_for()

template<class... Types>
constexpr size_t required_te_buffer_size_for ( )
inlineconstexpr

Definition at line 181 of file type-erasure.hpp.

◆ load_lib()

std::shared_ptr< void > load_lib ( const std::filesystem::path &  so_filename)

Definition at line 51 of file dl.cpp.

+ Here is the caller graph for this function:

◆ load_func()

void * load_func ( void handle,
const std::string &  name 
)

Definition at line 64 of file dl.cpp.

+ Here is the caller graph for this function: