My Project
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Friends
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 *, 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.

852{
853 found_roots=false;
854}
rootContainer ** roots
rootContainer ** mu

◆ ~rootArranger()

rootArranger::~rootArranger ( )
inline

Definition at line 157 of file mpr_numeric.h.

157{}

◆ rootArranger() [2/2]

rootArranger::rootArranger ( const rootArranger )
private

Member Function Documentation

◆ arrange()

void rootArranger::arrange ( )

Definition at line 883 of file mpr_numeric.cc.

884{
886 int anzm= mu[0]->getAnzElems();
887 int anzr= roots[0]->getAnzRoots();
888 int xkoord, r, rtest, xk, mtest;
889 bool found;
890 //gmp_complex mprec(1.0/pow(10,gmp_output_digits-5),1.0/pow(10,gmp_output_digits-5));
891
892 for ( xkoord= 0; xkoord < anzm; xkoord++ ) { // fuer x1,x2, x1,x2,x3, x1,x2,...,xn
893 gmp_float mprec(1.0/pow(10.0,(int)(gmp_output_digits/3)));
894 for ( r= 0; r < anzr; r++ ) { // fuer jede Nullstelle
895 // (x1-koordinate) * evp[1] + (x2-koordinate) * evp[2] +
896 // ... + (xkoord-koordinate) * evp[xkoord]
897 tmp= gmp_complex();
898 for ( xk =0; xk <= xkoord; xk++ )
899 {
900 tmp -= (*roots[xk])[r] * mu[xkoord]->evPointCoord(xk+1); //xk+1
901 }
902 found= false;
903 do { // while not found
904 for ( rtest= r; rtest < anzr; rtest++ ) { // fuer jede Nullstelle
905 zwerg = tmp - (*roots[xk])[rtest] * mu[xkoord]->evPointCoord(xk+1); // xk+1, xkoord+2
906 for ( mtest= 0; mtest < anzr; mtest++ )
907 {
908 // if ( tmp == (*mu[xkoord])[mtest] )
909 // {
910 if ( ((zwerg.real() <= (*mu[xkoord])[mtest].real() + mprec) &&
911 (zwerg.real() >= (*mu[xkoord])[mtest].real() - mprec)) &&
912 ((zwerg.imag() <= (*mu[xkoord])[mtest].imag() + mprec) &&
913 (zwerg.imag() >= (*mu[xkoord])[mtest].imag() - mprec)) )
914 {
915 roots[xk]->swapRoots( r, rtest );
916 found= true;
917 break;
918 }
919 }
920 } // rtest
921 if (!found)
922 {
923 WarnS("rootArranger::arrange: precision lost");
924 mprec*=10;
925 }
926 } while(!found);
927#if 0
928 if ( !found )
929 {
930 Warn("rootArranger::arrange: No match? coord %d, root %d.",xkoord,r);
931//#ifdef mprDEBUG_PROT
932 WarnS("One of these ...");
933 for ( rtest= r; rtest < anzr; rtest++ )
934 {
935 tmp= gmp_complex();
936 for ( xk =0; xk <= xkoord; xk++ )
937 {
938 tmp-= (*roots[xk])[r] * mu[xkoord]->evPointCoord(xk+1);
939 }
940 tmp-= (*roots[xk])[rtest] * mu[xkoord]->evPointCoord(xk+1); // xkoord+2
942 }
943 WarnS(" ... must match to one of these:");
944 for ( mtest= 0; mtest < anzr; mtest++ )
945 {
947 }
948//#endif
949 }
950#endif
951 } // r
952 } // xkoord
953}
Rational pow(const Rational &a, int e)
Definition GMPrat.cc:411
gmp_complex numbers based on
bool swapRoots(const int from, const int to)
int getAnzRoots()
Definition mpr_numeric.h:97
int getAnzElems()
Definition mpr_numeric.h:95
#define Warn
Definition emacs.cc:77
#define WarnS
Definition emacs.cc:78
bool found
EXTERN_VAR size_t gmp_output_digits
Definition mpr_base.h:115
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)

◆ solve_all()

void rootArranger::solve_all ( )

Definition at line 858 of file mpr_numeric.cc.

859{
860 int i;
861 found_roots= true;
862
863 // find roots of polys given by coeffs in roots
864 rc= roots[0]->getAnzElems();
865 for ( i= 0; i < rc; i++ )
866 if ( !roots[i]->solver( howclean ) )
867 {
868 found_roots= false;
869 return;
870 }
871 // find roots of polys given by coeffs in mu
872 mc= mu[0]->getAnzElems();
873 for ( i= 0; i < mc; i++ )
874 if ( ! mu[i]->solver( howclean ) )
875 {
876 found_roots= false;
877 return;
878 }
879}
int i
Definition cfEzgcd.cc:132

◆ success()

bool rootArranger::success ( )
inline

Definition at line 162 of file mpr_numeric.h.

162{ return found_roots; }

Friends And Related Symbol Documentation

◆ listOfRoots

lists listOfRoots ( rootArranger self,
const unsigned int  oprec 
)
friend

Definition at line 5081 of file ipshell.cc.

5082{
5083 int i,j;
5084 int count= self->roots[0]->getAnzRoots(); // number of roots
5085 int elem= self->roots[0]->getAnzElems(); // number of koordinates per root
5086
5087 lists listofroots= (lists)omAlloc( sizeof(slists) ); // must be done this way!
5088
5089 if ( self->found_roots )
5090 {
5091 listofroots->Init( count );
5092
5093 for (i=0; i < count; i++)
5094 {
5095 lists onepoint= (lists)omAlloc(sizeof(slists)); // must be done this way!
5096 onepoint->Init(elem);
5097 for ( j= 0; j < elem; j++ )
5098 {
5099 if ( !rField_is_long_C(currRing) )
5100 {
5101 onepoint->m[j].rtyp=STRING_CMD;
5102 onepoint->m[j].data=(void *)complexToStr((*self->roots[j])[i],oprec, currRing->cf);
5103 }
5104 else
5105 {
5106 onepoint->m[j].rtyp=NUMBER_CMD;
5107 onepoint->m[j].data=(void *)n_Copy((number)(self->roots[j]->getRoot(i)), currRing->cf);
5108 }
5109 onepoint->m[j].next= NULL;
5110 onepoint->m[j].name= NULL;
5111 }
5112 listofroots->m[i].rtyp=LIST_CMD;
5113 listofroots->m[i].data=(void *)onepoint;
5114 listofroots->m[j].next= NULL;
5115 listofroots->m[j].name= NULL;
5116 }
5117
5118 }
5119 else
5120 {
5121 listofroots->Init( 0 );
5122 }
5123
5124 return listofroots;
5125}
gmp_complex * getRoot(const int i)
Definition mpr_numeric.h:88
Definition lists.h:24
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition coeffs.h:448
int j
Definition facHensel.cc:110
@ NUMBER_CMD
Definition grammar.cc:288
slists * lists
#define omAlloc(size)
#define NULL
Definition omList.c:12
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
static BOOLEAN rField_is_long_C(const ring r)
Definition ring.h:545
int status int void size_t count
Definition si_signals.h:59
@ LIST_CMD
Definition tok.h:118
@ STRING_CMD
Definition tok.h:185

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: