My Project
Loading...
Searching...
No Matches
Macros | Functions
mpr_inout.h File Reference

Go to the source code of this file.

Macros

#define DEFAULT_DIGITS   30
 
#define MPR_DENSE   1
 
#define MPR_SPARSE   2
 

Functions

BOOLEAN nuUResSolve (leftv res, leftv args)
 solve a multipolynomial system using the u-resultant Input ideal must be 0-dimensional and (currRing->N) == IDELEMS(ideal).
 
BOOLEAN nuMPResMat (leftv res, leftv arg1, leftv arg2)
 returns module representing the multipolynomial resultant matrix Arguments 2: ideal i, int k k=0: use sparse resultant matrix of Gelfand, Kapranov and Zelevinsky k=1: use resultant matrix of Macaulay (k=0 is default)
 
BOOLEAN nuLagSolve (leftv res, leftv arg1, leftv arg2, leftv arg3)
 find the (complex) roots an univariate polynomial Determines the roots of an univariate polynomial using Laguerres' root-solver.
 
BOOLEAN nuVanderSys (leftv res, leftv arg1, leftv arg2, leftv arg3)
 COMPUTE: polynomial p with values given by v at points p1,..,pN derived from p; more precisely: consider p as point in K^n and v as N elements in K, let p1,..,pN be the points in K^n obtained by evaluating all monomials of degree 0,1,...,N at p in lexicographical order, then the procedure computes the polynomial f satisfying f(pi) = v[i] RETURN: polynomial f of degree d.
 
BOOLEAN loNewtonP (leftv res, leftv arg1)
 compute Newton Polytopes of input polynomials
 
BOOLEAN loSimplex (leftv res, leftv args)
 Implementation of the Simplex Algorithm.
 

Macro Definition Documentation

◆ DEFAULT_DIGITS

#define DEFAULT_DIGITS   30

Definition at line 13 of file mpr_inout.h.

◆ MPR_DENSE

#define MPR_DENSE   1

Definition at line 15 of file mpr_inout.h.

◆ MPR_SPARSE

#define MPR_SPARSE   2

Definition at line 16 of file mpr_inout.h.

Function Documentation

◆ loNewtonP()

BOOLEAN loNewtonP ( leftv  res,
leftv  arg1 
)

compute Newton Polytopes of input polynomials

Definition at line 4555 of file ipshell.cc.

4556{
4557 res->data= (void*)loNewtonPolytope( (ideal)arg1->Data() );
4558 return FALSE;
4559}
#define FALSE
Definition auxiliary.h:97
void * Data()
Definition subexpr.cc:1192
CanonicalForm res
Definition facAbsFact.cc:60
ideal loNewtonPolytope(const ideal id)
Definition mpr_base.cc:3191

◆ loSimplex()

BOOLEAN loSimplex ( leftv  res,
leftv  args 
)

Implementation of the Simplex Algorithm.

For args, see class simplex.

Definition at line 4561 of file ipshell.cc.

4562{
4563 if ( !(rField_is_long_R(currRing)) )
4564 {
4565 WerrorS("Ground field not implemented!");
4566 return TRUE;
4567 }
4568
4569 simplex * LP;
4570 matrix m;
4571
4572 leftv v= args;
4573 if ( v->Typ() != MATRIX_CMD ) // 1: matrix
4574 return TRUE;
4575 else
4576 m= (matrix)(v->CopyD());
4577
4578 LP = new simplex(MATROWS(m),MATCOLS(m));
4579 LP->mapFromMatrix(m);
4580
4581 v= v->next;
4582 if ( v->Typ() != INT_CMD ) // 2: m = number of constraints
4583 return TRUE;
4584 else
4585 LP->m= (int)(long)(v->Data());
4586
4587 v= v->next;
4588 if ( v->Typ() != INT_CMD ) // 3: n = number of variables
4589 return TRUE;
4590 else
4591 LP->n= (int)(long)(v->Data());
4592
4593 v= v->next;
4594 if ( v->Typ() != INT_CMD ) // 4: m1 = number of <= constraints
4595 return TRUE;
4596 else
4597 LP->m1= (int)(long)(v->Data());
4598
4599 v= v->next;
4600 if ( v->Typ() != INT_CMD ) // 5: m2 = number of >= constraints
4601 return TRUE;
4602 else
4603 LP->m2= (int)(long)(v->Data());
4604
4605 v= v->next;
4606 if ( v->Typ() != INT_CMD ) // 6: m3 = number of == constraints
4607 return TRUE;
4608 else
4609 LP->m3= (int)(long)(v->Data());
4610
4611#ifdef mprDEBUG_PROT
4612 Print("m (constraints) %d\n",LP->m);
4613 Print("n (columns) %d\n",LP->n);
4614 Print("m1 (<=) %d\n",LP->m1);
4615 Print("m2 (>=) %d\n",LP->m2);
4616 Print("m3 (==) %d\n",LP->m3);
4617#endif
4618
4619 LP->compute();
4620
4621 lists lres= (lists)omAlloc( sizeof(slists) );
4622 lres->Init( 6 );
4623
4624 lres->m[0].rtyp= MATRIX_CMD; // output matrix
4625 lres->m[0].data=(void*)LP->mapToMatrix(m);
4626
4627 lres->m[1].rtyp= INT_CMD; // found a solution?
4628 lres->m[1].data=(void*)(long)LP->icase;
4629
4630 lres->m[2].rtyp= INTVEC_CMD;
4631 lres->m[2].data=(void*)LP->posvToIV();
4632
4633 lres->m[3].rtyp= INTVEC_CMD;
4634 lres->m[3].data=(void*)LP->zrovToIV();
4635
4636 lres->m[4].rtyp= INT_CMD;
4637 lres->m[4].data=(void*)(long)LP->m;
4638
4639 lres->m[5].rtyp= INT_CMD;
4640 lres->m[5].data=(void*)(long)LP->n;
4641
4642 res->data= (void*)lres;
4643
4644 return FALSE;
4645}
#define TRUE
Definition auxiliary.h:101
int m
Definition cfEzgcd.cc:128
Variable next() const
Definition factory.h:146
Linear Programming / Linear Optimization using Simplex - Algorithm.
intvec * zrovToIV()
BOOLEAN mapFromMatrix(matrix m)
void compute()
matrix mapToMatrix(matrix m)
intvec * posvToIV()
Class used for (list of) interpreter objects.
Definition subexpr.h:83
Definition lists.h:24
#define Print
Definition emacs.cc:80
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
void WerrorS(const char *s)
Definition feFopen.cc:24
@ MATRIX_CMD
Definition grammar.cc:287
ip_smatrix * matrix
Definition matpol.h:43
#define MATROWS(i)
Definition matpol.h:26
#define MATCOLS(i)
Definition matpol.h:27
slists * lists
#define omAlloc(size)
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_R(const ring r)
Definition ring.h:548
@ INTVEC_CMD
Definition tok.h:101
@ INT_CMD
Definition tok.h:96

◆ nuLagSolve()

BOOLEAN nuLagSolve ( leftv  res,
leftv  arg1,
leftv  arg2,
leftv  arg3 
)

find the (complex) roots an univariate polynomial Determines the roots of an univariate polynomial using Laguerres' root-solver.

Good for polynomials with low and middle degree (<40). Arguments 3: poly arg1 , int arg2 , int arg3 arg2>0: defines precision of fractional part if ground field is Q arg3: number of iterations for approximation of roots (default=2) Returns a list of all (complex) roots of the polynomial arg1

Definition at line 4670 of file ipshell.cc.

4671{
4672 poly gls;
4673 gls= (poly)(arg1->Data());
4674 int howclean= (int)(long)arg3->Data();
4675
4676 if ( gls == NULL || pIsConstant( gls ) )
4677 {
4678 WerrorS("Input polynomial is constant!");
4679 return TRUE;
4680 }
4681
4683 {
4684 int* r=Zp_roots(gls, currRing);
4685 lists rlist;
4686 rlist= (lists)omAlloc( sizeof(slists) );
4687 rlist->Init( r[0] );
4688 for(int i=r[0];i>0;i--)
4689 {
4690 rlist->m[i-1].data=n_Init(r[i],currRing->cf);
4691 rlist->m[i-1].rtyp=NUMBER_CMD;
4692 }
4693 omFree(r);
4694 res->data=rlist;
4695 res->rtyp= LIST_CMD;
4696 return FALSE;
4697 }
4698 if ( !(rField_is_R(currRing) ||
4702 {
4703 WerrorS("Ground field not implemented!");
4704 return TRUE;
4705 }
4706
4709 {
4710 unsigned long int ii = (unsigned long int)arg2->Data();
4712 }
4713
4714 int ldummy;
4715 int deg= currRing->pLDeg( gls, &ldummy, currRing );
4716 int i,vpos=0;
4717 poly piter;
4718 lists elist;
4719
4720 elist= (lists)omAlloc( sizeof(slists) );
4721 elist->Init( 0 );
4722
4723 if ( rVar(currRing) > 1 )
4724 {
4725 piter= gls;
4726 for ( i= 1; i <= rVar(currRing); i++ )
4727 if ( pGetExp( piter, i ) )
4728 {
4729 vpos= i;
4730 break;
4731 }
4732 while ( piter )
4733 {
4734 for ( i= 1; i <= rVar(currRing); i++ )
4735 if ( (vpos != i) && (pGetExp( piter, i ) != 0) )
4736 {
4737 WerrorS("The input polynomial must be univariate!");
4738 return TRUE;
4739 }
4740 pIter( piter );
4741 }
4742 }
4743
4744 rootContainer * roots= new rootContainer();
4745 number * pcoeffs= (number *)omAlloc( (deg+1) * sizeof( number ) );
4746 piter= gls;
4747 for ( i= deg; i >= 0; i-- )
4748 {
4749 if ( piter && pTotaldegree(piter) == i )
4750 {
4751 pcoeffs[i]= nCopy( pGetCoeff( piter ) );
4752 //nPrint( pcoeffs[i] );PrintS(" ");
4753 pIter( piter );
4754 }
4755 else
4756 {
4757 pcoeffs[i]= nInit(0);
4758 }
4759 }
4760
4761#ifdef mprDEBUG_PROT
4762 for (i=deg; i >= 0; i--)
4763 {
4764 nPrint( pcoeffs[i] );PrintS(" ");
4765 }
4766 PrintLn();
4767#endif
4768
4769 roots->fillContainer( pcoeffs, NULL, 1, deg, rootContainer::onepoly, 1 );
4770 roots->solver( howclean );
4771
4772 int elem= roots->getAnzRoots();
4773 char *dummy;
4774 int j;
4775
4776 lists rlist;
4777 rlist= (lists)omAlloc( sizeof(slists) );
4778 rlist->Init( elem );
4779
4781 {
4782 for ( j= 0; j < elem; j++ )
4783 {
4784 rlist->m[j].rtyp=NUMBER_CMD;
4785 rlist->m[j].data=(void *)nCopy((number)(roots->getRoot(j)));
4786 //rlist->m[j].data=(void *)(number)(roots->getRoot(j));
4787 }
4788 }
4789 else
4790 {
4791 for ( j= 0; j < elem; j++ )
4792 {
4793 dummy = complexToStr( (*roots)[j], gmp_output_digits, currRing->cf );
4794 rlist->m[j].rtyp=STRING_CMD;
4795 rlist->m[j].data=(void *)dummy;
4796 }
4797 }
4798
4799 elist->Clean();
4800 //omFreeSize( (ADDRESS) elist, sizeof(slists) );
4801
4802 // this is (via fillContainer) the same data as in root
4803 //for ( i= deg; i >= 0; i-- ) nDelete( &pcoeffs[i] );
4804 //omFreeSize( (ADDRESS) pcoeffs, (deg+1) * sizeof( number ) );
4805
4806 delete roots;
4807
4808 res->data= (void*)rlist;
4809
4810 return FALSE;
4811}
int i
Definition cfEzgcd.cc:132
int * Zp_roots(poly p, const ring r)
Definition clapsing.cc:2191
complex root finder for univariate polynomials based on laguers algorithm
Definition mpr_numeric.h:66
gmp_complex * getRoot(const int i)
Definition mpr_numeric.h:88
void fillContainer(number *_coeffs, number *_ievpoint, const int _var, const int _tdg, const rootType _rt, const int _anz)
int getAnzRoots()
Definition mpr_numeric.h:97
bool solver(const int polishmode=PM_NONE)
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:539
int j
Definition facHensel.cc:110
@ NUMBER_CMD
Definition grammar.cc:289
#define pIter(p)
Definition monomials.h:37
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition monomials.h:44
EXTERN_VAR size_t gmp_output_digits
Definition mpr_base.h:115
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)
void setGMPFloatDigits(size_t digits, size_t rest)
Set size of mantissa digits - the number of output digits (basis 10) the size of mantissa consists of...
#define nCopy(n)
Definition numbers.h:15
#define nPrint(a)
only for debug, over any initialized currRing
Definition numbers.h:46
#define nInit(i)
Definition numbers.h:24
#define omFree(addr)
#define NULL
Definition omList.c:12
static long pTotaldegree(poly p)
Definition polys.h:283
#define pIsConstant(p)
like above, except that Comp must be 0
Definition polys.h:239
#define pGetExp(p, i)
Exponent.
Definition polys.h:42
void PrintS(const char *s)
Definition reporter.cc:284
void PrintLn()
Definition reporter.cc:310
static BOOLEAN rField_is_R(const ring r)
Definition ring.h:524
static BOOLEAN rField_is_Zp(const ring r)
Definition ring.h:506
static BOOLEAN rField_is_long_C(const ring r)
Definition ring.h:551
static BOOLEAN rField_is_Q(const ring r)
Definition ring.h:512
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition ring.h:598
@ LIST_CMD
Definition tok.h:118
@ STRING_CMD
Definition tok.h:187

◆ nuMPResMat()

BOOLEAN nuMPResMat ( leftv  res,
leftv  arg1,
leftv  arg2 
)

returns module representing the multipolynomial resultant matrix Arguments 2: ideal i, int k k=0: use sparse resultant matrix of Gelfand, Kapranov and Zelevinsky k=1: use resultant matrix of Macaulay (k=0 is default)

Definition at line 4647 of file ipshell.cc.

4648{
4649 ideal gls = (ideal)(arg1->Data());
4650 int imtype= (int)(long)arg2->Data();
4651
4653
4654 // check input ideal ( = polynomial system )
4655 if ( mprIdealCheck( gls, arg1->Name(), mtype, true ) != mprOk )
4656 {
4657 return TRUE;
4658 }
4659
4660 uResultant *resMat= new uResultant( gls, mtype, false );
4661 if (resMat!=NULL)
4662 {
4663 res->rtyp = MODUL_CMD;
4664 res->data= (void*)resMat->accessResMat()->getMatrix();
4665 if (!errorreported) delete resMat;
4666 }
4667 return errorreported;
4668}
virtual ideal getMatrix()
Definition mpr_base.h:31
const char * Name()
Definition subexpr.h:120
Base class for solving 0-dim poly systems using u-resultant.
Definition mpr_base.h:63
resMatrixBase * accessResMat()
Definition mpr_base.h:78
VAR short errorreported
Definition feFopen.cc:23
@ MODUL_CMD
Definition grammar.cc:288
@ mprOk
Definition mpr_base.h:98
uResultant::resMatType determineMType(int imtype)
mprState mprIdealCheck(const ideal theIdeal, const char *name, uResultant::resMatType mtype, BOOLEAN rmatrix=false)

◆ nuUResSolve()

BOOLEAN nuUResSolve ( leftv  res,
leftv  args 
)

solve a multipolynomial system using the u-resultant Input ideal must be 0-dimensional and (currRing->N) == IDELEMS(ideal).

Resultant method can be MPR_DENSE, which uses Macaulay Resultant (good for dense homogeneous polynoms) or MPR_SPARSE, which uses Sparse Resultant (Gelfand, Kapranov, Zelevinsky). Arguments 4: ideal i, int k, int l, int m k=0: use sparse resultant matrix of Gelfand, Kapranov and Zelevinsky k=1: use resultant matrix of Macaulay (k=0 is default) l>0: defines precision of fractional part if ground field is Q m=0,1,2: number of iterations for approximation of roots (default=2) Returns a list containing the roots of the system.

Definition at line 4914 of file ipshell.cc.

4915{
4916 leftv v= args;
4917
4918 ideal gls;
4919 int imtype;
4920 int howclean;
4921
4922 // get ideal
4923 if ( v->Typ() != IDEAL_CMD )
4924 return TRUE;
4925 else gls= (ideal)(v->Data());
4926 v= v->next;
4927
4928 // get resultant matrix type to use (0,1)
4929 if ( v->Typ() != INT_CMD )
4930 return TRUE;
4931 else imtype= (int)(long)v->Data();
4932 v= v->next;
4933
4934 if (imtype==0)
4935 {
4936 ideal test_id=idInit(1,1);
4937 int j;
4938 for(j=IDELEMS(gls)-1;j>=0;j--)
4939 {
4940 if (gls->m[j]!=NULL)
4941 {
4942 test_id->m[0]=gls->m[j];
4944 if (dummy_w!=NULL)
4945 {
4946 WerrorS("Newton polytope not of expected dimension");
4947 delete dummy_w;
4948 return TRUE;
4949 }
4950 }
4951 }
4952 }
4953
4954 // get and set precision in digits ( > 0 )
4955 if ( v->Typ() != INT_CMD )
4956 return TRUE;
4957 else if ( !(rField_is_R(currRing) || rField_is_long_R(currRing) || \
4959 {
4960 unsigned long int ii=(unsigned long int)v->Data();
4962 }
4963 v= v->next;
4964
4965 // get interpolation steps (0,1,2)
4966 if ( v->Typ() != INT_CMD )
4967 return TRUE;
4968 else howclean= (int)(long)v->Data();
4969
4971 int i,count;
4973 number smv= NULL;
4975
4976 //emptylist= (lists)omAlloc( sizeof(slists) );
4977 //emptylist->Init( 0 );
4978
4979 //res->rtyp = LIST_CMD;
4980 //res->data= (void *)emptylist;
4981
4982 // check input ideal ( = polynomial system )
4983 if ( mprIdealCheck( gls, args->Name(), mtype ) != mprOk )
4984 {
4985 return TRUE;
4986 }
4987
4988 uResultant * ures;
4992
4993 // main task 1: setup of resultant matrix
4994 ures= new uResultant( gls, mtype );
4995 if ( ures->accessResMat()->initState() != resMatrixBase::ready )
4996 {
4997 WerrorS("Error occurred during matrix setup!");
4998 return TRUE;
4999 }
5000
5001 // if dense resultant, check if minor nonsingular
5003 {
5004 smv= ures->accessResMat()->getSubDet();
5005#ifdef mprDEBUG_PROT
5006 PrintS("// Determinant of submatrix: ");nPrint(smv);PrintLn();
5007#endif
5008 if ( nIsZero(smv) )
5009 {
5010 WerrorS("Unsuitable input ideal: Minor of resultant matrix is singular!");
5011 return TRUE;
5012 }
5013 }
5014
5015 // main task 2: Interpolate specialized resultant polynomials
5016 if ( interpolate_det )
5017 iproots= ures->interpolateDenseSP( false, smv );
5018 else
5019 iproots= ures->specializeInU( false, smv );
5020
5021 // main task 3: Interpolate specialized resultant polynomials
5022 if ( interpolate_det )
5023 muiproots= ures->interpolateDenseSP( true, smv );
5024 else
5025 muiproots= ures->specializeInU( true, smv );
5026
5027#ifdef mprDEBUG_PROT
5028 int c= iproots[0]->getAnzElems();
5029 for (i=0; i < c; i++) pWrite(iproots[i]->getPoly());
5030 c= muiproots[0]->getAnzElems();
5031 for (i=0; i < c; i++) pWrite(muiproots[i]->getPoly());
5032#endif
5033
5034 // main task 4: Compute roots of specialized polys and match them up
5035 arranger= new rootArranger( iproots, muiproots, howclean );
5036 arranger->solve_all();
5037
5038 // get list of roots
5039 if ( arranger->success() )
5040 {
5041 arranger->arrange();
5043 }
5044 else
5045 {
5046 WerrorS("Solver was unable to find any roots!");
5047 return TRUE;
5048 }
5049
5050 // free everything
5051 count= iproots[0]->getAnzElems();
5052 for (i=0; i < count; i++) delete iproots[i];
5053 omFreeSize( (ADDRESS) iproots, count * sizeof(rootContainer*) );
5054 count= muiproots[0]->getAnzElems();
5055 for (i=0; i < count; i++) delete muiproots[i];
5057
5058 delete ures;
5059 delete arranger;
5060 if (smv!=NULL) nDelete( &smv );
5061
5062 res->data= (void *)listofroots;
5063
5064 //emptylist->Clean();
5065 // omFreeSize( (ADDRESS) emptylist, sizeof(slists) );
5066
5067 return FALSE;
5068}
int BOOLEAN
Definition auxiliary.h:88
@ denseResMat
Definition mpr_base.h:65
@ IDEAL_CMD
Definition grammar.cc:285
lists listOfRoots(rootArranger *self, const unsigned int oprec)
Definition ipshell.cc:5071
#define nDelete(n)
Definition numbers.h:16
#define nIsZero(n)
Definition numbers.h:19
#define omFreeSize(addr, size)
void pWrite(poly p)
Definition polys.h:309
int status int void size_t count
Definition si_signals.h:69
ideal idInit(int idsize, int rank)
initialise an ideal / module
intvec * id_QHomWeight(ideal id, const ring r)
#define IDELEMS(i)

◆ nuVanderSys()

BOOLEAN nuVanderSys ( leftv  res,
leftv  arg1,
leftv  arg2,
leftv  arg3 
)

COMPUTE: polynomial p with values given by v at points p1,..,pN derived from p; more precisely: consider p as point in K^n and v as N elements in K, let p1,..,pN be the points in K^n obtained by evaluating all monomials of degree 0,1,...,N at p in lexicographical order, then the procedure computes the polynomial f satisfying f(pi) = v[i] RETURN: polynomial f of degree d.

Definition at line 4813 of file ipshell.cc.

4814{
4815 int i;
4816 ideal p,w;
4817 p= (ideal)arg1->Data();
4818 w= (ideal)arg2->Data();
4819
4820 // w[0] = f(p^0)
4821 // w[1] = f(p^1)
4822 // ...
4823 // p can be a vector of numbers (multivariate polynom)
4824 // or one number (univariate polynom)
4825 // tdg = deg(f)
4826
4827 int n= IDELEMS( p );
4828 int m= IDELEMS( w );
4829 int tdg= (int)(long)arg3->Data();
4830
4831 res->data= (void*)NULL;
4832
4833 // check the input
4834 if ( tdg < 1 )
4835 {
4836 WerrorS("Last input parameter must be > 0!");
4837 return TRUE;
4838 }
4839 if ( n != rVar(currRing) )
4840 {
4841 Werror("Size of first input ideal must be equal to %d!",rVar(currRing));
4842 return TRUE;
4843 }
4844 if ( m != (int)pow((double)tdg+1,(double)n) )
4845 {
4846 Werror("Size of second input ideal must be equal to %d!",
4847 (int)pow((double)tdg+1,(double)n));
4848 return TRUE;
4849 }
4850 if ( !(rField_is_Q(currRing) /* ||
4851 rField_is_R() || rField_is_long_R() ||
4852 rField_is_long_C()*/ ) )
4853 {
4854 WerrorS("Ground field not implemented!");
4855 return TRUE;
4856 }
4857
4858 number tmp;
4859 number *pevpoint= (number *)omAlloc( n * sizeof( number ) );
4860 for ( i= 0; i < n; i++ )
4861 {
4862 pevpoint[i]=nInit(0);
4863 if ( (p->m)[i] )
4864 {
4865 tmp = pGetCoeff( (p->m)[i] );
4866 if ( nIsZero(tmp) || nIsOne(tmp) || nIsMOne(tmp) )
4867 {
4868 omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4869 WerrorS("Elements of first input ideal must not be equal to -1, 0, 1!");
4870 return TRUE;
4871 }
4872 } else tmp= NULL;
4873 if ( !nIsZero(tmp) )
4874 {
4875 if ( !pIsConstant((p->m)[i]))
4876 {
4877 omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4878 WerrorS("Elements of first input ideal must be numbers!");
4879 return TRUE;
4880 }
4881 pevpoint[i]= nCopy( tmp );
4882 }
4883 }
4884
4885 number *wresults= (number *)omAlloc( m * sizeof( number ) );
4886 for ( i= 0; i < m; i++ )
4887 {
4888 wresults[i]= nInit(0);
4889 if ( (w->m)[i] && !nIsZero(pGetCoeff((w->m)[i])) )
4890 {
4891 if ( !pIsConstant((w->m)[i]))
4892 {
4893 omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4894 omFreeSize( (ADDRESS)wresults, m * sizeof( number ) );
4895 WerrorS("Elements of second input ideal must be numbers!");
4896 return TRUE;
4897 }
4898 wresults[i]= nCopy(pGetCoeff((w->m)[i]));
4899 }
4900 }
4901
4902 vandermonde vm( m, n, tdg, pevpoint, FALSE );
4903 number *ncpoly= vm.interpolateDense( wresults );
4904 // do not free ncpoly[]!!
4905 poly rpoly= vm.numvec2poly( ncpoly );
4906
4907 omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4908 omFreeSize( (ADDRESS)wresults, m * sizeof( number ) );
4909
4910 res->data= (void*)rpoly;
4911 return FALSE;
4912}
Rational pow(const Rational &a, int e)
Definition GMPrat.cc:411
int p
Definition cfModGcd.cc:4086
vandermonde system solver for interpolating polynomials from their values
Definition mpr_numeric.h:29
const CanonicalForm & w
Definition facAbsFact.cc:51
#define nIsMOne(n)
Definition numbers.h:26
#define nIsOne(n)
Definition numbers.h:25
void Werror(const char *fmt,...)
Definition reporter.cc:189