My Project  debian-1:4.1.1-p2+ds-4build4
Macros | Functions
ipassign.cc File Reference
#include "kernel/mod2.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_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)
 
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 (poly &p)
 
BOOLEAN jjIMPORTFROM (leftv, leftv u, leftv v)
 

Macro Definition Documentation

◆ D

#define D (   A)    A

Definition at line 1077 of file ipassign.cc.

◆ IPASSIGN

#define IPASSIGN

Definition at line 1076 of file ipassign.cc.

◆ NULL_VAL

#define NULL_VAL   NULL

Definition at line 1078 of file ipassign.cc.

◆ TRANSEXT_PRIVATES

#define TRANSEXT_PRIVATES

Definition at line 13 of file ipassign.cc.

Function Documentation

◆ iiAssign()

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

Definition at line 1792 of file ipassign.cc.

1793 {
1794  if (errorreported) return TRUE;
1795  int ll=l->listLength();
1796  int rl;
1797  int lt=l->Typ();
1798  int rt=NONE;
1799  BOOLEAN b;
1800  if (l->rtyp==ALIAS_CMD)
1801  {
1802  Werror("`%s` is read-only",l->Name());
1803  }
1804 
1805  if (l->rtyp==IDHDL)
1806  {
1807  atKillAll((idhdl)l->data);
1808  IDFLAG((idhdl)l->data)=0;
1809  l->attribute=NULL;
1810  toplevel=FALSE;
1811  }
1812  else if (l->attribute!=NULL)
1813  atKillAll((idhdl)l);
1814  l->flag=0;
1815  if (ll==1)
1816  {
1817  /* l[..] = ... */
1818  if(l->e!=NULL)
1819  {
1820  BOOLEAN like_lists=0;
1821  blackbox *bb=NULL;
1822  int bt;
1823  if (((bt=l->rtyp)>MAX_TOK)
1824  || ((l->rtyp==IDHDL) && ((bt=IDTYP((idhdl)l->data))>MAX_TOK)))
1825  {
1826  bb=getBlackboxStuff(bt);
1827  like_lists=BB_LIKE_LIST(bb); // bb like a list
1828  }
1829  else if (((l->rtyp==IDHDL) && (IDTYP((idhdl)l->data)==LIST_CMD))
1830  || (l->rtyp==LIST_CMD))
1831  {
1832  like_lists=2; // bb in a list
1833  }
1834  if(like_lists)
1835  {
1836  if (traceit&TRACE_ASSIGN) PrintS("assign list[..]=...or similar\n");
1837  if (like_lists==1)
1838  {
1839  // check blackbox/newtype type:
1840  if(bb->blackbox_CheckAssign(bb,l,r)) return TRUE;
1841  }
1842  b=jiAssign_list(l,r);
1843  if((!b) && (like_lists==2))
1844  {
1845  //Print("jjA_L_LIST: - 2 \n");
1846  if((l->rtyp==IDHDL) && (l->data!=NULL))
1847  {
1848  ipMoveId((idhdl)l->data);
1849  l->attribute=IDATTR((idhdl)l->data);
1850  l->flag=IDFLAG((idhdl)l->data);
1851  }
1852  }
1853  r->CleanUp();
1854  Subexpr h;
1855  while (l->e!=NULL)
1856  {
1857  h=l->e->next;
1859  l->e=h;
1860  }
1861  return b;
1862  }
1863  }
1864  if (lt>MAX_TOK)
1865  {
1866  blackbox *bb=getBlackboxStuff(lt);
1867 #ifdef BLACKBOX_DEVEL
1868  Print("bb-assign: bb=%lx\n",bb);
1869 #endif
1870  return (bb==NULL) || bb->blackbox_Assign(l,r);
1871  }
1872  // end of handling elems of list and similar
1873  rl=r->listLength();
1874  if (rl==1)
1875  {
1876  /* system variables = ... */
1877  if(((l->rtyp>=VECHO)&&(l->rtyp<=VPRINTLEVEL))
1878  ||((l->rtyp>=VALTVARS)&&(l->rtyp<=VMINPOLY)))
1879  {
1880  b=iiAssign_sys(l,r);
1881  r->CleanUp();
1882  //l->CleanUp();
1883  return b;
1884  }
1885  rt=r->Typ();
1886  /* a = ... */
1887  if ((lt!=MATRIX_CMD)
1888  &&(lt!=BIGINTMAT_CMD)
1889  &&(lt!=CMATRIX_CMD)
1890  &&(lt!=INTMAT_CMD)
1891  &&((lt==rt)||(lt!=LIST_CMD)))
1892  {
1893  b=jiAssign_1(l,r,toplevel);
1894  if (l->rtyp==IDHDL)
1895  {
1896  if ((lt==DEF_CMD)||(lt==LIST_CMD))
1897  {
1898  ipMoveId((idhdl)l->data);
1899  }
1900  l->attribute=IDATTR((idhdl)l->data);
1901  l->flag=IDFLAG((idhdl)l->data);
1902  l->CleanUp();
1903  }
1904  r->CleanUp();
1905  return b;
1906  }
1907  if (((lt!=LIST_CMD)
1908  &&((rt==MATRIX_CMD)
1909  ||(rt==BIGINTMAT_CMD)
1910  ||(rt==CMATRIX_CMD)
1911  ||(rt==INTMAT_CMD)
1912  ||(rt==INTVEC_CMD)
1913  ||(rt==MODUL_CMD)))
1914  ||((lt==LIST_CMD)
1915  &&(rt==RESOLUTION_CMD))
1916  )
1917  {
1918  b=jiAssign_1(l,r,toplevel);
1919  if((l->rtyp==IDHDL)&&(l->data!=NULL))
1920  {
1921  if ((lt==DEF_CMD) || (lt==LIST_CMD))
1922  {
1923  //Print("ipAssign - 3.0\n");
1924  ipMoveId((idhdl)l->data);
1925  }
1926  l->attribute=IDATTR((idhdl)l->data);
1927  l->flag=IDFLAG((idhdl)l->data);
1928  }
1929  r->CleanUp();
1930  Subexpr h;
1931  while (l->e!=NULL)
1932  {
1933  h=l->e->next;
1935  l->e=h;
1936  }
1937  return b;
1938  }
1939  }
1940  if (rt==NONE) rt=r->Typ();
1941  }
1942  else if (ll==(rl=r->listLength()))
1943  {
1944  b=jiAssign_rec(l,r);
1945  return b;
1946  }
1947  else
1948  {
1949  if (rt==NONE) rt=r->Typ();
1950  if (rt==INTVEC_CMD)
1951  return jiA_INTVEC_L(l,r);
1952  else if (rt==VECTOR_CMD)
1953  return jiA_VECTOR_L(l,r);
1954  else if ((rt==IDEAL_CMD)||(rt==MATRIX_CMD))
1955  return jiA_MATRIX_L(l,r);
1956  else if ((rt==STRING_CMD)&&(rl==1))
1957  return jiA_STRING_L(l,r);
1958  Werror("length of lists in assignment does not match (l:%d,r:%d)",
1959  ll,rl);
1960  return TRUE;
1961  }
1962 
1963  leftv hh=r;
1964  BOOLEAN nok=FALSE;
1965  BOOLEAN map_assign=FALSE;
1966  switch (lt)
1967  {
1968  case INTVEC_CMD:
1969  nok=jjA_L_INTVEC(l,r,new intvec(exprlist_length(r)));
1970  break;
1971  case INTMAT_CMD:
1972  {
1973  nok=jjA_L_INTVEC(l,r,new intvec(IDINTVEC((idhdl)l->data)));
1974  break;
1975  }
1976  case BIGINTMAT_CMD:
1977  {
1978  nok=jjA_L_BIGINTMAT(l, r, new bigintmat(IDBIMAT((idhdl)l->data)));
1979  break;
1980  }
1981  case MAP_CMD:
1982  {
1983  // first element in the list sl (r) must be a ring
1984  if ((rt == RING_CMD)&&(r->e==NULL))
1985  {
1986  omFree((ADDRESS)IDMAP((idhdl)l->data)->preimage);
1987  IDMAP((idhdl)l->data)->preimage = omStrDup (r->Fullname());
1988  /* advance the expressionlist to get the next element after the ring */
1989  hh = r->next;
1990  }
1991  else
1992  {
1993  WerrorS("expected ring-name");
1994  nok=TRUE;
1995  break;
1996  }
1997  if (hh==NULL) /* map-assign: map f=r; */
1998  {
1999  WerrorS("expected image ideal");
2000  nok=TRUE;
2001  break;
2002  }
2003  if ((hh->next==NULL)&&(hh->Typ()==IDEAL_CMD))
2004  {
2005  BOOLEAN bo=jiAssign_1(l,hh,toplevel); /* map-assign: map f=r,i; */
2006  omFreeBin(hh,sleftv_bin);
2007  return bo;
2008  }
2009  //no break, handle the rest like an ideal:
2010  map_assign=TRUE;
2011  }
2012  case MATRIX_CMD:
2013  case IDEAL_CMD:
2014  case MODUL_CMD:
2015  {
2016  sleftv t;
2017  matrix olm = (matrix)l->Data();
2018  int rk;
2019  char *pr=((map)olm)->preimage;
2020  BOOLEAN module_assign=(/*l->Typ()*/ lt==MODUL_CMD);
2021  matrix lm ;
2022  int num;
2023  int j,k;
2024  int i=0;
2025  int mtyp=MATRIX_CMD; /*Type of left side object*/
2026  int etyp=POLY_CMD; /*Type of elements of left side object*/
2027 
2028  if (lt /*l->Typ()*/==MATRIX_CMD)
2029  {
2030  rk=olm->rows();
2031  num=olm->cols()*rk /*olm->rows()*/;
2032  lm=mpNew(olm->rows(),olm->cols());
2033  int el;
2034  if ((traceit&TRACE_ASSIGN) && (num!=(el=exprlist_length(hh))))
2035  {
2036  Warn("expression list length(%d) does not match matrix size(%d)",el,num);
2037  }
2038  }
2039  else /* IDEAL_CMD or MODUL_CMD */
2040  {
2041  num=exprlist_length(hh);
2042  lm=(matrix)idInit(num,1);
2043  if (module_assign)
2044  {
2045  rk=0;
2046  mtyp=MODUL_CMD;
2047  etyp=VECTOR_CMD;
2048  }
2049  else
2050  rk=1;
2051  }
2052 
2053  int ht;
2054  loop
2055  {
2056  if (hh==NULL)
2057  break;
2058  else
2059  {
2060  matrix rm;
2061  ht=hh->Typ();
2062  if ((j=iiTestConvert(ht,etyp))!=0)
2063  {
2064  nok=iiConvert(ht,etyp,j,hh,&t);
2065  hh->next=t.next;
2066  if (nok) break;
2067  lm->m[i]=(poly)t.CopyD(etyp);
2068  pNormalize(lm->m[i]);
2069  if (module_assign) rk=si_max(rk,(int)pMaxComp(lm->m[i]));
2070  i++;
2071  }
2072  else
2073  if ((j=iiTestConvert(ht,mtyp))!=0)
2074  {
2075  nok=iiConvert(ht,mtyp,j,hh,&t);
2076  hh->next=t.next;
2077  if (nok) break;
2078  rm = (matrix)t.CopyD(mtyp);
2079  if (module_assign)
2080  {
2081  j = si_min(num,rm->cols());
2082  rk=si_max(rk,(int)rm->rank);
2083  }
2084  else
2085  j = si_min(num-i,rm->rows() * rm->cols());
2086  for(k=0;k<j;k++,i++)
2087  {
2088  lm->m[i]=rm->m[k];
2089  pNormalize(lm->m[i]);
2090  rm->m[k]=NULL;
2091  }
2092  idDelete((ideal *)&rm);
2093  }
2094  else
2095  {
2096  nok=TRUE;
2097  break;
2098  }
2099  t.next=NULL;t.CleanUp();
2100  if (i==num) break;
2101  hh=hh->next;
2102  }
2103  }
2104  if (nok)
2105  idDelete((ideal *)&lm);
2106  else
2107  {
2108  idDelete((ideal *)&olm);
2109  if (module_assign) lm->rank=rk;
2110  else if (map_assign) ((map)lm)->preimage=pr;
2111  l=l->LData();
2112  if (l->rtyp==IDHDL)
2113  IDMATRIX((idhdl)l->data)=lm;
2114  else
2115  l->data=(char *)lm;
2116  }
2117  break;
2118  }
2119  case STRING_CMD:
2120  nok=jjA_L_STRING(l,r);
2121  break;
2122  //case DEF_CMD:
2123  case LIST_CMD:
2124  nok=jjA_L_LIST(l,r);
2125  break;
2126  case NONE:
2127  case 0:
2128  Werror("cannot assign to %s",l->Fullname());
2129  nok=TRUE;
2130  break;
2131  default:
2132  WerrorS("assign not impl.");
2133  nok=TRUE;
2134  break;
2135  } /* end switch: typ */
2136  if (nok && (!errorreported)) WerrorS("incompatible type in list assignment");
2137  r->CleanUp();
2138  return nok;
2139 }
#define atKillAll(H)
Definition: attrib.h:47
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
int BOOLEAN
Definition: auxiliary.h:85
#define TRUE
Definition: auxiliary.h:98
#define FALSE
Definition: auxiliary.h:94
void * ADDRESS
Definition: auxiliary.h:133
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
CanonicalForm num(const CanonicalForm &f)
int l
Definition: cfEzgcd.cc:93
int i
Definition: cfEzgcd.cc:125
int k
Definition: cfEzgcd.cc:92
CanonicalForm b
Definition: cfModGcd.cc:4044
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
Matrices of numbers.
Definition: bigintmat.h:52
Definition: idrec.h:35
Definition: intvec.h:21
long rank
Definition: matpol.h:19
int & rows()
Definition: matpol.h:23
int & cols()
Definition: matpol.h:24
poly * m
Definition: matpol.h:18
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
void * CopyD(int t)
Definition: subexpr.cc:703
int Typ()
Definition: subexpr.cc:992
leftv next
Definition: subexpr.h:86
int listLength()
Definition: subexpr.cc:56
const char * Fullname()
Definition: subexpr.h:125
void CleanUp(ring r=currRing)
Definition: subexpr.cc:328
Subexpr e
Definition: subexpr.h:105
#define Print
Definition: emacs.cc:80
#define Warn
Definition: emacs.cc:77
int j
Definition: facHensel.cc:105
void WerrorS(const char *s)
Definition: feFopen.cc:24
short errorreported
Definition: feFopen.cc:23
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:299
@ IDEAL_CMD
Definition: grammar.cc:283
@ VALTVARS
Definition: grammar.cc:303
@ MATRIX_CMD
Definition: grammar.cc:285
@ BIGINTMAT_CMD
Definition: grammar.cc:278
@ MAP_CMD
Definition: grammar.cc:284
@ INTMAT_CMD
Definition: grammar.cc:279
@ MODUL_CMD
Definition: grammar.cc:286
@ VECTOR_CMD
Definition: grammar.cc:290
@ RESOLUTION_CMD
Definition: grammar.cc:289
@ POLY_CMD
Definition: grammar.cc:288
@ VMINPOLY
Definition: grammar.cc:307
@ RING_CMD
Definition: grammar.cc:281
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
static BOOLEAN jiA_MATRIX_L(leftv l, leftv r)
Definition: ipassign.cc:1589
static BOOLEAN jiA_VECTOR_L(leftv l, leftv r)
Definition: ipassign.cc:1351
static BOOLEAN iiAssign_sys(leftv l, leftv r)
Definition: ipassign.cc:1251
static BOOLEAN jiAssign_rec(leftv l, leftv r)
Definition: ipassign.cc:1769
static BOOLEAN jjA_L_LIST(leftv l, leftv r)
Definition: ipassign.cc:1392
static BOOLEAN jiA_STRING_L(leftv l, leftv r)
Definition: ipassign.cc:1665
static BOOLEAN jjA_L_BIGINTMAT(leftv l, leftv r, bigintmat *bim)
Definition: ipassign.cc:1506
static BOOLEAN jiAssign_list(leftv l, leftv r)
Definition: ipassign.cc:1701
static BOOLEAN jjA_L_STRING(leftv l, leftv r)
Definition: ipassign.cc:1555
static BOOLEAN jiAssign_1(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1084
static BOOLEAN jiA_INTVEC_L(leftv l, leftv r)
Definition: ipassign.cc:1325
static BOOLEAN jjA_L_INTVEC(leftv l, leftv r, intvec *iv)
Definition: ipassign.cc:1457
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:401
void ipMoveId(idhdl tomove)
Definition: ipid.cc:613
#define IDMAP(a)
Definition: ipid.h:130
#define IDMATRIX(a)
Definition: ipid.h:129
#define IDINTVEC(a)
Definition: ipid.h:123
#define IDBIMAT(a)
Definition: ipid.h:124
#define IDFLAG(a)
Definition: ipid.h:115
omBin sleftv_bin
Definition: subexpr.cc:46
#define IDTYP(a)
Definition: ipid.h:114
#define IDATTR(a)
Definition: ipid.h:118
int exprlist_length(leftv v)
Definition: ipshell.cc:544
static Poly * h
Definition: janet.cc:972
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:36
ip_smatrix * matrix
Definition: matpol.h:31
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omFree(addr)
Definition: omAllocDecl.h:261
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define NULL
Definition: omList.c:10
#define pMaxComp(p)
Definition: polys.h:285
#define pNormalize(p)
Definition: polys.h:303
void PrintS(const char *s)
Definition: reporter.cc:284
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int traceit
Definition: febase.cc:42
#define TRACE_ASSIGN
Definition: reporter.h:45
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
#define loop
Definition: structs.h:78
omBin sSubexpr_bin
Definition: subexpr.cc:45
#define IDHDL
Definition: tok.h:31
@ ALIAS_CMD
Definition: tok.h:34
@ LIST_CMD
Definition: tok.h:118
@ VPRINTLEVEL
Definition: tok.h:212
@ INTVEC_CMD
Definition: tok.h:101
@ CMATRIX_CMD
Definition: tok.h:46
@ DEF_CMD
Definition: tok.h:58
@ VECHO
Definition: tok.h:205
@ STRING_CMD
Definition: tok.h:183
@ MAX_TOK
Definition: tok.h:215
#define NONE
Definition: tok.h:218

◆ iiAssign_sys()

static BOOLEAN iiAssign_sys ( leftv  l,
leftv  r 
)
static

Definition at line 1251 of file ipassign.cc.

1252 {
1253  int rt=r->Typ();
1254 
1255  if (rt==0)
1256  {
1257  if (!errorreported) Werror("`%s` is undefined",r->Fullname());
1258  return TRUE;
1259  }
1260  int i=0;
1261  int lt=l->rtyp;
1262  while (((dAssign_sys[i].res!=lt)
1263  || (dAssign_sys[i].arg!=rt))
1264  && (dAssign_sys[i].res!=0)) i++;
1265  if (dAssign_sys[i].res!=0)
1266  {
1267  if (!dAssign_sys[i].p(l,r))
1268  {
1269  // everything ok, clean up
1270  return FALSE;
1271  }
1272  }
1273  // implicite type conversion ----------------------------------------------
1274  if (dAssign_sys[i].res==0)
1275  {
1276  int ri;
1278  BOOLEAN failed=FALSE;
1279  i=0;
1280  while ((dAssign_sys[i].res!=lt)
1281  && (dAssign_sys[i].res!=0)) i++;
1282  while (dAssign_sys[i].res==lt)
1283  {
1284  if ((ri=iiTestConvert(rt,dAssign_sys[i].arg))!=0)
1285  {
1286  failed= ((iiConvert(rt,dAssign_sys[i].arg,ri,r,rn))
1287  || (dAssign_sys[i].p(l,rn)));
1288  // everything done, clean up temp. variables
1289  rn->CleanUp();
1291  if (failed)
1292  {
1293  // leave loop, goto error handling
1294  break;
1295  }
1296  else
1297  {
1298  // everything ok, return
1299  return FALSE;
1300  }
1301  }
1302  i++;
1303  }
1304  // error handling ---------------------------------------------------
1305  if(!errorreported)
1306  {
1307  Werror("`%s` = `%s` is not supported"
1308  ,Tok2Cmdname(lt),Tok2Cmdname(rt));
1309  if (BVERBOSE(V_SHOW_USE))
1310  {
1311  i=0;
1312  while ((dAssign_sys[i].res!=lt)
1313  && (dAssign_sys[i].res!=0)) i++;
1314  while (dAssign_sys[i].res==lt)
1315  {
1316  Werror("expected `%s` = `%s`"
1317  ,Tok2Cmdname(lt),Tok2Cmdname(dAssign_sys[i].arg));
1318  i++;
1319  }
1320  }
1321  }
1322  }
1323  return TRUE;
1324 }
int p
Definition: cfModGcd.cc:4019
CanonicalForm res
Definition: facAbsFact.cc:64
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:138
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define BVERBOSE(a)
Definition: options.h:35
#define V_SHOW_USE
Definition: options.h:52
sleftv * leftv
Definition: structs.h:60
const struct sValAssign_sys dAssign_sys[]
Definition: table.h:1339

◆ jiA_1x1INTMAT()

static BOOLEAN jiA_1x1INTMAT ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 699 of file ipassign.cc.

700 {
701  if (/*(*/ res->rtyp!=INTMAT_CMD /*)*/) /*|| (e!=NULL) - TRUE because of type int */
702  {
703  // no error message: assignment simply fails
704  return TRUE;
705  }
706  intvec* am=(intvec*)a->CopyD(INTMAT_CMD);
707  if ((am->rows()!=1) || (am->cols()!=1))
708  {
709  WerrorS("must be 1x1 intmat");
710  delete am;
711  return TRUE;
712  }
713  intvec* m=(intvec *)res->data;
714  // indices are correct (see ipExprArith3(..,'['..) )
715  int i=e->start;
716  int j=e->next->start;
717  IMATELEM(*m,i,j)=IMATELEM(*am,1,1);
718  delete am;
719  return FALSE;
720 }
int m
Definition: cfEzgcd.cc:121
int cols() const
Definition: intvec.h:93
int rows() const
Definition: intvec.h:94
#define IMATELEM(M, I, J)
Definition: intvec.h:83

◆ jiA_1x1MATRIX()

static BOOLEAN jiA_1x1MATRIX ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 721 of file ipassign.cc.

722 {
723  if (/*(*/ res->rtyp!=MATRIX_CMD /*)*/) /*|| (e!=NULL) - TRUE because of type poly */
724  {
725  // no error message: assignment simply fails
726  return TRUE;
727  }
728  matrix am=(matrix)a->CopyD(MATRIX_CMD);
729  if ((MATROWS(am)!=1) || (MATCOLS(am)!=1))
730  {
731  WerrorS("must be 1x1 matrix");
732  idDelete((ideal *)&am);
733  return TRUE;
734  }
735  matrix m=(matrix)res->data;
736  // indices are correct (see ipExprArith3(..,'['..) )
737  int i=e->start;
738  int j=e->next->start;
739  pDelete(&MATELEM(m,i,j));
740  pNormalize(MATELEM(am,1,1));
741  MATELEM(m,i,j)=MATELEM(am,1,1);
742  MATELEM(am,1,1)=NULL;
743  idDelete((ideal *)&am);
744  return FALSE;
745 }
#define MATELEM(mat, i, j)
Definition: matpol.h:28
#define MATROWS(i)
Definition: matpol.h:26
#define MATCOLS(i)
Definition: matpol.h:27
#define pDelete(p_ptr)
Definition: polys.h:173

◆ jiA_BIGINT()

static BOOLEAN jiA_BIGINT ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 581 of file ipassign.cc.

582 {
583  number p=(number)a->CopyD(BIGINT_CMD);
584  if (e==NULL)
585  {
586  if (res->data!=NULL) n_Delete((number *)&res->data,coeffs_BIGINT);
587  res->data=(void *)p;
588  }
589  else
590  {
591  int i=e->start-1;
592  if (i<0)
593  {
594  Werror("index[%d] must be positive",i+1);
595  return TRUE;
596  }
597  bigintmat *iv=(bigintmat *)res->data;
598  if (e->next==NULL)
599  {
600  WerrorS("only one index given");
601  return TRUE;
602  }
603  else
604  {
605  int c=e->next->start;
606  if ((i>=iv->rows())||(c<1)||(c>iv->cols()))
607  {
608  Werror("wrong range [%d,%d] in bigintmat %s(%d,%d)",i+1,c,res->Name(),iv->rows(),iv->cols());
609  return TRUE;
610  }
611  else
612  {
613  n_Delete((number *)&BIMATELEM(*iv,i+1,c),iv->basecoeffs());
614  BIMATELEM(*iv,i+1,c) = p;
615  }
616  }
617  }
618  jiAssignAttr(res,a);
619  return FALSE;
620 }
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:134
int cols() const
Definition: bigintmat.h:145
int rows() const
Definition: bigintmat.h:146
coeffs basecoeffs() const
Definition: bigintmat.h:147
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
static void jiAssignAttr(leftv l, leftv r)
Definition: ipassign.cc:320
coeffs coeffs_BIGINT
Definition: ipid.cc:52
if(yy_init)
Definition: libparse.cc:1418
@ BIGINT_CMD
Definition: tok.h:38

◆ jiA_BIGINTMAT()

static BOOLEAN jiA_BIGINTMAT ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 809 of file ipassign.cc.

810 {
811  if (res->data!=NULL) delete ((bigintmat *)res->data);
812  res->data=(void *)a->CopyD(BIGINTMAT_CMD);
813  jiAssignAttr(res,a);
814  return FALSE;
815 }

◆ jiA_CRING()

static BOOLEAN jiA_CRING ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 1065 of file ipassign.cc.

1066 {
1067  coeffs r=(coeffs)a->Data();
1068  if (r==NULL) return TRUE;
1069  if (res->data!=NULL) nKillChar((coeffs)res->data);
1070  res->data=(void *)a->CopyD(CRING_CMD);
1071  jiAssignAttr(res,a);
1072  return FALSE;
1073 }
void * Data()
Definition: subexpr.cc:1134
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:510
The main handler for Singular numbers which are suitable for Singular polynomials.
@ CRING_CMD
Definition: tok.h:56

◆ jiA_DEF()

static BOOLEAN jiA_DEF ( leftv  res,
leftv  ,
Subexpr   
)
static

Definition at line 1060 of file ipassign.cc.

1061 {
1062  res->data=(void *)0;
1063  return FALSE;
1064 }

◆ jiA_IDEAL()

static BOOLEAN jiA_IDEAL ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 816 of file ipassign.cc.

817 {
818  if (res->data!=NULL) idDelete((ideal*)&res->data);
819  res->data=(void *)a->CopyD(MATRIX_CMD);
820  if (a->rtyp==IDHDL) id_Normalize((ideal)a->Data(), currRing);
821  else id_Normalize((ideal)res->data, currRing);
822  jiAssignAttr(res,a);
823  if (((res->rtyp==IDEAL_CMD)||(res->rtyp==MODUL_CMD))
824  && (IDELEMS((ideal)(res->data))==1)
825  && (currRing->qideal==NULL)
826  && (!rIsPluralRing(currRing))
827  )
828  {
830  }
832  return FALSE;
833 }
int rtyp
Definition: subexpr.h:91
void jjNormalizeQRingId(leftv I)
Definition: ipassign.cc:2140
#define hasFlag(A, F)
Definition: ipid.h:107
#define setFlag(A, F)
Definition: ipid.h:108
#define FLAG_QRING
Definition: ipid.h:106
#define FLAG_STD
Definition: ipid.h:104
#define TEST_V_QRING
Definition: options.h:129
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
void id_Normalize(ideal I, const ring r)
normialize all polys in id
#define IDELEMS(i)
Definition: simpleideals.h:24

◆ jiA_IDEAL_M()

static BOOLEAN jiA_IDEAL_M ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 857 of file ipassign.cc.

858 {
859  if (res->data!=NULL) idDelete((ideal*)&res->data);
861  if (TEST_V_ALLWARN)
862  if (MATROWS(m)>1)
863  Warn("assign matrix with %d rows to an ideal in >>%s<<",MATROWS(m),my_yylinebuf);
864  IDELEMS((ideal)m)=MATROWS(m)*MATCOLS(m);
865  ((ideal)m)->rank=1;
866  MATROWS(m)=1;
867  id_Normalize((ideal)m, currRing);
868  res->data=(void *)m;
869  if (TEST_V_QRING && (currRing->qideal!=NULL)) jjNormalizeQRingId(res);
870  return FALSE;
871 }
char my_yylinebuf[80]
Definition: febase.cc:43
#define TEST_V_ALLWARN
Definition: options.h:140

◆ jiA_INT()

static BOOLEAN jiA_INT ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 353 of file ipassign.cc.

354 {
355  if (e==NULL)
356  {
357  res->data=(void *)a->Data();
358  jiAssignAttr(res,a);
359  }
360  else
361  {
362  int i=e->start-1;
363  if (i<0)
364  {
365  Werror("index[%d] must be positive",i+1);
366  return TRUE;
367  }
368  intvec *iv=(intvec *)res->data;
369  if (e->next==NULL)
370  {
371  if (i>=iv->length())
372  {
373  intvec *iv1=new intvec(i+1);
374  (*iv1)[i]=(int)((long)(a->Data()));
375  intvec *ivn=ivAdd(iv,iv1);
376  delete iv;
377  delete iv1;
378  res->data=(void *)ivn;
379  }
380  else
381  (*iv)[i]=(int)((long)(a->Data()));
382  }
383  else
384  {
385  int c=e->next->start;
386  if ((i>=iv->rows())||(c<1)||(c>iv->cols()))
387  {
388  Werror("wrong range [%d,%d] in intmat %s(%d,%d)",i+1,c,res->Name(),iv->rows(),iv->cols());
389  return TRUE;
390  }
391  else
392  IMATELEM(*iv,i+1,c) = (int)((long)(a->Data()));
393  }
394  }
395  return FALSE;
396 }
int length() const
Definition: intvec.h:92
intvec * ivAdd(intvec *a, intvec *b)
Definition: intvec.cc:249

◆ jiA_INTVEC()

static BOOLEAN jiA_INTVEC ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 786 of file ipassign.cc.

787 {
788  //if ((res->data==NULL) || (res->Typ()==a->Typ()))
789  {
790  if (res->data!=NULL) delete ((intvec *)res->data);
791  res->data=(void *)a->CopyD(INTVEC_CMD);
792  jiAssignAttr(res,a);
793  return FALSE;
794  }
795 #if 0
796  else
797  {
798  intvec *r=(intvec *)(res->data);
799  intvec *s=(intvec *)(a->Data());
800  int i=si_min(r->length(), s->length())-1;
801  for(;i>=0;i--)
802  {
803  (*r)[i]=(*s)[i];
804  }
805  return FALSE; //(r->length()< s->length());
806  }
807 #endif
808 }
const CanonicalForm int s
Definition: facAbsFact.cc:55

◆ jiA_INTVEC_L()

static BOOLEAN jiA_INTVEC_L ( leftv  l,
leftv  r 
)
static

Definition at line 1325 of file ipassign.cc.

1326 {
1327  /* right side is intvec, left side is list (of int)*/
1328  BOOLEAN nok;
1329  int i=0;
1330  leftv l1=l;
1331  leftv h;
1332  sleftv t;
1333  intvec *iv=(intvec *)r->Data();
1334  memset(&t,0,sizeof(sleftv));
1335  t.rtyp=INT_CMD;
1336  while ((i<iv->length())&&(l!=NULL))
1337  {
1338  t.data=(char *)(long)(*iv)[i];
1339  h=l->next;
1340  l->next=NULL;
1341  nok=jiAssign_1(l,&t,TRUE);
1342  l->next=h;
1343  if (nok) return TRUE;
1344  i++;
1345  l=h;
1346  }
1347  l1->CleanUp();
1348  r->CleanUp();
1349  return FALSE;
1350 }
void * data
Definition: subexpr.h:88
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:267
@ INT_CMD
Definition: tok.h:96

◆ jiA_LINK()

static BOOLEAN jiA_LINK ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 872 of file ipassign.cc.

873 {
874  si_link l=(si_link)res->data;
875 
876  if (l!=NULL) slCleanUp(l);
877 
878  if (a->Typ() == STRING_CMD)
879  {
880  if (l == NULL)
881  {
883  res->data = (void *) l;
884  }
885  return slInit(l, (char *) a->Data());
886  }
887  else if (a->Typ() == LINK_CMD)
888  {
889  if (l != NULL) omFreeBin(l, sip_link_bin);
890  res->data = slCopy((si_link)a->Data());
891  return FALSE;
892  }
893  return TRUE;
894 }
@ LINK_CMD
Definition: tok.h:117

◆ jiA_LIST()

static BOOLEAN jiA_LIST ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 632 of file ipassign.cc.

633 {
634  lists l=(lists)a->CopyD(LIST_CMD);
635  if (res->data!=NULL) ((lists)res->data)->Clean();
636  res->data=(void *)l;
637  jiAssignAttr(res,a);
638  return FALSE;
639 }
Definition: lists.h:23
slists * lists
Definition: mpr_numeric.h:146

◆ jiA_LIST_RES()

static BOOLEAN jiA_LIST_RES ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 621 of file ipassign.cc.

622 {
624  if (res->data!=NULL) ((lists)res->data)->Clean();
625  int add_row_shift = 0;
626  intvec *weights=(intvec*)atGet(a,"isHomog",INTVEC_CMD);
627  if (weights!=NULL) add_row_shift=weights->min_in();
628  res->data=(void *)syConvRes(r,TRUE,add_row_shift);
629  //jiAssignAttr(res,a);
630  return FALSE;
631 }
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:131
int min_in()
Definition: intvec.h:119
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:3122
ssyStrategy * syStrategy
Definition: syz.h:35

◆ jiA_MAP()

static BOOLEAN jiA_MAP ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 896 of file ipassign.cc.

897 {
898  if (res->data!=NULL)
899  {
900  omFree((ADDRESS)((map)res->data)->preimage);
901  ((map)res->data)->preimage=NULL;
902  idDelete((ideal*)&res->data);
903  }
904  res->data=(void *)a->CopyD(MAP_CMD);
905  jiAssignAttr(res,a);
906  return FALSE;
907 }

◆ jiA_MAP_ID()

static BOOLEAN jiA_MAP_ID ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 909 of file ipassign.cc.

910 {
911  map f=(map)res->data;
912  char *rn=f->preimage; // save the old/already assigned preimage ring name
913  f->preimage=NULL;
914  idDelete((ideal *)&f);
915  res->data=(void *)a->CopyD(IDEAL_CMD);
916  f=(map)res->data;
917  id_Normalize((ideal)f, currRing);
918  f->preimage = rn;
919  return FALSE;
920 }
FILE * f
Definition: checklibs.c:9

◆ jiA_MATRIX_L()

static BOOLEAN jiA_MATRIX_L ( leftv  l,
leftv  r 
)
static

Definition at line 1589 of file ipassign.cc.

1590 {
1591  /* right side is matrix, left side is list (of poly)*/
1592  BOOLEAN nok=FALSE;
1593  int i;
1595  leftv h;
1596  leftv ol=l;
1597  leftv o_r=r;
1598  sleftv t;
1599  memset(&t,0,sizeof(sleftv));
1600  t.rtyp=POLY_CMD;
1601  int mxn=MATROWS(m)*MATCOLS(m);
1602  loop
1603  {
1604  i=0;
1605  while ((i<mxn /*MATROWS(m)*MATCOLS(m)*/)&&(l!=NULL))
1606  {
1607  t.data=(char *)m->m[i];
1608  m->m[i]=NULL;
1609  h=l->next;
1610  l->next=NULL;
1611  idhdl hh=NULL;
1612  if ((l->rtyp==IDHDL)&&(l->Typ()==DEF_CMD)) hh=(idhdl)l->data;
1613  nok=jiAssign_1(l,&t,TRUE);
1614  if (hh!=NULL) { ipMoveId(hh);hh=NULL;}
1615  l->next=h;
1616  if (nok)
1617  {
1618  idDelete((ideal *)&m);
1619  goto ende;
1620  }
1621  i++;
1622  l=h;
1623  }
1624  idDelete((ideal *)&m);
1625  h=r;
1626  r=r->next;
1627  if (l==NULL)
1628  {
1629  if (r!=NULL)
1630  {
1631  WarnS("list length mismatch in assign (l>r)");
1632  nok=TRUE;
1633  }
1634  break;
1635  }
1636  else if (r==NULL)
1637  {
1638  WarnS("list length mismatch in assign (l<r)");
1639  nok=TRUE;
1640  break;
1641  }
1642  if ((r->Typ()==IDEAL_CMD)||(r->Typ()==MATRIX_CMD))
1643  {
1644  m=(matrix)r->CopyD(MATRIX_CMD);
1645  mxn=MATROWS(m)*MATCOLS(m);
1646  }
1647  else if (r->Typ()==POLY_CMD)
1648  {
1649  m=mpNew(1,1);
1650  MATELEM(m,1,1)=(poly)r->CopyD(POLY_CMD);
1651  pNormalize(MATELEM(m,1,1));
1652  mxn=1;
1653  }
1654  else
1655  {
1656  nok=TRUE;
1657  break;
1658  }
1659  }
1660 ende:
1661  o_r->CleanUp();
1662  ol->CleanUp();
1663  return nok;
1664 }
#define WarnS
Definition: emacs.cc:78
idrec * idhdl
Definition: ring.h:21

◆ jiA_MODUL_P()

static BOOLEAN jiA_MODUL_P ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 841 of file ipassign.cc.

843 {
844  if (res->data!=NULL) idDelete((ideal*)&res->data);
845  ideal I=idInit(1,1);
846  I->m[0]=(poly)a->CopyD(POLY_CMD);
847  if (I->m[0]!=NULL) pSetCompP(I->m[0],1);
848  pNormalize(I->m[0]);
849  res->data=(void *)I;
850  if (TEST_V_QRING && (currRing->qideal!=NULL))
851  {
853  else jjNormalizeQRingId(res);
854  }
855  return FALSE;
856 }
#define pSetCompP(a, i)
Definition: polys.h:289

◆ jiA_NUMBER()

static BOOLEAN jiA_NUMBER ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 397 of file ipassign.cc.

398 {
399  number p=(number)a->CopyD(NUMBER_CMD);
400  if (res->data!=NULL) nDelete((number *)&res->data);
401  nNormalize(p);
402  res->data=(void *)p;
403  jiAssignAttr(res,a);
404  return FALSE;
405 }
@ NUMBER_CMD
Definition: grammar.cc:287
#define nDelete(n)
Definition: numbers.h:17
#define nNormalize(n)
Definition: numbers.h:31

◆ jiA_PACKAGE()

static BOOLEAN jiA_PACKAGE ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 1054 of file ipassign.cc.

1055 {
1056  res->data=(void *)a->CopyD(PACKAGE_CMD);
1057  jiAssignAttr(res,a);
1058  return FALSE;
1059 }
@ PACKAGE_CMD
Definition: tok.h:149

◆ jiA_POLY()

static BOOLEAN jiA_POLY ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 640 of file ipassign.cc.

641 {
642  poly p=(poly)a->CopyD(POLY_CMD);
643  pNormalize(p);
644  if (e==NULL)
645  {
646  if ((p!=NULL) && TEST_V_QRING && (currRing->qideal!=NULL)
647  && (!hasFlag(a,FLAG_QRING)))
648  {
651  }
652  if (res->data!=NULL) pDelete((poly*)&res->data);
653  res->data=(void*)p;
654  jiAssignAttr(res,a);
655  }
656  else
657  {
658  int i,j;
659  matrix m=(matrix)res->data;
660  i=e->start;
661  if (e->next==NULL)
662  {
663  j=i; i=1;
664  // for all ideal like data types: check indices
665  if (j>MATCOLS(m))
666  {
667  if (TEST_V_ALLWARN)
668  {
669  Warn("increase ideal %d -> %d in %s",MATCOLS(m),j,my_yylinebuf);
670  }
671  pEnlargeSet(&(m->m),MATCOLS(m),j-MATCOLS(m));
672  MATCOLS(m)=j;
673  }
674  else if (j<=0)
675  {
676  Werror("index[%d] must be positive",j/*e->start*/);
677  return TRUE;
678  }
679  }
680  else
681  {
682  // for matrices: indices are correct (see ipExprArith3(..,'['..) )
683  j=e->next->start;
684  }
685  if ((p!=NULL) && TEST_V_QRING && (currRing->qideal!=NULL))
686  {
688  }
689  pDelete(&MATELEM(m,i,j));
690  MATELEM(m,i,j)=p;
691  /* for module: update rank */
692  if ((p!=NULL) && (pGetComp(p)!=0))
693  {
694  m->rank=si_max(m->rank,pMaxComp(p));
695  }
696  }
697  return FALSE;
698 }
void jjNormalizeQRingP(poly &p)
Definition: ipassign.cc:2175
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3633
#define pGetComp(p)
Component.
Definition: polys.h:37

◆ jiA_PROC()

static BOOLEAN jiA_PROC ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 768 of file ipassign.cc.

769 {
770  extern procinfo *iiInitSingularProcinfo(procinfo *pi, const char *libname,
771  const char *procname, int line,
772  long pos, BOOLEAN pstatic=FALSE);
773  if(res->data!=NULL) piKill((procinfo *)res->data);
774  if(a->Typ()==STRING_CMD)
775  {
776  res->data = (void *)omAlloc0Bin(procinfo_bin);
777  ((procinfo *)(res->data))->language=LANG_NONE;
778  iiInitSingularProcinfo((procinfo *)res->data,"",res->name,0,0);
779  ((procinfo *)res->data)->data.s.body=(char *)a->CopyD(STRING_CMD);
780  }
781  else
782  res->data=(void *)a->CopyD(PROC_CMD);
783  jiAssignAttr(res,a);
784  return FALSE;
785 }
@ PROC_CMD
Definition: grammar.cc:280
BOOLEAN piKill(procinfov pi)
Definition: ipid.cc:656
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int, long pos, BOOLEAN pstatic)
Definition: iplib.cc:991
#define pi
Definition: libparse.cc:1143
omBin procinfo_bin
Definition: subexpr.cc:47
@ LANG_NONE
Definition: subexpr.h:22

◆ jiA_QRING()

static BOOLEAN jiA_QRING ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 921 of file ipassign.cc.

922 {
923  // the follwing can only happen, if:
924  // - the left side is of type qring AND not an id
925  if ((e!=NULL)||(res->rtyp!=IDHDL))
926  {
927  WerrorS("qring_id expected");
928  return TRUE;
929  }
930  ring old_ring=(ring)res->Data();
931 
932  coeffs newcf = currRing->cf;
933  ideal id = (ideal)a->Data(); //?
934  const int cpos = idPosConstant(id);
936  if (cpos >= 0)
937  {
938  newcf = n_CoeffRingQuot1(p_GetCoeff(id->m[cpos], currRing), currRing->cf);
939  if(newcf == NULL)
940  return TRUE;
941  }
942  //qr=(ring)res->Data();
943  //if (qr!=NULL) omFreeBin((ADDRESS)qr, ip_sring_bin);
944  ring qr = rCopy(currRing);
945  assume(qr->cf == currRing->cf);
946 
947  if ( qr->cf != newcf )
948  {
949  nKillChar ( qr->cf ); // ???
950  qr->cf = newcf;
951  }
952  // we have to fill it, but the copy also allocates space
953  idhdl h=(idhdl)res->data; // we have res->rtyp==IDHDL
954  IDRING(h)=qr;
955 
956  ideal qid;
957 
958  if((rField_is_Ring(currRing)) && (cpos != -1))
959  {
960  int i, j;
961  int *perm = (int *)omAlloc0((qr->N+1)*sizeof(int));
962 
963  for(i=qr->N;i>0;i--)
964  perm[i]=i;
965 
966  nMapFunc nMap = n_SetMap(currRing->cf, newcf);
967  qid = idInit(IDELEMS(id)-1,1);
968  for(i = 0, j = 0; i<IDELEMS(id); i++)
969  if( i != cpos )
970  qid->m[j++] = p_PermPoly(id->m[i], perm, currRing, qr, nMap, NULL, 0);
971  }
972  else
973  qid = idrCopyR(id,currRing,qr);
974 
975  idSkipZeroes(qid);
976  //idPrint(qid);
977  if ((idElem(qid)>1) || rIsSCA(currRing) || (currRing->qideal!=NULL))
978  assumeStdFlag(a);
979 
980  if (currRing->qideal!=NULL) /* we are already in a qring! */
981  {
982  ideal tmp=idSimpleAdd(qid,currRing->qideal);
983  // both ideals should be GB, so dSimpleAdd is sufficient
984  idDelete(&qid);
985  qid=tmp;
986  // delete the qr copy of quotient ideal!!!
987  idDelete(&qr->qideal);
988  }
989  if (idElem(qid)==0)
990  {
991  qr->qideal = NULL;
992  id_Delete(&qid,currRing);
993  IDTYP(h)=RING_CMD;
994  }
995  else
996  qr->qideal = qid;
997 
998  // qr is a copy of currRing with the new qideal!
999  #ifdef HAVE_PLURAL
1000  if(rIsPluralRing(currRing) &&(qr->qideal!=NULL))
1001  {
1002  if (!hasFlag(a,FLAG_TWOSTD))
1003  {
1004  Warn("%s is no twosided standard basis",a->Name());
1005  }
1006 
1007  if( nc_SetupQuotient(qr, currRing) )
1008  {
1009 // WarnS("error in nc_SetupQuotient");
1010  }
1011  }
1012  #endif
1013  //rWrite(qr);
1014  rSetHdl((idhdl)res->data);
1015  if (old_ring!=NULL)
1016  {
1017  rDelete(old_ring);
1018  }
1019  return FALSE;
1020 }
const char * Name()
Definition: subexpr.h:120
static FORCE_INLINE coeffs n_CoeffRingQuot1(number c, const coeffs r)
Definition: coeffs.h:519
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:722
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:74
#define idSimpleAdd(A, B)
Definition: ideals.h:42
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:37
#define FLAG_TWOSTD
Definition: ipid.h:105
#define IDRING(a)
Definition: ipid.h:122
void rSetHdl(idhdl h)
Definition: ipshell.cc:5050
static bool rIsSCA(const ring r)
Definition: nc.h:198
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
Definition: old.gring.cc:3428
#define assume(x)
Definition: mod2.h:390
#define p_GetCoeff(p, r)
Definition: monomials.h:57
Definition: qr.h:46
#define omAlloc0(size)
Definition: omAllocDecl.h:211
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
Definition: p_polys.cc:4014
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:192
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:439
ring rCopy(ring r)
Definition: ring.cc:1605
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int idElem(const ideal F)
count non-zero elements
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
BOOLEAN assumeStdFlag(leftv h)
Definition: subexpr.cc:1471

◆ jiA_RESOLUTION()

static BOOLEAN jiA_RESOLUTION ( leftv  res,
leftv  a,
Subexpr   
)
static

Definition at line 834 of file ipassign.cc.

835 {
836  if (res->data!=NULL) syKillComputation((syStrategy)res->data);
837  res->data=(void *)a->CopyD(RESOLUTION_CMD);
838  jiAssignAttr(res,a);
839  return FALSE;
840 }
void syKillComputation(syStrategy syzstr, ring r=currRing)
Definition: syz1.cc:1496

◆ jiA_RING()

static BOOLEAN jiA_RING ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 1022 of file ipassign.cc.

1023 {
1024  BOOLEAN have_id=TRUE;
1025  if ((e!=NULL)||(res->rtyp!=IDHDL))
1026  {
1027  //WerrorS("id expected");
1028  //return TRUE;
1029  have_id=FALSE;
1030  }
1031  ring r=(ring)a->Data();
1032  if ((r==NULL)||(r->cf==NULL)) return TRUE;
1033  if (have_id)
1034  {
1035  idhdl rl=(idhdl)res->data;
1036  if (IDRING(rl)!=NULL) rKill(rl);
1037  IDRING(rl)=r;
1038  if ((IDLEV((idhdl)a->data)!=myynest) && (r==currRing))
1039  currRingHdl=(idhdl)res->data;
1040  }
1041  else
1042  {
1043  if (e==NULL) res->data=(char *)r;
1044  else
1045  {
1046  WerrorS("id expected");
1047  return TRUE;
1048  }
1049  }
1050  r->ref++;
1051  jiAssignAttr(res,a);
1052  return FALSE;
1053 }
int myynest
Definition: febase.cc:41
idhdl currRingHdl
Definition: ipid.cc:61
#define IDLEV(a)
Definition: ipid.h:116
void rKill(ring r)
Definition: ipshell.cc:6076

◆ jiA_STRING()

static BOOLEAN jiA_STRING ( leftv  res,
leftv  a,
Subexpr  e 
)
static

Definition at line 746 of file ipassign.cc.

747 {
748  if (e==NULL)
749  {
750  void* tmp = res->data;
751  res->data=(void *)a->CopyD(STRING_CMD);
752  jiAssignAttr(res,a);
753  omfree(tmp);
754  }
755  else
756  {
757  char *s=(char *)res->data;
758  if ((e->start>0)&&(e->start<=(int)strlen(s)))
759  s[e->start-1]=(char)(*((char *)a->Data()));
760  else
761  {
762  Werror("string index %d out of range 1..%d",e->start,(int)strlen(s));
763  return TRUE;
764  }
765  }
766  return FALSE;
767 }
#define omfree(addr)
Definition: omAllocDecl.h:237

◆ jiA_STRING_L()

static BOOLEAN jiA_STRING_L ( leftv  l,
leftv  r 
)
static

Definition at line 1665 of file ipassign.cc.

1666 {
1667  /*left side are strings, right side is a string*/
1668  /*e.g. s[2..3]="12" */
1669  /*the case s=t[1..4] is handled in iiAssign,
1670  * the case s[2..3]=t[3..4] is handled in iiAssgn_rec*/
1671  BOOLEAN nok=FALSE;
1672  sleftv t;
1673  leftv h,l1=l;
1674  int i=0;
1675  char *ss;
1676  char *s=(char *)r->Data();
1677  int sl=strlen(s);
1678 
1679  memset(&t,0,sizeof(sleftv));
1680  t.rtyp=STRING_CMD;
1681  while ((i<sl)&&(l!=NULL))
1682  {
1683  ss=(char *)omAlloc(2);
1684  ss[1]='\0';
1685  ss[0]=s[i];
1686  t.data=ss;
1687  h=l->next;
1688  l->next=NULL;
1689  nok=jiAssign_1(l,&t,TRUE);
1690  if (nok)
1691  {
1692  break;
1693  }
1694  i++;
1695  l=h;
1696  }
1697  r->CleanUp();
1698  l1->CleanUp();
1699  return nok;
1700 }
#define omAlloc(size)
Definition: omAllocDecl.h:210

◆ jiA_VECTOR_L()

static BOOLEAN jiA_VECTOR_L ( leftv  l,
leftv  r 
)
static

Definition at line 1351 of file ipassign.cc.

1352 {
1353  /* right side is vector, left side is list (of poly)*/
1354  BOOLEAN nok;
1355  leftv l1=l;
1356  ideal I=idVec2Ideal((poly)r->Data());
1357  leftv h;
1358  sleftv t;
1359  int i=0;
1360  memset(&t,0,sizeof(sleftv));
1361  while (l!=NULL)
1362  {
1363  t.rtyp=POLY_CMD;
1364  if (i>=IDELEMS(I))
1365  {
1366  t.data=NULL;
1367  }
1368  else
1369  {
1370  t.data=(char *)I->m[i];
1371  I->m[i]=NULL;
1372  }
1373  h=l->next;
1374  l->next=NULL;
1375  nok=jiAssign_1(l,&t,TRUE);
1376  l->next=h;
1377  t.CleanUp();
1378  if (nok)
1379  {
1380  idDelete(&I);
1381  return TRUE;
1382  }
1383  i++;
1384  l=h;
1385  }
1386  idDelete(&I);
1387  l1->CleanUp();
1388  r->CleanUp();
1389  //if (TEST_V_QRING && (currRing->qideal!=NULL)) jjNormalizeQRingP(l);
1390  return FALSE;
1391 }
static ideal idVec2Ideal(poly vec)
Definition: ideals.h:171

◆ jiAssign_1()

static BOOLEAN jiAssign_1 ( leftv  l,
leftv  r,
BOOLEAN  toplevel 
)
static

Definition at line 1084 of file ipassign.cc.

1085 {
1086  int rt=r->Typ();
1087  if (rt==0)
1088  {
1089  if (!errorreported) Werror("`%s` is undefined",r->Fullname());
1090  return TRUE;
1091  }
1092 
1093  int lt=l->Typ();
1094  if (lt==0)
1095  {
1096  if (!errorreported) Werror("left side `%s` is undefined",l->Fullname());
1097  return TRUE;
1098  }
1099  if(rt==NONE)
1100  {
1101  if ((!TEST_V_ASSIGN_NONE)||(lt!=DEF_CMD))
1102  {
1103  WarnS("right side is not a datum, assignment ignored");
1104  Warn("in line >>%s<<",my_yylinebuf);
1105  // if (!errorreported)
1106  // WerrorS("right side is not a datum");
1107  //return TRUE;
1108  }
1109  return FALSE;
1110  }
1111 
1112  if (lt==DEF_CMD)
1113  {
1114  if (TEST_V_ALLWARN
1115  && (rt!=RING_CMD)
1116  && (l->name!=NULL)
1117  && (l->e==NULL)
1118  && (iiCurrArgs==NULL) /* not in proc header */
1119  )
1120  {
1121  Warn("use `%s` instead of `def` in %s:%d:%s",Tok2Cmdname(rt),
1123  }
1124  if (l->rtyp==IDHDL)
1125  {
1126  IDTYP((idhdl)l->data)=rt;
1127  }
1128  else if (l->name!=NULL)
1129  {
1130  sleftv ll;
1131  iiDeclCommand(&ll,l,myynest,rt,&IDROOT);
1132  memcpy(l,&ll,sizeof(sleftv));
1133  }
1134  else
1135  {
1136  l->rtyp=rt;
1137  }
1138  lt=rt;
1139  }
1140  else
1141  {
1142  if ((l->data==r->data)&&(l->e==NULL)&&(r->e==NULL))
1143  return FALSE;
1144  }
1145  leftv ld=l;
1146  if (l->rtyp==IDHDL)
1147  {
1148  if (lt!=RING_CMD)
1149  ld=(leftv)l->data;
1150  }
1151  else if (toplevel)
1152  {
1153  WerrorS("error in assign: left side is not an l-value");
1154  return TRUE;
1155  }
1156  if (lt>MAX_TOK)
1157  {
1158  blackbox *bb=getBlackboxStuff(lt);
1159 #ifdef BLACKBOX_DEVEL
1160  Print("bb-assign: bb=%lx\n",bb);
1161 #endif
1162  return (bb==NULL) || bb->blackbox_Assign(l,r);
1163  }
1164  int start=0;
1165  while ((dAssign[start].res!=lt)
1166  && (dAssign[start].res!=0)) start++;
1167  int i=start;
1168  while ((dAssign[i].res==lt)
1169  && (dAssign[i].arg!=rt)) i++;
1170  if (dAssign[i].res==lt)
1171  {
1172  if (traceit&TRACE_ASSIGN) Print("assign %s=%s\n",Tok2Cmdname(lt),Tok2Cmdname(rt));
1173  BOOLEAN b;
1174  b=dAssign[i].p(ld,r,l->e);
1175  if(l!=ld) /* i.e. l is IDHDL, l->data is ld */
1176  {
1177  l->flag=ld->flag;
1178  l->attribute=ld->attribute;
1179  }
1180  return b;
1181  }
1182  // implicite type conversion ----------------------------------------------
1183  if (dAssign[i].res!=lt)
1184  {
1185  int ri;
1187  BOOLEAN failed=FALSE;
1188  i=start;
1189  //while ((dAssign[i].res!=lt)
1190  // && (dAssign[i].res!=0)) i++;
1191  while (dAssign[i].res==lt)
1192  {
1193  if ((ri=iiTestConvert(rt,dAssign[i].arg))!=0)
1194  {
1195  failed= iiConvert(rt,dAssign[i].arg,ri,r,rn);
1196  if(!failed)
1197  {
1198  failed= dAssign[i].p(ld,rn,l->e);
1199  if (traceit&TRACE_ASSIGN)
1200  Print("assign %s=%s ok? %d\n",Tok2Cmdname(lt),Tok2Cmdname(rn->rtyp),!failed);
1201  }
1202  // everything done, clean up temp. variables
1203  rn->CleanUp();
1205  if (failed)
1206  {
1207  // leave loop, goto error handling
1208  break;
1209  }
1210  else
1211  {
1212  if(l!=ld) /* i.e. l is IDHDL, l->data is ld */
1213  {
1214  l->flag=ld->flag;
1215  l->attribute=ld->attribute;
1216  }
1217  // everything ok, return
1218  return FALSE;
1219  }
1220  }
1221  i++;
1222  }
1223  // error handling ---------------------------------------------------
1224  if (!errorreported)
1225  {
1226  if ((l->rtyp==IDHDL) && (l->e==NULL))
1227  Werror("`%s`(%s) = `%s` is not supported",
1228  Tok2Cmdname(lt),l->Name(),Tok2Cmdname(rt));
1229  else
1230  Werror("`%s` = `%s` is not supported"
1231  ,Tok2Cmdname(lt),Tok2Cmdname(rt));
1232  if (BVERBOSE(V_SHOW_USE))
1233  {
1234  i=0;
1235  while ((dAssign[i].res!=lt)
1236  && (dAssign[i].res!=0)) i++;
1237  while (dAssign[i].res==lt)
1238  {
1239  Werror("expected `%s` = `%s`"
1240  ,Tok2Cmdname(lt),Tok2Cmdname(dAssign[i].arg));
1241  i++;
1242  }
1243  }
1244  }
1245  }
1246  return TRUE;
1247 }
char * filename
Definition: fevoices.h:63
BITSET flag
Definition: subexpr.h:90
attr attribute
Definition: subexpr.h:89
int yylineno
Definition: febase.cc:40
Voice * currentVoice
Definition: fevoices.cc:48
#define IDROOT
Definition: ipid.h:18
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1122
leftv iiCurrArgs
Definition: ipshell.cc:78
#define TEST_V_ASSIGN_NONE
Definition: options.h:132
const struct sValAssign dAssign[]
Definition: table.h:1288

◆ jiAssign_list()

static BOOLEAN jiAssign_list ( leftv  l,
leftv  r 
)
static

Definition at line 1701 of file ipassign.cc.

1702 {
1703  int i=l->e->start-1;
1704  if (i<0)
1705  {
1706  Werror("index[%d] must be positive",i+1);
1707  return TRUE;
1708  }
1709  if(l->attribute!=NULL)
1710  {
1711  atKillAll((idhdl)l);
1712  l->attribute=NULL;
1713  }
1714  l->flag=0;
1715  lists li;
1716  if (l->rtyp==IDHDL)
1717  {
1718  li=IDLIST((idhdl)l->data);
1719  }
1720  else
1721  {
1722  li=(lists)l->data;
1723  }
1724  if (i>li->nr)
1725  {
1726  if (TEST_V_ALLWARN)
1727  {
1728  Warn("increase list %d -> %d in %s",li->nr,i,my_yylinebuf);
1729  }
1730  li->m=(leftv)omreallocSize(li->m,(li->nr+1)*sizeof(sleftv),(i+1)*sizeof(sleftv));
1731  memset(&(li->m[li->nr+1]),0,(i-li->nr)*sizeof(sleftv));
1732  int j=li->nr+1;
1733  for(;j<=i;j++)
1734  li->m[j].rtyp=DEF_CMD;
1735  li->nr=i;
1736  }
1737  leftv ld=&(li->m[i]);
1738  ld->e=l->e->next;
1739  BOOLEAN b;
1740  sleftv tmp;
1741  memset(&tmp,0,sizeof(sleftv));
1742  if (/*(ld->rtyp!=LIST_CMD)
1743  &&*/(ld->e==NULL)
1744  && (ld->Typ()!=r->Typ()))
1745  {
1746  tmp.rtyp=DEF_CMD;
1747  b=iiAssign(&tmp,r,FALSE);
1748  ld->CleanUp();
1749  memcpy(ld,&tmp,sizeof(sleftv));
1750  }
1751  else if ((ld->e==NULL)
1752  && (ld->Typ()==r->Typ())
1753  && (ld->Typ()<MAX_TOK))
1754  {
1755  tmp.rtyp=r->Typ();
1756  tmp.data=(char*)idrecDataInit(r->Typ());
1757  b=iiAssign(&tmp,r,FALSE);
1758  ld->CleanUp();
1759  memcpy(ld,&tmp,sizeof(sleftv));
1760  }
1761  else
1762  {
1763  b=iiAssign(ld,r,FALSE);
1764  if (l->e!=NULL) l->e->next=ld->e;
1765  ld->e=NULL;
1766  }
1767  return b;
1768 }
sleftv * m
Definition: lists.h:45
int nr
Definition: lists.h:43
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1792
void * idrecDataInit(int t)
Definition: ipid.cc:127
#define IDLIST(a)
Definition: ipid.h:132
#define omreallocSize(addr, o_size, size)
Definition: omAllocDecl.h:231

◆ jiAssign_rec()

static BOOLEAN jiAssign_rec ( leftv  l,
leftv  r 
)
static

Definition at line 1769 of file ipassign.cc.

1770 {
1771  leftv l1=l;
1772  leftv r1=r;
1773  leftv lrest;
1774  leftv rrest;
1775  BOOLEAN b;
1776  do
1777  {
1778  lrest=l->next;
1779  rrest=r->next;
1780  l->next=NULL;
1781  r->next=NULL;
1782  b=iiAssign(l,r);
1783  l->next=lrest;
1784  r->next=rrest;
1785  l=lrest;
1786  r=rrest;
1787  } while ((!b)&&(l!=NULL));
1788  l1->CleanUp();
1789  r1->CleanUp();
1790  return b;
1791 }

◆ jiAssignAttr()

static void jiAssignAttr ( leftv  l,
leftv  r 
)
static

Definition at line 320 of file ipassign.cc.

321 {
322  // get the attribute of th right side
323  // and set it to l
324  leftv rv=r->LData();
325  if (rv!=NULL)
326  {
327  if (rv->e==NULL)
328  {
329  if (rv->attribute!=NULL)
330  {
331  attr la;
332  if (r->rtyp!=IDHDL)
333  {
334  la=rv->attribute;
335  rv->attribute=NULL;
336  }
337  else
338  {
339  la=rv->attribute->Copy();
340  }
341  l->attribute=la;
342  }
343  l->flag=rv->flag;
344  }
345  }
346  if (l->rtyp==IDHDL)
347  {
348  idhdl h=(idhdl)l->data;
349  IDATTR(h)=l->attribute;
350  IDFLAG(h)=l->flag;
351  }
352 }
Definition: attrib.h:21
attr Copy()
Definition: attrib.cc:35
leftv LData()
Definition: subexpr.cc:1403

◆ jjA_L_BIGINTMAT()

static BOOLEAN jjA_L_BIGINTMAT ( leftv  l,
leftv  r,
bigintmat bim 
)
static

Definition at line 1506 of file ipassign.cc.

1507 {
1508  /* left side is bigintmat, right side is list (of int,intvec,intmat)*/
1509  leftv hh=r;
1510  int i = 0;
1511  if (bim->length()==0) { WerrorS("bigintmat is 1x0"); delete bim; return TRUE; }
1512  while (hh!=NULL)
1513  {
1514  if (i>=bim->cols()*bim->rows())
1515  {
1516  if (traceit&TRACE_ASSIGN)
1517  {
1518  Warn("expression list length(%d) does not match bigintmat size(%d x %d)",
1519  exprlist_length(hh),bim->rows(),bim->cols());
1520  }
1521  break;
1522  }
1523  if (hh->Typ() == INT_CMD)
1524  {
1525  number tp = n_Init((int)((long)(hh->Data())), coeffs_BIGINT);
1526  bim->set(i++, tp);
1527  n_Delete(&tp, coeffs_BIGINT);
1528  }
1529  else if (hh->Typ() == BIGINT_CMD)
1530  {
1531  bim->set(i++, (number)(hh->Data()));
1532  }
1533  /*
1534  ((hh->Typ() == INTVEC_CMD)
1535  ||(hh->Typ() == INTMAT_CMD))
1536  {
1537  intvec *ivv = (intvec *)(hh->Data());
1538  int ll = 0,l = si_min(ivv->length(),iv->length());
1539  for (; l>0; l--)
1540  {
1541  (*iv)[i++] = (*ivv)[ll++];
1542  }
1543  }*/
1544  else
1545  {
1546  delete bim;
1547  return TRUE;
1548  }
1549  hh = hh->next;
1550  }
1551  if (IDBIMAT((idhdl)l->data)!=NULL) delete IDBIMAT((idhdl)l->data);
1552  IDBIMAT((idhdl)l->data)=bim;
1553  return FALSE;
1554 }
int length()
Definition: bigintmat.h:144
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:95
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

◆ jjA_L_INTVEC()

static BOOLEAN jjA_L_INTVEC ( leftv  l,
leftv  r,
intvec iv 
)
static

Definition at line 1457 of file ipassign.cc.

1458 {
1459  /* left side is intvec/intmat, right side is list (of int,intvec,intmat)*/
1460  leftv hh=r;
1461  int i = 0;
1462  while (hh!=NULL)
1463  {
1464  if (i>=iv->length())
1465  {
1466  if (traceit&TRACE_ASSIGN)
1467  {
1468  Warn("expression list length(%d) does not match intmat size(%d)",
1469  iv->length()+exprlist_length(hh),iv->length());
1470  }
1471  break;
1472  }
1473  if (hh->Typ() == INT_CMD)
1474  {
1475  (*iv)[i++] = (int)((long)(hh->Data()));
1476  }
1477  else if ((hh->Typ() == INTVEC_CMD)
1478  ||(hh->Typ() == INTMAT_CMD))
1479  {
1480  intvec *ivv = (intvec *)(hh->Data());
1481  int ll = 0,l = si_min(ivv->length(),iv->length());
1482  for (; l>0; l--)
1483  {
1484  (*iv)[i++] = (*ivv)[ll++];
1485  }
1486  }
1487  else
1488  {
1489  delete iv;
1490  return TRUE;
1491  }
1492  hh = hh->next;
1493  }
1494  if (l->rtyp==IDHDL)
1495  {
1496  if (IDINTVEC((idhdl)l->data)!=NULL) delete IDINTVEC((idhdl)l->data);
1497  IDINTVEC((idhdl)l->data)=iv;
1498  }
1499  else
1500  {
1501  if (l->data!=NULL) delete ((intvec*)l->data);
1502  l->data=(char*)iv;
1503  }
1504  return FALSE;
1505 }

◆ jjA_L_LIST()

static BOOLEAN jjA_L_LIST ( leftv  l,
leftv  r 
)
static

Definition at line 1392 of file ipassign.cc.

1396 {
1397  int sl = r->listLength();
1399  lists oldL;
1400  leftv h=NULL,o_r=r;
1401  int i;
1402  int rt;
1403 
1404  L->Init(sl);
1405  for (i=0;i<sl;i++)
1406  {
1407  if (h!=NULL) { /* e.g. not in the first step:
1408  * h is the pointer to the old sleftv,
1409  * r is the pointer to the next sleftv
1410  * (in this moment) */
1411  h->next=r;
1412  }
1413  h=r;
1414  r=r->next;
1415  h->next=NULL;
1416  rt=h->Typ();
1417  if ((rt==0)||(rt==NONE)||(rt==DEF_CMD))
1418  {
1419  L->Clean();
1420  Werror("`%s` is undefined",h->Fullname());
1421  //listall();
1422  goto err;
1423  }
1424  //if (rt==RING_CMD)
1425  //{
1426  // L->m[i].rtyp=rt;
1427  // L->m[i].data=h->Data();
1428  // ((ring)L->m[i].data)->ref++;
1429  //}
1430  //else
1431  L->m[i].CleanUp();
1432  L->m[i].Copy(h);
1433  if(errorreported)
1434  {
1435  L->Clean();
1436  goto err;
1437  }
1438  }
1439  oldL=(lists)l->Data();
1440  if (oldL!=NULL) oldL->Clean();
1441  if (l->rtyp==IDHDL)
1442  {
1443  IDLIST((idhdl)l->data)=L;
1444  IDTYP((idhdl)l->data)=LIST_CMD; // was possibly DEF_CMD
1445  if (lRingDependend(L)) ipMoveId((idhdl)l->data);
1446  }
1447  else
1448  {
1449  l->LData()->data=L;
1450  if ((l->e!=NULL) && (l->rtyp==DEF_CMD))
1451  l->rtyp=LIST_CMD;
1452  }
1453 err:
1454  o_r->CleanUp();
1455  return errorreported;
1456 }
void Copy(leftv e)
Definition: subexpr.cc:684
void Clean(ring r=currRing)
Definition: lists.h:25
INLINE_THIS void Init(int l=0)
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
omBin slists_bin
Definition: lists.cc:23
#define omAllocBin(bin)
Definition: omAllocDecl.h:205

◆ jjA_L_STRING()

static BOOLEAN jjA_L_STRING ( leftv  l,
leftv  r 
)
static

Definition at line 1555 of file ipassign.cc.

1556 {
1557  /* left side is string, right side is list of string*/
1558  leftv hh=r;
1559  int sl = 1;
1560  char *s;
1561  char *t;
1562  int tl;
1563  /* find the length */
1564  while (hh!=NULL)
1565  {
1566  if (hh->Typ()!= STRING_CMD)
1567  {
1568  return TRUE;
1569  }
1570  sl += strlen((char *)hh->Data());
1571  hh = hh->next;
1572  }
1573  s = (char * )omAlloc(sl);
1574  sl=0;
1575  hh = r;
1576  while (hh!=NULL)
1577  {
1578  t=(char *)hh->Data();
1579  tl=strlen(t);
1580  memcpy(s+sl,t,tl);
1581  sl+=tl;
1582  hh = hh->next;
1583  }
1584  s[sl]='\0';
1585  omFree((ADDRESS)IDDATA((idhdl)(l->data)));
1586  IDDATA((idhdl)(l->data))=s;
1587  return FALSE;
1588 }
#define IDDATA(a)
Definition: ipid.h:121

◆ jjCOLMAX()

static BOOLEAN jjCOLMAX ( leftv  ,
leftv  a 
)
static

Definition at line 64 of file ipassign.cc.

65 {
66  colmax=(int)((long)(a->Data()));
67  return FALSE;
68 }
int colmax
Definition: reporter.h:17

◆ jjECHO()

static BOOLEAN jjECHO ( leftv  ,
leftv  a 
)
static

Definition at line 54 of file ipassign.cc.

55 {
56  si_echo=(int)((long)(a->Data()));
57  return FALSE;
58 }
int si_echo
Definition: febase.cc:35

◆ jjIMPORTFROM()

BOOLEAN jjIMPORTFROM ( leftv  res,
leftv  u,
leftv  v 
)

Definition at line 2187 of file ipassign.cc.

2188 {
2189  //Print("importfrom %s::%s ->.\n",v->Name(),u->Name() );
2190  assume(u->Typ()==PACKAGE_CMD);
2191  char *vn=(char *)v->Name();
2192  idhdl h=((package)(u->Data()))->idroot->get(vn /*v->Name()*/, myynest);
2193  if (h!=NULL)
2194  {
2195  //check for existence
2196  if (((package)(u->Data()))==basePack)
2197  {
2198  WarnS("source and destination packages are identical");
2199  return FALSE;
2200  }
2201  idhdl t=basePack->idroot->get(vn /*v->Name()*/, myynest);
2202  if (t!=NULL)
2203  {
2204  if (BVERBOSE(V_REDEFINE)) Warn("redefining %s (%s)",vn,my_yylinebuf);
2205  killhdl(t);
2206  }
2207  sleftv tmp_expr;
2208  if (iiDeclCommand(&tmp_expr,v,myynest,DEF_CMD,&IDROOT)) return TRUE;
2209  sleftv h_expr;
2210  memset(&h_expr,0,sizeof(h_expr));
2211  h_expr.rtyp=IDHDL;
2212  h_expr.data=h;
2213  h_expr.name=vn;
2214  return iiAssign(&tmp_expr,&h_expr);
2215  }
2216  else
2217  {
2218  Werror("`%s` not found in `%s`",v->Name(), u->Name());
2219  return TRUE;
2220  }
2221  return FALSE;
2222 }
const char * name
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
package basePack
Definition: ipid.cc:60
void killhdl(idhdl h, package proot)
Definition: ipid.cc:376
#define V_REDEFINE
Definition: options.h:45
ip_package * package
Definition: structs.h:46

◆ jjMAXDEG()

static BOOLEAN jjMAXDEG ( leftv  ,
leftv  a 
)
static

Definition at line 83 of file ipassign.cc.

84 {
85  Kstd1_deg=(int)((long)(a->Data()));
86  if (Kstd1_deg!=0)
88  else
90  return FALSE;
91 }
int Kstd1_deg
Definition: kstd1.h:47
unsigned si_opt_1
Definition: options.c:5
#define Sy_bit(x)
Definition: options.h:32
#define OPT_DEGBOUND
Definition: options.h:89

◆ jjMAXMULT()

static BOOLEAN jjMAXMULT ( leftv  ,
leftv  a 
)
static

Definition at line 92 of file ipassign.cc.

93 {
94  Kstd1_mu=(int)((long)(a->Data()));
95  if (Kstd1_mu!=0)
97  else
99  return FALSE;
100 }
int Kstd1_mu
Definition: kstd1.h:47
#define OPT_MULTBOUND
Definition: options.h:88

◆ jjMINPOLY()

static BOOLEAN jjMINPOLY ( leftv  ,
leftv  a 
)
static

Definition at line 177 of file ipassign.cc.

178 {
179  if( !nCoeff_is_transExt(currRing->cf) && (currRing->idroot == NULL) && n_IsZero((number)a->Data(), currRing->cf) )
180  {
181 #ifndef SING_NDEBUG
182  WarnS("Set minpoly over non-transcendental ground field to 0?!");
183  Warn("in >>%s<<",my_yylinebuf);
184 #endif
185  return FALSE;
186  }
187 
188 
189  if ( !nCoeff_is_transExt(currRing->cf) )
190  {
191  WarnS("Trying to set minpoly over non-transcendental ground field...");
192  if(!nCoeff_is_algExt(currRing->cf) )
193  {
194  WerrorS("cannot set minpoly for these coeffients");
195  return TRUE;
196  }
197  }
198  if ((rVar(currRing->cf->extRing)!=1)
199  && !n_IsZero((number)a->Data(), currRing->cf) )
200  {
201  WerrorS("only univarite minpoly allowed");
202  return TRUE;
203  }
204 
205  BOOLEAN redefine_from_algext=FALSE;
206  if ( currRing->idroot != NULL )
207  {
208  redefine_from_algext=(currRing->cf->extRing->qideal!=NULL);
209 // return TRUE;
210 #ifndef SING_NDEBUG
211  idhdl p = currRing->idroot;
212 
213  WarnS("no minpoly allowed if there are local objects belonging to the basering: ");
214 
215  while(p != NULL)
216  {
217  PrintS(p->String(TRUE)); Print("(%s)\n",IDID(p));
218  p = p->next;
219  }
220 #endif
221  }
222 
223 // assume (currRing->idroot==NULL);
224 
225  number p = (number)a->CopyD(NUMBER_CMD);
226  n_Normalize(p, currRing->cf);
227 
228  if (n_IsZero(p, currRing->cf))
229  {
230  n_Delete(&p, currRing->cf);
231  if( nCoeff_is_transExt(currRing->cf) )
232  {
233 #ifndef SING_NDEBUG
234  WarnS("minpoly is already 0...");
235 #endif
236  return FALSE;
237  }
238  WarnS("cannot set minpoly to 0 / alg. extension?");
239  return TRUE;
240  }
241 
242  // remove all object currently in the ring
243  while(currRing->idroot!=NULL)
244  {
245 #ifndef SING_NDEBUG
246  Warn("killing a local object due to minpoly change: %s", IDID(currRing->idroot));
247 #endif
248  killhdl2(currRing->idroot,&(currRing->idroot),currRing);
249  }
250 
251  AlgExtInfo A;
252 
253  A.r = rCopy(currRing->cf->extRing); // Copy ground field!
254  // if minpoly was already set:
255  if( currRing->cf->extRing->qideal != NULL ) id_Delete(&(A.r->qideal),A.r);
256  ideal q = idInit(1,1);
257  if ((p==NULL) ||(NUM((fraction)p)==NULL))
258  {
259  WerrorS("Could not construct the alg. extension: minpoly==0");
260  // cleanup A: TODO
261  rDelete( A.r );
262  return TRUE;
263  }
264  if (!redefine_from_algext && (DEN((fraction)(p)) != NULL)) // minpoly must be a fraction with poly numerator...!!
265  {
266  poly n=DEN((fraction)(p));
267  if(!p_IsConstantPoly(n,currRing->cf->extRing))
268  {
269  WarnS("denominator must be constant - ignoring it");
270  }
271  p_Delete(&n,currRing->cf->extRing);
272  DEN((fraction)(p))=NULL;
273  }
274 
275  if (redefine_from_algext) q->m[0]=(poly)p;
276  else q->m[0] = NUM((fraction)p);
277  A.r->qideal = q;
278 
279 #if 0
280  PrintS("\nTrying to conver the currRing into an algebraic field: ");
281  PrintS("Ground poly. ring: \n");
282  rWrite( A.r );
283  PrintS("\nGiven MinPOLY: ");
284  p_Write( A.i->m[0], A.r );
285 #endif
286 
287  // :(
288 // NUM((fractionObject *)p) = NULL; // makes 0/ NULL fraction - which should not happen!
289 // n_Delete(&p, currRing->cf); // doesn't expect 0/ NULL :(
290  if (!redefine_from_algext)
291  {
292  extern omBin fractionObjectBin;
293  NUM((fractionObject *)p) = NULL; // not necessary, but still...
295  }
296 
297  coeffs new_cf = nInitChar(n_algExt, &A);
298  if (new_cf==NULL)
299  {
300  WerrorS("Could not construct the alg. extension: llegal minpoly?");
301  // cleanup A: TODO
302  rDelete( A.r );
303  return TRUE;
304  }
305  else
306  {
307  nKillChar(currRing->cf); currRing->cf=new_cf;
308  }
309  return FALSE;
310 }
struct for passing initialization parameters to naInitChar
Definition: algext.h:37
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition: coeffs.h:36
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:349
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:465
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:924
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
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:932
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:407
#define IDID(a)
Definition: ipid.h:117
omBin_t * omBin
Definition: omStructs.h:12
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:204
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:857
static BOOLEAN p_IsConstantPoly(const poly p, const ring r)
Definition: p_polys.h:1937
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:227
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
#define A
Definition: sirandom.c:23
omBin fractionObjectBin
Definition: transext.cc:90

◆ jjMINPOLY_red()

static void jjMINPOLY_red ( idhdl  h)
static

Definition at line 132 of file ipassign.cc.

133 {
134  switch(IDTYP(h))
135  {
136  case NUMBER_CMD:
137  {
138  number n=(number)IDDATA(h);
139  number one = nInit(1);
140  number nn=nMult(n,one);
141  nDelete(&n);nDelete(&one);
142  IDDATA(h)=(char*)nn;
143  break;
144  }
145  case VECTOR_CMD:
146  case POLY_CMD:
147  {
148  poly p=(poly)IDDATA(h);
150  break;
151  }
152  case IDEAL_CMD:
153  case MODUL_CMD:
154  case MAP_CMD:
155  case MATRIX_CMD:
156  {
157  int i;
158  ideal I=(ideal)IDDATA(h);
159  for(i=IDELEMS(I)-1;i>=0;i--)
160  I->m[i]=p_MinPolyNormalize(I->m[i], currRing);
161  break;
162  }
163  case LIST_CMD:
164  {
165  lists L=(lists)IDDATA(h);
166  int i=L->nr;
167  for(;i>=0;i--)
168  {
169  jjMINPOLY_red((idhdl)&(L->m[i]));
170  }
171  }
172  default:
173  //case RESOLUTION_CMD:
174  Werror("type %d too complex...set minpoly before",IDTYP(h)); break;
175  }
176 }
static void jjMINPOLY_red(idhdl h)
Definition: ipassign.cc:132
poly p_MinPolyNormalize(poly p, const ring r)
Definition: maps.cc:324
#define nInit(i)
Definition: numbers.h:25
#define nMult(n1, n2)
Definition: numbers.h:18

◆ jjNOETHER()

static BOOLEAN jjNOETHER ( leftv  ,
leftv  a 
)
static

Definition at line 312 of file ipassign.cc.

313 {
314  poly p=(poly)a->CopyD(POLY_CMD);
315  pDelete(&(currRing->ppNoether));
316  (currRing->ppNoether)=p;
317  return FALSE;
318 }

◆ jjNormalizeQRingId()

void jjNormalizeQRingId ( leftv  I)

Definition at line 2140 of file ipassign.cc.

2141 {
2142  if ((currRing->qideal!=NULL) && (!hasFlag(I,FLAG_QRING)))
2143  {
2144  if (I->e==NULL)
2145  {
2146  ideal I0=(ideal)I->Data();
2147  switch (I->Typ())
2148  {
2149  case IDEAL_CMD:
2150  case MODUL_CMD:
2151  {
2152  ideal F=idInit(1,1);
2153  ideal II=kNF(F,currRing->qideal,I0);
2154  idDelete(&F);
2155  if (I->rtyp!=IDHDL)
2156  {
2157  idDelete((ideal*)&(I0));
2158  I->data=II;
2159  }
2160  else
2161  {
2162  idhdl h=(idhdl)I->data;
2163  idDelete((ideal*)&IDIDEAL(h));
2164  IDIDEAL(h)=II;
2165  setFlag(h,FLAG_QRING);
2166  }
2167  break;
2168  }
2169  default: break;
2170  }
2171  setFlag(I,FLAG_QRING);
2172  }
2173  }
2174 }
#define IDIDEAL(a)
Definition: ipid.h:128
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2813

◆ jjNormalizeQRingP()

void jjNormalizeQRingP ( poly &  p)

Definition at line 2175 of file ipassign.cc.

2176 {
2177  if((p!=NULL) && (currRing->qideal!=NULL))
2178  {
2179  ideal F=idInit(1,1);
2180  poly p2=kNF(F,currRing->qideal,p);
2181  pNormalize(p2);
2182  idDelete(&F);
2183  pDelete(&p);
2184  p=p2;
2185  }
2186 }

◆ jjPRINTLEVEL()

static BOOLEAN jjPRINTLEVEL ( leftv  ,
leftv  a 
)
static

Definition at line 59 of file ipassign.cc.

60 {
61  printlevel=(int)((long)(a->Data()));
62  return FALSE;
63 }
int printlevel
Definition: febase.cc:36

◆ jjRTIMER()

static BOOLEAN jjRTIMER ( leftv  ,
leftv  a 
)
static

Definition at line 76 of file ipassign.cc.

77 {
78  rtimerv=(int)((long)(a->Data()));
79  initRTimer();
80  return FALSE;
81 }
int rtimerv
Definition: timer.cc:148
void initRTimer()
Definition: timer.cc:158

◆ jjSHORTOUT()

static BOOLEAN jjSHORTOUT ( leftv  ,
leftv  a 
)
static

Definition at line 106 of file ipassign.cc.

107 {
108  if (currRing != NULL)
109  {
110  BOOLEAN shortOut = (BOOLEAN)((long)a->Data());
111 #if HAVE_CAN_SHORT_OUT
112  if (!shortOut)
113  currRing->ShortOut = 0;
114  else
115  {
116  if (currRing->CanShortOut)
117  currRing->ShortOut = 1;
118  }
119 #else
120  currRing->ShortOut = shortOut;
121  coeffs cf = currRing->cf;
122  while (nCoeff_is_Extension(cf))
123  {
124  cf->extRing->ShortOut = shortOut;
125  assume(cf->extRing != NULL);
126  cf = cf->extRing->cf;
127  }
128 #endif
129  }
130  return FALSE;
131 }
CanonicalForm cf
Definition: cfModGcd.cc:4024
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:860

◆ jjTIMER()

static BOOLEAN jjTIMER ( leftv  ,
leftv  a 
)
static

Definition at line 69 of file ipassign.cc.

70 {
71  timerv=(int)((long)(a->Data()));
72  initTimer();
73  return FALSE;
74 }
int initTimer()
Definition: timer.cc:69
int timerv
Definition: timer.cc:19

◆ jjTRACE()

static BOOLEAN jjTRACE ( leftv  ,
leftv  a 
)
static

Definition at line 101 of file ipassign.cc.

102 {
103  traceit=(int)((long)(a->Data()));
104  return FALSE;
105 }