Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
uni20::mpcomplex Class Reference

Exact rational complex value or owning finite-precision MPC approximation. More...

#include <mpcomplex.hpp>

Public Types

using value_type = mpreal
 

Public Member Functions

mpcomplex at (Precision p) const
 
void copy_to (mpc_ptr destination) const
 Round into an initialized MPC destination at its existing component precisions.
 
mpreal imag () const
 
void imag (mpreal const &im)
 
bool initialized () const noexcept
 Whether this object holds exact or approximate numerical components.
 
bool is_exact () const noexcept
 Whether both components are exact rationals.
 
 mpcomplex ()
 Construct exact complex zero.
 
 mpcomplex (decimal_literal value)
 
 mpcomplex (decimal_literal value, Precision p)
 
 mpcomplex (exact_rational const &value)
 
 mpcomplex (exact_rational const &value, Precision p)
 
template<std::integral I>
requires (!std::same_as<I, bool>)
 mpcomplex (I value)
 
template<std::integral I>
requires (!std::same_as<I, bool>)
 mpcomplex (I value, Precision p)
 
 mpcomplex (mpc_srcptr value, Precision p)
 Copy a valid borrowed MPC value at finite component precision.
 
 mpcomplex (mpcomplex &&other) noexcept
 Transfer ownership, leaving the source unset.
 
 mpcomplex (mpcomplex const &)=default
 
 mpcomplex (mpcomplex const &other, Precision p)
 
 mpcomplex (mpreal const &re)
 
 mpcomplex (mpreal const &re, mpreal const &im)
 
 mpcomplex (mpreal const &re, mpreal const &im, Precision p)
 Construct components at explicit precision, or retain two exact components.
 
 mpcomplex (mpreal const &re, Precision p)
 
 mpcomplex (Precision p)
 
 mpcomplex (std::string_view re, std::string_view im, Precision p)
 
 mpcomplex (uninitialized_t) noexcept
 Construct an unset placeholder for overwrite storage.
 
mpc_srcptr native_handle () const
 Borrow an approximate MPC value; exact and unset states reject native access.
 
mpcomplex & operator*= (exact_rational const &rhs)
 
mpcomplex & operator*= (mpcomplex const &rhs)
 
mpcomplex & operator+= (exact_rational const &rhs)
 
mpcomplex & operator+= (mpcomplex const &rhs)
 
mpcomplex & operator-= (exact_rational const &rhs)
 
mpcomplex & operator-= (mpcomplex const &rhs)
 
mpcomplex & operator/= (exact_rational const &rhs)
 
mpcomplex & operator/= (mpcomplex const &rhs)
 
mpcomplex & operator= (mpcomplex other) noexcept
 
Precision precision () const
 
mpreal real () const
 Return an owning component with the same exact/approximate state.
 
void real (mpreal const &re)
 Replace a component, preserving finite precision or adopting the first approximate component's precision.
 
void swap (mpcomplex &other) noexcept
 

Detailed Description

Exact rational complex value or owning finite-precision MPC approximation.

Both components are exact, or both have the same finite precision. An exact component combined with an approximate component converts at that component's precision. Arithmetic is eager; finite operations round to nearest, ties to even. Default construction is exact zero.

Member Typedef Documentation

◆ value_type

Constructor & Destructor Documentation

◆ mpcomplex() [1/18]

uni20::mpcomplex::mpcomplex ( )
inline

Construct exact complex zero.

◆ mpcomplex() [2/18]

uni20::mpcomplex::mpcomplex ( uninitialized_t  )
inlineexplicitnoexcept

Construct an unset placeholder for overwrite storage.

◆ mpcomplex() [3/18]

uni20::mpcomplex::mpcomplex ( Precision  p)
inlineexplicit

◆ mpcomplex() [4/18]

uni20::mpcomplex::mpcomplex ( mpreal const &  re,
mpreal const &  im,
Precision  p 
)
inline

Construct components at explicit precision, or retain two exact components.

◆ mpcomplex() [5/18]

uni20::mpcomplex::mpcomplex ( mpreal const &  re,
mpreal const &  im 
)
inline

◆ mpcomplex() [6/18]

uni20::mpcomplex::mpcomplex ( mpreal const &  re)
inline

◆ mpcomplex() [7/18]

uni20::mpcomplex::mpcomplex ( mpreal const &  re,
Precision  p 
)
inline

◆ mpcomplex() [8/18]

template<std::integral I>
requires (!std::same_as<I, bool>)
uni20::mpcomplex::mpcomplex ( I  value)
inlineexplicit

◆ mpcomplex() [9/18]

uni20::mpcomplex::mpcomplex ( exact_rational const &  value)
inlineexplicit

◆ mpcomplex() [10/18]

uni20::mpcomplex::mpcomplex ( decimal_literal  value)
inlineexplicit

◆ mpcomplex() [11/18]

template<std::integral I>
requires (!std::same_as<I, bool>)
uni20::mpcomplex::mpcomplex ( I  value,
Precision  p 
)
inline

◆ mpcomplex() [12/18]

uni20::mpcomplex::mpcomplex ( exact_rational const &  value,
Precision  p 
)
inline

◆ mpcomplex() [13/18]

uni20::mpcomplex::mpcomplex ( decimal_literal  value,
Precision  p 
)
inline

◆ mpcomplex() [14/18]

uni20::mpcomplex::mpcomplex ( std::string_view  re,
std::string_view  im,
Precision  p 
)
inline

◆ mpcomplex() [15/18]

uni20::mpcomplex::mpcomplex ( mpcomplex const &  other,
Precision  p 
)
inline

◆ mpcomplex() [16/18]

uni20::mpcomplex::mpcomplex ( mpc_srcptr  value,
Precision  p 
)
inlineexplicit

Copy a valid borrowed MPC value at finite component precision.

Precondition
value points to an initialized MPC object during this call.

◆ mpcomplex() [17/18]

uni20::mpcomplex::mpcomplex ( mpcomplex const &  )
default

◆ mpcomplex() [18/18]

uni20::mpcomplex::mpcomplex ( mpcomplex &&  other)
inlinenoexcept

Transfer ownership, leaving the source unset.

Member Function Documentation

◆ at()

mpcomplex uni20::mpcomplex::at ( Precision  p) const
inline

◆ copy_to()

void uni20::mpcomplex::copy_to ( mpc_ptr  destination) const
inline

Round into an initialized MPC destination at its existing component precisions.

◆ imag() [1/2]

mpreal uni20::mpcomplex::imag ( ) const
inline

◆ imag() [2/2]

void uni20::mpcomplex::imag ( mpreal const &  im)
inline

◆ initialized()

bool uni20::mpcomplex::initialized ( ) const
inlinenoexcept

Whether this object holds exact or approximate numerical components.

◆ is_exact()

bool uni20::mpcomplex::is_exact ( ) const
inlinenoexcept

Whether both components are exact rationals.

◆ native_handle()

mpc_srcptr uni20::mpcomplex::native_handle ( ) const
inline

Borrow an approximate MPC value; exact and unset states reject native access.

◆ operator*=() [1/2]

mpcomplex & uni20::mpcomplex::operator*= ( exact_rational const &  rhs)
inline

◆ operator*=() [2/2]

mpcomplex & uni20::mpcomplex::operator*= ( mpcomplex const &  rhs)
inline

◆ operator+=() [1/2]

mpcomplex & uni20::mpcomplex::operator+= ( exact_rational const &  rhs)
inline

◆ operator+=() [2/2]

mpcomplex & uni20::mpcomplex::operator+= ( mpcomplex const &  rhs)
inline

◆ operator-=() [1/2]

mpcomplex & uni20::mpcomplex::operator-= ( exact_rational const &  rhs)
inline

◆ operator-=() [2/2]

mpcomplex & uni20::mpcomplex::operator-= ( mpcomplex const &  rhs)
inline

◆ operator/=() [1/2]

mpcomplex & uni20::mpcomplex::operator/= ( exact_rational const &  rhs)
inline

◆ operator/=() [2/2]

mpcomplex & uni20::mpcomplex::operator/= ( mpcomplex const &  rhs)
inline

◆ operator=()

mpcomplex & uni20::mpcomplex::operator= ( mpcomplex  other)
inlinenoexcept

◆ precision()

Precision uni20::mpcomplex::precision ( ) const
inline

◆ real() [1/2]

mpreal uni20::mpcomplex::real ( ) const
inline

Return an owning component with the same exact/approximate state.

◆ real() [2/2]

void uni20::mpcomplex::real ( mpreal const &  re)
inline

Replace a component, preserving finite precision or adopting the first approximate component's precision.

◆ swap()

void uni20::mpcomplex::swap ( mpcomplex &  other)
inlinenoexcept

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