UtilsLite
Utilities for C++ programming
Loading...
Searching...
No Matches
Utils Namespace Reference

Namespaces

namespace  Table
 
namespace  tp
 

Classes

class  AABBtree
 A class representing an axis-aligned bounding box tree. More...
 
class  AlgoBracket
 Class for solving \( f(x)=0 \) without the usew of derivative. More...
 
class  AlgoHNewton
 Class for solving \( f(x)=0 \) without the usew of derivative. More...
 
class  AlgoHNewton_base_fun
 Abstract base class for defining mathematical functions used in the zero search algorithm. More...
 
class  at_scope_exit_impl
 
class  Barrier
 
class  BinarySearch
 
class  Box2D
 A class representing a 2D axis-aligned bounding box. More...
 
class  Bracket_base_fun
 Abstract base class for defining mathematical functions used in the Bracket search algorithm. More...
 
class  Console
 Class to handle console output with different styles and levels. More...
 
class  HJPatternSearch
 Class for implementing the Hooke-Jeeves Pattern Search Algorithm. More...
 
class  Malloc
 Class for dynamic memory allocation of objects. More...
 
class  MallocFixed
 Class for fixed-size memory allocation of objects. More...
 
class  mex_class_handle
 A class template that manages a C++ object for use with MATLAB. More...
 
class  NelderMead
 Implements the Nelder-Mead optimization algorithm for nonlinear optimization problems. More...
 
class  Point2D
 A class representing a 2D point in space. More...
 
class  Poly
 Specializes the Eigen::Matrix class to represent and manipulate polynomials. More...
 
class  Polygon2D
 A class representing a 2D polygon using a dynamic matrix of vertices. More...
 
class  Quaternion
 Implement some operationn on quaternion. More...
 
class  Runtime_Error
 Custom runtime error class for handling runtime exceptions. More...
 
class  Runtime_TraceError
 A custom exception class that captures and stores a backtrace on error. More...
 
class  Segment2D
 A class representing a 2D line segment defined by two endpoints. More...
 
class  SHA3
 SHA-3 winning hash algorithm Keccak. More...
 
class  SimpleSemaphore
 
class  SpinLock
 
class  SpinLock_barrier
 
class  Sturm
 Class for managing and computing the Sturm sequence associated with a polynomial. More...
 
class  ThreadPool0
 Fake thread pool class. More...
 
class  ThreadPool1
 Manages a pool of worker threads for concurrent task execution. More...
 
class  ThreadPool2
 Manages a pool of worker threads for concurrent task execution. More...
 
class  ThreadPool3
 A thread pool for concurrent task execution with worker management. More...
 
class  ThreadPool4
 A thread pool for concurrent task execution with worker management. More...
 
class  ThreadPool5
 A thread pool for concurrent task execution with worker management. More...
 
class  ThreadPoolBase
 
class  TicToc
 A class for timing code execution. More...
 
class  Tokenizer
 A utility class for tokenizing strings. More...
 
class  Triangle2D
 A class representing a 2D triangle defined by three vertices. More...
 
class  Trichotomy
 Class for minimize the function \( f(x) \) without the usew of derivative. More...
 
class  Trichotomy_base_fun
 Abstract base class for defining mathematical functions used in the minimization algorithm. More...
 
class  TVD
 Class for performing Total Variation Denoising (TVD) on 1D signals. More...
 
class  WaitWorker
 
class  WorkerLoop
 
class  Zeros
 Class for solving the equation \( f(x) = 0 \) using various numerical methods. More...
 
class  Zeros_base_fun
 Abstract base class for defining mathematical functions used in root-finding algorithms. More...
 

Typedefs

using istream_type = std::basic_istream<char>
 Type for input stream.
 
using ostream_type = std::basic_ostream<char>
 Type for output stream.
 
using string = std::string
 Type for string.
 

Functions

string basename (string_view filename)
 Get the base name of a file.
 
string out_bytes (size_t nb)
 Utility function to convert byte size into a human-readable format.
 
void mex_error_message (string_view msg)
 Sends an error message to MATLAB.
 
bool mex_is_scalar (mxArray const *arg, string_view msg)
 Checks if the input argument is a scalar.
 
double mex_get_scalar_value (mxArray const *arg, string_view msg)
 Gets the scalar value from the input argument.
 
bool mex_get_bool (mxArray const *arg, string_view msg)
 Gets a boolean value from the input argument.
 
int64_t mex_get_int64 (mxArray const *arg, string_view msg)
 Gets a 64-bit integer value from the input argument.
 
double const * mex_vector_pointer (mxArray const *arg, mwSize &sz, string_view msg)
 Gets a pointer to a vector from the input argument.
 
double const * mex_matrix_pointer (mxArray const *arg, mwSize &nr, mwSize &nc, string_view msg)
 Gets a pointer to a matrix from the input argument.
 
void mex_set_scalar_value (mxArray *&arg, double value)
 Sets a scalar value in the output argument.
 
void mex_set_scalar_int32 (mxArray *&arg, int32_t value)
 Sets a scalar integer value in the output argument.
 
void mex_set_scalar_int64 (mxArray *&arg, int64_t value)
 Sets a scalar 64-bit integer value in the output argument.
 
void mex_set_scalar_bool (mxArray *&arg, bool value)
 Sets a boolean value in the output argument.
 
int32_t * mex_create_matrix_int32 (mxArray *&arg, mwSize nrow, mwSize ncol)
 Creates a numeric matrix of type int32 and returns a pointer to its data.
 
int64_t * mex_create_matrix_int64 (mxArray *&arg, mwSize nrow, mwSize ncol)
 Creates a numeric matrix of type int64 and returns a pointer to its data.
 
double * mex_create_matrix_value (mxArray *&arg, mwSize nrow, mwSize ncol)
 Creates a numeric matrix of type double and returns a pointer to its data.
 
template<typename R, typename I>
int mex_create_sparse_matrix (size_t nnz, size_t nrows, size_t ncols, I i_rows[], I j_cols[], R vals[], mxArray *arg_out[])
 Creates a sparse matrix in MATLAB format.
 
void mex_create_string_cell_array (mxArray *&arg, vector< string > const &str_vec)
 Creates a MATLAB cell array and fills it with a vector of C++ strings.
 
template<typename base>
mxArray * mex_convert_ptr_to_mx (base *ptr)
 Converts a pointer to a mex_class_handle into a MATLAB mxArray.
 
template<typename base>
mex_class_handle< base > * mex_convert_mx_to_handle_ptr (mxArray const *in)
 Converts a MATLAB mxArray back to a mex_class_handle pointer.
 
template<typename base>
base * mex_convert_mx_to_ptr (mxArray const *in)
 Converts a MATLAB mxArray to a pointer of the wrapped C++ object.
 
template<typename base>
void mex_destroy_object (mxArray const *&in)
 Destroys the object wrapped by the mex_class_handle.
 
template<typename T>
NaN ()
 
template<typename T>
Inf ()
 
template<typename T>
machine_eps ()
 
template<typename T>
sqrt_machine_eps ()
 
template<typename T>
maximum_value ()
 
template<typename T>
minimum_value ()
 
bool found_NaN (double const *pv, int DIM)
 
bool found_NaN (float const *pv, int DIM)
 
void check_NaN (double const *pv, string_view v_name, int DIM, int line, string_view file)
 
void check_NaN (float const *pv, string_view v_name, int DIM, int line, string_view file)
 
template<typename T>
Quaternion< T > operator* (Quaternion< T > const &a, Quaternion< T > const &b)
 
template<typename T>
ostream_typeoperator<< (ostream_type &os, Quaternion< T > const &Q)
 
template<class Function>
auto at_scope_exit (Function &&fun) -> at_scope_exit_impl< Function >
 
template<class Function>
auto at_scope_exit (Function const &fun) -> at_scope_exit_impl< Function const & >
 
void sleep_for_seconds (unsigned s)
 Sleep for a specified number of seconds.
 
void sleep_for_milliseconds (unsigned ms)
 Sleep for a specified number of milliseconds.
 
void sleep_for_microseconds (unsigned mus)
 Sleep for a specified number of microseconds.
 
void sleep_for_nanoseconds (unsigned ns)
 Sleep for a specified number of nanoseconds.
 
void split_string (string const &str, string const &sep, vector< string > &arr)
 
string get_basename (string_view path)
 
string get_filename (string_view path)
 
string get_extension (string_view path)
 
bool get_environment (string_view ename, string &res)
 Fetches the value of an environment variable.
 
void set_environment (string_view ename, string_view newval, bool overwrite)
 Sets the value of an environment variable.
 
void get_MAC_address (std::map< string, string > &addr)
 Retrieves the MAC addresses of network interfaces.
 
string get_host_name ()
 Retrieves the hostname of the system.
 
void get_IP_address (std::vector< string > &addr)
 Fetches the IP addresses of the system.
 
string get_user_name ()
 Retrieves the username of the current user.
 
string get_home_directory ()
 Retrieves the home directory of the current user.
 
string get_executable_path_name ()
 Retrieves the full path to the current executable.
 
bool check_if_file_exists (string_view fname)
 Checks if a file exists.
 
bool check_if_dir_exists (string_view dirname)
 Checks if a directory exists.
 
bool make_directory (string_view dirname, unsigned mode=0777)
 Creates a directory if it does not exist.
 
string get_date ()
 
string get_day_time ()
 
string get_day_time_and_date ()
 
string get_log_date_time ()
 
template<typename T_int, typename T_real>
void search_interval (T_int npts, T_real const X[], T_real &x, T_int &last_interval, bool closed, bool can_extend)
 
template<typename T_int, typename T_real>
void searchInterval (T_int npts, T_real const X[], T_real &x, T_int &last_interval, bool closed, bool can_extend)
 
string progress_bar (double const progress, int const width)
 Generates a text-based progress bar as a string.
 
void progress_bar (ostream_type &s, double const progress, int const width, string_view const msg)
 Outputs a text-based progress bar to the specified output stream.
 
void progress_bar2 (ostream_type &s, double const progress, int const width, string_view const msg)
 Outputs an enhanced text-based progress bar to the specified output stream.
 
void info (bool &bMMX, bool &bMMXplus, bool &bSSE, bool &bSSE2, bool &bSSE3, bool &bSSSE3, bool &bSSE41, bool &bSSE42, bool &bSSE4a, bool &bSSE5, bool &b3Dnow, bool &b3DnowExt)
 
bool has_MMX ()
 check if CPU support MMX instruction set
 
bool has_MMXplus ()
 check if CPU support MMXplus instruction set
 
bool has_SSE ()
 check if CPU support SSE instruction set
 
bool has_SSE2 ()
 check if CPU support SSE2 instruction set
 
bool has_SSE3 ()
 check if CPU support SSE3 instruction set
 
bool has_SSSE3 ()
 check if CPU support SSSE3 instruction set
 
bool has_SSE41 ()
 check if CPU support SSE41 instruction set
 
bool has_SSE42 ()
 check if CPU support SSE42 instruction set
 
bool has_SSE4a ()
 check if CPU support SSE4a instruction set
 
bool has_SSE5 ()
 check if CPU support SSE5 instruction set
 
bool has_3Dnow ()
 check if CPU support 3Dnow instruction set
 
bool has_3DnowExt ()
 check if CPU support 3DnowExt instruction set
 
string cpuInfo ()
 
string fmt_table_row (unsigned const width, string_view const L, string_view const R, string_view const F, string_view const title, string_view const align)
 
string fmt_table_row (unsigned const width, string_view const L, string_view const C, string_view const R, string_view const F, std::initializer_list< string_view > const names, string_view align)
 
string fmt_table_row (unsigned const width, string_view const L, string_view const C, string_view const R, string_view const F, unsigned const N)
 
string fmt_table_left_top ()
 
string fmt_table_left_middle ()
 
string fmt_table_left_bottom ()
 
string fmt_table_middle_top ()
 
string fmt_table_middle_middle ()
 
string fmt_table_middle_bottom ()
 
string fmt_table_right_top ()
 
string fmt_table_right_middle ()
 
string fmt_table_right_bottom ()
 
string fmt_table_cross ()
 
string fmt_table_bar ()
 
string fmt_table_vbar ()
 
string fmt_table_dot ()
 
string fmt_table_vdots ()
 
string fmt_table_row (unsigned width, string_view title="", string_view align="^", string_view fill=" ")
 
string fmt_table_top_row (unsigned width, string_view title="", string_view align="^", string_view fill="─")
 
string fmt_table_middle_row (unsigned width, string_view title="", string_view align="^", string_view fill="─")
 
string fmt_table_bottom_row (unsigned width, string_view title="", string_view align="^", string_view fill="─")
 
string fmt_table_row (unsigned width, std::initializer_list< string_view > names, string_view align="<", string_view fill=" ")
 
string fmt_table_top_row (unsigned width, std::initializer_list< string_view > names, string_view align="<", string_view fill="─")
 
string fmt_table_middle_row (unsigned width, std::initializer_list< string_view > names, string_view align="<", string_view fill="─")
 
string fmt_table_bottom_row (unsigned width, std::initializer_list< string_view > names, string_view align="<", string_view fill="─")
 
string fmt_table_row (unsigned width, unsigned N, string_view fill=" ")
 
string fmt_table_top_row (unsigned width, unsigned N, string_view fill="─")
 
string fmt_table_middle_row (unsigned width, unsigned N, string_view fill="─")
 
string fmt_table_bottom_row (unsigned width, unsigned N, string_view fill="─")
 
template<typename Real, typename Char>
std::basic_ostream< Char > & operator<< (std::basic_ostream< Char > &output, Poly< Real > const &p)
 
template<typename Real, typename Char>
std::basic_ostream< Char > & operator<< (std::basic_ostream< Char > &output, Sturm< Real > const &S)
 
void print_trace (int line, string_view file, string_view msg, ostream_type &stream)
 Prints a formatted trace message to the specified stream.
 
void printTrace (int line, string_view file, string_view reason, ostream_type &stream)
 

Variables

std::mutex MallocMutex
 Global mutex for thread-safe memory operations.
 
int64_t CountAlloc
 Global variables for tracking memory allocation statistics.
 
int64_t CountFreed
 
int64_t AllocatedBytes
 
int64_t MaximumAllocatedBytes
 
bool MallocDebug
 

Typedef Documentation

◆ istream_type

using Utils::istream_type = std::basic_istream<char>

Type for input stream.

◆ ostream_type

using Utils::ostream_type = std::basic_ostream<char>

Type for output stream.

◆ string

using Utils::string = std::string

Type for string.

Function Documentation

◆ basename()

string Utils::basename ( string_view filename)

Get the base name of a file.

Parameters
filenameC-style string representing the file name.
Returns
Base name of the file.

◆ check_NaN() [1/2]

void Utils::check_NaN ( double const * pv,
string_view v_name,
int DIM,
int line,
string_view file )

Checks for NaN values in an array of doubles and logs an error if found.

Parameters
pvPointer to the array of double values.
v_nameThe name of the variable for logging.
DIMThe dimension (size) of the array.
lineThe line number where the check is performed.
fileThe name of the file where the check is performed.

◆ check_NaN() [2/2]

void Utils::check_NaN ( float const * pv,
string_view v_name,
int DIM,
int line,
string_view file )

Checks for NaN values in an array of floats and logs an error if found.

Parameters
pvPointer to the array of float values.
v_nameThe name of the variable for logging.
DIMThe dimension (size) of the array.
lineThe line number where the check is performed.
fileThe name of the file where the check is performed.

◆ cpuInfo()

string Utils::cpuInfo ( )

Return a string describing the CPU.

◆ fmt_table_bar()

string Utils::fmt_table_bar ( )
inline

◆ fmt_table_bottom_row() [1/3]

string Utils::fmt_table_bottom_row ( unsigned width,
std::initializer_list< string_view > names,
string_view align = "<",
string_view fill = "─" )
inline

◆ fmt_table_bottom_row() [2/3]

string Utils::fmt_table_bottom_row ( unsigned width,
string_view title = "",
string_view align = "^",
string_view fill = "─" )
inline

◆ fmt_table_bottom_row() [3/3]

string Utils::fmt_table_bottom_row ( unsigned width,
unsigned N,
string_view fill = "─" )
inline

◆ fmt_table_cross()

string Utils::fmt_table_cross ( )
inline

◆ fmt_table_dot()

string Utils::fmt_table_dot ( )
inline

◆ fmt_table_left_bottom()

string Utils::fmt_table_left_bottom ( )
inline

◆ fmt_table_left_middle()

string Utils::fmt_table_left_middle ( )
inline

◆ fmt_table_left_top()

string Utils::fmt_table_left_top ( )
inline

◆ fmt_table_middle_bottom()

string Utils::fmt_table_middle_bottom ( )
inline

◆ fmt_table_middle_middle()

string Utils::fmt_table_middle_middle ( )
inline

◆ fmt_table_middle_row() [1/3]

string Utils::fmt_table_middle_row ( unsigned width,
std::initializer_list< string_view > names,
string_view align = "<",
string_view fill = "─" )
inline

◆ fmt_table_middle_row() [2/3]

string Utils::fmt_table_middle_row ( unsigned width,
string_view title = "",
string_view align = "^",
string_view fill = "─" )
inline

◆ fmt_table_middle_row() [3/3]

string Utils::fmt_table_middle_row ( unsigned width,
unsigned N,
string_view fill = "─" )
inline

◆ fmt_table_middle_top()

string Utils::fmt_table_middle_top ( )
inline

◆ fmt_table_right_bottom()

string Utils::fmt_table_right_bottom ( )
inline

◆ fmt_table_right_middle()

string Utils::fmt_table_right_middle ( )
inline

◆ fmt_table_right_top()

string Utils::fmt_table_right_top ( )
inline

◆ fmt_table_row() [1/6]

string Utils::fmt_table_row ( unsigned const width,
string_view const L,
string_view const C,
string_view const R,
string_view const F,
std::initializer_list< string_view > const names,
string_view align )

◆ fmt_table_row() [2/6]

string Utils::fmt_table_row ( unsigned const width,
string_view const L,
string_view const C,
string_view const R,
string_view const F,
unsigned const N )

◆ fmt_table_row() [3/6]

string Utils::fmt_table_row ( unsigned const width,
string_view const L,
string_view const R,
string_view const F,
string_view const title,
string_view const align )

◆ fmt_table_row() [4/6]

string Utils::fmt_table_row ( unsigned width,
std::initializer_list< string_view > names,
string_view align = "<",
string_view fill = " " )
inline

◆ fmt_table_row() [5/6]

string Utils::fmt_table_row ( unsigned width,
string_view title = "",
string_view align = "^",
string_view fill = " " )
inline

◆ fmt_table_row() [6/6]

string Utils::fmt_table_row ( unsigned width,
unsigned N,
string_view fill = " " )
inline

◆ fmt_table_top_row() [1/3]

string Utils::fmt_table_top_row ( unsigned width,
std::initializer_list< string_view > names,
string_view align = "<",
string_view fill = "─" )
inline

◆ fmt_table_top_row() [2/3]

string Utils::fmt_table_top_row ( unsigned width,
string_view title = "",
string_view align = "^",
string_view fill = "─" )
inline

◆ fmt_table_top_row() [3/3]

string Utils::fmt_table_top_row ( unsigned width,
unsigned N,
string_view fill = "─" )
inline

◆ fmt_table_vbar()

string Utils::fmt_table_vbar ( )
inline

◆ fmt_table_vdots()

string Utils::fmt_table_vdots ( )
inline

◆ found_NaN() [1/2]

bool Utils::found_NaN ( double const * pv,
int DIM )

Checks if a NaN value is found in an array of doubles.

Parameters
pvPointer to the array of double values.
DIMThe dimension (size) of the array.
Returns
True if a NaN value is found, otherwise false.

◆ found_NaN() [2/2]

bool Utils::found_NaN ( float const * pv,
int DIM )

Checks if a NaN value is found in an array of floats.

Parameters
pvPointer to the array of float values.
DIMThe dimension (size) of the array.
Returns
True if a NaN value is found, otherwise false.

◆ get_basename()

string Utils::get_basename ( string_view path)
inline

◆ get_extension()

string Utils::get_extension ( string_view path)
inline

◆ get_filename()

string Utils::get_filename ( string_view path)
inline

◆ has_3Dnow()

bool Utils::has_3Dnow ( )

check if CPU support 3Dnow instruction set

◆ has_3DnowExt()

bool Utils::has_3DnowExt ( )

check if CPU support 3DnowExt instruction set

◆ has_MMX()

bool Utils::has_MMX ( )

check if CPU support MMX instruction set

◆ has_MMXplus()

bool Utils::has_MMXplus ( )

check if CPU support MMXplus instruction set

◆ has_SSE()

bool Utils::has_SSE ( )

check if CPU support SSE instruction set

◆ has_SSE2()

bool Utils::has_SSE2 ( )

check if CPU support SSE2 instruction set

◆ has_SSE3()

bool Utils::has_SSE3 ( )

check if CPU support SSE3 instruction set

◆ has_SSE41()

bool Utils::has_SSE41 ( )

check if CPU support SSE41 instruction set

◆ has_SSE42()

bool Utils::has_SSE42 ( )

check if CPU support SSE42 instruction set

◆ has_SSE4a()

bool Utils::has_SSE4a ( )

check if CPU support SSE4a instruction set

◆ has_SSE5()

bool Utils::has_SSE5 ( )

check if CPU support SSE5 instruction set

◆ has_SSSE3()

bool Utils::has_SSSE3 ( )

check if CPU support SSSE3 instruction set

◆ Inf()

template<typename T>
T Utils::Inf ( )

Returns an infinity constant for the specified type.

Template Parameters
TThe type of the infinity constant. Supported types include float and double.
Returns
An infinity constant of type T.

◆ info()

void Utils::info ( bool & bMMX,
bool & bMMXplus,
bool & bSSE,
bool & bSSE2,
bool & bSSE3,
bool & bSSSE3,
bool & bSSE41,
bool & bSSE42,
bool & bSSE4a,
bool & bSSE5,
bool & b3Dnow,
bool & b3DnowExt )

Get info of Intel CPU

Parameters
[out]bMMXbooelan, support MMX instruction set
[out]bMMXplusbooelan, support MMXplus instruction set
[out]bSSEbooelan, support SSE instruction set
[out]bSSE2booelan, support SSE2 instruction set
[out]bSSE3booelan, support SSE3 instruction set
[out]bSSSE3booelan, support SSEE3 instruction set
[out]bSSE41booelan, support SSE41 instruction set
[out]bSSE42booelan, support SSE42 instruction set
[out]bSSE4abooelan, support SSE4a instruction set
[out]bSSE5booelan, support SSE5 instruction set
[out]b3Dnowbooelan, support 3Dnow instruction set
[out]b3DnowExtbooelan, support 3DnowExt instruction set

◆ machine_eps()

template<typename T>
T Utils::machine_eps ( )

Returns the machine epsilon for the specified type.

Template Parameters
TThe type of the machine epsilon. Supported types include float and double.
Returns
The machine epsilon constant of type T.

◆ maximum_value()

template<typename T>
T Utils::maximum_value ( )

Returns the maximum representable value for the specified type.

Template Parameters
TThe type for which to compute the maximum value. Supported types include float and double.
Returns
The maximum representable value of type T.

◆ minimum_value()

template<typename T>
T Utils::minimum_value ( )

Returns the minimum representable value for the specified type.

Template Parameters
TThe type for which to compute the minimum value. Supported types include float and double.
Returns
The minimum representable value of type T.

◆ NaN()

template<typename T>
T Utils::NaN ( )

Returns a Not-a-Number (NaN) constant for the specified type.

Template Parameters
TThe type of the NaN constant. Supported types include float and double.
Returns
A NaN constant of type T.

◆ operator*()

template<typename T>
Quaternion< T > Utils::operator* ( Quaternion< T > const & a,
Quaternion< T > const & b )
inline

Multiplies two quaternions.

The multiplication of two quaternions is defined as follows:

\[\mathbf{i} * \mathbf{j} = -\mathbf{j} * \mathbf{i} = \mathbf{k} \]

\[\mathbf{j} * \mathbf{k} = -\mathbf{k} * \mathbf{j} = \mathbf{i} \]

\[\mathbf{k} * \mathbf{i} = -\mathbf{i} * \mathbf{k} = \mathbf{j} \]

\[\mathbf{i} * \mathbf{i} = \mathbf{j} * \mathbf{j} = \mathbf{k} * \mathbf{k} = -1 \]

Parameters
aThe first quaternion.
bThe second quaternion.
Returns
The result of multiplying quaternions \( a \) and \( b \).

◆ operator<<() [1/3]

template<typename T>
ostream_type & Utils::operator<< ( ostream_type & os,
Quaternion< T > const & Q )
inline

Overloads the output stream operator for quaternions.

Parameters
osThe output stream.
QThe quaternion to output.
Returns
The output stream with the quaternion printed.

◆ operator<<() [2/3]

template<typename Real, typename Char>
std::basic_ostream< Char > & Utils::operator<< ( std::basic_ostream< Char > & output,
Poly< Real > const & p )
inline

◆ operator<<() [3/3]

template<typename Real, typename Char>
std::basic_ostream< Char > & Utils::operator<< ( std::basic_ostream< Char > & output,
Sturm< Real > const & S )
inline

◆ progress_bar() [1/2]

string Utils::progress_bar ( double const progress,
int const width )

Generates a text-based progress bar as a string.

This function creates a progress bar in the form of a string representation, which visually indicates the progress of a task. The progress is shown using equal signs, a greater-than symbol for the current position, and underscores for the remaining part of the bar.

Parameters
progressA value between 0.0 and 1.0 representing the progress of the task.
widthThe total width of the progress bar (number of characters).
Returns
A string representing the progress bar along with the percentage completed.

◆ progress_bar() [2/2]

void Utils::progress_bar ( ostream_type & s,
double const progress,
int const width,
string_view const msg )

Outputs a text-based progress bar to the specified output stream.

This function generates a progress bar and outputs it directly to the provided output stream, indicating the current progress of a task. The visual representation uses filled and unfilled squares to indicate progress and includes a percentage along with an optional message.

Parameters
sThe output stream where the progress bar will be displayed.
progressA value between 0.0 and 1.0 representing the progress of the task.
widthThe total width of the progress bar (number of characters).
msgAn optional message to display alongside the progress bar.

◆ progress_bar2()

void Utils::progress_bar2 ( ostream_type & s,
double const progress,
int const width,
string_view const msg )

Outputs an enhanced text-based progress bar to the specified output stream.

This function generates a more detailed progress bar using various characters to represent different levels of completion. It outputs the progress bar directly to the provided output stream, including a percentage and an optional message.

Parameters
sThe output stream where the progress bar will be displayed.
progressA value between 0.0 and 1.0 representing the progress of the task.
widthThe total width of the progress bar (number of characters).
msgAn optional message to display alongside the progress bar.

◆ search_interval()

template<typename T_int, typename T_real>
void Utils::search_interval ( T_int npts,
T_real const X[],
T_real & x,
T_int & last_interval,
bool closed,
bool can_extend )

◆ searchInterval()

template<typename T_int, typename T_real>
void Utils::searchInterval ( T_int npts,
T_real const X[],
T_real & x,
T_int & last_interval,
bool closed,
bool can_extend )
inline

◆ sleep_for_microseconds()

void Utils::sleep_for_microseconds ( unsigned mus)
inline

Sleep for a specified number of microseconds.

This function pauses the execution of the current thread for the specified number of microseconds.

Parameters
musThe number of microseconds to sleep.

◆ sleep_for_milliseconds()

void Utils::sleep_for_milliseconds ( unsigned ms)
inline

Sleep for a specified number of milliseconds.

This function pauses the execution of the current thread for the specified number of milliseconds.

Parameters
msThe number of milliseconds to sleep.

◆ sleep_for_nanoseconds()

void Utils::sleep_for_nanoseconds ( unsigned ns)
inline

Sleep for a specified number of nanoseconds.

This function pauses the execution of the current thread for the specified number of nanoseconds.

Parameters
nsThe number of nanoseconds to sleep.

◆ sleep_for_seconds()

void Utils::sleep_for_seconds ( unsigned s)
inline

Sleep for a specified number of seconds.

This function pauses the execution of the current thread for the specified number of seconds.

Parameters
sThe number of seconds to sleep.

◆ sqrt_machine_eps()

template<typename T>
T Utils::sqrt_machine_eps ( )

Returns the square root of the machine epsilon for the specified type.

Template Parameters
TThe type for which to compute the square root of machine epsilon. Supported types include float and double.
Returns
The square root of the machine epsilon of type T.