REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
Public Member Functions | Static Public Member Functions | Protected Attributes | Friends
TRestComplex Class Reference

Detailed Description

A generic class to handle complex numbers with real precision.

TRestComplex is a class that defines static methods with mathematical operations using complex numbers. This class has been generated by refurbishing the existing ROOT TComplex object and updating the double type by real MPFR types that allow to define an arbitrary precision.

It is possible to redefine the numbers precision as number of digits using TRestComplex::SetPrecision.

Code example inside restRoot:

root [0] TRestComplex::SetPrecision(30)
root [1] TRestComplex a
(TRestComplex &) (1,0i)
root [2] TRestComplex b(1.e-15)
(TRestComplex &) (1e-15,0i)
root [3] TRestComplex c(0,1)
(TRestComplex &) (0,1i)
root [4] TRestComplex d(0,1.e-25)
(TRestComplex &) (0,1e-25i)
root [5] a + b + c + d
(TRestComplex) (1.000000000000001,1.0000000000000000000000001i)
root [6] TRestComplex e = (a+b)/(c+d)
(TRestComplex &) (0,-1.0000000000000009999999999i)
A generic class to handle complex numbers with real precision.
Definition: TRestComplex.h:33

RESTsoft - Software for Rare Event Searches with TPCs

History of developments:

2016-December: First concept. Javier Galan

Author
Javier Galan javie.nosp@m.r.ga.nosp@m.lan@u.nosp@m.niza.nosp@m.r.es

Definition at line 33 of file TRestComplex.h.

#include <TRestComplex.h>

Public Member Functions

mpfr::mpreal Im () const
 
 operator Double_t () const
 
 operator Float_t () const
 
 operator Int_t () const
 
TRestComplex operator() (mpfr::mpreal x, mpfr::mpreal y, Bool_t polar=kFALSE)
 
TRestComplex operator* (const TRestComplex &c) const
 
TRestComplex operator* (mpfr::mpreal c) const
 
TRestComplex operator*= (const TRestComplex &c)
 
TRestComplex operator+ ()
 
TRestComplex operator+ (const TRestComplex &c) const
 
TRestComplex operator+ (mpfr::mpreal c) const
 
TRestComplex operator+= (const TRestComplex &c)
 
TRestComplex operator- ()
 
TRestComplex operator- (const TRestComplex &c) const
 
TRestComplex operator- (mpfr::mpreal c) const
 
TRestComplex operator-= (const TRestComplex &c)
 
TRestComplex operator/ (const TRestComplex &c) const
 
TRestComplex operator/ (mpfr::mpreal c) const
 
TRestComplex operator/= (const TRestComplex &c)
 
mpfr::mpreal Re () const
 
mpfr::mpreal Rho () const
 
mpfr::mpreal Rho2 () const
 
int Sign (const mpfr::mpreal &re, const mpfr::mpreal &im)
 
mpfr::mpreal Theta () const
 
 TRestComplex (mpfr::mpreal re, mpfr::mpreal im=0, Bool_t polar=kFALSE)
 Standard constructor.
 

Static Public Member Functions

static mpfr::mpreal Abs (const TRestComplex &c)
 
static TRestComplex ACos (const TRestComplex &c)
 
static TRestComplex ACosH (const TRestComplex &c)
 
static TRestComplex ASin (const TRestComplex &c)
 
static TRestComplex ASinH (const TRestComplex &c)
 
static TRestComplex ATan (const TRestComplex &c)
 
static TRestComplex ATanH (const TRestComplex &c)
 
static TRestComplex Conjugate (const TRestComplex &c)
 
static TRestComplex Cos (const TRestComplex &c)
 
static TRestComplex CosH (const TRestComplex &c)
 
static TRestComplex Exp (const TRestComplex &c)
 
static int GetPrecision ()
 
static TRestComplex I ()
 
static Int_t IsNaN (const TRestComplex &c)
 
static TRestComplex Log (const TRestComplex &c)
 
static TRestComplex Log10 (const TRestComplex &c)
 
static TRestComplex Log2 (const TRestComplex &c)
 
static TRestComplex Max (const TRestComplex &a, const TRestComplex &b)
 
static TRestComplex Min (const TRestComplex &a, const TRestComplex &b)
 
static TRestComplex Normalize (const TRestComplex &c)
 
static TRestComplex One ()
 
static TRestComplex Power (const TRestComplex &x, const TRestComplex &y)
 
static TRestComplex Power (const TRestComplex &x, Int_t y)
 
static TRestComplex Power (const TRestComplex &x, mpfr::mpreal y)
 
static TRestComplex Power (mpfr::mpreal x, const TRestComplex &y)
 
static TRestComplex Range (const TRestComplex &lb, const TRestComplex &ub, const TRestComplex &c)
 
static void SetPrecision (Int_t precision)
 
static TRestComplex Sin (const TRestComplex &c)
 
static TRestComplex SinH (const TRestComplex &c)
 
static TRestComplex Sqrt (const TRestComplex &c)
 
static TRestComplex Tan (const TRestComplex &c)
 
static TRestComplex TanH (const TRestComplex &c)
 

Protected Attributes

mpfr::mpreal fIm = 0
 The imaginary part of the complex number using MPFR precision.
 
mpfr::mpreal fRe = 1
 The real part of the complex number using MPFR precision.
 

Friends

TRestComplex operator* (Double_t d, const TRestComplex &c)
 
TRestComplex operator+ (Double_t d, const TRestComplex &c)
 
TRestComplex operator- (Double_t d, const TRestComplex &c)
 
TRestComplex operator/ (Double_t d, const TRestComplex &c)
 
std::ostream & operator<< (std::ostream &out, const TRestComplex &c)
 
std::istream & operator>> (std::istream &in, TRestComplex &c)
 

Member Function Documentation

◆ ACos()

static TRestComplex TRestComplex::ACos ( const TRestComplex c)
inlinestatic

MUST be implemented

Definition at line 149 of file TRestComplex.h.

◆ ACosH()

static TRestComplex TRestComplex::ACosH ( const TRestComplex c)
inlinestatic

MUST be implemented

Definition at line 174 of file TRestComplex.h.

◆ ASin()

static TRestComplex TRestComplex::ASin ( const TRestComplex c)
inlinestatic

MUST be implemented

Definition at line 144 of file TRestComplex.h.

◆ ASinH()

static TRestComplex TRestComplex::ASinH ( const TRestComplex c)
inlinestatic

MUST be implemented

Definition at line 169 of file TRestComplex.h.

◆ Sign()

int TRestComplex::Sign ( const mpfr::mpreal &  re,
const mpfr::mpreal &  im 
)
inline

MUST be implemented

Definition at line 139 of file TRestComplex.h.


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