pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
pRC::Float< W > Class Template Reference

Top-level class storing a floating point number. More...

#include <float.hpp>

Public Types

using Fundamental = Conditional< IsSatisfied<(W==16)>, BFloat16, Conditional< IsSatisfied<(W==32)>, float, Conditional< IsSatisfied<(W==64)>, double, Undefined > > >
 
using Value = Float< W >
 
template<class V , If< IsValue< V > > = 0>
using ChangeValue = V
 
using Signed = True<>
 
template<Bool R>
using ChangeSigned = Conditional< IsSatisfied<(R)>, Float< W >, Undefined >
 
using Width = pRC::Constant< Size, W >
 
template<Size Q>
using ChangeWidth = Float< Q >
 
using IsComplexified = False<>
 
using Complexify = Complex< Float< W > >
 
using NonComplex = Float< W >
 

Public Member Functions

 ~Float ()=default
 
constexpr Float (Float const &)=default
 
constexpr Float (Float &&)=default
 
constexpr Floatoperator= (Float const &) &=default
 
constexpr Floatoperator= (Float &&) &=default
 
constexpr Float ()=default
 
template<class U , If< IsConstructible< Fundamental, U > > = 0>
constexpr Float (U const basic)
 Float initializer from standard data types (like float, double)
 
template<class U , If< IsValue< U > > = 0>
constexpr Float (U const &value)
 Float initializer from pRC value data type (like Float, Integer)
 
template<class U , If< IsValue< U > > = 0>
constexpr Float (Complex< U > const &value)
 Float initializer from pRC::Complex object.
 
constexpr Float (Zero<> const)
 Float initializer from pRC::Zero.
 
constexpr Float (Unit<> const)
 Float initializer from pRC::Unit.
 
constexpr Float (Identity<> const)
 Float initializer from pRC::Identity.
 
template<class U , If< IsAssignable< Fundamental, U > > = 0>
constexpr autooperator= (U const basic) &
 Float assignment from standard data types (like float, double)
 
template<class U , If< IsValue< U > > = 0>
constexpr autooperator= (U const &value) &
 Float assignment from pRC value data type (like Float, Integer)
 
template<class U , If< IsValue< U > > = 0>
constexpr autooperator= (Complex< U > const &value) &
 Float assignment from Complex object.
 
constexpr autooperator= (Zero<> const) &
 Float assignment from pRC::Zero.
 
constexpr autooperator= (Unit<> const) &
 Float assignment from pRC::Unit.
 
constexpr autooperator= (Identity<> const) &
 Float assignment from pRC::Identity.
 
constexpr decltype(autooperator() () &&
 
constexpr decltype(autooperator() () const &&
 
constexpr autooperator() () &
 
constexpr autooperator() () const &
 
constexpr operator Fundamental () const
 
template<class X , If< IsInvocable< Add, Float &, X > > = 0>
constexpr autooperator+= (X &&rhs) &
 += operator for Float
 
template<class X , If< IsInvocable< Sub, Float &, X > > = 0>
constexpr autooperator-= (X &&rhs) &
 -= operator for Float
 
template<class X , If< IsInvocable< Mul, Float &, X > > = 0>
constexpr autooperator*= (X &&rhs) &
 *= operator for Float
 
template<class X , If< IsInvocable< Div, Float &, X > > = 0>
constexpr autooperator/= (X &&rhs) &
 /= operator for Float
 

Detailed Description

template<Size W>
class pRC::Float< W >

Top-level class storing a floating point number.

Floating-point numbers are supported for widths 16 (half-precision), 32 (standard-precision) and 64 (double-precision). See also Top-level Value types in pRC for an overview of pRCs builtin types.

Float<32> and Float<64> store the value internally as float and double. Float<16> stores the value internally as a BFloat16, which utilizes the std::uint16_t type.

Template Parameters
WWidth of the floating point number (16, 32 or 64)

Member Typedef Documentation

◆ ChangeSigned

template<Size W>
template<Bool R>
using pRC::Float< W >::ChangeSigned = Conditional<IsSatisfied<(R)>, Float<W>, Undefined>

◆ ChangeValue

template<Size W>
template<class V , If< IsValue< V > > = 0>
using pRC::Float< W >::ChangeValue = V

◆ ChangeWidth

template<Size W>
template<Size Q>
using pRC::Float< W >::ChangeWidth = Float<Q>

◆ Complexify

template<Size W>
using pRC::Float< W >::Complexify = Complex<Float<W> >

◆ Fundamental

template<Size W>
using pRC::Float< W >::Fundamental = Conditional<IsSatisfied<(W == 16)>, BFloat16, Conditional<IsSatisfied<(W == 32)>, float, Conditional<IsSatisfied<(W == 64)>, double, Undefined> >>

◆ IsComplexified

template<Size W>
using pRC::Float< W >::IsComplexified = False<>

◆ NonComplex

template<Size W>
using pRC::Float< W >::NonComplex = Float<W>

◆ Signed

template<Size W>
using pRC::Float< W >::Signed = True<>

◆ Value

template<Size W>
using pRC::Float< W >::Value = Float<W>

◆ Width

template<Size W>
using pRC::Float< W >::Width = pRC::Constant<Size, W>

Constructor & Destructor Documentation

◆ ~Float()

template<Size W>
pRC::Float< W >::~Float ( )
default

◆ Float() [1/9]

template<Size W>
constexpr pRC::Float< W >::Float ( Float< W > const )
constexprdefault

◆ Float() [2/9]

template<Size W>
constexpr pRC::Float< W >::Float ( Float< W > &&  )
constexprdefault

◆ Float() [3/9]

template<Size W>
constexpr pRC::Float< W >::Float ( )
constexprdefault

◆ Float() [4/9]

template<Size W>
template<class U , If< IsConstructible< Fundamental, U > > = 0>
constexpr pRC::Float< W >::Float ( U const  basic)
inlineconstexpr

Float initializer from standard data types (like float, double)

This function allows for initialization of Float objects using literals or standard floating point variables.

Template Parameters
Uinitializer type (inferred)
Parameters
basicinitializer of compatible type

◆ Float() [5/9]

template<Size W>
template<class U , If< IsValue< U > > = 0>
constexpr pRC::Float< W >::Float ( U const value)
inlineconstexpr

Float initializer from pRC value data type (like Float, Integer)

Template Parameters
Uinitializer type (inferred)
Parameters
valueinitializer of compatible type

◆ Float() [6/9]

template<Size W>
template<class U , If< IsValue< U > > = 0>
constexpr pRC::Float< W >::Float ( Complex< U > const value)
inlineconstexpr

Float initializer from pRC::Complex object.

This initializes the Float to the real part of the Complex object.

Template Parameters
Uinitializer type (inferred)
Parameters
valueComplex initializer

◆ Float() [7/9]

template<Size W>
constexpr pRC::Float< W >::Float ( Zero<> const  )
inlineconstexpr

Float initializer from pRC::Zero.

Parameters
_pRC::Zero object

◆ Float() [8/9]

template<Size W>
constexpr pRC::Float< W >::Float ( Unit<> const  )
inlineconstexpr

Float initializer from pRC::Unit.

Parameters
_pRC::Unit object

◆ Float() [9/9]

template<Size W>
constexpr pRC::Float< W >::Float ( Identity<> const  )
inlineconstexpr

Float initializer from pRC::Identity.

Parameters
_pRC::Identity object

Member Function Documentation

◆ operator Fundamental()

template<Size W>
constexpr pRC::Float< W >::operator Fundamental ( ) const
inlineexplicitconstexpr

◆ operator()() [1/4]

template<Size W>
constexpr auto & pRC::Float< W >::operator() ( ) &
inlineconstexpr

◆ operator()() [2/4]

template<Size W>
constexpr decltype(auto) pRC::Float< W >::operator() ( ) &&
inlineconstexpr

◆ operator()() [3/4]

template<Size W>
constexpr auto & pRC::Float< W >::operator() ( ) const &
inlineconstexpr

◆ operator()() [4/4]

template<Size W>
constexpr decltype(auto) pRC::Float< W >::operator() ( ) const &&
inlineconstexpr

◆ operator*=()

template<Size W>
template<class X , If< IsInvocable< Mul, Float &, X > > = 0>
constexpr auto & pRC::Float< W >::operator*= ( X &&  rhs) &
inlineconstexpr

*= operator for Float

Template Parameters
XpRC value class (inferred)
Parameters
rhsobject of class X, multiplier

◆ operator+=()

template<Size W>
template<class X , If< IsInvocable< Add, Float &, X > > = 0>
constexpr auto & pRC::Float< W >::operator+= ( X &&  rhs) &
inlineconstexpr

+= operator for Float

Template Parameters
XpRC value class (inferred)
Parameters
rhsobject of class X, addend

◆ operator-=()

template<Size W>
template<class X , If< IsInvocable< Sub, Float &, X > > = 0>
constexpr auto & pRC::Float< W >::operator-= ( X &&  rhs) &
inlineconstexpr

-= operator for Float

Template Parameters
XpRC value class (inferred)
Parameters
rhsobject of class X, subtrahend

◆ operator/=()

template<Size W>
template<class X , If< IsInvocable< Div, Float &, X > > = 0>
constexpr auto & pRC::Float< W >::operator/= ( X &&  rhs) &
inlineconstexpr

/= operator for Float

Template Parameters
XpRC value class (inferred)
Parameters
rhsobject of class X, divisor

◆ operator=() [1/8]

template<Size W>
template<class U , If< IsValue< U > > = 0>
constexpr auto & pRC::Float< W >::operator= ( Complex< U > const value) &
inlineconstexpr

Float assignment from Complex object.

This assigns the real part of the Complex object to the Float.

Template Parameters
Uassigned object type (inferred)
Parameters
valueassigned object

◆ operator=() [2/8]

template<Size W>
constexpr Float & pRC::Float< W >::operator= ( Float< W > &&  ) &
constexprdefault

◆ operator=() [3/8]

template<Size W>
constexpr Float & pRC::Float< W >::operator= ( Float< W > const ) &
constexprdefault

◆ operator=() [4/8]

template<Size W>
constexpr auto & pRC::Float< W >::operator= ( Identity<> const  ) &
inlineconstexpr

Float assignment from pRC::Identity.

Parameters
_pRC::Identity object

◆ operator=() [5/8]

template<Size W>
template<class U , If< IsValue< U > > = 0>
constexpr auto & pRC::Float< W >::operator= ( U const value) &
inlineconstexpr

Float assignment from pRC value data type (like Float, Integer)

Template Parameters
Uassigned object type (inferred)
Parameters
valueassigned object of compatible type

◆ operator=() [6/8]

template<Size W>
template<class U , If< IsAssignable< Fundamental, U > > = 0>
constexpr auto & pRC::Float< W >::operator= ( U const  basic) &
inlineconstexpr

Float assignment from standard data types (like float, double)

This function allows for assignment of Float objects using literals or standard floating point variables.

Template Parameters
Uassigned object type (inferred)
Parameters
basicassigned object of compatible type

◆ operator=() [7/8]

template<Size W>
constexpr auto & pRC::Float< W >::operator= ( Unit<> const  ) &
inlineconstexpr

Float assignment from pRC::Unit.

Parameters
_pRC::Unit object

◆ operator=() [8/8]

template<Size W>
constexpr auto & pRC::Float< W >::operator= ( Zero<> const  ) &
inlineconstexpr

Float assignment from pRC::Zero.

Parameters
_pRC::Zero object

The documentation for this class was generated from the following file: