ROOTPWA
|
Fractional Number. More...
#include <TFracNum.h>
Public Member Functions | |
TFracNum () | |
Default constructor with numerator and denominator set to 1. | |
TFracNum (Int_t mN, Int_t mD, Int_t *N, Int_t *D, Int_t s) | |
Constructor using the internal representation of the class. | |
TFracNum (Int_t inom, Int_t iden) | |
Constructor by the integer values of the numerator and denominator. | |
TFracNum (Int_t N, Int_t D, const char *s) | |
Constructor when numerator and denominator are factorial numbers, N!/D! | |
Int_t | DenomCommonDivisor (const TFracNum &) const |
Largest common divisor of numerator and denominator. | |
TFracNum * | SumSignedRoots (TFracNum *) |
The return value c satisfies ssqrt(c)=ssqrt(a)+ssqrt(b) | |
const char * | FracString () |
String in the form Num/Den. If Den=1, only Num is given. | |
const char * | FracStringSqrt () |
String of the square-root in the form Num/Den#RNum/RDen | |
Double_t | Print () const |
Complete information about the fractional number is put to cout. | |
Double_t | PrintToErr () const |
Complete information about the fractional number is put to cerr. | |
Double_t | Dval () |
Return the double-precision real value. | |
Bool_t | Sqrt () |
Try square root operation. | |
Bool_t | FlipSign () |
Flip sign of number. | |
Bool_t | Abs () |
Force sign to plus. | |
Bool_t | Invert () |
Inversion of number, so nominator and denumerator are flipped. | |
Int_t | GetSign () |
Return sign as +1 (also for zero or undefined number) or -1. | |
Int_t | GetNumerator () |
Return numerator. | |
Int_t | GetDenominator () |
Return denominator. | |
Bool_t | PrintDifference (const TFracNum &) const |
Output some comparative values for two fractional numbers. | |
char * | HeaderString () |
String containing NOM and DEN. | |
Bool_t | operator== (const TFracNum &) const |
Check whether two fractional numbers are equal. | |
Bool_t | operator> (const TFracNum &) const |
Check whether left-hand number is greater than right-hand number. | |
TFracNum | operator* (const TFracNum &) const |
Multiply two fractional numbers. | |
TFracNum | operator+ (const TFracNum &) const |
Add two fractional numbers. | |
Bool_t | SetINTs () |
Private Attributes | |
Int_t | maxPrimNom |
Int_t | maxPrimDen |
Int_t * | NOM |
Int_t * | DEN |
Int_t | sign_prefac |
Int_t | NOM_INT |
Int_t | DEN_INT |
Double_t | dvalue |
Fractional Number.
Fractional number with numerator and denominator represented by their prime number decomposition.
Some arithmetical operations are included but not complete.
Definition at line 38 of file TFracNum.h.
|
inline |
Default constructor with numerator and denominator set to 1.
Definition at line 71 of file TFracNum.h.
References DEN, maxPrimDen, maxPrimNom, NOM, and sign_prefac.
Constructor using the internal representation of the class.
mN | index of the largest prime number in the numerator |
mD | index of the largest prime number in the denominator |
N | Field of exponents of the numerator's prime numbers up to mN |
D | Field of exponents of the denominator's prime numbers up to mD |
s | Sign variable 1 or -1 depending on the sign s =-6666 means "undetermined" (this is for example a consequence of a division zero by zero) -7777 means "infinity" (for example a consequence of division by zero) |
Definition at line 13 of file TFracNum.cc.
References D(), debugFracNum, i, and Int_t.
Constructor by the integer values of the numerator and denominator.
inom | numerator |
iden | denominator |
Definition at line 73 of file TFracNum.cc.
References debugFracNum, Double_t, i, Int_t, MAXPRIMSQUARED, NPRIMFIELD, and PRIMES.
Constructor when numerator and denominator are factorial numbers, N!/D!
This method is much faster than giving the factorials to TFracNum(inom, iden)
N | numerator |
D | denominator |
s | control string. For described function, set to "factorial", otherwise the number is set to 1 |
Definition at line 32 of file TFracNum.cc.
References D(), debugFracNum, i, Int_t, NPRIMFIELD, and PRIMES.
Bool_t TFracNum::Abs | ( | ) |
Force sign to plus.
Definition at line 311 of file TFracNum.cc.
Referenced by ClebschGordanBox::ClebschGordan(), ClebschGordanInteger(), and SumSignedRoots().
Largest common divisor of numerator and denominator.
Definition at line 246 of file TFracNum.cc.
References DEN, i, Int_t, maxPrimDen, and PRIMES.
|
inline |
Return the double-precision real value.
Definition at line 140 of file TFracNum.h.
References dvalue.
Referenced by TSpinWaveFunction::CheckCGFormula(), and SumSignedRoots().
Bool_t TFracNum::FlipSign | ( | ) |
Flip sign of number.
Definition at line 304 of file TFracNum.cc.
Referenced by TLSContrib::Add(), ClebschGordanBox::ClebschGordan(), ClebschGordanInteger(), SumSignedRoots(), and TLSContrib::TLSContrib().
const char * TFracNum::FracString | ( | ) |
String in the form Num/Den. If Den=1, only Num is given.
Definition at line 623 of file TFracNum.cc.
References IOUTSTRING.
Referenced by TSpinWaveFunction::CheckCGFormula(), and ClebschGordanBox::ClebschGordan().
const char * TFracNum::FracStringSqrt | ( | ) |
String of the square-root in the form Num/Den#RNum/RDen
All numbers after the '#' are to be square-rooted, so Num/Den#RNum/RDen=Num/Den*sqrt(RNum/RDen)
Definition at line 643 of file TFracNum.cc.
References Bool_t, Int_t, IOUTSTRING, NULLSTRING, PRIMES, and SQUAREROOT_CHAR.
Referenced by TLSContrib::TLSContrib().
|
inline |
Return denominator.
Definition at line 163 of file TFracNum.h.
References DEN_INT.
Referenced by TJSS::PrintHFILE().
|
inline |
Return numerator.
Definition at line 160 of file TFracNum.h.
References NOM_INT.
Referenced by TJSS::PrintHFILE().
Int_t TFracNum::GetSign | ( | ) |
Return sign as +1 (also for zero or undefined number) or -1.
Definition at line 350 of file TFracNum.cc.
Referenced by ClebschGordanBox::ClebschGordan(), ClebschGordanInteger(), and TJSS::PrintHFILE().
char * TFracNum::HeaderString | ( | ) |
String containing NOM and DEN.
Definition at line 405 of file TFracNum.cc.
Bool_t TFracNum::Invert | ( | ) |
Inversion of number, so nominator and denumerator are flipped.
Definition at line 320 of file TFracNum.cc.
References Int_t.
Referenced by TLSContrib::Add(), ClebschGordanBox::ClebschGordan(), ClebschGordanInteger(), TLSNonRel::PrintG(), and TLSContrib::TLSContrib().
Multiply two fractional numbers.
Definition at line 434 of file TFracNum.cc.
References debugFracNum, DEN, i, Int_t, maxPrimDen, maxPrimNom, NOM, and sign_prefac.
Add two fractional numbers.
Definition at line 423 of file TFracNum.cc.
References DEN_INT, Int_t, NOM_INT, and sign_prefac.
Check whether two fractional numbers are equal.
Definition at line 356 of file TFracNum.cc.
References DEN, i, Int_t, maxPrimDen, maxPrimNom, NOM, and sign_prefac.
Check whether left-hand number is greater than right-hand number.
Definition at line 416 of file TFracNum.cc.
References dvalue.
Double_t TFracNum::Print | ( | ) | const |
Complete information about the fractional number is put to cout.
Definition at line 511 of file TFracNum.cc.
References debugFracNum, Double_t, i, Int_t, and PRIMES.
Referenced by ClebschGordanBox::ClebschGordan(), and ClebschGordanInteger().
Output some comparative values for two fractional numbers.
Definition at line 369 of file TFracNum.cc.
References DEN, i, Int_t, maxPrimDen, maxPrimNom, NOM, and sign_prefac.
Double_t TFracNum::PrintToErr | ( | ) | const |
Bool_t TFracNum::SetINTs | ( | ) |
Definition at line 207 of file TFracNum.cc.
References Double_t, Int_t, and PRIMES.
Referenced by ClebschGordanBox::ClebschGordan().
Bool_t TFracNum::Sqrt | ( | ) |
Try square root operation.
In case of success, return true. In case this does not lead to a fractional number, the number is left untouched and return value is false
Definition at line 281 of file TFracNum.cc.
References debugFracNum, i, and Int_t.
Referenced by ClebschGordanBox::ClebschGordan(), ClebschGordanInteger(), and SumSignedRoots().
The return value c satisfies ssqrt(c)=ssqrt(a)+ssqrt(b)
Here the signed square root function ssqrt(n)=sign(n)*sqrt(abs(n)) is used
Definition at line 259 of file TFracNum.cc.
References Abs(), Bool_t, Dval(), FlipSign(), Sqrt(), and TFracNum_Two().
Referenced by TLSContrib::Add(), TTensorTerm::AddTwoTerms(), and TLSContrib::TLSContrib().
|
private |
Definition at line 55 of file TFracNum.h.
Referenced by DenomCommonDivisor(), operator*(), operator==(), PrintDifference(), and TFracNum().
|
private |
Definition at line 66 of file TFracNum.h.
Referenced by GetDenominator(), and operator+().
|
private |
Definition at line 67 of file TFracNum.h.
Referenced by Dval(), and operator>().
|
private |
Definition at line 49 of file TFracNum.h.
Referenced by DenomCommonDivisor(), operator*(), operator==(), PrintDifference(), and TFracNum().
|
private |
Definition at line 46 of file TFracNum.h.
Referenced by operator*(), operator==(), PrintDifference(), and TFracNum().
|
private |
Definition at line 53 of file TFracNum.h.
Referenced by operator*(), operator==(), PrintDifference(), and TFracNum().
|
private |
Definition at line 65 of file TFracNum.h.
Referenced by GetNumerator(), and operator+().
|
private |
Definition at line 62 of file TFracNum.h.
Referenced by operator*(), operator+(), operator==(), PrintDifference(), and TFracNum().