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

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

#include <integer.hpp>

Public Types

using Fundamental = Conditional< IsSatisfied<(S)>, Conditional< IsSatisfied<(W==8)>, std::int8_t, Conditional< IsSatisfied<(W==16)>, std::int16_t, Conditional< IsSatisfied<(W==32)>, std::int32_t, Conditional< IsSatisfied<(W==64)>, std::int64_t, Undefined > > > >, Conditional< IsSatisfied<(W==8)>, std::uint8_t, Conditional< IsSatisfied<(W==16)>, std::uint16_t, Conditional< IsSatisfied<(W==32)>, std::uint32_t, Conditional< IsSatisfied<(W==64)>, std::uint64_t, Undefined > > > > >
 
using Value = Integer< S, W >
 
template<class V , If< IsValue< V > > = 0>
using ChangeValue = V
 
using Signed = pRC::Constant< Bool, S >
 
template<Bool R>
using ChangeSigned = Integer< R, W >
 
using Width = pRC::Constant< Size, W >
 
template<Size Q>
using ChangeWidth = Integer< S, Q >
 
using IsComplexified = False<>
 
using Complexify = Complex< Integer< S, W > >
 
using NonComplex = Integer< S, W >
 

Public Member Functions

 ~Integer ()=default
 
constexpr Integer (Integer const &)=default
 
constexpr Integer (Integer &&)=default
 
constexpr Integeroperator= (Integer const &) &=default
 
constexpr Integeroperator= (Integer &&) &=default
 
constexpr Integer ()=default
 
template<class U , If< IsConstructible< Fundamental, U > > = 0>
constexpr Integer (U const basic)
 Integer initializer from standard data types (like int, unsigned)
 
template<class U , If< IsValue< U > > = 0>
constexpr Integer (U const &value)
 Integer initializer from pRC value data type (like Float, Integer)
 
template<class U , If< IsValue< U > > = 0>
constexpr Integer (Complex< U > const &value)
 Integer initializer from pRC::Complex object.
 
constexpr Integer (Zero<> const)
 Integer initializer from pRC::Zero.
 
constexpr Integer (Unit<> const)
 Integer initializer from pRC::Unit.
 
constexpr Integer (Identity<> const)
 Integer initializer from pRC::Identity.
 
template<class U , If< IsAssignable< Fundamental, U > > = 0>
constexpr autooperator= (U const basic) &
 Integer assignment from standard data types (like int, unsigned)
 
template<class U , If< IsValue< U > > = 0>
constexpr autooperator= (U const &value) &
 Integer asignment from pRC value data type (like Float, Integer)
 
template<class U , If< IsValue< U > > = 0>
constexpr autooperator= (Complex< U > const &value) &
 Integer assignment from Complex object.
 
constexpr autooperator= (Zero<> const) &
 Integer assignment from pRC::Zero.
 
constexpr autooperator= (Unit<> const) &
 Integer assignment from pRC::Unit.
 
constexpr autooperator= (Identity<> const) &
 Integer 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, Integer &, X > > = 0>
constexpr autooperator+= (X &&rhs) &
 += operator for Integer
 
template<class X , If< IsInvocable< Sub, Integer &, X > > = 0>
constexpr autooperator-= (X &&rhs) &
 -= operator for Integer
 
template<class X , If< IsInvocable< Mul, Integer &, X > > = 0>
constexpr autooperator*= (X &&rhs) &
 *= operator for Integer
 
template<class X , If< IsInvocable< Div, Integer &, X > > = 0>
constexpr autooperator/= (X &&rhs) &
 /= operator for Integer
 
template<class X , If< IsInvocable< Mod, Integer &, X > > = 0>
constexpr autooperator%= (X &&rhs) &
 %= operator for Integer
 

Detailed Description

template<Bool S, Size W>
class pRC::Integer< S, W >

Top-level class storing a floating point number.

Signed and unsigned integers are supported for widths 8, 16, 32 and 64. They are internally stored as standard data types according to the following table:

Width Signed Internal data type
8 true std::int8_t
false std::uint8_t
16 true std::int16_t
false std::uint16_t
32 true std::int32_t
false std::uint32_t
64 true std::in64_t
false std::uint64_t

See also Top-level Value types in pRC for an overview of pRCs builtin types.

Template Parameters
Strue for signed, false for unsigned Integer
WWidth of the Integer (8, 16, 32 or 64)

Member Typedef Documentation

◆ ChangeSigned

template<Bool S, Size W>
template<Bool R>
using pRC::Integer< S, W >::ChangeSigned = Integer<R, W>

◆ ChangeValue

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

◆ ChangeWidth

template<Bool S, Size W>
template<Size Q>
using pRC::Integer< S, W >::ChangeWidth = Integer<S, Q>

◆ Complexify

template<Bool S, Size W>
using pRC::Integer< S, W >::Complexify = Complex<Integer<S, W> >

◆ Fundamental

template<Bool S, Size W>
using pRC::Integer< S, W >::Fundamental = Conditional<IsSatisfied<(S)>, Conditional<IsSatisfied<(W == 8)>, std::int8_t, Conditional<IsSatisfied<(W == 16)>, std::int16_t, Conditional<IsSatisfied<(W == 32)>, std::int32_t, Conditional<IsSatisfied<(W == 64)>, std::int64_t, Undefined> >> >, Conditional<IsSatisfied<(W == 8)>, std::uint8_t, Conditional<IsSatisfied<(W == 16)>, std::uint16_t, Conditional<IsSatisfied<(W == 32)>, std::uint32_t, Conditional<IsSatisfied<(W == 64)>, std::uint64_t, Undefined> >> >>

◆ IsComplexified

template<Bool S, Size W>
using pRC::Integer< S, W >::IsComplexified = False<>

◆ NonComplex

template<Bool S, Size W>
using pRC::Integer< S, W >::NonComplex = Integer<S, W>

◆ Signed

template<Bool S, Size W>
using pRC::Integer< S, W >::Signed = pRC::Constant<Bool, S>

◆ Value

template<Bool S, Size W>
using pRC::Integer< S, W >::Value = Integer<S, W>

◆ Width

template<Bool S, Size W>
using pRC::Integer< S, W >::Width = pRC::Constant<Size, W>

Constructor & Destructor Documentation

◆ ~Integer()

template<Bool S, Size W>
pRC::Integer< S, W >::~Integer ( )
default

◆ Integer() [1/9]

template<Bool S, Size W>
constexpr pRC::Integer< S, W >::Integer ( Integer< S, W > const )
constexprdefault

◆ Integer() [2/9]

template<Bool S, Size W>
constexpr pRC::Integer< S, W >::Integer ( Integer< S, W > &&  )
constexprdefault

◆ Integer() [3/9]

template<Bool S, Size W>
constexpr pRC::Integer< S, W >::Integer ( )
constexprdefault

◆ Integer() [4/9]

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

Integer initializer from standard data types (like int, unsigned)

This function allows for initializations of Integer objects using literals or standard floating point variables.

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

◆ Integer() [5/9]

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

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

Template Parameters
Uinitializer type (inferred)
valueinitializer of compatible type

◆ Integer() [6/9]

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

Integer initializer from pRC::Complex object.

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

Template Parameters
Uinitializer type (inferred)
Parameters
valueComplex initializer

◆ Integer() [7/9]

template<Bool S, Size W>
constexpr pRC::Integer< S, W >::Integer ( Zero<> const  )
inlineconstexpr

Integer initializer from pRC::Zero.

Parameters
_pRC::Zero object

◆ Integer() [8/9]

template<Bool S, Size W>
constexpr pRC::Integer< S, W >::Integer ( Unit<> const  )
inlineconstexpr

Integer initializer from pRC::Unit.

Parameters
_pRC::Unit object

◆ Integer() [9/9]

template<Bool S, Size W>
constexpr pRC::Integer< S, W >::Integer ( Identity<> const  )
inlineconstexpr

Integer initializer from pRC::Identity.

Parameters
_pRC::Identity object

Member Function Documentation

◆ operator Fundamental()

template<Bool S, Size W>
constexpr pRC::Integer< S, W >::operator Fundamental ( ) const
inlineexplicitconstexpr

◆ operator%=()

template<Bool S, Size W>
template<class X , If< IsInvocable< Mod, Integer &, X > > = 0>
constexpr auto & pRC::Integer< S, W >::operator%= ( X &&  rhs) &
inlineconstexpr

%= operator for Integer

Template Parameters
XpRC value class
Parameters
rhsobject of class X, divisor

◆ operator()() [1/4]

template<Bool S, Size W>
constexpr auto & pRC::Integer< S, W >::operator() ( ) &
inlineconstexpr

◆ operator()() [2/4]

template<Bool S, Size W>
constexpr decltype(auto) pRC::Integer< S, W >::operator() ( ) &&
inlineconstexpr

◆ operator()() [3/4]

template<Bool S, Size W>
constexpr auto & pRC::Integer< S, W >::operator() ( ) const &
inlineconstexpr

◆ operator()() [4/4]

template<Bool S, Size W>
constexpr decltype(auto) pRC::Integer< S, W >::operator() ( ) const &&
inlineconstexpr

◆ operator*=()

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

*= operator for Integer

Template Parameters
XpRC value class
Parameters
rhsobject of class X, multiplier

◆ operator+=()

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

+= operator for Integer

Template Parameters
XpRC value class
Parameters
rhsobject of class X, addend

◆ operator-=()

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

-= operator for Integer

Template Parameters
XpRC value class
Parameters
rhsobject of class X, subtrahend

◆ operator/=()

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

/= operator for Integer

The result of this is obtained by integer division

Template Parameters
XpRC value class
Parameters
rhsobject of class X, divisor

◆ operator=() [1/8]

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

Integer assignment from Complex object.

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

Template Parameters
Uassigned object type (inferred)
Parameters
valueassigned object

◆ operator=() [2/8]

template<Bool S, Size W>
constexpr auto & pRC::Integer< S, W >::operator= ( Identity<> const  ) &
inlineconstexpr

Integer assignment from pRC::Identity.

Parameters
_pRC::Identity object

◆ operator=() [3/8]

template<Bool S, Size W>
constexpr Integer & pRC::Integer< S, W >::operator= ( Integer< S, W > &&  ) &
constexprdefault

◆ operator=() [4/8]

template<Bool S, Size W>
constexpr Integer & pRC::Integer< S, W >::operator= ( Integer< S, W > const ) &
constexprdefault

◆ operator=() [5/8]

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

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

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

◆ operator=() [6/8]

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

Integer assignment from standard data types (like int, unsigned)

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

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

◆ operator=() [7/8]

template<Bool S, Size W>
constexpr auto & pRC::Integer< S, W >::operator= ( Unit<> const  ) &
inlineconstexpr

Integer assignment from pRC::Unit.

Parameters
_pRC::Unit object

◆ operator=() [8/8]

template<Bool S, Size W>
constexpr auto & pRC::Integer< S, W >::operator= ( Zero<> const  ) &
inlineconstexpr

Integer assignment from pRC::Zero.

Parameters
_pRC::Zero object

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