NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
nc::utils Namespace Reference

Namespaces

namespace  timeit_detail
 

Functions

template<typename dtype >
constexpr dtype cube (dtype inValue) noexcept
 
template<typename dtype , std::enable_if_t< std::is_integral< dtype >::value, int > = 0>
bool essentiallyEqual (const std::complex< dtype > &inValue1, const std::complex< dtype > &inValue2) noexcept
 
template<typename dtype , std::enable_if_t< std::is_floating_point< dtype >::value, int > = 0>
bool essentiallyEqual (const std::complex< dtype > &inValue1, const std::complex< dtype > &inValue2, const std::complex< dtype > &inEpsilon) noexcept
 
template<typename dtype , std::enable_if_t< std::is_integral< dtype >::value, int > = 0>
bool essentiallyEqual (dtype inValue1, dtype inValue2) noexcept
 
template<typename dtype , std::enable_if_t< std::is_floating_point< dtype >::value, int > = 0>
bool essentiallyEqual (dtype inValue1, dtype inValue2, dtype inEpsilon) noexcept
 
double gaussian (double inX, double inY, double inSigma) noexcept
 
double gaussian1d (double inX, double inMu, double inSigma) noexcept
 
constexpr double interp (double inValue1, double inValue2, double inPercent) noexcept
 
template<typename dtype >
std::string num2str (dtype inNumber)
 
template<typename dtype >
dtype power (dtype inValue, uint8 inPower) noexcept
 
template<typename dtype1 , typename dtype2 >
auto powerf (dtype1 inValue, const dtype2 inPower) noexcept
 
template<typename dtype >
constexpr dtype sqr (dtype inValue) noexcept
 
template<typename TimeUnit , typename Function , typename... Args>
timeit_detail::Result< TimeUnit > timeit (uint32 numIterations, PrintResults printResults, Function function, Args &&... args) noexcept
 
template<typename dtype >
std::string value2str (dtype inValue)
 

Function Documentation

◆ cube()

template<typename dtype >
constexpr dtype nc::utils::cube ( dtype  inValue)
constexprnoexcept

Cubes in input value

Parameters
inValue
Returns
cubed value

◆ essentiallyEqual() [1/4]

template<typename dtype , std::enable_if_t< std::is_integral< dtype >::value, int > = 0>
bool nc::utils::essentiallyEqual ( const std::complex< dtype > &  inValue1,
const std::complex< dtype > &  inValue2 
)
noexcept

tests that 2 complex values are "essentially equal"

Parameters
inValue1
inValue2
Returns
bool

tests that 2 floating point values are "essentially equal"

Parameters
inValue1
inValue2
Returns
bool

◆ essentiallyEqual() [2/4]

template<typename dtype , std::enable_if_t< std::is_floating_point< dtype >::value, int > = 0>
bool nc::utils::essentiallyEqual ( const std::complex< dtype > &  inValue1,
const std::complex< dtype > &  inValue2,
const std::complex< dtype > &  inEpsilon 
)
noexcept

tests that 2 complex values are "essentially equal"

Parameters
inValue1
inValue2
inEpsilon
Returns
bool

◆ essentiallyEqual() [3/4]

template<typename dtype , std::enable_if_t< std::is_integral< dtype >::value, int > = 0>
bool nc::utils::essentiallyEqual ( dtype  inValue1,
dtype  inValue2 
)
noexcept

tests that 2 integer values are "essentially equal"

Parameters
inValue1
inValue2
Returns
bool

tests that 2 floating point values are "essentially equal"

Parameters
inValue1
inValue2
Returns
bool

◆ essentiallyEqual() [4/4]

template<typename dtype , std::enable_if_t< std::is_floating_point< dtype >::value, int > = 0>
bool nc::utils::essentiallyEqual ( dtype  inValue1,
dtype  inValue2,
dtype  inEpsilon 
)
noexcept

tests that 2 floating point values are "essentially equal"

Parameters
inValue1
inValue2
inEpsilon
Returns
bool

◆ gaussian()

double nc::utils::gaussian ( double  inX,
double  inY,
double  inSigma 
)
inlinenoexcept

samples a 2D gaussian of mean zero and input STD sigma

Parameters
inX
inY
inSigma
Returns
dtype

◆ gaussian1d()

double nc::utils::gaussian1d ( double  inX,
double  inMu,
double  inSigma 
)
inlinenoexcept

samples a 1D gaussian of input mean and sigma

Parameters
inX
inMu
inSigma
Returns
dtype

◆ interp()

constexpr double nc::utils::interp ( double  inValue1,
double  inValue2,
double  inPercent 
)
constexprnoexcept

Returns the linear interpolation between two points

Parameters
inValue1
inValue2
inPercent
Returns
linear interpolated point

◆ num2str()

template<typename dtype >
std::string nc::utils::num2str ( dtype  inNumber)

Converts the number into a string

Parameters
inNumber
Returns
std::string

◆ power()

template<typename dtype >
dtype nc::utils::power ( dtype  inValue,
uint8  inPower 
)
noexcept

Raises the input value to an integer power

Parameters
inValue
inPower
Returns
inValue raised to inPower

◆ powerf()

template<typename dtype1 , typename dtype2 >
auto nc::utils::powerf ( dtype1  inValue,
const dtype2  inPower 
)
noexcept

Raises the input value to a floating point power

Parameters
inValue
inPower
Returns
inValue raised to inPower

◆ sqr()

template<typename dtype >
constexpr dtype nc::utils::sqr ( dtype  inValue)
constexprnoexcept

Squares in input value

Parameters
inValue
Returns
squared value

◆ timeit()

template<typename TimeUnit , typename Function , typename... Args>
timeit_detail::Result< TimeUnit > nc::utils::timeit ( uint32  numIterations,
PrintResults  printResults,
Function  function,
Args &&...  args 
)
noexcept

Timing of a function

Parameters
numIterationsnumber of iterations for the timing statistics
printResultstrue to print the results
functionthe function to time
argsthe arguements that are forwarded to the function input
Returns
timing statistics

◆ value2str()

template<typename dtype >
std::string nc::utils::value2str ( dtype  inValue)

Converts the value into a string

Parameters
inValue
Returns
std::string