PLSSVM - Parallel Least Squares Support Vector Machine  2.0.0
A Least Squares Support Vector Machine implementation using different backends.
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
plssvm::detail Namespace Reference

Namespace containing implementation details. Should not directly be used by users. More...

Namespaces

 cmd
 Namespace containing implementation details for the command line interface functionality. Should not directly be used by users.
 
 io
 Namespace containing implementation details for the IO related functions. Should not directly be used by users.
 

Classes

struct  csvm_backend_exists< cuda::csvm >
 Sets the value to true since C-SVMs using the CUDA backend are available. More...
 
class  gpu_csvm
 A C-SVM implementation for all GPU backends to reduce code duplication. More...
 
class  gpu_device_ptr
 Small wrapper class around a GPU device pointer together with commonly used device functions for all GPU backends to reduce code duplication. More...
 
struct  csvm_backend_exists< hip::csvm >
 Sets the value to true since C-SVMs using the HIP backend are available. More...
 
struct  csvm_backend_exists< opencl::csvm >
 Sets the value to true since C-SVMs using the OpenCL backend are available. More...
 
struct  csvm_backend_exists< openmp::csvm >
 Sets the value to true since C-SVMs using the OpenMP backend are available. More...
 
struct  csvm_backend_exists< dpcpp::csvm >
 Sets the value to true since C-SVMs using the SYCL backend with DPC++ as SYCL implementation are available. More...
 
struct  csvm_backend_exists< hipsycl::csvm >
 Sets the value to true since C-SVMs using the SYCL backend with hipSYCL as SYCL implementation are available. More...
 
class  execution_range
 Class specifying a backend independent execution range. More...
 
struct  tracking_entry
 A single tracking entry containing a specific category, a unique name, and the actual value to be tracked. More...
 
struct  is_tracking_entry
 Check whether T is a tracking entry. Ignores all top-level const, volatile, and reference qualifiers. More...
 
class  performance_tracker
 Store the tracked information during calls to plssvm-train, plssvm-predict, and plssvm-scale. More...
 
class  sha256
 A hashing struct used for sha256 hashing. More...
 
struct  real_type_label_type_combination
 Encapsulates a combination of a used real_type (float or double) and label_type (an arithmetic type or std::string). More...
 
struct  concat_tuple_types
 
struct  concat_tuple_types< std::tuple< FirstTupleTypes... >, std::tuple< SecondTupleTypes... > >
 Concatenate the types of the two tuples to a new tuple type. More...
 
struct  cartesian_type_product
 
struct  cartesian_type_product< std::tuple< FirstTupleType, FirstTupleRemainingTypes... >, std::tuple< SecondTupleTypes... > >
 Calculate the cartesian product of the types in two tuples and return a new tuple with the corresponding real_type_label_type_combination types. More...
 
struct  cartesian_type_product< std::tuple<>, std::tuple< SecondTupleTypes... > >
 
struct  type_list_contains
 Checks whether the type T is present in the Tuple. More...
 
struct  type_list_contains< T, std::tuple< Types... > >
 Checks whether the type T is present in the tuple Types. More...
 
struct  is_array
 Type trait to check whether T is a std::array. More...
 
struct  is_array< std::array< T, I > >
 Type trait to check whether T is a std::array. More...
 
struct  is_vector
 Type trait to check whether T is a std::vector. More...
 
struct  is_vector< std::vector< T > >
 Type trait to check whether T is a std::vector. More...
 
struct  is_deque
 Type trait to check whether T is a std::deque. More...
 
struct  is_deque< std::deque< T > >
 Type trait to check whether T is a std::deque. More...
 
struct  is_forward_list
 Type trait to check whether T is a std::forward_list. More...
 
struct  is_forward_list< std::forward_list< T > >
 Type trait to check whether T is a std::forward_list. More...
 
struct  is_list
 Type trait to check whether T is a std::list. More...
 
struct  is_list< std::list< T > >
 Type trait to check whether T is a std::list. More...
 
struct  is_set
 Type trait to check whether T is a std::set. More...
 
struct  is_set< std::set< T > >
 Type trait to check whether T is a std::set. More...
 
struct  is_map
 Type trait to check whether T is a std::map. More...
 
struct  is_map< std::map< Key, T > >
 Type trait to check whether T is a std::map. More...
 
struct  is_multiset
 Type trait to check whether T is a std::multiset. More...
 
struct  is_multiset< std::multiset< T > >
 Type trait to check whether T is a std::multiset. More...
 
struct  is_multimap
 Type trait to check whether T is a std::multimap. More...
 
struct  is_multimap< std::multimap< Key, T > >
 Type trait to check whether T is a std::multimap. More...
 
struct  is_unordered_set
 Type trait to check whether T is a std::unordered_set. More...
 
struct  is_unordered_set< std::unordered_set< T > >
 Type trait to check whether T is a std::unordered_set. More...
 
struct  is_unordered_map
 Type trait to check whether T is a std::unordered_map. More...
 
struct  is_unordered_map< std::unordered_map< Key, T > >
 Type trait to check whether T is a std::unordered_map. More...
 
struct  is_unordered_multiset
 Type trait to check whether T is a std::unordered_multiset. More...
 
struct  is_unordered_multiset< std::unordered_multiset< T > >
 Type trait to check whether T is a std::unordered_multiset. More...
 
struct  is_unordered_multimap
 Type trait to check whether T is a std::unordered_multimap. More...
 
struct  is_unordered_multimap< std::unordered_multimap< Key, T > >
 Type trait to check whether T is a std::unordered_multimap. More...
 
struct  parameter
 Class for encapsulating all important C-SVM parameters. More...
 

Typedefs

template<typename... T>
using concat_tuple_types_t = typename concat_tuple_types< T... >::type
 Shorthand for the typename concat_tuple_types<...>::type type.
 
template<typename... T>
using cartesian_type_product_t = typename cartesian_type_product< T... >::type
 Shorthand for the typename cartesian_type_product<...>::type type.
 
using real_type_list = std::tuple< float, double >
 A type list of all supported real types as std::tuple.
 
using label_type_list = std::tuple< bool, char, signed char, unsigned char, short, unsigned short, int, unsigned int, long, unsigned long, long long, unsigned long long, float, double, long double, std::string >
 A type list of all supported label types (currently arithmetic types and std::string) as std::tuple.
 
using real_type_label_type_combination_list = detail::cartesian_type_product_t< real_type_list, label_type_list >
 The cartesian product of all real types and label types as std::tuple.
 
template<typename T >
using remove_cvref_t = std::remove_cv_t< std::remove_reference_t< T > >
 Remove the topmost reference- and cv-qualifiers. More...
 

Enumerations

enum class  layout_type { aos , soa }
 Enum class for all available layout types. More...
 

Functions

template<typename csvm_type , typename... Args>
std::unique_ptr< csvmmake_csvm_default_impl ([[maybe_unused]] Args &&...args)
 Construct a C-SVM using the parameters args. More...
 
template<typename... Args>
std::unique_ptr< csvmmake_csvm_sycl_impl ([[maybe_unused]] Args &&...args)
 Construct a SYCL C-SVM using the parameters args. More...
 
template<typename... Args>
std::unique_ptr< csvmmake_csvm_impl (const backend_type backend, Args &&...args)
 Create a new C-SVM using the backend type and the additional parameter args. More...
 
template<typename T >
constexpr std::string_view arithmetic_type_name ()=delete
 Tries to convert the given type to its name as string representation including possible const and/or volatile qualifiers. More...
 
template<typename... Args>
void check_assertion (const bool cond, const std::string_view cond_str, const source_location &loc, const std::string_view msg, Args &&...args)
 Function called by the PLSSVM_ASSERT macro. Checks the assertion condition. If the condition evaluates to false, prints the assertion condition together with additional information (e.g., plssvm::source_location information) and aborts the program. More...
 
std::ostream & operator<< (std::ostream &out, const execution_range &range)
 Output the execution range to the given output-stream out. More...
 
std::ostream & operator<< (std::ostream &out, layout_type layout)
 Output the layout to the given output-stream out. More...
 
std::istream & operator>> (std::istream &in, layout_type &layout)
 Use the input-stream in to initialize the layout type. More...
 
template<typename real_type >
std::vector< real_type > transform_to_aos_layout (const std::vector< std::vector< real_type >> &matrix, const std::size_t boundary_size, const std::size_t num_points, const std::size_t num_features)
 Convert a 2D matrix into a 1D array in Array-of-Structs layout adding boundary_size values per data point for padding. More...
 
template<typename real_type >
std::vector< real_type > transform_to_soa_layout (const std::vector< std::vector< real_type >> &matrix, const std::size_t boundary_size, const std::size_t num_points, const std::size_t num_features)
 Convert a 2D matrix into a 1D array in Struct-of-Arrays layout adding boundary_size values per feature for padding. More...
 
template<typename real_type >
std::vector< real_type > transform_to_layout (const layout_type layout, const std::vector< std::vector< real_type >> &matrix, const std::size_t boundary_size, const std::size_t num_points)
 Convert a 2D matrix into a 1D array in the layout adding boundary_size values per data point or feature respectively for padding. More...
 
template<typename... Args>
void log (const verbosity_level verb, const std::string_view msg, Args &&...args)
 
template<typename T >
std::ostream & operator<< (std::ostream &out, const tracking_entry< T > &entry)
 Output the tracking entry to the given output-stream out. Only the tracked value is output excluding the category and name. More...
 
template<typename T , typename Exception = std::runtime_error, PLSSVM_REQUIRES((std::is_arithmetic_v< T >||std::is_same_v< remove_cvref_t< T >, std::string >)) >
convert_to (const std::string_view str)
 Converts the string str to a value of type T. More...
 
template<typename T >
extract_first_integer_from_string (std::string_view str)
 Extract the first integer from the given string str and converts it to T ignoring a potential sign. More...
 
template<typename T >
std::vector< T > split_as (const std::string_view str, const char delim=' ')
 Split the string str at the positions with delimiter delim and return the sub-strings converted to the type T. More...
 
bool starts_with (std::string_view str, std::string_view sv) noexcept
 Checks if the string str starts with the prefix sv. More...
 
bool starts_with (std::string_view str, char c) noexcept
 Checks if the string str starts with the character c. More...
 
bool ends_with (std::string_view str, std::string_view sv) noexcept
 Checks if the string str ends with the suffix sv. More...
 
bool ends_with (std::string_view str, char c) noexcept
 Checks if the string str ends with the character c. More...
 
bool contains (std::string_view str, std::string_view sv) noexcept
 Checks if the string str contains the string sv. More...
 
bool contains (std::string_view str, char c) noexcept
 Checks if the string str contains the character c. More...
 
std::string_view trim_left (std::string_view str) noexcept
 Returns a new std::string_view equal to str where all leading whitespaces are removed. More...
 
std::string_view trim_right (std::string_view str) noexcept
 Returns a new std::string_view equal to str where all trailing whitespaces are removed. More...
 
std::string_view trim (std::string_view str) noexcept
 Returns a new std::string_view equal to str where all leading and trailing whitespaces are removed. More...
 
std::string & replace_all (std::string &str, std::string_view what, std::string_view with)
 Replaces all occurrences of what with with in the string str. More...
 
std::string & to_lower_case (std::string &str)
 Convert the string str to its all lower case representation. More...
 
std::string as_lower_case (std::string_view str)
 Return a new string with the same content as str but all lower case. More...
 
std::string & to_upper_case (std::string &str)
 Convert the string str to its all upper case representation. More...
 
std::string as_upper_case (std::string_view str)
 Return a new string with the same content as str but all upper case. More...
 
std::vector< std::string_view > split (std::string_view str, char delim=' ')
 Split the string str at the positions with delimiter delim and return the sub-strings. More...
 
void unreachable ()
 Invokes undefined behavior. Used to mark code paths that may never be reachable. More...
 
template<std::size_t I, typename... Types>
constexpr decltype(auto) get (Types &&...args) noexcept
 Get the I-th element of the parameter pack args at compile-time. More...
 
template<typename Enum >
constexpr std::underlying_type_t< Enum > to_underlying (const Enum e) noexcept
 Converts an enumeration to its underlying type. More...
 
template<typename Enum >
constexpr std::underlying_type_t< Enum > to_underlying (const default_value< Enum > &e) noexcept
 Converts an enumeration wrapped in a plssvm::default_value to its underlying type. More...
 
template<typename Container , typename Pred , PLSSVM_REQUIRES(is_container_v< Container >) >
Container::size_type erase_if (Container &c, Pred pred)
 Implements an erase_if function for different containers according to https://en.cppreference.com/w/cpp/container/map/erase_if. More...
 
template<typename Container , typename T , PLSSVM_REQUIRES(is_container_v< Container >) >
bool contains (const Container &c, const T &val)
 Check whether the Container c contains the value val. More...
 
std::string current_date_time ()
 Return the current date time in the format "YYYY-MM-DD hh:mm:ss". More...
 
template<typename ExpectedType , typename IgorParser , typename NamedArgType >
ExpectedType get_value_from_named_parameter (const IgorParser &parser, const NamedArgType &named_arg)
 Parse the value hold be named_arg and return it converted to the ExpectedType. More...
 
template<typename T >
constexpr bool operator== (const parameter< T > &lhs, const parameter< T > &rhs) noexcept
 Compares the two parameter sets lhs and rhs for equality. More...
 
template<typename T >
constexpr bool operator!= (const parameter< T > &lhs, const parameter< T > &rhs) noexcept
 Compares the two parameter sets lhs and rhs for inequality. More...
 
template<typename T >
constexpr bool equivalent (const parameter< T > &lhs, const parameter< T > &rhs) noexcept
 Checks whether the two parameter sets lhs and rhs are equivalent. More...
 
template<typename T >
std::ostream & operator<< (std::ostream &out, const parameter< T > &params)
 Output all parameters encapsulated by params to the given output-stream out. More...
 

Variables

template<typename T >
constexpr bool is_tracking_entry_v = is_tracking_entry<T>::value
 
std::shared_ptr< performance_trackerglobal_tracker
 The global performance tracker instance used for the default tracking.
 
template<typename T , typename Tuple >
constexpr bool type_list_contains_v = type_list_contains<T, Tuple>::value
 Checks whether the type T is present in the Tuple.
 
template<typename >
constexpr bool always_false_v = false
 Type-dependent expression that always evaluates to false.
 
template<typename T >
constexpr bool is_array_v = is_array<T>::value
 Type trait to check whether T is a std::array.
 
template<typename T >
constexpr bool is_vector_v = is_vector<T>::value
 Type trait to check whether T is a std::vector.
 
template<typename T >
constexpr bool is_deque_v = is_deque<T>::value
 Type trait to check whether T is a std::deque.
 
template<typename T >
constexpr bool is_forward_list_v = is_forward_list<T>::value
 Type trait to check whether T is a std::forward_list.
 
template<typename T >
constexpr bool is_list_v = is_list<T>::value
 Type trait to check whether T is a std::list.
 
template<typename T >
constexpr bool is_sequence_container_v = is_array_v<T> || is_vector_v<T> || is_deque_v<T> || is_forward_list_v<T> || is_list_v<T>
 Type trait to check whether T is a sequence container.
 
template<typename T >
constexpr bool is_set_v = is_set<T>::value
 Type trait to check whether T is a std::set.
 
template<typename T >
constexpr bool is_map_v = is_map<T>::value
 Type trait to check whether T is a std::map.
 
template<typename T >
constexpr bool is_multiset_v = is_multiset<T>::value
 Type trait to check whether T is a std::multiset.
 
template<typename T >
constexpr bool is_multimap_v = is_multimap<T>::value
 Type trait to check whether T is a std::multimap.
 
template<typename T >
constexpr bool is_associative_container_v = is_set_v<T> || is_map_v<T> || is_multimap_v<T> || is_multiset_v<T>
 Type trait to check whether T is a associative container.
 
template<typename T >
constexpr bool is_unordered_set_v = is_unordered_set<T>::value
 Type trait to check whether T is a std::unordered_set.
 
template<typename T >
constexpr bool is_unordered_map_v = is_unordered_map<T>::value
 Type trait to check whether T is a std::unordered_map.
 
template<typename T >
constexpr bool is_unordered_multiset_v = is_unordered_multiset<T>::value
 Type trait to check whether T is a std::unordered_multiset.
 
template<typename T >
constexpr bool is_unordered_multimap_v = is_unordered_multimap<T>::value
 Type trait to check whether T is a std::unordered_multimap.
 
template<typename T >
constexpr bool is_unordered_associative_container_v = is_unordered_set_v<T> || is_unordered_map_v<T> || is_unordered_multimap_v<T> || is_unordered_multiset_v<T>
 Type trait to check whether T is a unordered associative container.
 
template<typename T >
constexpr bool is_container_v = is_sequence_container_v<T> || is_associative_container_v<T> || is_unordered_associative_container_v<T>
 Type trait to check whether T is a container.
 
template<typename... Args>
constexpr bool has_only_named_args_v = !igor::has_unnamed_arguments<Args...>()
 Trait to check whether Args only contains named-parameter.
 
template<typename... Args>
constexpr bool has_only_parameter_named_args_v = !igor::has_other_than<Args...>(plssvm::kernel_type, plssvm::gamma, plssvm::degree, plssvm::coef0, plssvm::cost)
 Trait to check whether Args only contains named-parameter that can be used to initialize a plssvm::parameter struct.
 
template<typename... Args>
constexpr bool has_only_sycl_parameter_named_args_v = !igor::has_other_than<Args...>(plssvm::kernel_type, plssvm::gamma, plssvm::degree, plssvm::coef0, plssvm::cost, plssvm::sycl_implementation_type, plssvm::sycl_kernel_invocation_type)
 Trait to check whether Args only contains named-parameter that can be used to initialize a plssvm::parameter struct including SYCL specific named-parameters.
 

Detailed Description

Namespace containing implementation details. Should not directly be used by users.

Typedef Documentation

◆ remove_cvref_t

template<typename T >
using plssvm::detail::remove_cvref_t = typedef std::remove_cv_t<std::remove_reference_t<T> >

Remove the topmost reference- and cv-qualifiers.

For more information see std::remove_cvref_t.

Enumeration Type Documentation

◆ layout_type

Enum class for all available layout types.

Enumerator
aos 

Array-of-Structs (AoS)

soa 

Structs-of-Arrays (SoA)

Function Documentation

◆ make_csvm_default_impl()

template<typename csvm_type , typename... Args>
std::unique_ptr<csvm> plssvm::detail::make_csvm_default_impl ( [[maybe_unused] ] Args &&...  args)
inline

Construct a C-SVM using the parameters args.

The default case, no special parameters for the C-SVMs are necessary.

Template Parameters
csvm_typethe type of the C-SVM
Argsthe types of the parameters to initialize the C-SVM
Parameters
[in]argsthe parameters used to initialize the C-SVM
Exceptions
plssvm::unsupported_backend_exceptionif the backend is not recognized
Returns
the C-SVM ([[nodiscard]])

◆ make_csvm_sycl_impl()

template<typename... Args>
std::unique_ptr<csvm> plssvm::detail::make_csvm_sycl_impl ( [[maybe_unused] ] Args &&...  args)
inline

Construct a SYCL C-SVM using the parameters args.

The special case for the SYCL backend to handle the SYCL specific parameters.

Template Parameters
Argsthe types of the parameters to initialize the SYCL C-SVM
Parameters
[in]argsthe parameters used to initialize the SYCL C-SVM
Exceptions
plssvm::unsupported_backend_exceptionif the backend is not recognized
Returns
the SYCL C-SVM ([[nodiscard]])

◆ make_csvm_impl()

template<typename... Args>
std::unique_ptr<csvm> plssvm::detail::make_csvm_impl ( const backend_type  backend,
Args &&...  args 
)
inline

Create a new C-SVM using the backend type and the additional parameter args.

Template Parameters
Argsthe types of the parameters to initialize the C-SVM
Parameters
[in]backendthe backend to use
[in]argsthe parameters used to initialize the respective C-SVM
Exceptions
plssvm::unsupported_backend_exceptionif the backend is not recognized
Returns
the C-SVM ([[nodiscard]])

◆ arithmetic_type_name()

template<typename T >
constexpr std::string_view plssvm::detail::arithmetic_type_name ( )
inlineconstexprdelete

Tries to convert the given type to its name as string representation including possible const and/or volatile qualifiers.

The definition is marked as deleted if T isn't an arithmetic type.

Template Parameters
Tthe type to convert to a string
Returns
the name of T ([[nodiscard]])

◆ check_assertion()

template<typename... Args>
void plssvm::detail::check_assertion ( const bool  cond,
const std::string_view  cond_str,
const source_location loc,
const std::string_view  msg,
Args &&...  args 
)
inline

Function called by the PLSSVM_ASSERT macro. Checks the assertion condition. If the condition evaluates to false, prints the assertion condition together with additional information (e.g., plssvm::source_location information) and aborts the program.

Template Parameters
Argsthe placeholder types
Parameters
[in]condthe assertion condition, aborts the program if evaluated to false
[in]cond_strthe assertion condition as string
[in]locthe source location where the assertion appeared
[in]msgthe custom assertion message
[in]argsthe placeholder values

◆ operator<<() [1/4]

std::ostream& plssvm::detail::operator<< ( std::ostream &  out,
const execution_range range 
)

Output the execution range to the given output-stream out.

Parameters
[in,out]outthe output-stream to write the execution range to
[in]rangethe execution range
Returns
the output-stream

◆ operator<<() [2/4]

std::ostream& plssvm::detail::operator<< ( std::ostream &  out,
layout_type  layout 
)

Output the layout to the given output-stream out.

Parameters
[in,out]outthe output-stream to write the layout type to
[in]layoutthe layout type
Returns
the output-stream

◆ operator>>()

std::istream& plssvm::detail::operator>> ( std::istream &  in,
layout_type layout 
)

Use the input-stream in to initialize the layout type.

Parameters
[in,out]ininput-stream to extract the layout type from
[in]layoutthe layout type
Returns
the input-stream

◆ transform_to_aos_layout()

template<typename real_type >
std::vector<real_type> plssvm::detail::transform_to_aos_layout ( const std::vector< std::vector< real_type >> &  matrix,
const std::size_t  boundary_size,
const std::size_t  num_points,
const std::size_t  num_features 
)
inline

Convert a 2D matrix into a 1D array in Array-of-Structs layout adding boundary_size values per data point for padding.

The 1D array is assembled data point wise. For more information see: https://www.wikiwand.com/en/AoS_and_SoA.

Template Parameters
real_typethe type of the values in the 2D matrix and the transformed 1D array
Parameters
[in]matrixthe 2D matrix to transform
[in]boundary_sizethe number of boundary elements to insert as padding
[in]num_pointsthe number of data points to transform
[in]num_featuresthe number of features per data point in the 2D matrix
Returns
the transformed 1D array in Array-of-Structs layout ([[nodiscard]])

◆ transform_to_soa_layout()

template<typename real_type >
std::vector<real_type> plssvm::detail::transform_to_soa_layout ( const std::vector< std::vector< real_type >> &  matrix,
const std::size_t  boundary_size,
const std::size_t  num_points,
const std::size_t  num_features 
)
inline

Convert a 2D matrix into a 1D array in Struct-of-Arrays layout adding boundary_size values per feature for padding.

The 1D array is assembled feature wise. For more information see: https://www.wikiwand.com/en/AoS_and_SoA.

Template Parameters
real_typethe type of the values in the 2D matrix and the transformed 1D array
Parameters
[in]matrixthe 2D matrix to transform
[in]boundary_sizethe number of boundary elements to insert as padding
[in]num_pointsthe number of data points to transform
[in]num_featuresthe number of features per data point in the 2D matrix
Returns
the transformed 1D array in Struct-of-Arrays layout ([[nodiscard]])

◆ transform_to_layout()

template<typename real_type >
std::vector<real_type> plssvm::detail::transform_to_layout ( const layout_type  layout,
const std::vector< std::vector< real_type >> &  matrix,
const std::size_t  boundary_size,
const std::size_t  num_points 
)
inline

Convert a 2D matrix into a 1D array in the layout adding boundary_size values per data point or feature respectively for padding.

For more information regarding AoS and SoA see: https://www.wikiwand.com/en/AoS_and_SoA.

Template Parameters
real_typethe type of the values in the 2D matrix and the transformed 1D array
Parameters
[in]layoutthe layout type to transform the 2D matrix to, either Array-of-Structs (AoS) or Struct-of-Arrays (SoA)
[in]matrixthe 2D matrix to transform
[in]boundary_sizethe number of boundary elements to insert as padding
[in]num_pointsthe number of data points to transform
Returns
the transformed 1D array in the specified layout ([[nodiscard]])

◆ log()

template<typename... Args>
void plssvm::detail::log ( const verbosity_level  verb,
const std::string_view  msg,
Args &&...  args 
)

@breif Output the message msg filling the {fmt} like placeholders with args to the standard output stream.

If a value in Args is of type plssvm::detail::tracking_entry and performance tracking is enabled, this is also added to the plssvm::detail::performance_tracker. Only logs the message if the verbosity level matches the plssvm::verbosity level.

Template Parameters
Argsthe types of the placeholder values
Parameters
[in]verbthe verbosity level of the message to log; must match the plssvm::verbosity level to log the message
[in]msgthe message to print on the standard output stream if requested (i.e., plssvm::verbose is true)
[in]argsthe values to fill the {fmt}-like placeholders in msg

◆ operator<<() [3/4]

template<typename T >
std::ostream& plssvm::detail::operator<< ( std::ostream &  out,
const tracking_entry< T > &  entry 
)

Output the tracking entry to the given output-stream out. Only the tracked value is output excluding the category and name.

Template Parameters
Tthe type of the value tracked in the tracking entry
Parameters
[in,out]outthe output-stream to write the tracking entry to
[in]entrythe tracking entry
Returns
the output-stream

◆ convert_to()

template<typename T , typename Exception = std::runtime_error, PLSSVM_REQUIRES((std::is_arithmetic_v< T >||std::is_same_v< remove_cvref_t< T >, std::string >)) >
T plssvm::detail::convert_to ( const std::string_view  str)
inline

Converts the string str to a value of type T.

If T is an integral type std::from_chars is used, if T is a floating point type float_fast::from_chars is used, if T is a std::string the normal std::string constructor is used, and if T is neither of the three, an exception is thrown.

Template Parameters
Tthe type to convert the value of str to, must be an arithmetic type or a std::string
Exceptionthe exception type to throw in case that str can't be converted to a value of T (default: std::runtime_error).
Parameters
[in]strthe string to convert
Exceptions
Exceptionif str can't be converted to a value of type T
Returns
the value of type T denoted by str ([[nodiscard]])

◆ extract_first_integer_from_string()

template<typename T >
T plssvm::detail::extract_first_integer_from_string ( std::string_view  str)
inline

Extract the first integer from the given string str and converts it to T ignoring a potential sign.

Template Parameters
Tthe type to convert the first integer to
Parameters
[in]strthe string to check
Exceptions
std::runtime_errorif str doesn't contain an integer
Returns
the converted first integer of type T ([[nodiscard]])

◆ split_as()

template<typename T >
std::vector<T> plssvm::detail::split_as ( const std::string_view  str,
const char  delim = ' ' 
)
inline

Split the string str at the positions with delimiter delim and return the sub-strings converted to the type T.

Template Parameters
Tthe type to convert the value of str to, must be an arithmetic type or a std::string
Parameters
[in]strthe string to split
[in]delimthe split delimiter
Returns
the split sub-strings converted to the type T ([[nodiscard]])

◆ starts_with() [1/2]

bool plssvm::detail::starts_with ( std::string_view  str,
std::string_view  sv 
)
noexcept

Checks if the string str starts with the prefix sv.

Parameters
[in]strthe string to check
[in]svthe string to match against the start of str
Returns
true if str starts with the string sv, otherwise false ([[nodiscard]])

◆ starts_with() [2/2]

bool plssvm::detail::starts_with ( std::string_view  str,
char  c 
)
noexcept

Checks if the string str starts with the character c.

Parameters
[in]strthe string to check
[in]cthe character to match against the first character of str
Returns
true if str starts with the character c, otherwise false ([[nodiscard]])

◆ ends_with() [1/2]

bool plssvm::detail::ends_with ( std::string_view  str,
std::string_view  sv 
)
noexcept

Checks if the string str ends with the suffix sv.

Parameters
[in]strthe string to check
[in]svthe string to match against the end of str
Returns
true if str ends with the string sv, otherwise false ([[nodiscard]])

◆ ends_with() [2/2]

bool plssvm::detail::ends_with ( std::string_view  str,
char  c 
)
noexcept

Checks if the string str ends with the character c.

Parameters
[in]strthe string to check
[in]cthe character to match against the last character of str
Returns
true if str ends with the character c, otherwise false ([[nodiscard]])

◆ contains() [1/3]

bool plssvm::detail::contains ( std::string_view  str,
std::string_view  sv 
)
noexcept

Checks if the string str contains the string sv.

Parameters
[in]strthe string to check
[in]svthe string to find
Returns
true if str contains the string sv, otherwise false ([[nodiscard]])

◆ contains() [2/3]

bool plssvm::detail::contains ( std::string_view  str,
char  c 
)
noexcept

Checks if the string str contains the character c.

Parameters
[in]strthe string to check
[in]cthe character to find
Returns
true if str contains the character c, otherwise false ([[nodiscard]])

◆ trim_left()

std::string_view plssvm::detail::trim_left ( std::string_view  str)
noexcept

Returns a new std::string_view equal to str where all leading whitespaces are removed.

Parameters
[in]strthe string to remove the leading whitespaces
Returns
the string str without leading whitespace ([[nodiscard]])

◆ trim_right()

std::string_view plssvm::detail::trim_right ( std::string_view  str)
noexcept

Returns a new std::string_view equal to str where all trailing whitespaces are removed.

Parameters
[in]strthe string to remove the trailing whitespaces
Returns
the string str without trailing whitespace ([[nodiscard]])

◆ trim()

std::string_view plssvm::detail::trim ( std::string_view  str)
noexcept

Returns a new std::string_view equal to str where all leading and trailing whitespaces are removed.

Parameters
[in]strthe string to remove the leading and trailing whitespaces
Returns
the string str without leading and trailing whitespace ([[nodiscard]])

◆ replace_all()

std::string& plssvm::detail::replace_all ( std::string &  str,
std::string_view  what,
std::string_view  with 
)

Replaces all occurrences of what with with in the string str.

Parameters
[in,out]strthe string to replace the values
[in]whatthe string to replace
[in]withthe string to replace with
Returns
the replaced string

◆ to_lower_case()

std::string& plssvm::detail::to_lower_case ( std::string &  str)

Convert the string str to its all lower case representation.

Parameters
[in,out]strthe string to transform
Returns
the transformed string

◆ as_lower_case()

std::string plssvm::detail::as_lower_case ( std::string_view  str)

Return a new string with the same content as str but all lower case.

In contrast to to_lower_case(std::string&) this function does not change the input string str.

Parameters
[in]strthe string to use in the transformation
Returns
the transformed string ([[nodiscard]])

◆ to_upper_case()

std::string& plssvm::detail::to_upper_case ( std::string &  str)

Convert the string str to its all upper case representation.

Parameters
[in,out]strthe string to transform
Returns
the transformed string

◆ as_upper_case()

std::string plssvm::detail::as_upper_case ( std::string_view  str)

Return a new string with the same content as str but all upper case.

In contrast to to_upper_case(std::string&) this function does not change the input string str.

Parameters
[in]strthe string to use in the transformation
Returns
the transformed string ([[nodiscard]])

◆ split()

std::vector<std::string_view> plssvm::detail::split ( std::string_view  str,
char  delim = ' ' 
)

Split the string str at the positions with delimiter delim and return the sub-strings.

Parameters
[in]strthe string to split
[in]delimthe split delimiter
Returns
the split sub-strings ([[nodiscard]])

◆ unreachable()

void plssvm::detail::unreachable ( )
inline

Invokes undefined behavior. Used to mark code paths that may never be reachable.

See: C++23 std::unreachable

◆ get()

template<std::size_t I, typename... Types>
constexpr decltype(auto) plssvm::detail::get ( Types &&...  args)
constexprnoexcept

Get the I-th element of the parameter pack args at compile-time.

Template Parameters
Ithe index of the element to get
Typesthe types inside the parameter pack
Parameters
[in]argsthe values of the parameter pack
Returns
the I-th element of args ([[nodiscard]])

◆ to_underlying() [1/2]

template<typename Enum >
constexpr std::underlying_type_t<Enum> plssvm::detail::to_underlying ( const Enum  e)
constexprnoexcept

Converts an enumeration to its underlying type.

Template Parameters
Enumthe enumeration type
Parameters
[in]eenumeration value to convert
Returns
the integer value of the underlying type of Enum, converted from e ([[nodiscard]])

◆ to_underlying() [2/2]

template<typename Enum >
constexpr std::underlying_type_t<Enum> plssvm::detail::to_underlying ( const default_value< Enum > &  e)
constexprnoexcept

Converts an enumeration wrapped in a plssvm::default_value to its underlying type.

Template Parameters
Enumthe enumeration type
Parameters
[in]eenumeration value to convert wrapped in a plssvm::default_value
Returns
the integer value of the underlying type of Enum, converted from e ([[nodiscard]])

◆ erase_if()

template<typename Container , typename Pred , PLSSVM_REQUIRES(is_container_v< Container >) >
Container::size_type plssvm::detail::erase_if ( Container &  c,
Pred  pred 
)
inline

Implements an erase_if function for different containers according to https://en.cppreference.com/w/cpp/container/map/erase_if.

Template Parameters
Containerthe container type
Predthe type of the unary-predicate
Parameters
[in,out]cthe container to erase the elements that match the predicate pred from
[in]predthe predicate the to be erased elements must match
Returns
the number of erased elements

◆ contains() [3/3]

template<typename Container , typename T , PLSSVM_REQUIRES(is_container_v< Container >) >
bool plssvm::detail::contains ( const Container &  c,
const T &  val 
)
inline

Check whether the Container c contains the value val.

Template Parameters
Containerthe container type
Tthe type of the value to check
Parameters
[in]cthe container to check if it contains the value val
[in]valthe value to check
Returns
true if the val exists in the container c, otherwise false ([[nodiscard]])

◆ current_date_time()

std::string plssvm::detail::current_date_time ( )

Return the current date time in the format "YYYY-MM-DD hh:mm:ss".

Returns
the current date time ([[nodiscard]])

◆ get_value_from_named_parameter()

template<typename ExpectedType , typename IgorParser , typename NamedArgType >
ExpectedType plssvm::detail::get_value_from_named_parameter ( const IgorParser &  parser,
const NamedArgType &  named_arg 
)

Parse the value hold be named_arg and return it converted to the ExpectedType.

Template Parameters
ExpectedTypethe type the value of the named argument should be converted to
IgorParserthe type of the named-parameter parser
NamedArgTypethe type of the named-parameter (necessary since they are struct tags)
Parameters
[in]parserthe named-parameter parser
[in]named_argthe named-parameter argument
Returns
the value of named_arg converted to ExpectedType ([[nodiscard]])

◆ operator==()

template<typename T >
constexpr bool plssvm::detail::operator== ( const parameter< T > &  lhs,
const parameter< T > &  rhs 
)
constexprnoexcept

Compares the two parameter sets lhs and rhs for equality.

Two parameter sets are equal if and only if all SVM parameters are equal.

Template Parameters
Tthe real_type
Parameters
[in]lhsthe first parameter set
[in]rhsthe second parameter set
Returns
true if both parameter sets are equal, false otherwise ([[nodiscard]])

◆ operator!=()

template<typename T >
constexpr bool plssvm::detail::operator!= ( const parameter< T > &  lhs,
const parameter< T > &  rhs 
)
constexprnoexcept

Compares the two parameter sets lhs and rhs for inequality.

Two parameter sets are unequal if any of the SVM parameters are unequal.

Template Parameters
Tthe real_type
Parameters
[in]lhsthe first parameter set
[in]rhsthe second parameter set
Returns
true if both parameter sets are unequal, false otherwise ([[nodiscard]])

◆ equivalent()

template<typename T >
constexpr bool plssvm::detail::equivalent ( const parameter< T > &  lhs,
const parameter< T > &  rhs 
)
constexprnoexcept

Checks whether the two parameter sets lhs and rhs are equivalent.

Compares the member variables based on the kernel, i.e., for example for the rbf kernel both parameter sets must only have the same gamma and cost values but may differ in the values of degree or coef0. If all members should be compared regardless of the kernel type, one can use the operator== overload.

Parameters
[in]lhsthe first parameter set
[in]rhsthe second parameter set
Returns
true if both parameter sets are equivalent, false otherwise ([[nodiscard]])

◆ operator<<() [4/4]

template<typename T >
std::ostream& plssvm::detail::operator<< ( std::ostream &  out,
const parameter< T > &  params 
)

Output all parameters encapsulated by params to the given output-stream out.

Template Parameters
Tthe type of the data
Parameters
[in,out]outthe output-stream to write the parameters to
[in]paramsthe parameter set
Returns
the output-stream

Variable Documentation

◆ is_tracking_entry_v

template<typename T >
constexpr bool plssvm::detail::is_tracking_entry_v = is_tracking_entry<T>::value
constexpr

A shorthand for plssvm::is_tracking_entry::value.