Macros | Functions
ipassign.cc File Reference
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <kernel/mod2.h>
#include <misc/auxiliary.h>
#include <omalloc/omalloc.h>
#include <polys/ext_fields/transext.h>
#include <misc/options.h>
#include <misc/intvec.h>
#include <coeffs/coeffs.h>
#include <coeffs/numbers.h>
#include <coeffs/bigintmat.h>
#include <polys/ext_fields/algext.h>
#include <polys/monomials/ring.h>
#include <polys/matpol.h>
#include <polys/monomials/maps.h>
#include <polys/nc/nc.h>
#include <polys/nc/sca.h>
#include <polys/prCopy.h>
#include <kernel/polys.h>
#include <kernel/ideals.h>
#include <kernel/GBEngine/kstd1.h>
#include <kernel/oswrapper/timer.h>
#include <kernel/combinatorics/stairc.h>
#include <kernel/GBEngine/syz.h>
#include "tok.h"
#include "ipid.h"
#include "idrec.h"
#include "subexpr.h"
#include "lists.h"
#include "ipconv.h"
#include "attrib.h"
#include "links/silink.h"
#include "ipshell.h"
#include "blackbox.h"
#include <Singular/number2.h>
#include "table.h"

Go to the source code of this file.

Macros

#define TRANSEXT_PRIVATES
 
#define IPASSIGN
 
#define D(A)   A
 
#define NULL_VAL   NULL
 

Functions

static BOOLEAN jjECHO (leftv, leftv a)
 
static BOOLEAN jjPRINTLEVEL (leftv, leftv a)
 
static BOOLEAN jjCOLMAX (leftv, leftv a)
 
static BOOLEAN jjTIMER (leftv, leftv a)
 
static BOOLEAN jjRTIMER (leftv, leftv a)
 
static BOOLEAN jjMAXDEG (leftv, leftv a)
 
static BOOLEAN jjMAXMULT (leftv, leftv a)
 
static BOOLEAN jjTRACE (leftv, leftv a)
 
static BOOLEAN jjSHORTOUT (leftv, leftv a)
 
static void jjMINPOLY_red (idhdl h)
 
static BOOLEAN jjMINPOLY (leftv, leftv a)
 
static BOOLEAN jjNOETHER (leftv, leftv a)
 
static void jiAssignAttr (leftv l, leftv r)
 
static BOOLEAN jiA_INT (leftv res, leftv a, Subexpr e)
 
static BOOLEAN jiA_NUMBER (leftv res, leftv a, Subexpr)
 
static BOOLEAN jiA_NUMBER2 (leftv res, leftv a, Subexpr e)
 
static BOOLEAN jiA_NUMBER2_I (leftv res, leftv a, Subexpr e)
 
static BOOLEAN jiA_NUMBER2_N (leftv res, leftv a, Subexpr e)
 
static BOOLEAN jiA_BIGINT (leftv res, leftv a, Subexpr e)
 
static BOOLEAN jiA_LIST_RES (leftv res, leftv a, Subexpr)
 
static BOOLEAN jiA_LIST (leftv res, leftv a, Subexpr)
 
static BOOLEAN jiA_POLY (leftv res, leftv a, Subexpr e)
 
static BOOLEAN jiA_1x1INTMAT (leftv res, leftv a, Subexpr e)
 
static BOOLEAN jiA_1x1MATRIX (leftv res, leftv a, Subexpr e)
 
static BOOLEAN jiA_STRING (leftv res, leftv a, Subexpr e)
 
static BOOLEAN jiA_PROC (leftv res, leftv a, Subexpr)
 
static BOOLEAN jiA_INTVEC (leftv res, leftv a, Subexpr)
 
static BOOLEAN jiA_BIGINTMAT (leftv res, leftv a, Subexpr)
 
static BOOLEAN jiA_IDEAL (leftv res, leftv a, Subexpr)
 
static BOOLEAN jiA_RESOLUTION (leftv res, leftv a, Subexpr)
 
static BOOLEAN jiA_MODUL_P (leftv res, leftv a, Subexpr)
 
static BOOLEAN jiA_IDEAL_M (leftv res, leftv a, Subexpr)
 
static BOOLEAN jiA_LINK (leftv res, leftv a, Subexpr)
 
static BOOLEAN jiA_MAP (leftv res, leftv a, Subexpr)
 
static BOOLEAN jiA_MAP_ID (leftv res, leftv a, Subexpr)
 
static BOOLEAN jiA_QRING (leftv res, leftv a, Subexpr e)
 
static BOOLEAN jiA_RING (leftv res, leftv a, Subexpr e)
 
static BOOLEAN jiA_PACKAGE (leftv res, leftv a, Subexpr)
 
static BOOLEAN jiA_DEF (leftv res, leftv, Subexpr)
 
static BOOLEAN jiA_CRING (leftv res, leftv a, Subexpr e)
 
static BOOLEAN jiAssign_1 (leftv l, leftv r, BOOLEAN toplevel)
 
static BOOLEAN iiAssign_sys (leftv l, leftv r)
 
static BOOLEAN jiA_INTVEC_L (leftv l, leftv r)
 
static BOOLEAN jiA_VECTOR_L (leftv l, leftv r)
 
static BOOLEAN jjA_L_LIST (leftv l, leftv r)
 
static BOOLEAN jjA_L_INTVEC (leftv l, leftv r, intvec *iv)
 
static BOOLEAN jjA_L_BIGINTMAT (leftv l, leftv r, bigintmat *bim)
 
static BOOLEAN jjA_L_STRING (leftv l, leftv r)
 
static BOOLEAN jiA_MATRIX_L (leftv l, leftv r)
 
static BOOLEAN jiA_STRING_L (leftv l, leftv r)
 
static BOOLEAN jiAssign_list (leftv l, leftv r)
 
static BOOLEAN jiAssign_rec (leftv l, leftv r)
 
BOOLEAN iiAssign (leftv l, leftv r, BOOLEAN toplevel)
 
void jjNormalizeQRingId (leftv I)
 
void jjNormalizeQRingP (leftv I)
 
BOOLEAN jjIMPORTFROM (leftv, leftv u, leftv v)
 

Macro Definition Documentation

#define D (   A)    A

Definition at line 1058 of file ipassign.cc.

#define IPASSIGN

Definition at line 1057 of file ipassign.cc.

#define NULL_VAL   NULL

Definition at line 1059 of file ipassign.cc.

#define TRANSEXT_PRIVATES

Definition at line 19 of file ipassign.cc.

Function Documentation

BOOLEAN iiAssign ( leftv  l,
leftv  r,
BOOLEAN  toplevel 
)

Definition at line 1772 of file ipassign.cc.

1773 {
1774  if (errorreported) return TRUE;
1775  int ll=l->listLength();
1776  int rl;
1777  int lt=l->Typ();
1778  int rt=NONE;
1779  BOOLEAN b;
1780  if (l->rtyp==ALIAS_CMD)
1781  {
1782  Werror("`%s` is read-only",l->Name());
1783  }
1784 
1785  if (l->rtyp==IDHDL)
1786  {
1787  atKillAll((idhdl)l->data);
1788  IDFLAG((idhdl)l->data)=0;
1789  l->attribute=NULL;
1790  toplevel=FALSE;
1791  }
1792  else if (l->attribute!=NULL)
1793  atKillAll((idhdl)l);
1794  l->flag=0;
1795  if (ll==1)
1796  {
1797  /* l[..] = ... */
1798  if(l->e!=NULL)
1799  {
1800  BOOLEAN like_lists=0;
1801  blackbox *bb=NULL;
1802  int bt;
1803  if (((bt=l->rtyp)>MAX_TOK)
1804  || ((l->rtyp==IDHDL) && ((bt=IDTYP((idhdl)l->data))>MAX_TOK)))
1805  {
1806  bb=getBlackboxStuff(bt);
1807  like_lists=BB_LIKE_LIST(bb); // bb like a list
1808  }
1809  else if (((l->rtyp==IDHDL) && (IDTYP((idhdl)l->data)==LIST_CMD))
1810  || (l->rtyp==LIST_CMD))
1811  {
1812  like_lists=2; // bb in a list
1813  }
1814  if(like_lists)
1815  {
1816  if (traceit&TRACE_ASSIGN) PrintS("assign list[..]=...or similar\n");
1817  if (like_lists==1)
1818  {
1819  // check blackbox/newtype type:
1820  if(bb->blackbox_CheckAssign(bb,l,r)) return TRUE;
1821  }
1822  b=jiAssign_list(l,r);
1823  if((!b) && (like_lists==2))
1824  {
1825  //Print("jjA_L_LIST: - 2 \n");
1826  if((l->rtyp==IDHDL) && (l->data!=NULL))
1827  {
1828  ipMoveId((idhdl)l->data);
1829  l->attribute=IDATTR((idhdl)l->data);
1830  l->flag=IDFLAG((idhdl)l->data);
1831  }
1832  }
1833  r->CleanUp();
1834  Subexpr h;
1835  while (l->e!=NULL)
1836  {
1837  h=l->e->next;
1839  l->e=h;
1840  }
1841  return b;
1842  }
1843  }
1844  if (lt>MAX_TOK)
1845  {
1846  blackbox *bb=getBlackboxStuff(lt);
1847 #ifdef BLACKBOX_DEVEL
1848  Print("bb-assign: bb=%lx\n",bb);
1849 #endif
1850  return (bb==NULL) || bb->blackbox_Assign(l,r);
1851  }
1852  // end of handling elems of list and similar
1853  rl=r->listLength();
1854  if (rl==1)
1855  {
1856  /* system variables = ... */
1857  if(((l->rtyp>=VECHO)&&(l->rtyp<=VPRINTLEVEL))
1858  ||((l->rtyp>=VALTVARS)&&(l->rtyp<=VMINPOLY)))
1859  {
1860  b=iiAssign_sys(l,r);
1861  r->CleanUp();
1862  //l->CleanUp();
1863  return b;
1864  }
1865  rt=r->Typ();
1866  /* a = ... */
1867  if ((lt!=MATRIX_CMD)
1868  &&(lt!=BIGINTMAT_CMD)
1869  &&(lt!=CMATRIX_CMD)
1870  &&(lt!=INTMAT_CMD)
1871  &&((lt==rt)||(lt!=LIST_CMD)))
1872  {
1873  b=jiAssign_1(l,r,toplevel);
1874  if (l->rtyp==IDHDL)
1875  {
1876  if ((lt==DEF_CMD)||(lt==LIST_CMD))
1877  {
1878  ipMoveId((idhdl)l->data);
1879  }
1880  l->attribute=IDATTR((idhdl)l->data);
1881  l->flag=IDFLAG((idhdl)l->data);
1882  l->CleanUp();
1883  }
1884  r->CleanUp();
1885  return b;
1886  }
1887  if (((lt!=LIST_CMD)
1888  &&((rt==MATRIX_CMD)
1889  ||(rt==BIGINTMAT_CMD)
1890  ||(rt==CMATRIX_CMD)
1891  ||(rt==INTMAT_CMD)
1892  ||(rt==INTVEC_CMD)
1893  ||(rt==MODUL_CMD)))
1894  ||((lt==LIST_CMD)
1895  &&(rt==RESOLUTION_CMD))
1896  )
1897  {
1898  b=jiAssign_1(l,r,toplevel);
1899  if((l->rtyp==IDHDL)&&(l->data!=NULL))
1900  {
1901  if ((lt==DEF_CMD) || (lt==LIST_CMD))
1902  {
1903  //Print("ipAssign - 3.0\n");
1904  ipMoveId((idhdl)l->data);
1905  }
1906  l->attribute=IDATTR((idhdl)l->data);
1907  l->flag=IDFLAG((idhdl)l->data);
1908  }
1909  r->CleanUp();
1910  Subexpr h;
1911  while (l->e!=NULL)
1912  {
1913  h=l->e->next;
1915  l->e=h;
1916  }
1917  return b;
1918  }
1919  }
1920  if (rt==NONE) rt=r->Typ();
1921  }
1922  else if (ll==(rl=r->listLength()))
1923  {
1924  b=jiAssign_rec(l,r);
1925  return b;
1926  }
1927  else
1928  {
1929  if (rt==NONE) rt=r->Typ();
1930  if (rt==INTVEC_CMD)
1931  return jiA_INTVEC_L(l,r);
1932  else if (rt==VECTOR_CMD)
1933  return jiA_VECTOR_L(l,r);
1934  else if ((rt==IDEAL_CMD)||(rt==MATRIX_CMD))
1935  return jiA_MATRIX_L(l,r);
1936  else if ((rt==STRING_CMD)&&(rl==1))
1937  return jiA_STRING_L(l,r);
1938  Werror("length of lists in assignment does not match (l:%d,r:%d)",
1939  ll,rl);
1940  return TRUE;
1941  }
1942 
1943  leftv hh=r;
1944  BOOLEAN nok=FALSE;
1945  BOOLEAN map_assign=FALSE;
1946  switch (lt)
1947  {
1948  case INTVEC_CMD:
1949  nok=jjA_L_INTVEC(l,r,new intvec(exprlist_length(r)));
1950  break;
1951  case INTMAT_CMD:
1952  {
1953  nok=jjA_L_INTVEC(l,r,new intvec(IDINTVEC((idhdl)l->data)));
1954  break;
1955  }
1956  case BIGINTMAT_CMD:
1957  {
1958  nok=jjA_L_BIGINTMAT(l, r, new bigintmat(IDBIMAT((idhdl)l->data)));
1959  break;
1960  }
1961  case MAP_CMD:
1962  {
1963  // first element in the list sl (r) must be a ring
1964  if (((rt == RING_CMD)||(rt == QRING_CMD))&&(r->e==NULL))
1965  {
1966  omFree((ADDRESS)IDMAP((idhdl)l->data)->preimage);
1967  IDMAP((idhdl)l->data)->preimage = omStrDup (r->Fullname());
1968  /* advance the expressionlist to get the next element after the ring */
1969  hh = r->next;
1970  //r=hh;
1971  }
1972  else
1973  {
1974  WerrorS("expected ring-name");
1975  nok=TRUE;
1976  break;
1977  }
1978  if (hh==NULL) /* map-assign: map f=r; */
1979  {
1980  WerrorS("expected image ideal");
1981  nok=TRUE;
1982  break;
1983  }
1984  if ((hh->next==NULL)&&(hh->Typ()==IDEAL_CMD))
1985  return jiAssign_1(l,hh,toplevel); /* map-assign: map f=r,i; */
1986  //no break, handle the rest like an ideal:
1987  map_assign=TRUE;
1988  }
1989  case MATRIX_CMD:
1990  case IDEAL_CMD:
1991  case MODUL_CMD:
1992  {
1993  sleftv t;
1994  matrix olm = (matrix)l->Data();
1995  int rk;
1996  char *pr=((map)olm)->preimage;
1997  BOOLEAN module_assign=(/*l->Typ()*/ lt==MODUL_CMD);
1998  matrix lm ;
1999  int num;
2000  int j,k;
2001  int i=0;
2002  int mtyp=MATRIX_CMD; /*Type of left side object*/
2003  int etyp=POLY_CMD; /*Type of elements of left side object*/
2004 
2005  if (lt /*l->Typ()*/==MATRIX_CMD)
2006  {
2007  rk=olm->rows();
2008  num=olm->cols()*rk /*olm->rows()*/;
2009  lm=mpNew(olm->rows(),olm->cols());
2010  int el;
2011  if ((traceit&TRACE_ASSIGN) && (num!=(el=exprlist_length(hh))))
2012  {
2013  Warn("expression list length(%d) does not match matrix size(%d)",el,num);
2014  }
2015  }
2016  else /* IDEAL_CMD or MODUL_CMD */
2017  {
2018  num=exprlist_length(hh);
2019  lm=(matrix)idInit(num,1);
2020  if (module_assign)
2021  {
2022  rk=0;
2023  mtyp=MODUL_CMD;
2024  etyp=VECTOR_CMD;
2025  }
2026  else
2027  rk=1;
2028  }
2029 
2030  int ht;
2031  loop
2032  {
2033  if (hh==NULL)
2034  break;
2035  else
2036  {
2037  matrix rm;
2038  ht=hh->Typ();
2039  if ((j=iiTestConvert(ht,etyp))!=0)
2040  {
2041  nok=iiConvert(ht,etyp,j,hh,&t);
2042  hh->next=t.next;
2043  if (nok) break;
2044  lm->m[i]=(poly)t.CopyD(etyp);
2045  pNormalize(lm->m[i]);
2046  if (module_assign) rk=si_max(rk,(int)pMaxComp(lm->m[i]));
2047  i++;
2048  }
2049  else
2050  if ((j=iiTestConvert(ht,mtyp))!=0)
2051  {
2052  nok=iiConvert(ht,mtyp,j,hh,&t);
2053  hh->next=t.next;
2054  if (nok) break;
2055  rm = (matrix)t.CopyD(mtyp);
2056  if (module_assign)
2057  {
2058  j = si_min(num,rm->cols());
2059  rk=si_max(rk,(int)rm->rank);
2060  }
2061  else
2062  j = si_min(num-i,rm->rows() * rm->cols());
2063  for(k=0;k<j;k++,i++)
2064  {
2065  lm->m[i]=rm->m[k];
2066  pNormalize(lm->m[i]);
2067  rm->m[k]=NULL;
2068  }
2069  idDelete((ideal *)&rm);
2070  }
2071  else
2072  {
2073  nok=TRUE;
2074  break;
2075  }
2076  t.next=NULL;t.CleanUp();
2077  if (i==num) break;
2078  hh=hh->next;
2079  }
2080  }
2081  if (nok)
2082  idDelete((ideal *)&lm);
2083  else
2084  {
2085  idDelete((ideal *)&olm);
2086  if (module_assign) lm->rank=rk;
2087  else if (map_assign) ((map)lm)->preimage=pr;
2088  l=l->LData();
2089  if (l->rtyp==IDHDL)
2090  IDMATRIX((idhdl)l->data)=lm;
2091  else
2092  l->data=(char *)lm;
2093  }
2094  break;
2095  }
2096  case STRING_CMD:
2097  nok=jjA_L_STRING(l,r);
2098  break;
2099  //case DEF_CMD:
2100  case LIST_CMD:
2101  nok=jjA_L_LIST(l,r);
2102  break;
2103  case NONE:
2104  case 0:
2105  Werror("cannot assign to %s",l->Fullname());
2106  nok=TRUE;
2107  break;
2108  default:
2109  WerrorS("assign not impl.");
2110  nok=TRUE;
2111  break;
2112  } /* end switch: typ */
2113  if (nok && (!errorreported)) WerrorS("incompatible type in list assignment");
2114  r->CleanUp();
2115  return nok;
2116 }
int & rows()
Definition: matpol.h:24
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
static BOOLEAN jiA_INTVEC_L(leftv l, leftv r)
Definition: ipassign.cc:1303
void ipMoveId(idhdl tomove)
Definition: ipid.cc:601
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:290
Definition: tok.h:157
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRACE_ASSIGN
Definition: reporter.h:43
static BOOLEAN jjA_L_INTVEC(leftv l, leftv r, intvec *iv)
Definition: ipassign.cc:1435
#define Print
Definition: emacs.cc:83
Subexpr e
Definition: subexpr.h:106
BITSET flag
Definition: subexpr.h:91
CanonicalForm num(const CanonicalForm &f)
#define IDINTVEC(a)
Definition: ipid.h:127
#define pMaxComp(p)
Definition: polys.h:270
loop
Definition: myNF.cc:98
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
#define FALSE
Definition: auxiliary.h:140
int exprlist_length(leftv v)
Definition: ipshell.cc:552
Matrices of numbers.
Definition: bigintmat.h:32
static BOOLEAN jiAssign_list(leftv l, leftv r)
Definition: ipassign.cc:1679
Definition: tok.h:167
static BOOLEAN jiAssign_1(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1065
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
#define IDBIMAT(a)
Definition: ipid.h:128
void WerrorS(const char *s)
Definition: feFopen.cc:23
int k
Definition: cfEzgcd.cc:93
int traceit
Definition: febase.cc:47
int Typ()
Definition: subexpr.cc:955
const char * Name()
Definition: subexpr.h:121
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
const char * Fullname()
Definition: subexpr.h:126
static BOOLEAN jjA_L_BIGINTMAT(leftv l, leftv r, bigintmat *bim)
Definition: ipassign.cc:1484
static BOOLEAN iiAssign_sys(leftv l, leftv r)
Definition: ipassign.cc:1229
void * data
Definition: subexpr.h:89
#define IDTYP(a)
Definition: ipid.h:118
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
int j
Definition: myNF.cc:70
Definition: tok.h:58
#define omFree(addr)
Definition: omAllocDecl.h:261
pNormalize(P.p)
static BOOLEAN jiA_VECTOR_L(leftv l, leftv r)
Definition: ipassign.cc:1329
omBin sSubexpr_bin
Definition: subexpr.cc:49
ip_smatrix * matrix
static BOOLEAN jjA_L_STRING(leftv l, leftv r)
Definition: ipassign.cc:1533
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
Definition: tok.h:88
#define IDMAP(a)
Definition: ipid.h:134
short errorreported
Definition: feFopen.cc:22
leftv next
Definition: subexpr.h:87
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
Definition: tok.h:38
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define atKillAll(H)
Definition: attrib.h:42
static BOOLEAN jiA_STRING_L(leftv l, leftv r)
Definition: ipassign.cc:1643
int & cols()
Definition: matpol.h:25
#define NULL
Definition: omList.c:10
static BOOLEAN jiAssign_rec(leftv l, leftv r)
Definition: ipassign.cc:1749
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:287
static BOOLEAN jiA_MATRIX_L(leftv l, leftv r)
Definition: ipassign.cc:1567
static BOOLEAN jjA_L_LIST(leftv l, leftv r)
Definition: ipassign.cc:1370
int rtyp
Definition: subexpr.h:92
#define IDFLAG(a)
Definition: ipid.h:119
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
#define IDATTR(a)
Definition: ipid.h:122
void * Data()
Definition: subexpr.cc:1097
Definition: tok.h:96
attr attribute
Definition: subexpr.h:90
Definition: tok.h:126
polyrec * poly
Definition: hilb.h:10
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
#define NONE
Definition: tok.h:170
leftv LData()
Definition: subexpr.cc:1366
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void * CopyD(int t)
Definition: subexpr.cc:662
long rank
Definition: matpol.h:20
#define IDMATRIX(a)
Definition: ipid.h:133
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
static BOOLEAN iiAssign_sys ( leftv  l,
leftv  r 
)
static

Definition at line 1229 of file ipassign.cc.

1230 {
1231  int rt=r->Typ();
1232 
1233  if (rt==0)
1234  {
1235  if (!errorreported) Werror("`%s` is undefined",r->Fullname());
1236  return TRUE;
1237  }
1238  int i=0;
1239  int lt=l->rtyp;
1240  while (((dAssign_sys[i].res!=lt)
1241  || (dAssign_sys[i].arg!=rt))
1242  && (dAssign_sys[i].res!=0)) i++;
1243  if (dAssign_sys[i].res!=0)
1244  {
1245  if (!dAssign_sys[i].p(l,r))
1246  {
1247  // everything ok, clean up
1248  return FALSE;
1249  }
1250  }
1251  // implicite type conversion ----------------------------------------------
1252  if (dAssign_sys[i].res==0)
1253  {
1254  int ri;
1256  BOOLEAN failed=FALSE;
1257  i=0;
1258  while ((dAssign_sys[i].res!=lt)
1259  && (dAssign_sys[i].res!=0)) i++;
1260  while (dAssign_sys[i].res==lt)
1261  {
1262  if ((ri=iiTestConvert(rt,dAssign_sys[i].arg))!=0)
1263  {
1264  failed= ((iiConvert(rt,dAssign_sys[i].arg,ri,r,rn))
1265  || (dAssign_sys[i].p(l,rn)));
1266  // everything done, clean up temp. variables
1267  rn->CleanUp();
1269  if (failed)
1270  {
1271  // leave loop, goto error handling
1272  break;
1273  }
1274  else
1275  {
1276  // everything ok, return
1277  return FALSE;
1278  }
1279  }
1280  i++;
1281  }
1282  // error handling ---------------------------------------------------
1283  if(!errorreported)
1284  {
1285  Werror("`%s` = `%s` is not supported"
1286  ,Tok2Cmdname(lt),Tok2Cmdname(rt));
1287  if (BVERBOSE(V_SHOW_USE))
1288  {
1289  i=0;
1290  while ((dAssign_sys[i].res!=lt)
1291  && (dAssign_sys[i].res!=0)) i++;
1292  while (dAssign_sys[i].res==lt)
1293  {
1294  Werror("expected `%s` = `%s`"
1295  ,Tok2Cmdname(lt),Tok2Cmdname(dAssign_sys[i].arg));
1296  i++;
1297  }
1298  }
1299  }
1300  }
1301  return TRUE;
1302 }
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:290
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
sleftv * leftv
Definition: structs.h:60
int Typ()
Definition: subexpr.cc:955
const char * Fullname()
Definition: subexpr.h:126
poly res
Definition: myNF.cc:322
#define V_SHOW_USE
Definition: options.h:50
omBin sleftv_bin
Definition: subexpr.cc:50
int i
Definition: cfEzgcd.cc:123
short errorreported
Definition: feFopen.cc:22
#define BVERBOSE(a)
Definition: options.h:33
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:287
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
struct sValAssign_sys dAssign_sys[]
Definition: table.h:1234
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static BOOLEAN jiA_1x1INTMAT ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 684 of file ipassign.cc.

685 {
686  if (/*(*/ res->rtyp!=INTMAT_CMD /*)*/) /*|| (e!=NULL) - TRUE because of type int */
687  {
688  // no error message: assignment simply fails
689  return TRUE;
690  }
691  intvec* am=(intvec*)a->CopyD(INTMAT_CMD);
692  if ((am->rows()!=1) || (am->cols()!=1))
693  {
694  WerrorS("must be 1x1 intmat");
695  delete am;
696  return TRUE;
697  }
698  intvec* m=(intvec *)res->data;
699  // indices are correct (see ipExprArith3(..,'['..) )
700  int i=e->start;
701  int j=e->next->start;
702  IMATELEM(*m,i,j)=IMATELEM(*am,1,1);
703  delete am;
704  return FALSE;
705 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87
int rows() const
Definition: intvec.h:88
int rtyp
Definition: subexpr.h:92
#define IMATELEM(M, I, J)
Definition: intvec.h:77
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_1x1MATRIX ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 706 of file ipassign.cc.

707 {
708  if (/*(*/ res->rtyp!=MATRIX_CMD /*)*/) /*|| (e!=NULL) - TRUE because of type poly */
709  {
710  // no error message: assignment simply fails
711  return TRUE;
712  }
713  matrix am=(matrix)a->CopyD(MATRIX_CMD);
714  if ((MATROWS(am)!=1) || (MATCOLS(am)!=1))
715  {
716  WerrorS("must be 1x1 matrix");
717  idDelete((ideal *)&am);
718  return TRUE;
719  }
720  matrix m=(matrix)res->data;
721  // indices are correct (see ipExprArith3(..,'['..) )
722  int i=e->start;
723  int j=e->next->start;
724  pDelete(&MATELEM(m,i,j));
725  pNormalize(MATELEM(am,1,1));
726  MATELEM(m,i,j)=MATELEM(am,1,1);
727  MATELEM(am,1,1)=NULL;
728  idDelete((ideal *)&am);
729  return FALSE;
730 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
void * data
Definition: subexpr.h:89
int j
Definition: myNF.cc:70
pNormalize(P.p)
ip_smatrix * matrix
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
int rtyp
Definition: subexpr.h:92
#define MATROWS(i)
Definition: matpol.h:27
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void * CopyD(int t)
Definition: subexpr.cc:662
#define MATELEM(mat, i, j)
Definition: matpol.h:29
static BOOLEAN jiA_BIGINT ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 574 of file ipassign.cc.

575 {
576  number p=(number)a->CopyD(BIGINT_CMD);
577  if (e==NULL)
578  {
579  if (res->data!=NULL) n_Delete((number *)&res->data,coeffs_BIGINT);
580  res->data=(void *)p;
581  }
582  else
583  {
584  int i=e->start-1;
585  if (i<0)
586  {
587  Werror("index[%d] must be positive",i+1);
588  return TRUE;
589  }
590  bigintmat *iv=(bigintmat *)res->data;
591  if (e->next==NULL)
592  {
593  WerrorS("only one index given");
594  return TRUE;
595  }
596  else
597  {
598  int c=e->next->start;
599  if ((i>=iv->rows())||(c<1)||(c>iv->cols()))
600  {
601  Werror("wrong range [%d,%d] in bigintmat %s(%d,%d)",i+1,c,res->Name(),iv->rows(),iv->cols());
602  return TRUE;
603  }
604  else
605  {
606  n_Delete((number *)&BIMATELEM(*iv,i+1,c),iv->basecoeffs());
607  BIMATELEM(*iv,i+1,c) = p;
608  }
609  }
610  }
611  jiAssignAttr(res,a);
612  return FALSE;
613 }
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
#define FALSE
Definition: auxiliary.h:140
Definition: tok.h:42
return P p
Definition: myNF.cc:203
Matrices of numbers.
Definition: bigintmat.h:32
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
coeffs coeffs_BIGINT
Definition: ipid.cc:53
const char * Name()
Definition: subexpr.h:121
int int kStrategy strat if(h==NULL) return NULL
void * data
Definition: subexpr.h:89
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: bigintmat.h:128
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:117
int rows() const
Definition: bigintmat.h:129
#define NULL
Definition: omList.c:10
coeffs basecoeffs() const
Definition: bigintmat.h:130
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_BIGINTMAT ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 794 of file ipassign.cc.

795 {
796  if (res->data!=NULL) delete ((bigintmat *)res->data);
797  res->data=(void *)a->CopyD(BIGINTMAT_CMD);
798  jiAssignAttr(res,a);
799  return FALSE;
800 }
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
void * data
Definition: subexpr.h:89
#define NULL
Definition: omList.c:10
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_CRING ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 1048 of file ipassign.cc.

1049 {
1050  res->data=(void *)a->CopyD(CRING_CMD);
1051  jiAssignAttr(res,a);
1052  return FALSE;
1053 }
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
#define FALSE
Definition: auxiliary.h:140
void * data
Definition: subexpr.h:89
Definition: tok.h:56
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_DEF ( leftv  res,
leftv  ,
Subexpr   
)
static

Definition at line 1042 of file ipassign.cc.

1043 {
1044  res->data=(void *)0;
1045  return FALSE;
1046 }
#define FALSE
Definition: auxiliary.h:140
void * data
Definition: subexpr.h:89
static BOOLEAN jiA_IDEAL ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 801 of file ipassign.cc.

802 {
803  if (res->data!=NULL) idDelete((ideal*)&res->data);
804  res->data=(void *)a->CopyD(MATRIX_CMD);
805  if (a->rtyp==IDHDL) id_Normalize((ideal)a->Data(), currRing);
806  else id_Normalize((ideal)res->data, currRing);
807  jiAssignAttr(res,a);
808  if (((res->rtyp==IDEAL_CMD)||(res->rtyp==MODUL_CMD))
809  && (IDELEMS((ideal)(res->data))==1)
810  && (currRing->qideal==NULL)
811  && (!rIsPluralRing(currRing))
812  )
813  {
814  setFlag(res,FLAG_STD);
815  }
816  if (TEST_V_QRING && (currRing->qideal!=NULL)&& (!hasFlag(res,FLAG_QRING))) jjNormalizeQRingId(res);
817  return FALSE;
818 }
void id_Normalize(ideal I, const ring r)
normialize all polys in id
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
#define FALSE
Definition: auxiliary.h:140
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define setFlag(A, F)
Definition: ipid.h:112
#define FLAG_QRING
Definition: ipid.h:110
#define TEST_V_QRING
Definition: options.h:125
#define IDELEMS(i)
Definition: simpleideals.h:24
#define FLAG_STD
Definition: ipid.h:108
void jjNormalizeQRingId(leftv I)
Definition: ipassign.cc:2117
#define NULL
Definition: omList.c:10
#define hasFlag(A, F)
Definition: ipid.h:111
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_IDEAL_M ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 842 of file ipassign.cc.

843 {
844  if (res->data!=NULL) idDelete((ideal*)&res->data);
846  if (TEST_V_ALLWARN)
847  if (MATROWS(m)>1)
848  Warn("assign matrix with %d rows to an ideal in >>%s<<",MATROWS(m),my_yylinebuf);
849  IDELEMS((ideal)m)=MATROWS(m)*MATCOLS(m);
850  ((ideal)m)->rank=1;
851  MATROWS(m)=1;
852  id_Normalize((ideal)m, currRing);
853  res->data=(void *)m;
854  if (TEST_V_QRING && (currRing->qideal!=NULL)) jjNormalizeQRingId(res);
855  return FALSE;
856 }
void id_Normalize(ideal I, const ring r)
normialize all polys in id
#define FALSE
Definition: auxiliary.h:140
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char my_yylinebuf[80]
Definition: febase.cc:48
ip_smatrix * matrix
int m
Definition: cfEzgcd.cc:119
#define TEST_V_QRING
Definition: options.h:125
#define IDELEMS(i)
Definition: simpleideals.h:24
void jjNormalizeQRingId(leftv I)
Definition: ipassign.cc:2117
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
#define MATROWS(i)
Definition: matpol.h:27
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
#define TEST_V_ALLWARN
Definition: options.h:135
void * CopyD(int t)
Definition: subexpr.cc:662
#define Warn
Definition: emacs.cc:80
static BOOLEAN jiA_INT ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 358 of file ipassign.cc.

359 {
360  if (e==NULL)
361  {
362  res->data=(void *)a->Data();
363  jiAssignAttr(res,a);
364  }
365  else
366  {
367  int i=e->start-1;
368  if (i<0)
369  {
370  Werror("index[%d] must be positive",i+1);
371  return TRUE;
372  }
373  intvec *iv=(intvec *)res->data;
374  if (e->next==NULL)
375  {
376  if (i>=iv->length())
377  {
378  intvec *iv1=new intvec(i+1);
379  (*iv1)[i]=(int)((long)(a->Data()));
380  intvec *ivn=ivAdd(iv,iv1);
381  delete iv;
382  delete iv1;
383  res->data=(void *)ivn;
384  }
385  else
386  (*iv)[i]=(int)((long)(a->Data()));
387  }
388  else
389  {
390  int c=e->next->start;
391  if ((i>=iv->rows())||(c<1)||(c>iv->cols()))
392  {
393  Werror("wrong range [%d,%d] in intmat %s(%d,%d)",i+1,c,res->Name(),iv->rows(),iv->cols());
394  return TRUE;
395  }
396  else
397  IMATELEM(*iv,i+1,c) = (int)((long)(a->Data()));
398  }
399  }
400  return FALSE;
401 }
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int length() const
Definition: intvec.h:86
const char * Name()
Definition: subexpr.h:121
int int kStrategy strat if(h==NULL) return NULL
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:87
int rows() const
Definition: intvec.h:88
void * Data()
Definition: subexpr.cc:1097
#define IMATELEM(M, I, J)
Definition: intvec.h:77
void Werror(const char *fmt,...)
Definition: reporter.cc:199
intvec * ivAdd(intvec *a, intvec *b)
Definition: intvec.cc:276
static BOOLEAN jiA_INTVEC ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 771 of file ipassign.cc.

772 {
773  //if ((res->data==NULL) || (res->Typ()==a->Typ()))
774  {
775  if (res->data!=NULL) delete ((intvec *)res->data);
776  res->data=(void *)a->CopyD(INTVEC_CMD);
777  jiAssignAttr(res,a);
778  return FALSE;
779  }
780 #if 0
781  else
782  {
783  intvec *r=(intvec *)(res->data);
784  intvec *s=(intvec *)(a->Data());
785  int i=si_min(r->length(), s->length())-1;
786  for(;i>=0;i--)
787  {
788  (*r)[i]=(*s)[i];
789  }
790  return FALSE; //(r->length()< s->length());
791  }
792 #endif
793 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
#define FALSE
Definition: auxiliary.h:140
int length() const
Definition: intvec.h:86
void * data
Definition: subexpr.h:89
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
Definition: tok.h:88
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1097
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_INTVEC_L ( leftv  l,
leftv  r 
)
static

Definition at line 1303 of file ipassign.cc.

1304 {
1305  /* right side is intvec, left side is list (of int)*/
1306  BOOLEAN nok;
1307  int i=0;
1308  leftv l1=l;
1309  leftv h;
1310  sleftv t;
1311  intvec *iv=(intvec *)r->Data();
1312  memset(&t,0,sizeof(sleftv));
1313  t.rtyp=INT_CMD;
1314  while ((i<iv->length())&&(l!=NULL))
1315  {
1316  t.data=(char *)(long)(*iv)[i];
1317  h=l->next;
1318  l->next=NULL;
1319  nok=jiAssign_1(l,&t,TRUE);
1320  l->next=h;
1321  if (nok) return TRUE;
1322  i++;
1323  l=h;
1324  }
1325  l1->CleanUp();
1326  r->CleanUp();
1327  return FALSE;
1328 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
static BOOLEAN jiAssign_1(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1065
#define TRUE
Definition: auxiliary.h:144
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
void * Data()
Definition: subexpr.cc:1097
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
int l
Definition: cfEzgcd.cc:94
static BOOLEAN jiA_LINK ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 857 of file ipassign.cc.

858 {
859  si_link l=(si_link)res->data;
860 
861  if (l!=NULL) slCleanUp(l);
862 
863  if (a->Typ() == STRING_CMD)
864  {
865  if (l == NULL)
866  {
868  res->data = (void *) l;
869  }
870  return slInit(l, (char *) a->Data());
871  }
872  else if (a->Typ() == LINK_CMD)
873  {
874  if (l != NULL) omFreeBin(l, sip_link_bin);
875  res->data = slCopy((si_link)a->Data());
876  return FALSE;
877  }
878  return TRUE;
879 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int Typ()
Definition: subexpr.cc:955
int int kStrategy strat if(h==NULL) return NULL
void * data
Definition: subexpr.h:89
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
Definition: tok.h:95
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1097
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
int l
Definition: cfEzgcd.cc:94
static BOOLEAN jiA_LIST ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 625 of file ipassign.cc.

626 {
627  lists l=(lists)a->CopyD(LIST_CMD);
628  if (res->data!=NULL) ((lists)res->data)->Clean();
629  res->data=(void *)l;
630  jiAssignAttr(res,a);
631  return FALSE;
632 }
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
void * data
Definition: subexpr.h:89
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:96
void * CopyD(int t)
Definition: subexpr.cc:662
int l
Definition: cfEzgcd.cc:94
static BOOLEAN jiA_LIST_RES ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 614 of file ipassign.cc.

615 {
617  if (res->data!=NULL) ((lists)res->data)->Clean();
618  int add_row_shift = 0;
619  intvec *weights=(intvec*)atGet(a,"isHomog",INTVEC_CMD);
620  if (weights!=NULL) add_row_shift=weights->min_in();
621  res->data=(void *)syConvRes(r,TRUE,add_row_shift);
622  //jiAssignAttr(res,a);
623  return FALSE;
624 }
#define FALSE
Definition: auxiliary.h:140
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:2760
#define TRUE
Definition: auxiliary.h:144
int min_in()
Definition: intvec.h:110
void * data
Definition: subexpr.h:89
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
Definition: tok.h:88
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
void * CopyD(int t)
Definition: subexpr.cc:662
ssyStrategy * syStrategy
Definition: syz.h:35
static BOOLEAN jiA_MAP ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 881 of file ipassign.cc.

882 {
883  if (res->data!=NULL)
884  {
885  omFree((ADDRESS)((map)res->data)->preimage);
886  ((map)res->data)->preimage=NULL;
887  idDelete((ideal*)&res->data);
888  }
889  res->data=(void *)a->CopyD(MAP_CMD);
890  jiAssignAttr(res,a);
891  return FALSE;
892 }
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
#define FALSE
Definition: auxiliary.h:140
void * ADDRESS
Definition: auxiliary.h:161
void * data
Definition: subexpr.h:89
#define omFree(addr)
Definition: omAllocDecl.h:261
#define NULL
Definition: omList.c:10
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_MAP_ID ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 894 of file ipassign.cc.

895 {
896  map f=(map)res->data;
897  char *rn=f->preimage; // save the old/already assigned preimage ring name
898  f->preimage=NULL;
899  idDelete((ideal *)&f);
900  res->data=(void *)a->CopyD(IDEAL_CMD);
901  f=(map)res->data;
902  id_Normalize((ideal)f, currRing);
903  f->preimage = rn;
904  return FALSE;
905 }
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
void id_Normalize(ideal I, const ring r)
normialize all polys in id
#define FALSE
Definition: auxiliary.h:140
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
FILE * f
Definition: checklibs.c:7
#define NULL
Definition: omList.c:10
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_MATRIX_L ( leftv  l,
leftv  r 
)
static

Definition at line 1567 of file ipassign.cc.

1568 {
1569  /* right side is matrix, left side is list (of poly)*/
1570  BOOLEAN nok=FALSE;
1571  int i;
1573  leftv h;
1574  leftv ol=l;
1575  leftv o_r=r;
1576  sleftv t;
1577  memset(&t,0,sizeof(sleftv));
1578  t.rtyp=POLY_CMD;
1579  int mxn=MATROWS(m)*MATCOLS(m);
1580  loop
1581  {
1582  i=0;
1583  while ((i<mxn /*MATROWS(m)*MATCOLS(m)*/)&&(l!=NULL))
1584  {
1585  t.data=(char *)m->m[i];
1586  m->m[i]=NULL;
1587  h=l->next;
1588  l->next=NULL;
1589  idhdl hh=NULL;
1590  if ((l->rtyp==IDHDL)&&(l->Typ()==DEF_CMD)) hh=(idhdl)l->data;
1591  nok=jiAssign_1(l,&t,TRUE);
1592  if (hh!=NULL) { ipMoveId(hh);hh=NULL;}
1593  l->next=h;
1594  if (nok)
1595  {
1596  idDelete((ideal *)&m);
1597  goto ende;
1598  }
1599  i++;
1600  l=h;
1601  }
1602  idDelete((ideal *)&m);
1603  h=r;
1604  r=r->next;
1605  if (l==NULL)
1606  {
1607  if (r!=NULL)
1608  {
1609  Warn("list length mismatch in assign (l>r)");
1610  nok=TRUE;
1611  }
1612  break;
1613  }
1614  else if (r==NULL)
1615  {
1616  Warn("list length mismatch in assign (l<r)");
1617  nok=TRUE;
1618  break;
1619  }
1620  if ((r->Typ()==IDEAL_CMD)||(r->Typ()==MATRIX_CMD))
1621  {
1622  m=(matrix)r->CopyD(MATRIX_CMD);
1623  mxn=MATROWS(m)*MATCOLS(m);
1624  }
1625  else if (r->Typ()==POLY_CMD)
1626  {
1627  m=mpNew(1,1);
1628  MATELEM(m,1,1)=(poly)r->CopyD(POLY_CMD);
1629  pNormalize(MATELEM(m,1,1));
1630  mxn=1;
1631  }
1632  else
1633  {
1634  nok=TRUE;
1635  break;
1636  }
1637  }
1638 ende:
1639  o_r->CleanUp();
1640  ol->CleanUp();
1641  return nok;
1642 }
void ipMoveId(idhdl tomove)
Definition: ipid.cc:601
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
static BOOLEAN jiAssign_1(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1065
#define TRUE
Definition: auxiliary.h:144
int Typ()
Definition: subexpr.cc:955
int int kStrategy strat if(h==NULL) return NULL
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
Definition: tok.h:58
pNormalize(P.p)
ip_smatrix * matrix
int m
Definition: cfEzgcd.cc:119
idrec * idhdl
Definition: ring.h:18
int i
Definition: cfEzgcd.cc:123
leftv next
Definition: subexpr.h:87
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
#define MATROWS(i)
Definition: matpol.h:27
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void * CopyD(int t)
Definition: subexpr.cc:662
int l
Definition: cfEzgcd.cc:94
#define MATELEM(mat, i, j)
Definition: matpol.h:29
#define Warn
Definition: emacs.cc:80
static BOOLEAN jiA_MODUL_P ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 826 of file ipassign.cc.

828 {
829  if (res->data!=NULL) idDelete((ideal*)&res->data);
830  ideal I=idInit(1,1);
831  I->m[0]=(poly)a->CopyD(POLY_CMD);
832  if (I->m[0]!=NULL) pSetCompP(I->m[0],1);
833  pNormalize(I->m[0]);
834  res->data=(void *)I;
835  if (TEST_V_QRING && (currRing->qideal!=NULL))
836  {
837  if (hasFlag(a,FLAG_QRING)) setFlag(res,FLAG_QRING);
838  else jjNormalizeQRingId(res);
839  }
840  return FALSE;
841 }
#define FALSE
Definition: auxiliary.h:140
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCompP(a, i)
Definition: polys.h:274
pNormalize(P.p)
#define setFlag(A, F)
Definition: ipid.h:112
#define FLAG_QRING
Definition: ipid.h:110
#define TEST_V_QRING
Definition: options.h:125
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
void jjNormalizeQRingId(leftv I)
Definition: ipassign.cc:2117
#define NULL
Definition: omList.c:10
#define hasFlag(A, F)
Definition: ipid.h:111
polyrec * poly
Definition: hilb.h:10
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_NUMBER ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 402 of file ipassign.cc.

403 {
404  number p=(number)a->CopyD(NUMBER_CMD);
405  if (res->data!=NULL) nDelete((number *)&res->data);
406  nNormalize(p);
407  res->data=(void *)p;
408  jiAssignAttr(res,a);
409  return FALSE;
410 }
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
#define nNormalize(n)
Definition: numbers.h:30
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
void * data
Definition: subexpr.h:89
#define nDelete(n)
Definition: numbers.h:16
#define NULL
Definition: omList.c:10
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_NUMBER2 ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 412 of file ipassign.cc.

413 {
414  number2 n=(number2)a->CopyD(CNUMBER_CMD);
415  if (e==NULL)
416  {
417  if (res->data!=NULL)
418  {
419  number2 nn=(number2)res->data;
420  n2Delete(nn);
421  }
422  res->data=(void *)n;
423  jiAssignAttr(res,a);
424  }
425  else
426  {
427  int i=e->start-1;
428  if (i<0)
429  {
430  Werror("index[%d] must be positive",i+1);
431  return TRUE;
432  }
433  bigintmat *iv=(bigintmat *)res->data;
434  if (e->next==NULL)
435  {
436  WerrorS("only one index given");
437  return TRUE;
438  }
439  else
440  {
441  int c=e->next->start;
442  if ((i>=iv->rows())||(c<1)||(c>iv->cols()))
443  {
444  Werror("wrong range [%d,%d] in cmatrix %s(%d,%d)",i+1,c,res->Name(),iv->rows(),iv->cols());
445  return TRUE;
446  }
447  else if (iv->basecoeffs()==n->cf)
448  {
449  n_Delete((number *)&BIMATELEM(*iv,i+1,c),iv->basecoeffs());
450  BIMATELEM(*iv,i+1,c) = n->n;
451  }
452  else
453  {
454  WerrorS("different base");
455  return TRUE;
456  }
457  }
458  }
459  jiAssignAttr(res,a);
460  return FALSE;
461 }
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
void n2Delete(number2 &d)
Definition: number2.cc:285
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
const char * Name()
Definition: subexpr.h:121
int int kStrategy strat if(h==NULL) return NULL
void * data
Definition: subexpr.h:89
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: bigintmat.h:128
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:117
int rows() const
Definition: bigintmat.h:129
#define NULL
Definition: omList.c:10
coeffs basecoeffs() const
Definition: bigintmat.h:130
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_NUMBER2_I ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 462 of file ipassign.cc.

463 {
464  if (e==NULL)
465  {
466  if (res->data!=NULL)
467  {
468  number2 nn=(number2)res->data;
469  number2 n=n2Init((long)a->Data(),nn->cf);
470  n2Delete(nn);
471  res->data=(void *)n;
472  }
473  else
474  {
475  WerrorS("no (c)ring avialable for conversion from int");
476  return TRUE;
477  }
478  }
479  else
480  {
481  int i=e->start-1;
482  if (i<0)
483  {
484  Werror("index[%d] must be positive",i+1);
485  return TRUE;
486  }
487  bigintmat *iv=(bigintmat *)res->data;
488  if (e->next==NULL)
489  {
490  WerrorS("only one index given");
491  return TRUE;
492  }
493  else
494  {
495  int c=e->next->start;
496  if ((i>=iv->rows())||(c<1)||(c>iv->cols()))
497  {
498  Werror("wrong range [%d,%d] in cmatrix %s(%d,%d)",i+1,c,res->Name(),iv->rows(),iv->cols());
499  return TRUE;
500  }
501  else
502  {
503  n_Delete((number *)&BIMATELEM(*iv,i+1,c),iv->basecoeffs());
504  BIMATELEM(*iv,i+1,c) = n_Init((long)a->Data(),iv->basecoeffs());
505  }
506  }
507  }
508  return FALSE;
509 }
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
void n2Delete(number2 &d)
Definition: number2.cc:285
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
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
const char * Name()
Definition: subexpr.h:121
int int kStrategy strat if(h==NULL) return NULL
void * data
Definition: subexpr.h:89
static number2 n2Init(long i, coeffs c)
Definition: number2.h:17
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: bigintmat.h:128
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:117
int rows() const
Definition: bigintmat.h:129
#define NULL
Definition: omList.c:10
coeffs basecoeffs() const
Definition: bigintmat.h:130
void * Data()
Definition: subexpr.cc:1097
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static BOOLEAN jiA_NUMBER2_N ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 510 of file ipassign.cc.

511 {
512  if (e==NULL)
513  {
514  if (res->data!=NULL)
515  {
516  number2 nn=(number2)res->data;
517  if (currRing->cf==nn->cf)
518  {
519  number2 n=(number2)omAlloc(sizeof(*n));
520  n->cf=currRing->cf; n->cf++;
521  n->n=(number)a->CopyD(NUMBER_CMD);
522  n2Delete(nn);
523  res->data=(void *)n;
524  }
525  else
526  {
527  WerrorS("different base");
528  return TRUE;
529  }
530  }
531  else
532  {
533  WerrorS("no (c)ring avialable for conversion from number");
534  return TRUE;
535  }
536  }
537  else
538  {
539  int i=e->start-1;
540  if (i<0)
541  {
542  Werror("index[%d] must be positive",i+1);
543  return TRUE;
544  }
545  bigintmat *iv=(bigintmat *)res->data;
546  if (e->next==NULL)
547  {
548  WerrorS("only one index given");
549  return TRUE;
550  }
551  else
552  {
553  int c=e->next->start;
554  if ((i>=iv->rows())||(c<1)||(c>iv->cols()))
555  {
556  Werror("wrong range [%d,%d] in cmatrix %s(%d,%d)",i+1,c,res->Name(),iv->rows(),iv->cols());
557  return TRUE;
558  }
559  else if (iv->basecoeffs()==currRing->cf)
560  {
561  n_Delete((number *)&BIMATELEM(*iv,i+1,c),iv->basecoeffs());
562  BIMATELEM(*iv,i+1,c) = (number)(a->CopyD(NUMBER_CMD));
563  }
564  else
565  {
566  WerrorS("different base");
567  return TRUE;
568  }
569  }
570  }
571  return FALSE;
572 }
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
void n2Delete(number2 &d)
Definition: number2.cc:285
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
#define omAlloc(size)
Definition: omAllocDecl.h:210
const char * Name()
Definition: subexpr.h:121
int int kStrategy strat if(h==NULL) return NULL
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: bigintmat.h:128
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:117
int rows() const
Definition: bigintmat.h:129
#define NULL
Definition: omList.c:10
coeffs basecoeffs() const
Definition: bigintmat.h:130
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_PACKAGE ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 1036 of file ipassign.cc.

1037 {
1038  res->data=(void *)a->CopyD(PACKAGE_CMD);
1039  jiAssignAttr(res,a);
1040  return FALSE;
1041 }
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
#define FALSE
Definition: auxiliary.h:140
void * data
Definition: subexpr.h:89
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_POLY ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 633 of file ipassign.cc.

634 {
635  poly p=(poly)a->CopyD(POLY_CMD);
636  pNormalize(p);
637  if (e==NULL)
638  {
639  if (res->data!=NULL) pDelete((poly*)&res->data);
640  res->data=(void*)p;
641  jiAssignAttr(res,a);
642  if (TEST_V_QRING && (currRing->qideal!=NULL) && (!hasFlag(res,FLAG_QRING))) jjNormalizeQRingP(res);
643  }
644  else
645  {
646  int i,j;
647  matrix m=(matrix)res->data;
648  i=e->start;
649  if (e->next==NULL)
650  {
651  j=i; i=1;
652  // for all ideal like data types: check indices
653  if (j>MATCOLS(m))
654  {
655  if (TEST_V_ALLWARN)
656  {
657  Warn("increase ideal %d -> %d in %s",MATCOLS(m),j,my_yylinebuf);
658  }
659  pEnlargeSet(&(m->m),MATCOLS(m),j-MATCOLS(m));
660  MATCOLS(m)=j;
661  }
662  else if (j<=0)
663  {
664  Werror("index[%d] must be positive",j/*e->start*/);
665  return TRUE;
666  }
667  }
668  else
669  {
670  // for matrices: indices are correct (see ipExprArith3(..,'['..) )
671  j=e->next->start;
672  }
673  pDelete(&MATELEM(m,i,j));
674  MATELEM(m,i,j)=p;
675  /* for module: update rank */
676  if ((p!=NULL) && (pGetComp(p)!=0))
677  {
678  m->rank=si_max(m->rank,pMaxComp(p));
679  }
681  }
682  return FALSE;
683 }
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
void jjNormalizeQRingP(leftv I)
Definition: ipassign.cc:2152
#define pMaxComp(p)
Definition: polys.h:270
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
#define pGetComp(p)
Component.
Definition: polys.h:37
int int kStrategy strat if(h==NULL) return NULL
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
poly * m
Definition: matpol.h:19
char my_yylinebuf[80]
Definition: febase.cc:48
int j
Definition: myNF.cc:70
pNormalize(P.p)
ip_smatrix * matrix
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
#define FLAG_QRING
Definition: ipid.h:110
int i
Definition: cfEzgcd.cc:123
#define TEST_V_QRING
Definition: options.h:125
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3540
#define hasFlag(A, F)
Definition: ipid.h:111
#define pDelete(p_ptr)
Definition: polys.h:157
polyrec * poly
Definition: hilb.h:10
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define TEST_V_ALLWARN
Definition: options.h:135
void * CopyD(int t)
Definition: subexpr.cc:662
long rank
Definition: matpol.h:20
#define MATELEM(mat, i, j)
Definition: matpol.h:29
#define Warn
Definition: emacs.cc:80
static BOOLEAN jiA_PROC ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 753 of file ipassign.cc.

754 {
755  extern procinfo *iiInitSingularProcinfo(procinfo *pi, const char *libname,
756  const char *procname, int line,
757  long pos, BOOLEAN pstatic=FALSE);
758  if(res->data!=NULL) piKill((procinfo *)res->data);
759  if(a->Typ()==STRING_CMD)
760  {
761  res->data = (void *)omAlloc0Bin(procinfo_bin);
762  ((procinfo *)(res->data))->language=LANG_NONE;
763  iiInitSingularProcinfo((procinfo *)res->data,"",res->name,0,0);
764  ((procinfo *)res->data)->data.s.body=(char *)a->CopyD(STRING_CMD);
765  }
766  else
767  res->data=(void *)a->CopyD(PROC_CMD);
768  jiAssignAttr(res,a);
769  return FALSE;
770 }
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int line, long pos, BOOLEAN pstatic)
Definition: iplib.cc:976
#define FALSE
Definition: auxiliary.h:140
int Typ()
Definition: subexpr.cc:955
BOOLEAN piKill(procinfov pi)
Definition: ipid.cc:644
omBin procinfo_bin
Definition: subexpr.cc:51
void * data
Definition: subexpr.h:89
const char * name
Definition: subexpr.h:88
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define pi
Definition: libparse.cc:1143
#define NULL
Definition: omList.c:10
int BOOLEAN
Definition: auxiliary.h:131
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_QRING ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 906 of file ipassign.cc.

907 {
908  // the follwing can only happen, if:
909  // - the left side is of type qring AND not an id
910  if ((e!=NULL)||(res->rtyp!=IDHDL))
911  {
912  WerrorS("qring_id expected");
913  return TRUE;
914  }
915  assume(res->Data()==NULL);
916 
917  coeffs newcf = currRing->cf;
918  ideal id = (ideal)a->Data(); //?
919  const int cpos = idPosConstant(id);
921  if (cpos >= 0)
922  {
923  newcf = n_CoeffRingQuot1(p_GetCoeff(id->m[cpos], currRing), currRing->cf);
924  if(newcf == NULL)
925  return TRUE;
926  }
927  //qr=(ring)res->Data();
928  //if (qr!=NULL) omFreeBin((ADDRESS)qr, ip_sring_bin);
929  ring qr = rCopy(currRing);
930  assume(qr->cf == currRing->cf);
931 
932  if ( qr->cf != newcf )
933  {
934  nKillChar ( qr->cf ); // ???
935  qr->cf = newcf;
936  }
937  // we have to fill it, but the copy also allocates space
938  idhdl h=(idhdl)res->data; // we have res->rtyp==IDHDL
939  IDRING(h)=qr;
940 
941  ideal qid;
942 
943 #ifdef HAVE_RINGS
944  if((rField_is_Ring(currRing)) && (cpos != -1))
945  {
946  int i, j;
947  int *perm = (int *)omAlloc0((qr->N+1)*sizeof(int));
948 
949  for(i=qr->N;i>0;i--)
950  perm[i]=i;
951 
952  nMapFunc nMap = n_SetMap(currRing->cf, newcf);
953  qid = idInit(IDELEMS(id)-1,1);
954  for(i = 0, j = 0; i<IDELEMS(id); i++)
955  if( i != cpos )
956  qid->m[j++] = p_PermPoly(id->m[i], perm, currRing, qr, nMap, NULL, 0);
957  }
958  else
959 #endif
960  qid = idrCopyR(id,currRing,qr);
961 
962  idSkipZeroes(qid);
963  //idPrint(qid);
964  if ((idElem(qid)>1) || rIsSCA(currRing) || (currRing->qideal!=NULL))
965  assumeStdFlag(a);
966 
967  if (currRing->qideal!=NULL) /* we are already in a qring! */
968  {
969  ideal tmp=idSimpleAdd(qid,currRing->qideal);
970  // both ideals should be GB, so dSimpleAdd is sufficient
971  idDelete(&qid);
972  qid=tmp;
973  // delete the qr copy of quotient ideal!!!
974  idDelete(&qr->qideal);
975  }
976  if (idElem(qid)==0)
977  {
978  qr->qideal = NULL;
979  id_Delete(&qid,currRing);
980  IDTYP(h)=RING_CMD;
981  }
982  else
983  qr->qideal = qid;
984 
985  // qr is a copy of currRing with the new qideal!
986  #ifdef HAVE_PLURAL
987  if(rIsPluralRing(currRing) &&(qr->qideal!=NULL))
988  {
989  if (!hasFlag(a,FLAG_TWOSTD))
990  {
991  Warn("%s is no twosided standard basis",a->Name());
992  }
993 
994  if( nc_SetupQuotient(qr, currRing) )
995  {
996 // WarnS("error in nc_SetupQuotient");
997  }
998  }
999  #endif
1000  //rWrite(qr);
1001  rSetHdl((idhdl)res->data);
1002  return FALSE;
1003 }
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:42
#define FALSE
Definition: auxiliary.h:140
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
Definition: old.gring.cc:3488
#define idSimpleAdd(A, B)
Definition: ideals.h:58
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
const char * Name()
Definition: subexpr.h:121
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
#define FLAG_TWOSTD
Definition: ipid.h:109
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
The main handler for Singular numbers which are suitable for Singular polynomials.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:72
idrec * idhdl
Definition: ring.h:18
BOOLEAN assumeStdFlag(leftv h)
Definition: subexpr.cc:1434
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:720
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar)
Definition: p_polys.cc:3928
ring rCopy(ring r)
Definition: ring.cc:1618
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
#define hasFlag(A, F)
Definition: ipid.h:111
#define IDRING(a)
Definition: ipid.h:126
int rtyp
Definition: subexpr.h:92
static bool rIsSCA(const ring r)
Definition: nc.h:206
void * Data()
Definition: subexpr.cc:1097
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:193
#define p_GetCoeff(p, r)
Definition: monomials.h:57
int idElem(const ideal F)
count non-zero elements
void rSetHdl(idhdl h)
Definition: ipshell.cc:4696
int perm[100]
static Poly * h
Definition: janet.cc:978
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:488
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
#define omAlloc0(size)
Definition: omAllocDecl.h:211
static FORCE_INLINE coeffs n_CoeffRingQuot1(number c, const coeffs r)
Definition: coeffs.h:519
#define Warn
Definition: emacs.cc:80
static BOOLEAN jiA_RESOLUTION ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 819 of file ipassign.cc.

820 {
821  if (res->data!=NULL) syKillComputation((syStrategy)res->data);
822  res->data=(void *)a->CopyD(RESOLUTION_CMD);
823  jiAssignAttr(res,a);
824  return FALSE;
825 }
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
#define FALSE
Definition: auxiliary.h:140
void * data
Definition: subexpr.h:89
#define NULL
Definition: omList.c:10
void syKillComputation(syStrategy syzstr, ring r=currRing)
Definition: syz1.cc:1497
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_RING ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 1005 of file ipassign.cc.

1006 {
1007  BOOLEAN have_id=TRUE;
1008  if ((e!=NULL)||(res->rtyp!=IDHDL))
1009  {
1010  //WerrorS("id expected");
1011  //return TRUE;
1012  have_id=FALSE;
1013  }
1014  ring r=(ring)a->Data();
1015  if (have_id)
1016  {
1017  idhdl rl=(idhdl)res->data;
1018  if (IDRING(rl)!=NULL) rKill(rl);
1019  IDRING(rl)=r;
1020  if ((IDLEV((idhdl)a->data)!=myynest) && (r==currRing))
1021  currRingHdl=(idhdl)res->data;
1022  }
1023  else
1024  {
1025  if (e==NULL) res->data=(char *)r;
1026  else
1027  {
1028  WerrorS("id expected");
1029  return TRUE;
1030  }
1031  }
1032  r->ref++;
1033  jiAssignAttr(res,a);
1034  return FALSE;
1035 }
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int int kStrategy strat if(h==NULL) return NULL
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
void rKill(ring r)
Definition: ipshell.cc:5690
idhdl currRingHdl
Definition: ipid.cc:64
idrec * idhdl
Definition: ring.h:18
#define IDLEV(a)
Definition: ipid.h:120
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:126
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
int BOOLEAN
Definition: auxiliary.h:131
static BOOLEAN jiA_STRING ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 731 of file ipassign.cc.

732 {
733  if (e==NULL)
734  {
735  void* tmp = res->data;
736  res->data=(void *)a->CopyD(STRING_CMD);
737  jiAssignAttr(res,a);
738  omfree(tmp);
739  }
740  else
741  {
742  char *s=(char *)res->data;
743  if ((e->start>0)&&(e->start<=(int)strlen(s)))
744  s[e->start-1]=(char)(*((char *)a->Data()));
745  else
746  {
747  Werror("string index %d out of range 1..%d",e->start,(int)strlen(s));
748  return TRUE;
749  }
750  }
751  return FALSE;
752 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:325
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int int kStrategy strat if(h==NULL) return NULL
void * data
Definition: subexpr.h:89
#define omfree(addr)
Definition: omAllocDecl.h:237
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1097
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void * CopyD(int t)
Definition: subexpr.cc:662
static BOOLEAN jiA_STRING_L ( leftv  l,
leftv  r 
)
static

Definition at line 1643 of file ipassign.cc.

1644 {
1645  /*left side are strings, right side is a string*/
1646  /*e.g. s[2..3]="12" */
1647  /*the case s=t[1..4] is handled in iiAssign,
1648  * the case s[2..3]=t[3..4] is handled in iiAssgn_rec*/
1649  BOOLEAN nok=FALSE;
1650  sleftv t;
1651  leftv h,l1=l;
1652  int i=0;
1653  char *ss;
1654  char *s=(char *)r->Data();
1655  int sl=strlen(s);
1656 
1657  memset(&t,0,sizeof(sleftv));
1658  t.rtyp=STRING_CMD;
1659  while ((i<sl)&&(l!=NULL))
1660  {
1661  ss=(char *)omAlloc(2);
1662  ss[1]='\0';
1663  ss[0]=s[i];
1664  t.data=ss;
1665  h=l->next;
1666  l->next=NULL;
1667  nok=jiAssign_1(l,&t,TRUE);
1668  if (nok)
1669  {
1670  break;
1671  }
1672  i++;
1673  l=h;
1674  }
1675  r->CleanUp();
1676  l1->CleanUp();
1677  return nok;
1678 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
static BOOLEAN jiAssign_1(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1065
#define TRUE
Definition: auxiliary.h:144
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
int i
Definition: cfEzgcd.cc:123
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
void * Data()
Definition: subexpr.cc:1097
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
int l
Definition: cfEzgcd.cc:94
static BOOLEAN jiA_VECTOR_L ( leftv  l,
leftv  r 
)
static

Definition at line 1329 of file ipassign.cc.

1330 {
1331  /* right side is vector, left side is list (of poly)*/
1332  BOOLEAN nok;
1333  leftv l1=l;
1334  ideal I=idVec2Ideal((poly)r->Data());
1335  leftv h;
1336  sleftv t;
1337  int i=0;
1338  while (l!=NULL)
1339  {
1340  memset(&t,0,sizeof(sleftv));
1341  t.rtyp=POLY_CMD;
1342  if (i>=IDELEMS(I))
1343  {
1344  t.data=NULL;
1345  }
1346  else
1347  {
1348  t.data=(char *)I->m[i];
1349  I->m[i]=NULL;
1350  }
1351  h=l->next;
1352  l->next=NULL;
1353  nok=jiAssign_1(l,&t,TRUE);
1354  l->next=h;
1355  t.CleanUp();
1356  if (nok)
1357  {
1358  idDelete(&I);
1359  return TRUE;
1360  }
1361  i++;
1362  l=h;
1363  }
1364  idDelete(&I);
1365  l1->CleanUp();
1366  r->CleanUp();
1367  //if (TEST_V_QRING && (currRing->qideal!=NULL)) jjNormalizeQRingP(l);
1368  return FALSE;
1369 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
ideal idVec2Ideal(poly vec)
Definition: ideals.h:169
#define FALSE
Definition: auxiliary.h:140
static BOOLEAN jiAssign_1(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1065
#define TRUE
Definition: auxiliary.h:144
void * data
Definition: subexpr.h:89
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
void * Data()
Definition: subexpr.cc:1097
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
int l
Definition: cfEzgcd.cc:94
static BOOLEAN jiAssign_1 ( leftv  l,
leftv  r,
BOOLEAN  toplevel 
)
static

Definition at line 1065 of file ipassign.cc.

1066 {
1067  int rt=r->Typ();
1068  if (rt==0)
1069  {
1070  if (!errorreported) Werror("`%s` is undefined",r->Fullname());
1071  return TRUE;
1072  }
1073 
1074  int lt=l->Typ();
1075  if (lt==0)
1076  {
1077  if (!errorreported) Werror("left side `%s` is undefined",l->Fullname());
1078  return TRUE;
1079  }
1080  if(rt==NONE)
1081  {
1082  WarnS("right side is not a datum, assignment ignored");
1083  // if (!errorreported)
1084  // WerrorS("right side is not a datum");
1085  //return TRUE;
1086  return FALSE;
1087  }
1088 
1089  if (lt==DEF_CMD)
1090  {
1091  if (TEST_V_ALLWARN
1092  && (rt!=RING_CMD)
1093  && (rt!=QRING_CMD)
1094  && (l->name!=NULL)
1095  && (l->e==NULL)
1096  && (iiCurrArgs==NULL) /* not in proc header */
1097  )
1098  {
1099  Warn("use `%s` instead of `def` in %s:%d:%s",Tok2Cmdname(rt),
1101  }
1102  if (l->rtyp==IDHDL)
1103  {
1104  IDTYP((idhdl)l->data)=rt;
1105  }
1106  else if (l->name!=NULL)
1107  {
1108  sleftv ll;
1109  iiDeclCommand(&ll,l,myynest,rt,&IDROOT);
1110  memcpy(l,&ll,sizeof(sleftv));
1111  }
1112  else
1113  {
1114  l->rtyp=rt;
1115  }
1116  lt=rt;
1117  }
1118  else
1119  {
1120  if ((l->data==r->data)&&(l->e==NULL)&&(r->e==NULL))
1121  return FALSE;
1122  }
1123  leftv ld=l;
1124  if (l->rtyp==IDHDL)
1125  {
1126  if ((lt!=QRING_CMD)&&(lt!=RING_CMD))
1127  ld=(leftv)l->data;
1128  }
1129  else if (toplevel)
1130  {
1131  WerrorS("error in assign: left side is not an l-value");
1132  return TRUE;
1133  }
1134  if (lt>MAX_TOK)
1135  {
1136  blackbox *bb=getBlackboxStuff(lt);
1137 #ifdef BLACKBOX_DEVEL
1138  Print("bb-assign: bb=%lx\n",bb);
1139 #endif
1140  return (bb==NULL) || bb->blackbox_Assign(l,r);
1141  }
1142  int start=0;
1143  while ((dAssign[start].res!=lt)
1144  && (dAssign[start].res!=0)) start++;
1145  int i=start;
1146  while ((dAssign[i].res==lt)
1147  && (dAssign[i].arg!=rt)) i++;
1148  if (dAssign[i].res==lt)
1149  {
1150  if (traceit&TRACE_ASSIGN) Print("assign %s=%s\n",Tok2Cmdname(lt),Tok2Cmdname(rt));
1151  BOOLEAN b;
1152  b=dAssign[i].p(ld,r,l->e);
1153  if(l!=ld) /* i.e. l is IDHDL, l->data is ld */
1154  {
1155  l->flag=ld->flag;
1156  l->attribute=ld->attribute;
1157  }
1158  return b;
1159  }
1160  // implicite type conversion ----------------------------------------------
1161  if (dAssign[i].res!=lt)
1162  {
1163  int ri;
1165  BOOLEAN failed=FALSE;
1166  i=start;
1167  //while ((dAssign[i].res!=lt)
1168  // && (dAssign[i].res!=0)) i++;
1169  while (dAssign[i].res==lt)
1170  {
1171  if ((ri=iiTestConvert(rt,dAssign[i].arg))!=0)
1172  {
1173  failed= iiConvert(rt,dAssign[i].arg,ri,r,rn);
1174  if(!failed)
1175  {
1176  failed= dAssign[i].p(ld,rn,l->e);
1177  if (traceit&TRACE_ASSIGN)
1178  Print("assign %s=%s ok? %d\n",Tok2Cmdname(lt),Tok2Cmdname(rn->rtyp),!failed);
1179  }
1180  // everything done, clean up temp. variables
1181  rn->CleanUp();
1183  if (failed)
1184  {
1185  // leave loop, goto error handling
1186  break;
1187  }
1188  else
1189  {
1190  if(l!=ld) /* i.e. l is IDHDL, l->data is ld */
1191  {
1192  l->flag=ld->flag;
1193  l->attribute=ld->attribute;
1194  }
1195  // everything ok, return
1196  return FALSE;
1197  }
1198  }
1199  i++;
1200  }
1201  // error handling ---------------------------------------------------
1202  if (!errorreported)
1203  {
1204  if ((l->rtyp==IDHDL) && (l->e==NULL))
1205  Werror("`%s`(%s) = `%s` is not supported",
1206  Tok2Cmdname(lt),l->Name(),Tok2Cmdname(rt));
1207  else
1208  Werror("`%s` = `%s` is not supported"
1209  ,Tok2Cmdname(lt),Tok2Cmdname(rt));
1210  if (BVERBOSE(V_SHOW_USE))
1211  {
1212  i=0;
1213  while ((dAssign[i].res!=lt)
1214  && (dAssign[i].res!=0)) i++;
1215  while (dAssign[i].res==lt)
1216  {
1217  Werror("expected `%s` = `%s`"
1218  ,Tok2Cmdname(lt),Tok2Cmdname(dAssign[i].arg));
1219  i++;
1220  }
1221  }
1222  }
1223  }
1224  return TRUE;
1225 }
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:290
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRACE_ASSIGN
Definition: reporter.h:43
int yylineno
Definition: febase.cc:45
#define Print
Definition: emacs.cc:83
Subexpr e
Definition: subexpr.h:106
BITSET flag
Definition: subexpr.h:91
#define FALSE
Definition: auxiliary.h:140
char * filename
Definition: fevoices.h:62
Definition: tok.h:167
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:23
int traceit
Definition: febase.cc:47
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:955
const char * Name()
Definition: subexpr.h:121
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
const char * Fullname()
Definition: subexpr.h:126
void * data
Definition: subexpr.h:89
poly res
Definition: myNF.cc:322
int myynest
Definition: febase.cc:46
#define V_SHOW_USE
Definition: options.h:50
#define IDTYP(a)
Definition: ipid.h:118
char my_yylinebuf[80]
Definition: febase.cc:48
Definition: tok.h:58
const char * name
Definition: subexpr.h:88
struct sValAssign dAssign[]
Definition: table.h:1190
omBin sleftv_bin
Definition: subexpr.cc:50
int i
Definition: cfEzgcd.cc:123
short errorreported
Definition: feFopen.cc:22
#define BVERBOSE(a)
Definition: options.h:33
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1112
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
Voice * currentVoice
Definition: fevoices.cc:57
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:287
leftv iiCurrArgs
Definition: ipshell.cc:84
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
attr attribute
Definition: subexpr.h:90
Definition: tok.h:126
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
#define NONE
Definition: tok.h:170
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define TEST_V_ALLWARN
Definition: options.h:135
int l
Definition: cfEzgcd.cc:94
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
#define Warn
Definition: emacs.cc:80
static BOOLEAN jiAssign_list ( leftv  l,
leftv  r 
)
static

Definition at line 1679 of file ipassign.cc.

1680 {
1681  int i=l->e->start-1;
1682  if (i<0)
1683  {
1684  Werror("index[%d] must be positive",i+1);
1685  return TRUE;
1686  }
1687  if(l->attribute!=NULL)
1688  {
1689  atKillAll((idhdl)l);
1690  l->attribute=NULL;
1691  }
1692  l->flag=0;
1693  lists li;
1694  if (l->rtyp==IDHDL)
1695  {
1696  li=IDLIST((idhdl)l->data);
1697  }
1698  else
1699  {
1700  li=(lists)l->data;
1701  }
1702  if (i>li->nr)
1703  {
1704  if (TEST_V_ALLWARN)
1705  {
1706  Warn("increase list %d -> %d in %s",li->nr,i,my_yylinebuf);
1707  }
1708  li->m=(leftv)omreallocSize(li->m,(li->nr+1)*sizeof(sleftv),(i+1)*sizeof(sleftv));
1709  memset(&(li->m[li->nr+1]),0,(i-li->nr)*sizeof(sleftv));
1710  int j=li->nr+1;
1711  for(;j<=i;j++)
1712  li->m[j].rtyp=DEF_CMD;
1713  li->nr=i;
1714  }
1715  leftv ld=&(li->m[i]);
1716  ld->e=l->e->next;
1717  BOOLEAN b;
1718  if (/*(ld->rtyp!=LIST_CMD)
1719  &&*/(ld->e==NULL)
1720  && (ld->Typ()!=r->Typ()))
1721  {
1722  sleftv tmp;
1723  memset(&tmp,0,sizeof(sleftv));
1724  tmp.rtyp=DEF_CMD;
1725  b=iiAssign(&tmp,r,FALSE);
1726  ld->CleanUp();
1727  memcpy(ld,&tmp,sizeof(sleftv));
1728  }
1729  else if ((ld->e==NULL)
1730  && (ld->Typ()==r->Typ())
1731  && (ld->Typ()<MAX_TOK))
1732  {
1733  sleftv tmp;
1734  memset(&tmp,0,sizeof(sleftv));
1735  tmp.rtyp=r->Typ();
1736  tmp.data=(char*)idrecDataInit(r->Typ());
1737  b=iiAssign(&tmp,r,FALSE);
1738  ld->CleanUp();
1739  memcpy(ld,&tmp,sizeof(sleftv));
1740  }
1741  else
1742  {
1743  b=iiAssign(ld,r,FALSE);
1744  if (l->e!=NULL) l->e->next=ld->e;
1745  ld->e=NULL;
1746  }
1747  return b;
1748 }
void * idrecDataInit(int t)
Definition: ipid.cc:131
#define IDLIST(a)
Definition: ipid.h:136
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
BITSET flag
Definition: subexpr.h:91
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
#define omreallocSize(addr, o_size, size)
Definition: omAllocDecl.h:231
Definition: tok.h:167
#define TRUE
Definition: auxiliary.h:144
sleftv * leftv
Definition: structs.h:60
int Typ()
Definition: subexpr.cc:955
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
char my_yylinebuf[80]
Definition: febase.cc:48
int j
Definition: myNF.cc:70
Definition: tok.h:58
int i
Definition: cfEzgcd.cc:123
#define atKillAll(H)
Definition: attrib.h:42
int nr
Definition: lists.h:43
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
attr attribute
Definition: subexpr.h:90
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define TEST_V_ALLWARN
Definition: options.h:135
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1772
#define Warn
Definition: emacs.cc:80
static BOOLEAN jiAssign_rec ( leftv  l,
leftv  r 
)
static

Definition at line 1749 of file ipassign.cc.

1750 {
1751  leftv l1=l;
1752  leftv r1=r;
1753  leftv lrest;
1754  leftv rrest;
1755  BOOLEAN b;
1756  do
1757  {
1758  lrest=l->next;
1759  rrest=r->next;
1760  l->next=NULL;
1761  r->next=NULL;
1762  b=iiAssign(l,r);
1763  l->next=lrest;
1764  r->next=rrest;
1765  l=lrest;
1766  r=rrest;
1767  } while ((!b)&&(l!=NULL));
1768  l1->CleanUp();
1769  r1->CleanUp();
1770  return b;
1771 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
const ring r
Definition: syzextra.cc:208
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
int l
Definition: cfEzgcd.cc:94
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1772
static void jiAssignAttr ( leftv  l,
leftv  r 
)
static

Definition at line 325 of file ipassign.cc.

326 {
327  // get the attribute of th right side
328  // and set it to l
329  leftv rv=r->LData();
330  if (rv!=NULL)
331  {
332  if (rv->e==NULL)
333  {
334  if (rv->attribute!=NULL)
335  {
336  attr la;
337  if (r->rtyp!=IDHDL)
338  {
339  la=rv->attribute;
340  rv->attribute=NULL;
341  }
342  else
343  {
344  la=rv->attribute->Copy();
345  }
346  l->attribute=la;
347  }
348  l->flag=rv->flag;
349  }
350  }
351  if (l->rtyp==IDHDL)
352  {
353  idhdl h=(idhdl)l->data;
354  IDATTR(h)=l->attribute;
355  IDFLAG(h)=l->flag;
356  }
357 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: attrib.h:15
Subexpr e
Definition: subexpr.h:106
BITSET flag
Definition: subexpr.h:91
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
idrec * idhdl
Definition: ring.h:18
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
#define IDFLAG(a)
Definition: ipid.h:119
#define IDATTR(a)
Definition: ipid.h:122
attr Copy()
Definition: attrib.cc:41
attr attribute
Definition: subexpr.h:90
static Poly * h
Definition: janet.cc:978
leftv LData()
Definition: subexpr.cc:1366
static BOOLEAN jjA_L_BIGINTMAT ( leftv  l,
leftv  r,
bigintmat bim 
)
static

Definition at line 1484 of file ipassign.cc.

1485 {
1486  /* left side is bigintmat, right side is list (of int,intvec,intmat)*/
1487  leftv hh=r;
1488  int i = 0;
1489  if (bim->length()==0) { WerrorS("bigintmat is 1x0"); delete bim; return TRUE; }
1490  while (hh!=NULL)
1491  {
1492  if (i>=bim->cols()*bim->rows())
1493  {
1494  if (traceit&TRACE_ASSIGN)
1495  {
1496  Warn("expression list length(%d) does not match bigintmat size(%d x %d)",
1497  exprlist_length(hh),bim->rows(),bim->cols());
1498  }
1499  break;
1500  }
1501  if (hh->Typ() == INT_CMD)
1502  {
1503  number tp = n_Init((int)((long)(hh->Data())), coeffs_BIGINT);
1504  bim->set(i++, tp);
1505  n_Delete(&tp, coeffs_BIGINT);
1506  }
1507  else if (hh->Typ() == BIGINT_CMD)
1508  {
1509  bim->set(i++, (number)(hh->Data()));
1510  }
1511  /*
1512  ((hh->Typ() == INTVEC_CMD)
1513  ||(hh->Typ() == INTMAT_CMD))
1514  {
1515  intvec *ivv = (intvec *)(hh->Data());
1516  int ll = 0,l = si_min(ivv->length(),iv->length());
1517  for (; l>0; l--)
1518  {
1519  (*iv)[i++] = (*ivv)[ll++];
1520  }
1521  }*/
1522  else
1523  {
1524  delete bim;
1525  return TRUE;
1526  }
1527  hh = hh->next;
1528  }
1529  if (IDBIMAT((idhdl)l->data)!=NULL) delete IDBIMAT((idhdl)l->data);
1530  IDBIMAT((idhdl)l->data)=bim;
1531  return FALSE;
1532 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRACE_ASSIGN
Definition: reporter.h:43
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
Definition: tok.h:42
int exprlist_length(leftv v)
Definition: ipshell.cc:552
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
#define TRUE
Definition: auxiliary.h:144
int length()
Definition: bigintmat.h:127
#define IDBIMAT(a)
Definition: ipid.h:128
void WerrorS(const char *s)
Definition: feFopen.cc:23
int traceit
Definition: febase.cc:47
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
Definition: idrec.h:34
void set(int i, int j, number n, const coeffs C=NULL)
replace an entry with a copy (delete old + copy new!). NOTE: starts at [1,1]
Definition: bigintmat.cc:93
void * data
Definition: subexpr.h:89
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: bigintmat.h:128
leftv next
Definition: subexpr.h:87
int rows() const
Definition: bigintmat.h:129
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1097
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
#define Warn
Definition: emacs.cc:80
static BOOLEAN jjA_L_INTVEC ( leftv  l,
leftv  r,
intvec iv 
)
static

Definition at line 1435 of file ipassign.cc.

1436 {
1437  /* left side is intvec/intmat, right side is list (of int,intvec,intmat)*/
1438  leftv hh=r;
1439  int i = 0;
1440  while (hh!=NULL)
1441  {
1442  if (i>=iv->length())
1443  {
1444  if (traceit&TRACE_ASSIGN)
1445  {
1446  Warn("expression list length(%d) does not match intmat size(%d)",
1447  iv->length()+exprlist_length(hh),iv->length());
1448  }
1449  break;
1450  }
1451  if (hh->Typ() == INT_CMD)
1452  {
1453  (*iv)[i++] = (int)((long)(hh->Data()));
1454  }
1455  else if ((hh->Typ() == INTVEC_CMD)
1456  ||(hh->Typ() == INTMAT_CMD))
1457  {
1458  intvec *ivv = (intvec *)(hh->Data());
1459  int ll = 0,l = si_min(ivv->length(),iv->length());
1460  for (; l>0; l--)
1461  {
1462  (*iv)[i++] = (*ivv)[ll++];
1463  }
1464  }
1465  else
1466  {
1467  delete iv;
1468  return TRUE;
1469  }
1470  hh = hh->next;
1471  }
1472  if (l->rtyp==IDHDL)
1473  {
1474  if (IDINTVEC((idhdl)l->data)!=NULL) delete IDINTVEC((idhdl)l->data);
1475  IDINTVEC((idhdl)l->data)=iv;
1476  }
1477  else
1478  {
1479  if (l->data!=NULL) delete ((intvec*)l->data);
1480  l->data=(char*)iv;
1481  }
1482  return FALSE;
1483 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRACE_ASSIGN
Definition: reporter.h:43
Definition: tok.h:85
#define IDINTVEC(a)
Definition: ipid.h:127
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
#define FALSE
Definition: auxiliary.h:140
int exprlist_length(leftv v)
Definition: ipshell.cc:552
#define TRUE
Definition: auxiliary.h:144
int length() const
Definition: intvec.h:86
int traceit
Definition: febase.cc:47
int Typ()
Definition: subexpr.cc:955
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
#define Warn
Definition: emacs.cc:80
static BOOLEAN jjA_L_LIST ( leftv  l,
leftv  r 
)
static

Definition at line 1370 of file ipassign.cc.

1374 {
1375  int sl = r->listLength();
1377  lists oldL;
1378  leftv h=NULL,o_r=r;
1379  int i;
1380  int rt;
1381 
1382  L->Init(sl);
1383  for (i=0;i<sl;i++)
1384  {
1385  if (h!=NULL) { /* e.g. not in the first step:
1386  * h is the pointer to the old sleftv,
1387  * r is the pointer to the next sleftv
1388  * (in this moment) */
1389  h->next=r;
1390  }
1391  h=r;
1392  r=r->next;
1393  h->next=NULL;
1394  rt=h->Typ();
1395  if ((rt==0)||(rt==NONE)||(rt==DEF_CMD))
1396  {
1397  L->Clean();
1398  Werror("`%s` is undefined",h->Fullname());
1399  //listall();
1400  goto err;
1401  }
1402  //if ((rt==RING_CMD)||(rt==QRING_CMD))
1403  //{
1404  // L->m[i].rtyp=rt;
1405  // L->m[i].data=h->Data();
1406  // ((ring)L->m[i].data)->ref++;
1407  //}
1408  //else
1409  L->m[i].CleanUp();
1410  L->m[i].Copy(h);
1411  if(errorreported)
1412  {
1413  L->Clean();
1414  goto err;
1415  }
1416  }
1417  oldL=(lists)l->Data();
1418  if (oldL!=NULL) oldL->Clean();
1419  if (l->rtyp==IDHDL)
1420  {
1421  IDLIST((idhdl)l->data)=L;
1422  IDTYP((idhdl)l->data)=LIST_CMD; // was possibly DEF_CMD
1423  if (lRingDependend(L)) ipMoveId((idhdl)l->data);
1424  }
1425  else
1426  {
1427  l->LData()->data=L;
1428  if ((l->e!=NULL) && (l->rtyp==DEF_CMD))
1429  l->rtyp=LIST_CMD;
1430  }
1431 err:
1432  o_r->CleanUp();
1433  return errorreported;
1434 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define IDLIST(a)
Definition: ipid.h:136
void ipMoveId(idhdl tomove)
Definition: ipid.cc:601
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
Definition: lists.h:22
int listLength()
Definition: subexpr.cc:61
int Typ()
Definition: subexpr.cc:955
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
const char * Fullname()
Definition: subexpr.h:126
void * data
Definition: subexpr.h:89
#define IDTYP(a)
Definition: ipid.h:118
const ring r
Definition: syzextra.cc:208
Definition: tok.h:58
void Copy(leftv e)
Definition: subexpr.cc:643
int i
Definition: cfEzgcd.cc:123
short errorreported
Definition: feFopen.cc:22
leftv next
Definition: subexpr.h:87
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1097
Definition: tok.h:96
omBin slists_bin
Definition: lists.cc:23
static Poly * h
Definition: janet.cc:978
#define NONE
Definition: tok.h:170
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
leftv LData()
Definition: subexpr.cc:1366
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static BOOLEAN jjA_L_STRING ( leftv  l,
leftv  r 
)
static

Definition at line 1533 of file ipassign.cc.

1534 {
1535  /* left side is string, right side is list of string*/
1536  leftv hh=r;
1537  int sl = 1;
1538  char *s;
1539  char *t;
1540  int tl;
1541  /* find the length */
1542  while (hh!=NULL)
1543  {
1544  if (hh->Typ()!= STRING_CMD)
1545  {
1546  return TRUE;
1547  }
1548  sl += strlen((char *)hh->Data());
1549  hh = hh->next;
1550  }
1551  s = (char * )omAlloc(sl);
1552  sl=0;
1553  hh = r;
1554  while (hh!=NULL)
1555  {
1556  t=(char *)hh->Data();
1557  tl=strlen(t);
1558  memcpy(s+sl,t,tl);
1559  sl+=tl;
1560  hh = hh->next;
1561  }
1562  s[sl]='\0';
1563  omFree((ADDRESS)IDDATA((idhdl)(l->data)));
1564  IDDATA((idhdl)(l->data))=s;
1565  return FALSE;
1566 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
int Typ()
Definition: subexpr.cc:955
#define omAlloc(size)
Definition: omAllocDecl.h:210
Definition: idrec.h:34
void * data
Definition: subexpr.h:89
const ring r
Definition: syzextra.cc:208
#define omFree(addr)
Definition: omAllocDecl.h:261
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1097
#define IDDATA(a)
Definition: ipid.h:125
static BOOLEAN jjCOLMAX ( leftv  ,
leftv  a 
)
static

Definition at line 72 of file ipassign.cc.

73 {
74  colmax=(int)((long)(a->Data()));
75  return FALSE;
76 }
#define FALSE
Definition: auxiliary.h:140
void * Data()
Definition: subexpr.cc:1097
int colmax
Definition: febase.cc:43
static BOOLEAN jjECHO ( leftv  ,
leftv  a 
)
static

Definition at line 62 of file ipassign.cc.

63 {
64  si_echo=(int)((long)(a->Data()));
65  return FALSE;
66 }
#define FALSE
Definition: auxiliary.h:140
void * Data()
Definition: subexpr.cc:1097
int si_echo
Definition: febase.cc:41
BOOLEAN jjIMPORTFROM ( leftv  ,
leftv  u,
leftv  v 
)

Definition at line 2183 of file ipassign.cc.

2184 {
2185  //Print("importfrom %s::%s ->.\n",v->Name(),u->Name() );
2186  assume(u->Typ()==PACKAGE_CMD);
2187  char *vn=(char *)v->Name();
2188  idhdl h=((package)(u->Data()))->idroot->get(vn /*v->Name()*/, myynest);
2189  if (h!=NULL)
2190  {
2191  //check for existence
2192  if (((package)(u->Data()))==basePack)
2193  {
2194  WarnS("source and destination packages are identical");
2195  return FALSE;
2196  }
2197  idhdl t=basePack->idroot->get(vn /*v->Name()*/, myynest);
2198  if (t!=NULL)
2199  {
2200  Warn("redefining `%s`",vn);
2201  killhdl(t);
2202  }
2203  sleftv tmp_expr;
2204  if (iiDeclCommand(&tmp_expr,v,myynest,DEF_CMD,&IDROOT)) return TRUE;
2205  sleftv h_expr;
2206  memset(&h_expr,0,sizeof(h_expr));
2207  h_expr.rtyp=IDHDL;
2208  h_expr.data=h;
2209  h_expr.name=vn;
2210  return iiAssign(&tmp_expr,&h_expr);
2211  }
2212  else
2213  {
2214  Werror("`%s` not found in `%s`",v->Name(), u->Name());
2215  return TRUE;
2216  }
2217  return FALSE;
2218 }
ip_package * package
Definition: structs.h:46
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:955
const char * Name()
Definition: subexpr.h:121
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
Definition: tok.h:58
const char * name
Definition: subexpr.h:88
#define assume(x)
Definition: mod2.h:405
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1112
#define NULL
Definition: omList.c:10
void killhdl(idhdl h, package proot)
Definition: ipid.cc:369
package basePack
Definition: ipid.cc:63
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1772
#define Warn
Definition: emacs.cc:80
static BOOLEAN jjMAXDEG ( leftv  ,
leftv  a 
)
static

Definition at line 91 of file ipassign.cc.

92 {
93  Kstd1_deg=(int)((long)(a->Data()));
94  if (Kstd1_deg!=0)
96  else
98  return FALSE;
99 }
unsigned si_opt_1
Definition: options.c:5
#define FALSE
Definition: auxiliary.h:140
#define Sy_bit(x)
Definition: options.h:30
void * Data()
Definition: subexpr.cc:1097
#define OPT_DEGBOUND
Definition: options.h:85
int Kstd1_deg
Definition: kutil.cc:228
static BOOLEAN jjMAXMULT ( leftv  ,
leftv  a 
)
static

Definition at line 100 of file ipassign.cc.

101 {
102  Kstd1_mu=(int)((long)(a->Data()));
103  if (Kstd1_mu!=0)
105  else
107  return FALSE;
108 }
unsigned si_opt_1
Definition: options.c:5
#define FALSE
Definition: auxiliary.h:140
#define OPT_MULTBOUND
Definition: options.h:84
#define Sy_bit(x)
Definition: options.h:30
int Kstd1_mu
Definition: kutil.cc:229
void * Data()
Definition: subexpr.cc:1097
static BOOLEAN jjMINPOLY ( leftv  ,
leftv  a 
)
static

Definition at line 184 of file ipassign.cc.

185 {
186  if( !nCoeff_is_transExt(currRing->cf) && (currRing->idroot == NULL) && n_IsZero((number)a->Data(), currRing->cf) )
187  {
188 #ifndef SING_NDEBUG
189  WarnS("Set minpoly over non-transcendental ground field to 0?!");
190  Warn("in >>%s<<",my_yylinebuf);
191 #endif
192  return FALSE;
193  }
194 
195 
196  if ( !nCoeff_is_transExt(currRing->cf) )
197  {
198  WarnS("Trying to set minpoly over non-transcendental ground field...");
199  if(!nCoeff_is_algExt(currRing->cf) )
200  {
201  WerrorS("cannot set minpoly for these coeffients");
202  return TRUE;
203  }
204  }
205  if ((rVar(currRing->cf->extRing)!=1)
206  && !n_IsZero((number)a->Data(), currRing->cf) )
207  {
208  WerrorS("only univarite minpoly allowed");
209  return TRUE;
210  }
211 
212  if ( currRing->idroot != NULL )
213  {
214 // return TRUE;
215 #ifndef SING_NDEBUG
216  idhdl p = currRing->idroot;
217 
218  WarnS("no minpoly allowed if there are local objects belonging to the basering: ");
219 
220  while(p != NULL)
221  {
222  PrintS(p->String(TRUE)); PrintLn();
223  p = p->next;
224  }
225 #endif
226  }
227 
228 // assume (currRing->idroot==NULL);
229 
230  number p = (number)a->CopyD(NUMBER_CMD);
231  n_Normalize(p, currRing->cf);
232 
233  if (n_IsZero(p, currRing->cf))
234  {
235  n_Delete(&p, currRing);
236  if( nCoeff_is_transExt(currRing->cf) )
237  {
238 #ifndef SING_NDEBUG
239  WarnS("minpoly is already 0...");
240 #endif
241  return FALSE;
242  }
243  WarnS("cannot set minpoly to 0 / alg. extension?");
244  return TRUE;
245  }
246 
247  // remove all object currently in the ring
248  while(currRing->idroot!=NULL)
249  {
250 #ifndef SING_NDEBUG
251  Warn("killing a local object due to minpoly change: %s", IDID(currRing->idroot));
252 #endif
253  killhdl2(currRing->idroot,&(currRing->idroot),currRing);
254  }
255 
256  AlgExtInfo A;
257 
258  A.r = rCopy(currRing->cf->extRing); // Copy ground field!
259  // if minpoly was already set:
260  if( currRing->cf->extRing->qideal != NULL ) id_Delete(&(A.r->qideal),A.r);
261  ideal q = idInit(1,1);
262  if ((p==NULL) ||(NUM((fraction)p)==NULL))
263  {
264  Werror("Could not construct the alg. extension: minpoly==0");
265  // cleanup A: TODO
266  rDelete( A.r );
267  return TRUE;
268  }
269  if (DEN((fraction)(p)) != NULL) // minpoly must be a fraction with poly numerator...!!
270  {
271  poly z=NUM((fraction)p);
272  poly n=DEN((fraction)(p));
273  z=p_Mult_nn(z,pGetCoeff(n),currRing->cf->extRing);
274  NUM((fraction)p)=z;
275  DEN((fraction)(p))=NULL;
276  p_Delete(&n,currRing->cf->extRing);
277  }
278 
279  q->m[0] = NUM((fraction)p);
280  A.r->qideal = q;
281 
282 #if 0
283  PrintS("\nTrying to conver the currRing into an algebraic field: ");
284  PrintS("Ground poly. ring: \n");
285  rWrite( A.r );
286  PrintS("\nGiven MinPOLY: ");
287  p_Write( A.i->m[0], A.r );
288 #endif
289 
290  // :(
291 // NUM((fractionObject *)p) = NULL; // makes 0/ NULL fraction - which should not happen!
292 // n_Delete(&p, currRing->cf); // doesn't expect 0/ NULL :(
293  if(true)
294  {
295  extern omBin fractionObjectBin;
296  NUM((fractionObject *)p) = NULL; // not necessary, but still...
297  omFreeBin((ADDRESS)p, fractionObjectBin);
298  }
299 
300 
301  coeffs new_cf = nInitChar(n_algExt, &A);
302 
303  if (new_cf==NULL)
304  {
305  Werror("Could not construct the alg. extension: llegal minpoly?");
306  // cleanup A: TODO
307  rDelete( A.r );
308  return TRUE;
309  }
310  else
311  {
312  nKillChar(currRing->cf); currRing->cf=new_cf;
313  }
314 
315  return FALSE;
316 }
omBin_t * omBin
Definition: omStructs.h:12
void PrintLn()
Definition: reporter.cc:322
ring r
Definition: algext.h:40
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define TRUE
Definition: auxiliary.h:144
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:579
void * ADDRESS
Definition: auxiliary.h:161
void WerrorS(const char *s)
Definition: feFopen.cc:23
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define WarnS
Definition: emacs.cc:81
char * String(BOOLEAN typed=FALSE)
Definition: ipid.cc:246
Definition: idrec.h:34
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:400
char my_yylinebuf[80]
Definition: febase.cc:48
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:911
The main handler for Singular numbers which are suitable for Singular polynomials.
#define A
Definition: sirandom.c:23
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:919
void PrintS(const char *s)
Definition: reporter.cc:294
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:902
idhdl next
Definition: idrec.h:38
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:465
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
ring rCopy(ring r)
Definition: ring.cc:1618
#define NULL
Definition: omList.c:10
struct for passing initialization parameters to naInitChar
Definition: algext.h:40
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic ...
Definition: coeffs.h:35
void * Data()
Definition: subexpr.cc:1097
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
polyrec * poly
Definition: hilb.h:10
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:488
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void * CopyD(int t)
Definition: subexpr.cc:662
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:327
omBin fractionObjectBin
Definition: transext.cc:93
#define Warn
Definition: emacs.cc:80
static void jjMINPOLY_red ( idhdl  h)
static

Definition at line 139 of file ipassign.cc.

140 {
141  switch(IDTYP(h))
142  {
143  case NUMBER_CMD:
144  {
145  number n=(number)IDDATA(h);
146  number one = nInit(1);
147  number nn=nMult(n,one);
148  nDelete(&n);nDelete(&one);
149  IDDATA(h)=(char*)nn;
150  break;
151  }
152  case VECTOR_CMD:
153  case POLY_CMD:
154  {
155  poly p=(poly)IDDATA(h);
156  IDDATA(h)=(char*)p_MinPolyNormalize(p, currRing);
157  break;
158  }
159  case IDEAL_CMD:
160  case MODUL_CMD:
161  case MAP_CMD:
162  case MATRIX_CMD:
163  {
164  int i;
165  ideal I=(ideal)IDDATA(h);
166  for(i=IDELEMS(I)-1;i>=0;i--)
167  I->m[i]=p_MinPolyNormalize(I->m[i], currRing);
168  break;
169  }
170  case LIST_CMD:
171  {
172  lists L=(lists)IDDATA(h);
173  int i=L->nr;
174  for(;i>=0;i--)
175  {
176  jjMINPOLY_red((idhdl)&(L->m[i]));
177  }
178  }
179  default:
180  //case RESOLUTION_CMD:
181  Werror("type %d too complex...set minpoly before",IDTYP(h)); break;
182  }
183 }
sleftv * m
Definition: lists.h:45
Definition: lists.h:22
return P p
Definition: myNF.cc:203
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
Definition: idrec.h:34
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
#define nMult(n1, n2)
Definition: numbers.h:17
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define nDelete(n)
Definition: numbers.h:16
poly p_MinPolyNormalize(poly p, const ring r)
Definition: maps.cc:328
int nr
Definition: lists.h:43
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:96
polyrec * poly
Definition: hilb.h:10
#define IDDATA(a)
Definition: ipid.h:125
#define nInit(i)
Definition: numbers.h:24
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static void jjMINPOLY_red(idhdl h)
Definition: ipassign.cc:139
static BOOLEAN jjNOETHER ( leftv  ,
leftv  a 
)
static

Definition at line 317 of file ipassign.cc.

318 {
319  poly p=(poly)a->CopyD(POLY_CMD);
320  pDelete(&(currRing->ppNoether));
321  (currRing->ppNoether)=p;
322  return FALSE;
323 }
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pDelete(p_ptr)
Definition: polys.h:157
polyrec * poly
Definition: hilb.h:10
void * CopyD(int t)
Definition: subexpr.cc:662
void jjNormalizeQRingId ( leftv  I)

Definition at line 2117 of file ipassign.cc.

2118 {
2119  if ((currRing->qideal!=NULL) && (!hasFlag(I,FLAG_QRING)))
2120  {
2121  if (I->e==NULL)
2122  {
2123  ideal I0=(ideal)I->Data();
2124  switch (I->Typ())
2125  {
2126  case IDEAL_CMD:
2127  case MODUL_CMD:
2128  {
2129  ideal F=idInit(1,1);
2130  ideal II=kNF(F,currRing->qideal,I0);
2131  idDelete(&F);
2132  if (I->rtyp!=IDHDL)
2133  {
2134  idDelete((ideal*)&(I0));
2135  I->data=II;
2136  }
2137  else
2138  {
2139  idhdl h=(idhdl)I->data;
2140  idDelete((ideal*)&IDIDEAL(h));
2141  IDIDEAL(h)=II;
2142  setFlag(h,FLAG_QRING);
2143  }
2144  break;
2145  }
2146  default: break;
2147  }
2148  setFlag(I,FLAG_QRING);
2149  }
2150  }
2151 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2815
Subexpr e
Definition: subexpr.h:106
#define IDIDEAL(a)
Definition: ipid.h:132
int Typ()
Definition: subexpr.cc:955
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define setFlag(A, F)
Definition: ipid.h:112
idrec * idhdl
Definition: ring.h:18
#define FLAG_QRING
Definition: ipid.h:110
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
#define hasFlag(A, F)
Definition: ipid.h:111
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
static Poly * h
Definition: janet.cc:978
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void jjNormalizeQRingP ( leftv  I)

Definition at line 2152 of file ipassign.cc.

2153 {
2154  if ((currRing->qideal!=NULL) && (!hasFlag(I,FLAG_QRING)))
2155  {
2156  poly p=(poly)I->Data();
2157  if ((I->e==NULL) && (p!=NULL))
2158  {
2159  ideal F=idInit(1,1);
2160  poly II=kNF(F,currRing->qideal,p);
2161  idDelete(&F);
2162  if ((I->rtyp==POLY_CMD)
2163  || (I->rtyp==VECTOR_CMD))
2164  {
2165  pDelete(&p);
2166  I->data=II;
2167  }
2168  else if (I->rtyp==IDHDL)
2169  {
2170  pDelete(&p);
2171  idhdl h=(idhdl)I->data;
2172  IDPOLY(h)=II;
2173  setFlag(h,FLAG_QRING);
2174  }
2175  else
2176  {
2177  pDelete(&II);
2178  }
2179  }
2180  setFlag(I,FLAG_QRING);
2181  }
2182 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2815
Subexpr e
Definition: subexpr.h:106
return P p
Definition: myNF.cc:203
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define setFlag(A, F)
Definition: ipid.h:112
idrec * idhdl
Definition: ring.h:18
#define FLAG_QRING
Definition: ipid.h:110
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
#define IDPOLY(a)
Definition: ipid.h:129
#define hasFlag(A, F)
Definition: ipid.h:111
#define pDelete(p_ptr)
Definition: polys.h:157
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
static BOOLEAN jjPRINTLEVEL ( leftv  ,
leftv  a 
)
static

Definition at line 67 of file ipassign.cc.

68 {
69  printlevel=(int)((long)(a->Data()));
70  return FALSE;
71 }
#define FALSE
Definition: auxiliary.h:140
void * Data()
Definition: subexpr.cc:1097
int printlevel
Definition: febase.cc:42
static BOOLEAN jjRTIMER ( leftv  ,
leftv  a 
)
static

Definition at line 84 of file ipassign.cc.

85 {
86  rtimerv=(int)((long)(a->Data()));
87  initRTimer();
88  return FALSE;
89 }
#define FALSE
Definition: auxiliary.h:140
void initRTimer()
Definition: timer.cc:158
void * Data()
Definition: subexpr.cc:1097
int rtimerv
Definition: timer.cc:148
static BOOLEAN jjSHORTOUT ( leftv  ,
leftv  a 
)
static

Definition at line 114 of file ipassign.cc.

115 {
116  if (currRing != NULL)
117  {
118  BOOLEAN shortOut = (BOOLEAN)((long)a->Data());
119 #if HAVE_CAN_SHORT_OUT
120  if (!shortOut)
121  currRing->ShortOut = 0;
122  else
123  {
124  if (currRing->CanShortOut)
125  currRing->ShortOut = 1;
126  }
127 #else
128  currRing->ShortOut = shortOut;
129  coeffs cf = currRing->cf;
130  while (nCoeff_is_Extension(cf)) {
131  cf->extRing->ShortOut = shortOut;
132  assume(cf->extRing != NULL);
133  cf = cf->extRing->cf;
134  }
135 #endif
136  }
137  return FALSE;
138 }
#define FALSE
Definition: auxiliary.h:140
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define assume(x)
Definition: mod2.h:405
The main handler for Singular numbers which are suitable for Singular polynomials.
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1097
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:844
int BOOLEAN
Definition: auxiliary.h:131
static BOOLEAN jjTIMER ( leftv  ,
leftv  a 
)
static

Definition at line 77 of file ipassign.cc.

78 {
79  timerv=(int)((long)(a->Data()));
80  initTimer();
81  return FALSE;
82 }
#define FALSE
Definition: auxiliary.h:140
int timerv
Definition: timer.cc:19
void * Data()
Definition: subexpr.cc:1097
int initTimer()
Definition: timer.cc:69
static BOOLEAN jjTRACE ( leftv  ,
leftv  a 
)
static

Definition at line 109 of file ipassign.cc.

110 {
111  traceit=(int)((long)(a->Data()));
112  return FALSE;
113 }
#define FALSE
Definition: auxiliary.h:140
int traceit
Definition: febase.cc:47
void * Data()
Definition: subexpr.cc:1097