Loading...
Searching...
No Matches
rootArranger Class Reference

`#include <mpr_numeric.h>`

## Public Member Functions

| rootArranger (rootContainer **_roots, rootContainer **_mu, const int _howclean=PM_CORRUPT)
| ~rootArranger ()
void | solve_all ()
void | arrange ()
bool | success ()

## Private Member Functions

| rootArranger (const rootArranger &)

## Private Attributes

rootContainer ** | roots
rootContainer ** | mu
int | howclean
int | rc
int | mc
bool | found_roots

## Friends

lists | listOfRoots (rootArranger *self, const unsigned int oprec)

## Detailed Description

Definition at line 149 of file mpr_numeric.h.

## Constructor & Destructor Documentation

## rootArranger() [1/2]

rootArranger::rootArranger | ( | rootContainer ** | _roots,
|  | rootContainer ** | _mu,
|  | const int | _howclean = PM_CORRUPT )

Definition at line 848 of file mpr_numeric.cc.

: roots(_roots), mu(_mu), howclean(_howclean)
{
found_roots=false;
}
rootArranger::roots
rootContainer ** roots
Definition mpr_numeric.h:167
rootArranger::mu
rootContainer ** mu
Definition mpr_numeric.h:168
rootArranger::found_roots
bool found_roots
Definition mpr_numeric.h:172
rootArranger::howclean
int howclean
Definition mpr_numeric.h:170

## ~rootArranger()

rootArranger::~rootArranger | ( |  | ) |

inline

Definition at line 157 of file mpr_numeric.h.

{}

## rootArranger() [2/2]

rootArranger::rootArranger | ( | const rootArranger & |  | ) |

private

## Member Function Documentation

## arrange()

void rootArranger::arrange | ( |  | ) |

Definition at line 883 of file mpr_numeric.cc.

{
gmp_complex tmp,zwerg;
int anzm= mu[0]->getAnzElems();
int anzr= roots[0]->getAnzRoots();
int xkoord, r, rtest, xk, mtest;
bool found;
//gmp_complex mprec(1.0/pow(10,gmp_output_digits-5),1.0/pow(10,gmp_output_digits-5));
for ( xkoord= 0; xkoord < anzm; xkoord++ ) { // fuer x1,x2, x1,x2,x3, x1,x2,...,xn
gmp_float mprec(1.0/pow(10.0,(int)(gmp_output_digits/3)));
for ( r= 0; r < anzr; r++ ) { // fuer jede Nullstelle
// (x1-koordinate) * evp[1] + (x2-koordinate) * evp[2] +
// ... + (xkoord-koordinate) * evp[xkoord]
tmp= gmp_complex();
for ( xk =0; xk <= xkoord; xk++ )
{
tmp -= (*roots[xk])[r] * mu[xkoord]->evPointCoord(xk+1); //xk+1
}
found= false;
do { // while not found
for ( rtest= r; rtest < anzr; rtest++ ) { // fuer jede Nullstelle
zwerg = tmp - (*roots[xk])[rtest] * mu[xkoord]->evPointCoord(xk+1); // xk+1, xkoord+2
for ( mtest= 0; mtest < anzr; mtest++ )
{
// if ( tmp == (*mu[xkoord])[mtest] )
// {
if ( ((zwerg.real() <= (*mu[xkoord])[mtest].real() + mprec) &&
(zwerg.real() >= (*mu[xkoord])[mtest].real() - mprec)) &&
((zwerg.imag() <= (*mu[xkoord])[mtest].imag() + mprec) &&
(zwerg.imag() >= (*mu[xkoord])[mtest].imag() - mprec)) )
{
roots[xk]->swapRoots( r, rtest );
found= true;
break;
}
}
} // rtest
if (!found)
{
WarnS("rootArranger::arrange: precision lost");
mprec*=10;
}
} while(!found);
#if 0
if ( !found )
{
Warn("rootArranger::arrange: No match? coord %d, root %d.",xkoord,r);
//#ifdef mprDEBUG_PROT
WarnS("One of these ...");
for ( rtest= r; rtest < anzr; rtest++ )
{
tmp= gmp_complex();
for ( xk =0; xk <= xkoord; xk++ )
{
tmp-= (*roots[xk])[r] * mu[xkoord]->evPointCoord(xk+1);
}
tmp-= (*roots[xk])[rtest] * mu[xkoord]->evPointCoord(xk+1); // xkoord+2
Warn(" %s",complexToStr(tmp,gmp_output_digits+1),rtest);
}
WarnS(" ... must match to one of these:");
for ( mtest= 0; mtest < anzr; mtest++ )
{
Warn(" %s",complexToStr((*mu[xkoord])[mtest],gmp_output_digits+1));
}
//#endif
}
#endif
} // r
} // xkoord
}
pow
Rational pow(const Rational &a, int e)
Definition GMPrat.cc:411
gmp_complex::imag
gmp_float imag() const
Definition mpr_complex.h:237
gmp_complex::real
gmp_float real() const
Definition mpr_complex.h:236
Warn
#define Warn
Definition emacs.cc:77
WarnS
#define WarnS
Definition emacs.cc:78
found
bool found
Definition facFactorize.cc:55
gmp_output_digits
EXTERN_VAR size_t gmp_output_digits
Definition mpr_base.h:115
complexToStr
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)
Definition mpr_complex.cc:693

## solve_all()

void rootArranger::solve_all | ( |  | ) |

Definition at line 858 of file mpr_numeric.cc.

{
int i;
found_roots= true;
// find roots of polys given by coeffs in roots
rc= roots[0]->getAnzElems();
for ( i= 0; i < rc; i++ )
if ( !roots[i]->solver( howclean ) )
{
found_roots= false;
return;
}
// find roots of polys given by coeffs in mu
mc= mu[0]->getAnzElems();
for ( i= 0; i < mc; i++ )
if ( ! mu[i]->solver( howclean ) )
{
found_roots= false;
return;
}
}
i
int i
Definition cfEzgcd.cc:132
rootArranger::rc
int rc
Definition mpr_numeric.h:171
rootArranger::mc
int mc
Definition mpr_numeric.h:171

## success()

bool rootArranger::success | ( |  | ) |

inline

Definition at line 162 of file mpr_numeric.h.

{ return found_roots; }

## Friends And Related Symbol Documentation

## listOfRoots

lists listOfRoots | ( | rootArranger * | self,
|  | const unsigned int | oprec )

friend

Definition at line 5082 of file ipshell.cc.

{
int i,j;
int count= self->roots[0]->getAnzRoots(); // number of roots
int elem= self->roots[0]->getAnzElems(); // number of koordinates per root
lists listofroots= (lists)omAlloc( sizeof(slists) ); // must be done this way!
if ( self->found_roots )
{
listofroots->Init( count );
for (i=0; i < count; i++)
{
lists onepoint= (lists)omAlloc(sizeof(slists)); // must be done this way!
onepoint->Init(elem);
for ( j= 0; j < elem; j++ )
{
if ( !rField_is_long_C(currRing) )
{
onepoint->m[j].rtyp=STRING_CMD;
onepoint->m[j].data=(void *)complexToStr((*self->roots[j])[i],oprec, currRing->cf);
}
else
{
onepoint->m[j].rtyp=NUMBER_CMD;
onepoint->m[j].data=(void *)n_Copy((number)(self->roots[j]->getRoot(i)), currRing->cf);
}
onepoint->m[j].next= NULL;
onepoint->m[j].name= NULL;
}
listofroots->m[i].rtyp=LIST_CMD;
listofroots->m[i].data=(void *)onepoint;
listofroots->m[j].next= NULL;
listofroots->m[j].name= NULL;
}
}
else
{
listofroots->Init( 0 );
}
return listofroots;
}
rootContainer::getRoot
gmp_complex * getRoot(const int i)
Definition mpr_numeric.h:88
rootContainer::getAnzRoots
int getAnzRoots()
Definition mpr_numeric.h:97
rootContainer::getAnzElems
int getAnzElems()
Definition mpr_numeric.h:95
sleftv::name
const char * name
Definition subexpr.h:87
sleftv::rtyp
int rtyp
Definition subexpr.h:91
sleftv::next
leftv next
Definition subexpr.h:86
sleftv::data
void * data
Definition subexpr.h:88
slists::m
sleftv * m
Definition lists.h:46
slists::Init
INLINE_THIS void Init(int l=0)
n_Copy
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition coeffs.h:457
j
int j
Definition facHensel.cc:110
NUMBER_CMD
@ NUMBER_CMD
Definition grammar.cc:289
lists
slists * lists
Definition mpr_numeric.h:146
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
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
rField_is_long_C
static BOOLEAN rField_is_long_C(const ring r)
Definition ring.h:551
count
int status int void size_t count
Definition si_signals.h:69
LIST_CMD
@ LIST_CMD
Definition tok.h:118
STRING_CMD
@ STRING_CMD
Definition tok.h:187

## Field Documentation

## found_roots

bool rootArranger::found_roots

private

Definition at line 172 of file mpr_numeric.h.

## howclean

int rootArranger::howclean

private

Definition at line 170 of file mpr_numeric.h.

## mc

int rootArranger::mc

private

Definition at line 171 of file mpr_numeric.h.

## mu

rootContainer** rootArranger::mu

private

Definition at line 168 of file mpr_numeric.h.

## rc

int rootArranger::rc

private

Definition at line 171 of file mpr_numeric.h.

## roots

rootContainer** rootArranger::roots

private

Definition at line 167 of file mpr_numeric.h.

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

- kernel/numeric/mpr_numeric.h
- kernel/numeric/mpr_numeric.cc