numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_collect::util Namespace Reference

Namespace of utilities. More...

Namespaces

namespace  concepts
 Namespace of C++ concepts.
 
namespace  impl
 Namespace of internal implementations.
 

Classes

class  bidirectional_vector
 Class to save data in a sequence which can be extended even toward negative direction. More...
 
class  equal
 Class to compare two values with operator==. More...
 
class  greater
 Class to compare two values with operator>. More...
 
class  greater_equal
 Class to compare two values with operator>=. More...
 
class  iteration_period_checker
 Class to check periods of iterations. More...
 
class  kahan_adder
 Class to add numbers using Kahan summation [14]. More...
 
class  less
 Class to compare two values with operator<. More...
 
class  less_equal
 Class to compare two values with operator<=. More...
 
class  not_equal
 Class to compare two values with operator!=. More...
 
class  object_storage
 Class of storage of objects. More...
 
class  producer_consumer_circular_queue
 Class of a queue using a circular buffer and thread-safe for a single producer thread and a single consumer thread. More...
 
class  source_info_view
 Class to hold information of source codes. More...
 
class  static_stack
 Class of stacks using static arrays. More...
 
class  unsafe_cast
 Class of exception on unsafe casts. More...
 
class  vector
 Class of vectors wrapping std::vector class to use singed integers as indices. More...
 

Typedefs

template<typename Key , typename Value , concepts::hash_function< Key > Hash = std::hash<Key>, concepts::comparator< Key, Key > KeyEqual = equal<Key>, typename Allocator = std::allocator<std::pair<Key, Value>>>
using concurrent_map
 Type of concurrent maps.
 

Enumerations

enum class  dense_matrix_format_type : std::uint8_t { one_line , multi_line }
 Enumeration of matrix format types. More...
 
enum class  sparse_matrix_format_type : std::uint8_t { one_line , multi_line }
 Enumeration of matrix format types. More...
 

Functions

template<typename Matrix >
auto format_dense_matrix (const Eigen::DenseBase< Matrix > &mat, dense_matrix_format_type type=dense_matrix_format_type::one_line)
 Format a dense matrix.
 
template<typename Vector >
auto format_dense_vector (const Eigen::DenseBase< Vector > &vec)
 Format a dense vector.
 
template<typename... Args>
auto format_errno (fmt::format_string< Args... > format, Args &&... args) -> std::string
 Format a message with error message determined by errno.
 
template<base::concepts::sparse_matrix Matrix>
auto format_sparse_matrix (const Matrix &mat, sparse_matrix_format_type type=sparse_matrix_format_type::one_line)
 Format a sparse matrix.
 
template<base::concepts::integral T>
constexpr auto greatest_common_divisor (T a, T b) -> T
 Calculate the greatest common divisor.
 
constexpr auto hash_string (std::string_view str) noexcept -> std::uint32_t
 Calculate a hash number of a string.
 
template<base::concepts::integral T>
constexpr auto least_common_multiple (T a, T b) -> T
 Calculate the least common multiple.
 
template<base::concepts::integral T>
constexpr auto multiply_safely (T a, T b) -> T
 Multiply two integers with check of overflow.
 
template<base::concepts::integral To, base::concepts::integral From>
auto safe_cast (const From &value) -> To
 Cast safely.
 

Variables

constexpr std::size_t cache_line = hash_tables::utility::cache_line
 Size of cache line.
 

Detailed Description

Namespace of utilities.

Typedef Documentation

◆ concurrent_map

template<typename Key , typename Value , concepts::hash_function< Key > Hash = std::hash<Key>, concepts::comparator< Key, Key > KeyEqual = equal<Key>, typename Allocator = std::allocator<std::pair<Key, Value>>>
using num_collect::util::concurrent_map
Initial value:
hash_tables::maps::separate_shared_chain_map_mt<Key,
Value, Hash, KeyEqual, Allocator>

Type of concurrent maps.

Template Parameters
KeyType of keys.
ValueType of mapped values.
HashType of the hash function.
KeyEqualType of the function to check equality of keys.
AllocatorType of the allocator.

Definition at line 47 of file concurrent_map.h.

Enumeration Type Documentation

◆ dense_matrix_format_type

enum class num_collect::util::dense_matrix_format_type : std::uint8_t
strong

Enumeration of matrix format types.

Enumerator
one_line 

One line.

multi_line 

Multiple lines.

Definition at line 35 of file format_dense_matrix.h.

◆ sparse_matrix_format_type

enum class num_collect::util::sparse_matrix_format_type : std::uint8_t
strong

Enumeration of matrix format types.

Enumerator
one_line 

One line.

multi_line 

Multiple lines.

Definition at line 37 of file format_sparse_matrix.h.

Function Documentation

◆ format_dense_matrix()

template<typename Matrix >
auto num_collect::util::format_dense_matrix ( const Eigen::DenseBase< Matrix > & mat,
dense_matrix_format_type type = dense_matrix_format_type::one_line )
inlinenodiscard

Format a dense matrix.

Template Parameters
MatrixType of the matrix.
Parameters
[in]matMatrix.
[in]typeFormat type.
Returns
Expression for formatting using fmt library.
Note
Format of each element can be specified in fmt's format strings.

Definition at line 99 of file format_dense_matrix.h.

◆ format_dense_vector()

template<typename Vector >
auto num_collect::util::format_dense_vector ( const Eigen::DenseBase< Vector > & vec)
inlinenodiscard

Format a dense vector.

Template Parameters
VectorType of the vector.
Parameters
[in]vecVector.
Returns
Expression for formatting using fmt library.
Note
Format of each element can be specified in fmt's format strings.

Definition at line 72 of file format_dense_vector.h.

◆ format_errno()

template<typename... Args>
auto num_collect::util::format_errno ( fmt::format_string< Args... > format,
Args &&... args ) -> std::string
inlinenodiscard

Format a message with error message determined by errno.

Template Parameters
ArgsTypes of arguments.
Parameters
[in]formatFormat.
[in]argsArguments.
Returns
Formatted message.

Definition at line 42 of file format_errno.h.

◆ format_sparse_matrix()

template<base::concepts::sparse_matrix Matrix>
auto num_collect::util::format_sparse_matrix ( const Matrix & mat,
sparse_matrix_format_type type = sparse_matrix_format_type::one_line )
inlinenodiscard

Format a sparse matrix.

Template Parameters
MatrixType of the matrix.
Parameters
[in]matMatrix.
[in]typeFormat type.
Returns
Expression for formatting using fmt library.
Note
Format of each element can be specified in fmt's format strings.

Definition at line 101 of file format_sparse_matrix.h.

◆ greatest_common_divisor()

template<base::concepts::integral T>
auto num_collect::util::greatest_common_divisor ( T a,
T b ) -> T
nodiscardconstexpr

Calculate the greatest common divisor.

Template Parameters
TType of integers.
Parameters
[in]aAn integer.
[in]bAn integer.
Returns
Greatest common divisor of the integers.

Definition at line 38 of file greatest_common_divisor.h.

◆ hash_string()

auto num_collect::util::hash_string ( std::string_view str) -> std::uint32_t
nodiscardconstexprnoexcept

Calculate a hash number of a string.

Note
This function can calculate a hash number at compile-time.
Parameters
[in]strString.
Returns
Hash number.

Definition at line 35 of file hash_string.h.

◆ least_common_multiple()

template<base::concepts::integral T>
auto num_collect::util::least_common_multiple ( T a,
T b ) -> T
nodiscardconstexpr

Calculate the least common multiple.

Template Parameters
TType of integers.
Parameters
[in]aAn integer.
[in]bAn integer.
Returns
Least common multiple of the integers.

Definition at line 37 of file least_common_multiple.h.

◆ multiply_safely()

template<base::concepts::integral T>
auto num_collect::util::multiply_safely ( T a,
T b ) -> T
nodiscardconstexpr

Multiply two integers with check of overflow.

Template Parameters
TType of integers.
Parameters
[in]aAn integer.
[in]bAn integer.
Returns
Result of multiplication.

Definition at line 37 of file multiply_safely.h.

◆ safe_cast()

template<base::concepts::integral To, base::concepts::integral From>
auto num_collect::util::safe_cast ( const From & value) -> To
inlinenodiscard

Cast safely.

Template Parameters
ToType to cast to.
FromType to cast from.
Parameters
[in]valueValue.
Returns
Casted value.

Definition at line 54 of file safe_cast.h.

Variable Documentation

◆ cache_line

std::size_t num_collect::util::cache_line = hash_tables::utility::cache_line
constexpr

Size of cache line.

Definition at line 31 of file cache_line.h.