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 Namespace Reference

The main namespace containing all public API functions. More...

Namespaces

 cuda
 Namespace containing the C-SVM using the CUDA backend.
 
 detail
 Namespace containing implementation details. Should not directly be used by users.
 
 dpcpp
 Namespace containing the C-SVM using the SYCL backend with DPC++ as SYCL implementation.
 
 hip
 Namespace containing the C-SVM using the HIP backend.
 
 hipsycl
 Namespace containing the C-SVM using the SYCL backend with hipSYCL as SYCL implementation.
 
 opencl
 Namespace containing the C-SVM using the OpenCL backend.
 
 openmp
 Namespace containing the C-SVM using the OpenMP backend.
 
 operators
 Namespace containing operator overloads for std::vector and other mathematical functions on vectors.
 
 sycl
 Namespace containing the C-SVM using the SYCL backend with the preferred SYCL implementation.
 
 version
 Namespace containing versioning information.
 

Classes

struct  csvm_to_backend_type
 Get the plssvm::backend_type of the C-SVM class of type T. Ignores all top-level const, volatile, and reference qualifiers. More...
 
class  csvm
 Base class for all C-SVM backends. More...
 
struct  csvm_backend_exists
 Sets the value of the value member to true if T is a C-SVM using an available backend. Ignores any top-level const, volatile, and reference qualifiers. More...
 
class  data_set
 Encapsulate all necessary data that is needed for training or predicting using an SVM. More...
 
struct  default_init
 This class denotes an explicit default value initialization used to distinguish between the default value or user provided initialization in the default_value class. More...
 
class  default_value
 This class encapsulates a value that may be a default value or not. More...
 
struct  is_default_value
 Test whether the given type T is of type plssvm::default_value ignoring all top-level const, volatile, and reference qualifiers. More...
 
class  exception
 Base class for all custom exception types. Forwards its message to std::runtime_error and saves the exception name and the call side source location information. More...
 
class  invalid_parameter_exception
 Exception type thrown if the provided parameter is invalid. More...
 
class  file_reader_exception
 Exception type thrown if the file_reader is used inappropriately (e.g., if two files should be opened at the same time). More...
 
class  data_set_exception
 Exception type thrown if a data_set is used inappropriately. More...
 
class  file_not_found_exception
 Exception type thrown if the provided file couldn't be found. More...
 
class  invalid_file_format_exception
 Exception type thrown if the provided file has an invalid format for the selected parser (e.g. if the arff parser tries to parse a LIBSVM file). More...
 
class  unsupported_backend_exception
 Exception type thrown if the requested backend is not supported on the target machine. More...
 
class  unsupported_kernel_type_exception
 Exception type thrown if the requested kernel type is not supported. More...
 
class  gpu_device_ptr_exception
 Exception type thrown if an error in the generic plssvm::detail::gpu_device_ptr occurred. More...
 
class  source_location
 The plssvm::source_location class represents certain information about the source code, such as file names, line numbers, or function names. More...
 
class  model
 Implements a class encapsulating the result of a call to the SVM fit function. A model is used to predict the labels of a new data set. More...
 

Typedefs

using kernel_index_type = int
 Integer type used inside kernels.
 
template<typename T >
using optional_ref = std::optional< std::reference_wrapper< T > >
 Type alias for an optional reference (since std::optional<T&> is not allowed). More...
 
using parameter = detail::parameter< double >
 The public parameter type uses double to store the SVM parameters.
 

Enumerations

enum class  backend_type {
  automatic , openmp , cuda , hip ,
  opencl , sycl
}
 Enum class for all possible backend types. More...
 
enum class  verbosity_level { quiet = 0b000 , libsvm = 0b001 , timing = 0b010 , full = 0b100 }
 Enum class for all possible verbosity levels. More...
 
enum class  file_format_type { libsvm , arff }
 Enum class for all supported file types. More...
 
enum class  kernel_function_type { linear = 0 , polynomial = 1 , rbf = 2 }
 Enum class for all implemented kernel functions. More...
 
enum class  target_platform {
  automatic , cpu , gpu_nvidia , gpu_amd ,
  gpu_intel
}
 Enum class for all possible targets. More...
 

Functions

std::vector< backend_typelist_available_backends ()
 Return a list of all currently available backends. More...
 
backend_type determine_default_backend (const std::vector< backend_type > &available_backends=list_available_backends(), const std::vector< target_platform > &available_target_platforms=list_available_target_platforms())
 Returns the default backend (if plssvm::backend_type::automatic is used) given the backend and target platform lists. More...
 
std::ostream & operator<< (std::ostream &out, backend_type backend)
 Output the backend to the given output-stream out. More...
 
std::istream & operator>> (std::istream &in, backend_type &backend)
 Use the input-stream in to initialize the backend type. More...
 
template<typename... Args>
std::unique_ptr< csvmmake_csvm (const backend_type backend, Args &&...args)
 Create a new C-SVM using the backend type and additional parameter args. More...
 
template<typename... Args>
std::unique_ptr< csvmmake_csvm (Args &&...args)
 Create a new C-SVM using the automatic backend type and the additional parameter args. More...
 
template<typename T >
std::ostream & operator<< (std::ostream &out, const default_value< T > &val)
 Output the wrapped value of val to the given output-stream out. More...
 
template<typename T >
std::istream & operator>> (std::istream &in, default_value< T > &val)
 Use the input-stream in to initialize the default_value val. More...
 
template<typename T >
constexpr void swap (default_value< T > &lhs, default_value< T > &rhs) noexcept(noexcept(lhs.swap(rhs)))
 Swap the content of two default_values lhs and rhs. More...
 
template<typename T >
constexpr bool operator== (const default_value< T > &lhs, const default_value< T > &rhs) noexcept
 Compares the two active values lhs and rhs for equality. More...
 
template<typename T >
constexpr bool operator== (const default_value< T > &lhs, const T &rhs) noexcept
 Compares the two active values lhs and rhs for equality. More...
 
template<typename T >
constexpr bool operator== (const T &lhs, const default_value< T > &rhs) noexcept
 Compares the two active values lhs and rhs for equality. More...
 
template<typename T >
constexpr bool operator!= (const default_value< T > &lhs, const default_value< T > &rhs) noexcept
 Compares the two active values lhs and rhs for inequality. More...
 
template<typename T >
constexpr bool operator!= (const default_value< T > &lhs, const T &rhs) noexcept
 Compares the two active values lhs and rhs for inequality. More...
 
template<typename T >
constexpr bool operator!= (const T &lhs, const default_value< T > &rhs) noexcept
 Compares the two active values lhs and rhs for inequality. More...
 
template<typename T >
constexpr bool operator< (const default_value< T > &lhs, const default_value< T > &rhs) noexcept
 Compares the two active values: lhs < rhs. More...
 
template<typename T >
constexpr bool operator< (const default_value< T > &lhs, const T &rhs) noexcept
 Compares the two active values: lhs < rhs. More...
 
template<typename T >
constexpr bool operator< (const T &lhs, const default_value< T > &rhs) noexcept
 Compares the two active values: lhs < rhs. More...
 
template<typename T >
constexpr bool operator> (const default_value< T > &lhs, const default_value< T > &rhs) noexcept
 Compares the two active values: lhs > rhs. More...
 
template<typename T >
constexpr bool operator> (const default_value< T > &lhs, const T &rhs) noexcept
 Compares the two active values: lhs > rhs. More...
 
template<typename T >
constexpr bool operator> (const T &lhs, const default_value< T > &rhs) noexcept
 Compares the two active values: lhs > rhs. More...
 
template<typename T >
constexpr bool operator<= (const default_value< T > &lhs, const default_value< T > &rhs) noexcept
 Compares the two active values: lhs <= rhs. More...
 
template<typename T >
constexpr bool operator<= (const default_value< T > &lhs, const T &rhs) noexcept
 Compares the two active values: lhs <= rhs. More...
 
template<typename T >
constexpr bool operator<= (const T &lhs, const default_value< T > &rhs) noexcept
 Compares the two active values: lhs <= rhs. More...
 
template<typename T >
constexpr bool operator>= (const default_value< T > &lhs, const default_value< T > &rhs) noexcept
 Compares the two active values: lhs >= rhs. More...
 
template<typename T >
constexpr bool operator>= (const default_value< T > &lhs, const T &rhs) noexcept
 Compares the two active values: lhs >= rhs. More...
 
template<typename T >
constexpr bool operator>= (const T &lhs, const default_value< T > &rhs) noexcept
 Compares the two active values: lhs >= rhs. More...
 
std::ostream & operator<< (std::ostream &out, verbosity_level verb)
 Output the verb to the given output-stream out. More...
 
std::istream & operator>> (std::istream &in, verbosity_level &verb)
 Use the input-stream in to initialize the verb level. More...
 
verbosity_level operator| (verbosity_level lhs, verbosity_level rhs)
 Bitwise-or to set multiple verbosity levels at once for a logging message. More...
 
verbosity_level operator|= (verbosity_level &lhs, verbosity_level rhs)
 Bitwise-or to set multiple verbosity levels at once for a logging message. More...
 
verbosity_level operator& (verbosity_level lhs, verbosity_level rhs)
 Bitwise-and to check verbosity levels for a logging message. More...
 
verbosity_level operator&= (verbosity_level &lhs, verbosity_level rhs)
 Bitwise-and to check verbosity levels for a logging message. More...
 
std::ostream & operator<< (std::ostream &out, file_format_type format)
 Output the format to the given output-stream out. More...
 
std::istream & operator>> (std::istream &in, file_format_type &format)
 Use the input-stream in to initialize the format type. More...
 
std::ostream & operator<< (std::ostream &out, kernel_function_type kernel)
 Output the kernel type to the given output-stream out. More...
 
std::string_view kernel_function_type_to_math_string (kernel_function_type kernel) noexcept
 Return the mathematical representation of the kernel_type kernel. More...
 
std::istream & operator>> (std::istream &in, kernel_function_type &kernel)
 Use the input-stream in to initialize the kernel type. More...
 
template<kernel_function_type kernel, typename real_type , typename... Args>
real_type kernel_function (const std::vector< real_type > &xi, const std::vector< real_type > &xj, Args &&...args)
 Computes the value of the two vectors xi and xj using the kernel function determined at compile-time. More...
 
template<typename real_type >
real_type kernel_function (const std::vector< real_type > &xi, const std::vector< real_type > &xj, const detail::parameter< real_type > &params)
 Computes the value of the two vectors xi and xj using the kernel function and kernel parameter stored in params. More...
 
constexpr bool equivalent (const parameter &lhs, const parameter &rhs) noexcept
 Checks whether the two parameter sets lhs and rhs are equivalent. More...
 
std::vector< target_platformlist_available_target_platforms ()
 Return a list of all currently available target platforms. More...
 
target_platform determine_default_target_platform (const std::vector< target_platform > &platform_device_list=list_available_target_platforms())
 Return the default target platform given the available devices in platform_device_list. More...
 
std::ostream & operator<< (std::ostream &out, target_platform target)
 Output the target platform to the given output-stream out. More...
 
std::istream & operator>> (std::istream &in, target_platform &target)
 Use the input-stream in to initialize the target platform. More...
 

Variables

template<typename T >
constexpr backend_type csvm_to_backend_type_v = csvm_to_backend_type<T>::value
 Get the plssvm::backend_type of the C-SVM class of type T. Ignores all top-level const, volatile, and reference qualifiers. More...
 
constexpr kernel_index_type THREAD_BLOCK_SIZE = 16
 Global compile-time constant used for internal caching. May be changed during the CMake configuration step.
 
constexpr kernel_index_type INTERNAL_BLOCK_SIZE = 6
 Global compile-time constant used for internal caching. May be changed during the CMake configuration step.
 
constexpr kernel_index_type OPENMP_BLOCK_SIZE = 64
 Global compile-time constant used for internal caching in the OpenMP kernel. May be changed during the CMake configuration step.
 
template<typename T >
constexpr bool csvm_backend_exists_v = csvm_backend_exists<T>::value
 Sets the value of the value member to true if T is a C-SVM using an available backend. Ignores any top-level const, volatile, and reference qualifiers.
 
template<typename T >
constexpr bool is_default_value_v = is_default_value<T>::value
 Test whether the given type T is of type plssvm::default_value ignoring all top-level const, volatile, and reference qualifiers.
 
verbosity_level verbosity
 The verbosity level used in the logging function. My be changed by the user.
 

Detailed Description

The main namespace containing all public API functions.

Typedef Documentation

◆ optional_ref

template<typename T >
using plssvm::optional_ref = typedef std::optional<std::reference_wrapper<T> >

Type alias for an optional reference (since std::optional<T&> is not allowed).

Template Parameters
Tthe type to wrap as a reference

Enumeration Type Documentation

◆ backend_type

enum plssvm::backend_type
strong

Enum class for all possible backend types.

Note
All different SYCL implementations have the same backend type "sycl".
Enumerator
automatic 

The default backend. Depends on the specified target platform.

openmp 

OpenMP to target CPUs only (currently no OpenMP target offloading support).

cuda 

CUDA to target NVIDIA GPUs only.

hip 

HIP to target AMD and NVIDIA GPUs.

opencl 

OpenCL to target CPUs and GPUs from different vendors.

sycl 

SYCL to target CPUs and GPUs from different vendors. Currently tested SYCL implementations are DPC++ and hipSYCL.

◆ verbosity_level

Enum class for all possible verbosity levels.

Enumerator
quiet 

Nothing is logged to the standard output.

libsvm 

Log the same messages as LIBSVM (used for better LIBSVM conformity).

timing 

Log all messages related to timing information.

full 

Log all messages.

◆ file_format_type

Enum class for all supported file types.

Enumerator
libsvm 

The LIBSVM file format. Used as default. For the file format specification see: https://www.csie.ntu.edu.tw/~cjlin/libsvm/faq.html

arff 

The ARFF file format. For the file format specification see: https://www.cs.waikato.ac.nz/~ml/weka/arff.html

◆ kernel_function_type

Enum class for all implemented kernel functions.

Enumerator
linear 

Linear kernel function: \(\vec{u}^T \cdot \vec{v}\).

polynomial 

Polynomial kernel function: \((gamma \cdot \vec{u}^T \cdot \vec{v} + coef0)^{degree}\).

rbf 

Radial basis function: \(e^{(-gamma \cdot |\vec{u} - \vec{v}|^2)}\).

◆ target_platform

Enum class for all possible targets.

Enumerator
automatic 

The default target with respect to the used backend type. Checks for available devices in the following order: NVIDIA GPUs -> AMD GPUs -> Intel GPUs -> CPUs.

cpu 

Target CPUs only (Intel, AMD, IBM, ...).

gpu_nvidia 

Target GPUs from NVIDIA.

gpu_amd 

Target GPUs from AMD.

gpu_intel 

Target GPUs from Intel.

Function Documentation

◆ list_available_backends()

std::vector<backend_type> plssvm::list_available_backends ( )

Return a list of all currently available backends.

Only backends that where found during the CMake configuration are available.

Returns
a list of the available backends ([[nodiscard]])

◆ determine_default_backend()

backend_type plssvm::determine_default_backend ( const std::vector< backend_type > &  available_backends = list_available_backends(),
const std::vector< target_platform > &  available_target_platforms = list_available_target_platforms() 
)

Returns the default backend (if plssvm::backend_type::automatic is used) given the backend and target platform lists.

Parameters
[in]available_backendslist of backends; if no backends are provided, queries all available backends
[in]available_target_platformslist of target platforms; if no target platforms are provided, queries all available target platforms
Returns
the default backend given the backend and target platform lists ([[nodiscard]])

◆ operator<<() [1/6]

std::ostream& plssvm::operator<< ( std::ostream &  out,
backend_type  backend 
)

Output the backend to the given output-stream out.

Parameters
[in,out]outthe output-stream to write the backend type to
[in]backendthe backend type
Returns
the output-stream

◆ operator>>() [1/6]

std::istream& plssvm::operator>> ( std::istream &  in,
backend_type backend 
)

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

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

◆ make_csvm() [1/2]

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

Create a new C-SVM using the backend type and 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]])
Examples
csvm_examples.cpp, csvm_factory_examples.cpp, and model_examples.cpp.

◆ make_csvm() [2/2]

template<typename... Args>
std::unique_ptr<csvm> plssvm::make_csvm ( Args &&...  args)
inline

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

Template Parameters
Argsthe types of the parameters to initialize the C-SVM
Parameters
[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]])

◆ operator<<() [2/6]

template<typename T >
std::ostream& plssvm::operator<< ( std::ostream &  out,
const default_value< T > &  val 
)
inline

Output the wrapped value of val to the given output-stream out.

Template Parameters
Tthe type of the wrapped value
Parameters
[in,out]outthe output-stream to write the wrapped default_value value to
[in]valthe default_value
Returns
the output-stream

◆ operator>>() [2/6]

template<typename T >
std::istream& plssvm::operator>> ( std::istream &  in,
default_value< T > &  val 
)
inline

Use the input-stream in to initialize the default_value val.

Sets the user defined value, i.e., plssvm::default_value::is_default() will return false and the default value will not be used.

Template Parameters
Tthe type of the wrapped value
Parameters
[in,out]ininput-stream to extract the wrapped default_value value from
[in]valthe default_value
Returns
the input-stream

◆ swap()

template<typename T >
constexpr void plssvm::swap ( default_value< T > &  lhs,
default_value< T > &  rhs 
)
constexprnoexcept

Swap the content of two default_values lhs and rhs.

Parameters
[in,out]lhsthe first default_value
[in,out]rhsthe second default_value

◆ operator==() [1/3]

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

Compares the two active values lhs and rhs for equality.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values are equal, false otherwise ([[nodiscard]])

◆ operator==() [2/3]

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

Compares the two active values lhs and rhs for equality.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values are equal, false otherwise ([[nodiscard]])

◆ operator==() [3/3]

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

Compares the two active values lhs and rhs for equality.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values are equal, false otherwise ([[nodiscard]])

◆ operator!=() [1/3]

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

Compares the two active values lhs and rhs for inequality.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values are unequal, false otherwise ([[nodiscard]])

◆ operator!=() [2/3]

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

Compares the two active values lhs and rhs for inequality.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values are unequal, false otherwise ([[nodiscard]])

◆ operator!=() [3/3]

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

Compares the two active values lhs and rhs for inequality.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values are unequal, false otherwise ([[nodiscard]])

◆ operator<() [1/3]

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

Compares the two active values: lhs < rhs.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values of lhs is less than the active value of rhs, false otherwise ([[nodiscard]])

◆ operator<() [2/3]

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

Compares the two active values: lhs < rhs.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values of lhs is less than the active value of rhs, false otherwise ([[nodiscard]])

◆ operator<() [3/3]

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

Compares the two active values: lhs < rhs.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values of lhs is less than the active value of rhs, false otherwise ([[nodiscard]])

◆ operator>() [1/3]

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

Compares the two active values: lhs > rhs.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values of lhs is greater than the active value of rhs, false otherwise ([[nodiscard]])

◆ operator>() [2/3]

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

Compares the two active values: lhs > rhs.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values of lhs is greater than the active value of rhs, false otherwise ([[nodiscard]])

◆ operator>() [3/3]

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

Compares the two active values: lhs > rhs.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values of lhs is greater than the active value of rhs, false otherwise ([[nodiscard]])

◆ operator<=() [1/3]

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

Compares the two active values: lhs <= rhs.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values of lhs is less or equal than the active value of rhs, false otherwise ([[nodiscard]])

◆ operator<=() [2/3]

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

Compares the two active values: lhs <= rhs.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values of lhs is less or equal than the active value of rhs, false otherwise ([[nodiscard]])

◆ operator<=() [3/3]

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

Compares the two active values: lhs <= rhs.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values of lhs is less or equal than the active value of rhs, false otherwise ([[nodiscard]])

◆ operator>=() [1/3]

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

Compares the two active values: lhs >= rhs.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values of lhs is greater or equal than the active value of rhs, false otherwise ([[nodiscard]])

◆ operator>=() [2/3]

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

Compares the two active values: lhs >= rhs.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values of lhs is greater or equal than the active value of rhs, false otherwise ([[nodiscard]])

◆ operator>=() [3/3]

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

Compares the two active values: lhs >= rhs.

Template Parameters
Tthe type of the wrapped value
Parameters
[in]lhsthe first default_value
[in]rhsthe second default_value
Returns
true if the active values of lhs is greater or equal than the active value of rhs, false otherwise ([[nodiscard]])

◆ operator<<() [3/6]

std::ostream& plssvm::operator<< ( std::ostream &  out,
verbosity_level  verb 
)

Output the verb to the given output-stream out.

If more than one verbosity level is provided, outputs all of them, e.g., "libsvm | timing".

Parameters
[in,out]outthe output-stream to write the verbosity level to
[in]verbthe verbosity level
Returns
the output-stream

◆ operator>>() [3/6]

std::istream& plssvm::operator>> ( std::istream &  in,
verbosity_level verb 
)

Use the input-stream in to initialize the verb level.

If more than one verbosity level is provided, e.g., "libsvm | timing" returns a bitwise-or of the respective enum values. If any of the values is "quiet", the result will always be plssvm::verbosity_level::quiet.

Parameters
[in,out]ininput-stream to extract the verbosity level from
[in]verbthe verbosity level
Returns
the input-stream

◆ operator|()

verbosity_level plssvm::operator| ( verbosity_level  lhs,
verbosity_level  rhs 
)

Bitwise-or to set multiple verbosity levels at once for a logging message.

Parameters
[in]lhsthe first verbosity level
[in]rhsthe second verbosity level
Returns
the logical-or of the two verbosity levels ([[nodiscard]])

◆ operator|=()

verbosity_level plssvm::operator|= ( verbosity_level lhs,
verbosity_level  rhs 
)

Bitwise-or to set multiple verbosity levels at once for a logging message.

Parameters
[in]lhsthe first verbosity level
[in]rhsthe second verbosity level
Returns
the logical-or of the two verbosity levels

◆ operator&()

verbosity_level plssvm::operator& ( verbosity_level  lhs,
verbosity_level  rhs 
)

Bitwise-and to check verbosity levels for a logging message.

Parameters
[in]lhsthe first verbosity level
[in]rhsthe second verbosity level
Returns
the logical-and of the two verbosity levels ([[nodiscard]])

◆ operator&=()

verbosity_level plssvm::operator&= ( verbosity_level lhs,
verbosity_level  rhs 
)

Bitwise-and to check verbosity levels for a logging message.

Parameters
[in]lhsthe first verbosity level
[in]rhsthe second verbosity level
Returns
the logical-and of the two verbosity levels

◆ operator<<() [4/6]

std::ostream& plssvm::operator<< ( std::ostream &  out,
file_format_type  format 
)

Output the format to the given output-stream out.

Parameters
[in,out]outthe output-stream to write the file format type to
[in]formatthe file format type
Returns
the output-stream

◆ operator>>() [4/6]

std::istream& plssvm::operator>> ( std::istream &  in,
file_format_type format 
)

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

Parameters
[in,out]ininput-stream to extract the file format type from
[in]formatthe file format type
Returns
the input-stream

◆ operator<<() [5/6]

std::ostream& plssvm::operator<< ( std::ostream &  out,
kernel_function_type  kernel 
)

Output the kernel type to the given output-stream out.

Parameters
[in,out]outthe output-stream to write the kernel type to
[in]kernelthe kernel type
Returns
the output-stream

◆ kernel_function_type_to_math_string()

std::string_view plssvm::kernel_function_type_to_math_string ( kernel_function_type  kernel)
noexcept

Return the mathematical representation of the kernel_type kernel.

Uses placeholders for the scalar values and vectors.

Parameters
[in]kernelthe kernel type
Returns
the mathematical representation of kernel ([[nodiscard]])

◆ operator>>() [5/6]

std::istream& plssvm::operator>> ( std::istream &  in,
kernel_function_type kernel 
)

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

The extracted value is matched case-insensitive and can be the integer value of the kernel_type.

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

◆ kernel_function() [1/2]

template<kernel_function_type kernel, typename real_type , typename... Args>
real_type plssvm::kernel_function ( const std::vector< real_type > &  xi,
const std::vector< real_type > &  xj,
Args &&...  args 
)
inline

Computes the value of the two vectors xi and xj using the kernel function determined at compile-time.

Template Parameters
kernelthe type of the kernel
real_typethe type of the values
Argsadditional parameters used in the respective kernel function
Parameters
[in]xithe first vector
[in]xjthe second vector
[in]argsadditional parameters
Returns
the value computed by the kernel function ([[nodiscard]])

◆ kernel_function() [2/2]

template<typename real_type >
real_type plssvm::kernel_function ( const std::vector< real_type > &  xi,
const std::vector< real_type > &  xj,
const detail::parameter< real_type > &  params 
)

Computes the value of the two vectors xi and xj using the kernel function and kernel parameter stored in params.

Template Parameters
real_typethe type of the values
Parameters
[in]xithe first vector
[in]xjthe second vector
[in]paramsclass encapsulating the kernel type and kernel parameters
Exceptions
plssvm::unsupported_kernel_type_exceptionif the kernel function in params is not supported
Returns
the computed kernel function value ([[nodiscard]])

◆ equivalent()

constexpr bool plssvm::equivalent ( const parameter lhs,
const parameter 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]])

◆ list_available_target_platforms()

std::vector<target_platform> plssvm::list_available_target_platforms ( )

Return a list of all currently available target platforms.

Only target platforms that where requested during the CMake configuration are available.

Returns
the available target platforms ([[nodiscard]])

◆ determine_default_target_platform()

target_platform plssvm::determine_default_target_platform ( const std::vector< target_platform > &  platform_device_list = list_available_target_platforms())

Return the default target platform given the available devices in platform_device_list.

Does not take the currently available backends into account!

Parameters
[in]platform_device_listlist of target_platforms found in the current setup; if no target_platforms are provided, queries all available target_platforms
Returns
the default target_platform ([[nodiscard]])

◆ operator<<() [6/6]

std::ostream& plssvm::operator<< ( std::ostream &  out,
target_platform  target 
)

Output the target platform to the given output-stream out.

Parameters
[in,out]outthe output-stream to write the target platform to
[in]targetthe target platform
Returns
the output-stream

◆ operator>>() [6/6]

std::istream& plssvm::operator>> ( std::istream &  in,
target_platform target 
)

Use the input-stream in to initialize the target platform.

Parameters
[in,out]ininput-stream to extract the target platform from
[in]targetthe target platform
Returns
the input-stream

Variable Documentation

◆ csvm_to_backend_type_v

template<typename T >
constexpr backend_type plssvm::csvm_to_backend_type_v = csvm_to_backend_type<T>::value
constexpr

Get the plssvm::backend_type of the C-SVM class of type T. Ignores all top-level const, volatile, and reference qualifiers.

Provides a member variable value if T is a valid C-SVM. If T is a SYCL C-SVM, an additional member variable impl is provided showing the used SYCL implementation.

Template Parameters
Tthe type of the C-SVM to get the backend type from

A shorthand for plssvm::csvm_to_backend_type::value.