Loading...
Searching...
No Matches
Number Class Reference

`#include <Number.h>`

## Public Member Functions

number | as_number () const
Number & | operator= (const Number &n2)
Number | operator- ()
Number & | operator+= (const Number &n2)
Number & | operator*= (const Number &n2)
Number & | operator-= (const Number &n2)
Number & | operator/= (const Number &n2)
Number & | operator= (int n2)
Number & | operator+= (int n2)
Number & | operator*= (int n2)
Number & | operator-= (int n2)
Number & | operator/= (int n2)
| Number ()
| Number (const Number &n)
| Number (number n, ring r)
| Number (int n, ring r)
| Number (int n, intrusive_ptr< ip_sring > r)
| Number (int n)
void | write () const
| ~Number ()
ring | getRing () const

## Protected Attributes

number | n
intrusive_ptr< ip_sring > | r

## Friends

class | Poly
class | Vector
template<poly_variant, class, class>
class | PolyBase
class | PolyImpl
Number | operator+ (const Number &n1, const Number &n2)
Number | operator- (const Number &n1, const Number &n2)
Number | operator/ (const Number &n1, const Number &n2)
Number | operator* (const Number &n1, const Number &n2)
bool | operator== (const Number &n1, const Number &n2)
Number | operator+ (const Number &n1, int n2)
Number | operator- (const Number &n1, int n2)
Number | operator/ (const Number &n1, int n2)
Number | operator* (const Number &n1, int n2)
bool | operator== (const Number &n1, int n2)
Number | operator+ (int n1, const Number &n2)
Number | operator- (int n1, const Number &n2)
Number | operator/ (int n1, const Number &n2)
Number | operator* (int n1, const Number &n2)
bool | operator== (int n1, const Number &n2)

## Detailed Description

Definition at line 33 of file Number.h.

## Constructor & Destructor Documentation

## Number() [1/6]

Number::Number | ( |  | ) |

inline

Definition at line 169 of file Number.h.

{
r=currRing;
if (r.get()!=NULL)
n=n_Init(0,r.get()->cf);
else
n=(number) NULL;
}
Number::r
intrusive_ptr< ip_sring > r
Definition Number.h:218
Number::n
number n
Definition Number.h:217
n_Init
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition coeffs.h:541
NULL
#define NULL
Definition omList.c:12
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13

## Number() [2/6]

Number::Number | ( | const Number & | n | ) |

inline

Definition at line 177 of file Number.h.

{
r=n.r;
this->n=n_Copy(n.n,r.get()->cf);
}
n_Copy
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition coeffs.h:457

## Number() [3/6]

Number::Number | ( | number | n,
|  | ring | r )

inline

Definition at line 182 of file Number.h.

{
this->n=n_Copy(n,r->cf);
this->r=r;
}

## Number() [4/6]

Number::Number | ( | int | n,
|  | ring | r )

inline

Definition at line 187 of file Number.h.

{
this->r=r;
this->n=n_Init(n,r->cf);
}

## Number() [5/6]

Number::Number | ( | int | n,
|  | intrusive_ptr< ip_sring > | r )

inline

Definition at line 192 of file Number.h.

{
this->r=r;
this->n=n_Init(n,r.get()->cf);
}

## Number() [6/6]

Number::Number | ( | int | n | ) |

inline explicit

Definition at line 197 of file Number.h.

{
r=currRing;
this->n=n_Init(n,r.get()->cf);
}

## ~Number()

Number::~Number | ( |  | ) |

inline

Definition at line 207 of file Number.h.

{
if (r!=NULL)
n_Delete(&n,r.get()->cf);
}
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:461

## Member Function Documentation

## as_number()

number Number::as_number | ( |  | ) | const

inline

Definition at line 59 of file Number.h.

{
return n_Copy(n,r.get()->cf);
}

## getRing()

ring Number::getRing | ( |  | ) | const

inline

Definition at line 212 of file Number.h.

{
return r.get();
}

## operator*=() [1/2]

Number & Number::operator*= | ( | const Number & | n2 | ) |

inline

Definition at line 91 of file Number.h.

{
if (r!=n2.r)
{
WerrorS("not the same ring");
return *this;
}
number nv=n_Mult(n,n2.n,r.get()->cf);
n_Delete(&n,r.get()->cf);
n=nv;
return *this;
}
n_Mult
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition coeffs.h:639
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24

## operator*=() [2/2]

Number & Number::operator*= | ( | int | n2 | ) |

inline

Definition at line 142 of file Number.h.

{
number n2n=n_Init(n2,r.get()->cf);
number nv=n_Mult(n,n2n,r.get()->cf);
n_Delete(&n,r.get()->cf);
n_Delete(&n2n,r.get()->cf);
n=nv;
return *this;
}

## operator+=() [1/2]

Number & Number::operator+= | ( | const Number & | n2 | ) |

inline

Definition at line 79 of file Number.h.

{
if (r!=n2.r)
{
WerrorS("not the same ring");
return *this;
}
number nv=n_Add(n,n2.n,r.get()->cf);
n_Delete(&n,r.get()->cf);
n=nv;
return *this;
}
n_Add
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
Definition coeffs.h:653

## operator+=() [2/2]

Number & Number::operator+= | ( | int | n2 | ) |

inline

Definition at line 133 of file Number.h.

{
number n2n=n_Init(n2,r.get()->cf);
number nv=n_Add(n,n2n,r.get()->cf);
n_Delete(&n,r.get()->cf);
n_Delete(&n2n,r.get()->cf);
n=nv;
return *this;
}

## operator-()

Number Number::operator- | ( |  | ) |

inline

Definition at line 72 of file Number.h.

{
Number t(*this);
//t.n=n_Copy(n,r);
t.n=n_InpNeg(t.n,r.get()->cf);
return t;
}
Number::Number
Number()
Definition Number.h:169
n_InpNeg
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition coeffs.h:560

## operator-=() [1/2]

Number & Number::operator-= | ( | const Number & | n2 | ) |

inline

Definition at line 103 of file Number.h.

{
if (r!=n2.r)
{
WerrorS("not the same ring");
return *this;
}
number nv=n_Sub(n,n2.n,r.get()->cf);
n_Delete(&n,r.get()->cf);
n=nv;
return *this;
}
n_Sub
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
Definition coeffs.h:658

## operator-=() [2/2]

Number & Number::operator-= | ( | int | n2 | ) |

inline

Definition at line 151 of file Number.h.

{
number n2n=n_Init(n2,r.get()->cf);
number nv=n_Sub(n,n2n,r.get()->cf);
n_Delete(&n,r.get()->cf);
n_Delete(&n2n,r.get()->cf);
n=nv;
return *this;
}

## operator/=() [1/2]

Number & Number::operator/= | ( | const Number & | n2 | ) |

inline

Definition at line 115 of file Number.h.

{
if (r!=n2.r)
{
WerrorS("not the same ring");
return *this;
}
number nv=n_Div(n,n2.n,r.get()->cf);
n_Delete(&n,r.get()->cf);
n=nv;
return *this;
}
n_Div
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition coeffs.h:618

## operator/=() [2/2]

Number & Number::operator/= | ( | int | n2 | ) |

inline

Definition at line 160 of file Number.h.

{
number n2n=n_Init(n2,r.get()->cf);
number nv=n_Div(n,n2n,r.get()->cf);
n_Delete(&n,r.get()->cf);
n_Delete(&n2n,r.get()->cf);
n=nv;
return *this;
}

## operator=() [1/2]

Number & Number::operator= | ( | const Number & | n2 | ) |

inline

Definition at line 63 of file Number.h.

{
//durch Reihenfolge Selbstzuweisungen berücksichtigt
number nc=n_Copy(n2.n,n2.r.get()->cf);
n_Delete(&n,r.get()->cf);
r=n2.r;
n=nc;
return *this;
}

## operator=() [2/2]

Number & Number::operator= | ( | int | n2 | ) |

inline

Definition at line 127 of file Number.h.

{
n_Delete(&n,r.get()->cf);
n=n_Init(n2,r.get()->cf);
return *this;
}

## write()

void Number::write | ( |  | ) | const

inline

Definition at line 202 of file Number.h.

{
number towrite=n;
n_Write(towrite,r.get()->cf);
}
n_Write
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition coeffs.h:594

## Friends And Related Symbol Documentation

## operator* [1/3]

Number operator* | ( | const Number & | n1,
|  | const Number & | n2 )

friend

Definition at line 227 of file Number.h.

{
Number erg(n1);
erg*=n2;
return erg;
}

## operator* [2/3]

Number operator* | ( | const Number & | n1,
|  | int | n2 )

friend

Definition at line 257 of file Number.h.

{
Number erg(n1);
erg*=Number(n2,n1.r);
return erg;
}

## operator* [3/3]

Number operator* | ( | int | n1,
|  | const Number & | n2 )

friend

Definition at line 294 of file Number.h.

{
Number erg(n2);
return erg*=Number(n1,n2.r);
}

## operator+ [1/3]

Number operator+ | ( | const Number & | n1,
|  | const Number & | n2 )

friend

Definition at line 221 of file Number.h.

{
Number erg(n1);
erg+=n2;
return erg;
}

## operator+ [2/3]

Number operator+ | ( | const Number & | n1,
|  | int | n2 )

friend

Definition at line 251 of file Number.h.

{
Number erg(n1);
erg+=Number(n2,n1.r);
return erg;
}

## operator+ [3/3]

Number operator+ | ( | int | n1,
|  | const Number & | n2 )

friend

Definition at line 279 of file Number.h.

{
Number erg(n2);
return erg+=Number(n1,n2.r);
}

## operator- [1/3]

Number operator- | ( | const Number & | n1,
|  | const Number & | n2 )

friend

Definition at line 233 of file Number.h.

{
Number erg(n1);
erg-=n2;
return erg;
}

## operator- [2/3]

Number operator- | ( | const Number & | n1,
|  | int | n2 )

friend

Definition at line 263 of file Number.h.

{
Number erg(n1);
erg-=Number(n2,n1.r);
return erg;
}

## operator- [3/3]

Number operator- | ( | int | n1,
|  | const Number & | n2 )

friend

Definition at line 284 of file Number.h.

{
Number erg(n1,n2.r);
return erg-=n2;
}

## operator/ [1/3]

Number operator/ | ( | const Number & | n1,
|  | const Number & | n2 )

friend

Definition at line 239 of file Number.h.

{
Number erg(n1);
erg/=n2;
return erg;
}

## operator/ [2/3]

Number operator/ | ( | const Number & | n1,
|  | int | n2 )

friend

Definition at line 269 of file Number.h.

{
Number erg(n1);
erg/=Number(n2,n1.r);
return erg;
}

## operator/ [3/3]

Number operator/ | ( | int | n1,
|  | const Number & | n2 )

friend

Definition at line 289 of file Number.h.

{
Number erg(n1,n2.r);
return erg/=n2;
}

## operator== [1/3]

bool operator== | ( | const Number & | n1,
|  | const Number & | n2 )

friend

Definition at line 245 of file Number.h.

{
if(n1.r!=n2.r)
return false;
return n_Equal(n1.n,n2.n,n1.r.get()->cf);
}
n_Equal
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
Definition coeffs.h:466

## operator== [2/3]

bool operator== | ( | const Number & | n1,
|  | int | n2 )

friend

Definition at line 275 of file Number.h.

{
return n_Equal(n1.n,Number(n2,n1.r).n,n1.r.get()->cf);
}

## operator== [3/3]

bool operator== | ( | int | n1,
|  | const Number & | n2 )

friend

Definition at line 299 of file Number.h.

{
return n2==Number(n1,n2.r);
}

## Poly

friend class Poly

friend

Definition at line 51 of file Number.h.

## PolyBase

template<poly_variant, class, class>

friend class PolyBase

friend

Definition at line 57 of file Number.h.

## PolyImpl

friend class PolyImpl

friend

Definition at line 58 of file Number.h.

## Vector

friend class Vector

friend

Definition at line 52 of file Number.h.

## Field Documentation

## n

number Number::n

protected

Definition at line 217 of file Number.h.

## r

intrusive_ptr<ip_sring> Number::r

protected

Definition at line 218 of file Number.h.

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

- Singular/dyn_modules/python/Number.h