My Project
Loading...
Searching...
No Matches
ipassign.cc File Reference
#include "kernel/mod2.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 "coeffs/longrat.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)
#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)
coeffs jjSetMinpoly (coeffs cf, number a)
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 ring jjCheck_FLAG_OTHER_RING (leftv res)
static BOOLEAN jiA_NUMBER (leftv res, leftv a, Subexpr)
static BOOLEAN jiA_BIGINT (leftv res, leftv a, Subexpr e)
static BOOLEAN jiA_BIGINT_N (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_INTVEC_BI (leftv res, leftv a, Subexpr)
static BOOLEAN jiA_BIGINTMAT (leftv res, leftv a, Subexpr)
static BOOLEAN jiA_BIGINTVEC_IV (leftv res, leftv a, Subexpr)
static BOOLEAN jiA_BUCKET (leftv res, leftv a, Subexpr e)
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_IDEAL_Mo (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, int rt, BOOLEAN toplevel, BOOLEAN is_qring=FALSE)
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_BIGINTVEC (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)
poly jj_NormalizeQRingP (poly p, const ring r)
BOOLEAN jjIMPORTFROM (leftv, leftv u, leftv v)

Macro Definition Documentation

◆ D

#define D ( A)
Value:
#define A
Definition sirandom.c:24

Definition at line 1325 of file ipassign.cc.

◆ IPASSIGN

#define IPASSIGN

Definition at line 1324 of file ipassign.cc.

◆ NULL_VAL

#define NULL_VAL   NULL

Definition at line 1326 of file ipassign.cc.

◆ TRANSEXT_PRIVATES

#define TRANSEXT_PRIVATES

Definition at line 11 of file ipassign.cc.

Function Documentation

◆ iiAssign()

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

Definition at line 2099 of file ipassign.cc.

2100{
2101 if (errorreported) return TRUE;
2102 int ll=l->listLength();
2103 int rl;
2104 int lt=l->Typ();
2105 int rt=NONE;
2106 int is_qring=FALSE;
2107 BOOLEAN b=FALSE;
2108 if (l->rtyp==ALIAS_CMD)
2109 {
2110 Werror("`%s` is read-only",l->Name());
2111 }
2112
2113 if (l->rtyp==IDHDL)
2114 {
2115 atKillAll((idhdl)l->data);
2116 is_qring=hasFlag((idhdl)l->data,FLAG_QRING_DEF);
2117 IDFLAG((idhdl)l->data)=0;
2118 l->attribute=NULL;
2119 toplevel=FALSE;
2120 }
2121 else if (l->attribute!=NULL)
2122 atKillAll((idhdl)l);
2123 if (ll==1)
2124 {
2125 /* l[..] = ... */
2126 if(l->e!=NULL)
2127 {
2128 BOOLEAN like_lists=0;
2129 blackbox *bb=NULL;
2130 int bt;
2131 if (((bt=l->rtyp)>MAX_TOK)
2132 || ((l->rtyp==IDHDL) && ((bt=IDTYP((idhdl)l->data))>MAX_TOK)))
2133 {
2134 bb=getBlackboxStuff(bt);
2135 like_lists=BB_LIKE_LIST(bb); // bb like a list
2136 }
2137 else if (((l->rtyp==IDHDL) && (IDTYP((idhdl)l->data)==LIST_CMD))
2138 || (l->rtyp==LIST_CMD))
2139 {
2140 like_lists=2; // bb in a list
2141 }
2142 if(like_lists)
2143 {
2144 if (traceit&TRACE_ASSIGN) PrintS("assign list[..]=...or similar\n");
2145 if (like_lists==1)
2146 {
2147 // check blackbox/newtype type:
2148 if(bb->blackbox_CheckAssign(bb,l,r)) return TRUE;
2149 }
2150 b=jiAssign_list(l,r);
2151 if((!b) && (like_lists==2))
2152 {
2153 //Print("jjA_L_LIST: - 2 \n");
2154 if((l->rtyp==IDHDL) && (l->data!=NULL))
2155 {
2156 ipMoveId((idhdl)l->data);
2157 l->attribute=IDATTR((idhdl)l->data);
2158 l->flag=IDFLAG((idhdl)l->data);
2159 }
2160 }
2161 r->CleanUp();
2162 Subexpr h;
2163 while (l->e!=NULL)
2164 {
2165 h=l->e->next;
2167 l->e=h;
2168 }
2169 return b;
2170 }
2171 }
2172 if (lt>MAX_TOK)
2173 {
2174 blackbox *bb=getBlackboxStuff(lt);
2175#ifdef BLACKBOX_DEVEL
2176 Print("bb-assign: bb=%lx\n",bb);
2177#endif
2178 return (bb==NULL) || bb->blackbox_Assign(l,r);
2179 }
2180 // end of handling elems of list and similar
2181 rl=r->listLength();
2182 if (rl==1)
2183 {
2184 /* system variables = ... */
2185 if(((l->rtyp>=VECHO)&&(l->rtyp<=VPRINTLEVEL))
2186 ||((l->rtyp>=VALTVARS)&&(l->rtyp<=VMINPOLY)))
2187 {
2188 b=iiAssign_sys(l,r);
2189 r->CleanUp();
2190 //l->CleanUp();
2191 return b;
2192 }
2193 rt=r->Typ();
2194 /* a = ... */
2195 if ((lt!=MATRIX_CMD)
2196 &&(lt!=BIGINTMAT_CMD)
2197 &&(lt!=BIGINTVEC_CMD)
2198 &&(lt!=CMATRIX_CMD)
2199 &&(lt!=INTMAT_CMD)
2200 &&((lt==rt)||(lt!=LIST_CMD)))
2201 {
2202 b=jiAssign_1(l,r,rt,toplevel,is_qring);
2203 if (l->rtyp==IDHDL)
2204 {
2205 if ((lt==DEF_CMD)||(lt==LIST_CMD))
2206 {
2207 ipMoveId((idhdl)l->data);
2208 }
2209 l->attribute=IDATTR((idhdl)l->data);
2210 l->flag=IDFLAG((idhdl)l->data);
2211 l->CleanUp();
2212 }
2213 r->CleanUp();
2214 return b;
2215 }
2216 if (((lt!=LIST_CMD)
2217 &&((rt==MATRIX_CMD)
2218 ||(rt==BIGINTMAT_CMD)
2219 ||(rt==BIGINTVEC_CMD)
2220 ||(rt==CMATRIX_CMD)
2221 ||(rt==INTMAT_CMD)
2222 ||(rt==INTVEC_CMD)
2223 ||(rt==MODUL_CMD)))
2224 ||((lt==LIST_CMD)
2225 &&(rt==RESOLUTION_CMD))
2226 )
2227 {
2228 b=jiAssign_1(l,r,rt,toplevel);
2229 if((l->rtyp==IDHDL)&&(l->data!=NULL))
2230 {
2231 if ((lt==DEF_CMD) || (lt==LIST_CMD))
2232 {
2233 //Print("ipAssign - 3.0\n");
2234 ipMoveId((idhdl)l->data);
2235 }
2236 l->attribute=IDATTR((idhdl)l->data);
2237 l->flag=IDFLAG((idhdl)l->data);
2238 }
2239 r->CleanUp();
2240 Subexpr h;
2241 while (l->e!=NULL)
2242 {
2243 h=l->e->next;
2245 l->e=h;
2246 }
2247 return b;
2248 }
2249 }
2250 if (rt==NONE) rt=r->Typ();
2251 }
2252 else if (ll==(rl=r->listLength()))
2253 {
2254 b=jiAssign_rec(l,r);
2255 return b;
2256 }
2257 else
2258 {
2259 if (rt==NONE) rt=r->Typ();
2260 if (rt==INTVEC_CMD)
2261 return jiA_INTVEC_L(l,r);
2262 else if (rt==VECTOR_CMD)
2263 return jiA_VECTOR_L(l,r);
2264 else if ((rt==IDEAL_CMD)||(rt==MATRIX_CMD))
2265 return jiA_MATRIX_L(l,r);
2266 else if ((rt==STRING_CMD)&&(rl==1))
2267 return jiA_STRING_L(l,r);
2268 Werror("length of lists in assignment does not match (l:%d,r:%d)",
2269 ll,rl);
2270 return TRUE;
2271 }
2272
2273 leftv hh=r;
2274 BOOLEAN map_assign=FALSE;
2275 switch (lt)
2276 {
2277 case INTVEC_CMD:
2279 break;
2280 case INTMAT_CMD:
2281 {
2282 b=jjA_L_INTVEC(l,r,new intvec(IDINTVEC((idhdl)l->data)));
2283 break;
2284 }
2285 case BIGINTVEC_CMD:
2286 {
2287 b=jjA_L_BIGINTVEC(l, r, new bigintmat(IDBIMAT((idhdl)l->data)));
2288 break;
2289 }
2290 case BIGINTMAT_CMD:
2291 {
2292 b=jjA_L_BIGINTMAT(l, r, new bigintmat(IDBIMAT((idhdl)l->data)));
2293 break;
2294 }
2295 case MAP_CMD:
2296 {
2297 // first element in the list sl (r) must be a ring
2298 if ((rt == RING_CMD)&&(r->e==NULL))
2299 {
2300 omFreeBinAddr((ADDRESS)IDMAP((idhdl)l->data)->preimage);
2301 IDMAP((idhdl)l->data)->preimage = omStrDup (r->Fullname());
2302 /* advance the expressionlist to get the next element after the ring */
2303 hh = r->next;
2304 }
2305 else
2306 {
2307 WerrorS("expected ring-name");
2308 b=TRUE;
2309 break;
2310 }
2311 if (hh==NULL) /* map-assign: map f=r; */
2312 {
2313 WerrorS("expected image ideal");
2314 b=TRUE;
2315 break;
2316 }
2317 if ((hh->next==NULL)&&(hh->Typ()==IDEAL_CMD))
2318 {
2319 b=jiAssign_1(l,hh,IDEAL_CMD,toplevel); /* map-assign: map f=r,i; */
2321 return b;
2322 }
2323 //no break, handle the rest like an ideal:
2324 map_assign=TRUE; // and continue
2325 }
2326 case MATRIX_CMD:
2327 case IDEAL_CMD:
2328 case MODUL_CMD:
2329 {
2330 sleftv t;
2331 matrix olm = (matrix)l->Data();
2332 long rk;
2333 char *pr=((map)olm)->preimage;
2334 BOOLEAN module_assign=(/*l->Typ()*/ lt==MODUL_CMD);
2335 matrix lm ;
2336 long num;
2337 int j,k;
2338 int i=0;
2339 int mtyp=MATRIX_CMD; /*Type of left side object*/
2340 int etyp=POLY_CMD; /*Type of elements of left side object*/
2341
2342 if (lt /*l->Typ()*/==MATRIX_CMD)
2343 {
2344 rk=olm->rows();
2345 num=olm->cols()*rk /*olm->rows()*/;
2346 lm=mpNew(olm->rows(),olm->cols());
2347 int el;
2348 if ((traceit&TRACE_ASSIGN) && (num!=(el=exprlist_length(hh))))
2349 {
2350 Warn("expression list length(%d) does not match matrix size(%d)",el,num);
2351 }
2352 }
2353 else /* IDEAL_CMD or MODUL_CMD */
2354 {
2355 num=exprlist_length(hh);
2356 lm=(matrix)idInit(num,1);
2357 if (module_assign)
2358 {
2359 rk=0;
2360 mtyp=MODUL_CMD;
2361 etyp=VECTOR_CMD;
2362 }
2363 else
2364 rk=1;
2365 }
2366
2367 int ht;
2368 loop
2369 {
2370 if (hh==NULL)
2371 break;
2372 else
2373 {
2374 matrix rm;
2375 ht=hh->Typ();
2376 if ((j=iiTestConvert(ht,etyp))!=0)
2377 {
2378 b=iiConvert(ht,etyp,j,hh,&t);
2379 hh->next=t.next;
2380 if (b)
2381 { Werror("can not convert %s(%s) -> %s",Tok2Cmdname(ht),hh->Name(),Tok2Cmdname(etyp));
2382 break;
2383 }
2384 lm->m[i]=(poly)t.CopyD(etyp);
2385 pNormalize(lm->m[i]);
2386 if (module_assign) rk=si_max(rk,pMaxComp(lm->m[i]));
2387 i++;
2388 }
2389 else
2390 if ((j=iiTestConvert(ht,mtyp))!=0)
2391 {
2392 b=iiConvert(ht,mtyp,j,hh,&t);
2393 hh->next=t.next;
2394 if (b)
2395 { Werror("can not convert %s(%s) -> %s",Tok2Cmdname(ht),hh->Name(),Tok2Cmdname(mtyp));
2396 break;
2397 }
2398 rm = (matrix)t.CopyD(mtyp);
2399 if (module_assign)
2400 {
2401 j = si_min((int)num,rm->cols());
2402 rk=si_max(rk,rm->rank);
2403 }
2404 else
2405 j = si_min(num-i,(long)rm->rows() * (long)rm->cols());
2406 for(k=0;k<j;k++,i++)
2407 {
2408 lm->m[i]=rm->m[k];
2409 pNormalize(lm->m[i]);
2410 rm->m[k]=NULL;
2411 }
2412 idDelete((ideal *)&rm);
2413 }
2414 else
2415 {
2416 b=TRUE;
2417 Werror("can not convert %s(%s) -> %s",Tok2Cmdname(ht),hh->Name(),Tok2Cmdname(mtyp));
2418 break;
2419 }
2420 t.next=NULL;t.CleanUp();
2421 if (i==num) break;
2422 hh=hh->next;
2423 }
2424 }
2425 if (b)
2426 idDelete((ideal *)&lm);
2427 else
2428 {
2429 idDelete((ideal *)&olm);
2430 if (module_assign) lm->rank=rk;
2431 else if (map_assign) ((map)lm)->preimage=pr;
2432 l=l->LData();
2433 if (l->rtyp==IDHDL)
2434 IDMATRIX((idhdl)l->data)=lm;
2435 else
2436 l->data=(char *)lm;
2437 }
2438 break;
2439 }
2440 case STRING_CMD:
2441 b=jjA_L_STRING(l,r);
2442 break;
2443 //case DEF_CMD:
2444 case LIST_CMD:
2445 b=jjA_L_LIST(l,r);
2446 break;
2447 case NONE:
2448 case 0:
2449 Werror("cannot assign to %s",l->Fullname());
2450 b=TRUE;
2451 break;
2452 default:
2453 WerrorS("assign not impl.");
2454 b=TRUE;
2455 break;
2456 } /* end switch: typ */
2457 if (b && (!errorreported)) WerrorS("incompatible type in list assignment");
2458 r->CleanUp();
2459 return b;
2460}
#define atKillAll(H)
Definition attrib.h:47
static int si_max(const int a, const int b)
Definition auxiliary.h:125
int BOOLEAN
Definition auxiliary.h:88
#define TRUE
Definition auxiliary.h:101
#define FALSE
Definition auxiliary.h:97
void * ADDRESS
Definition auxiliary.h:120
static int si_min(const int a, const int b)
Definition auxiliary.h:126
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition blackbox.cc:17
#define BB_LIKE_LIST(B)
Definition blackbox.h:53
CanonicalForm num(const CanonicalForm &f)
int l
Definition cfEzgcd.cc:100
int i
Definition cfEzgcd.cc:132
int k
Definition cfEzgcd.cc:99
CanonicalForm b
Definition cfModGcd.cc:4111
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Matrices of numbers.
Definition bigintmat.h:51
long rank
Definition matpol.h:19
poly * m
Definition matpol.h:18
int & cols()
Definition matpol.h:24
int & rows()
Definition matpol.h:23
Class used for (list of) interpreter objects.
Definition subexpr.h:83
void * CopyD(int t)
Definition subexpr.cc:714
int Typ()
Definition subexpr.cc:1048
leftv next
Definition subexpr.h:86
const char * Name()
Definition subexpr.h:120
int listLength()
Definition subexpr.cc:51
void CleanUp(ring r=currRing)
Definition subexpr.cc:351
const char * Fullname()
Definition subexpr.h:125
Subexpr e
Definition subexpr.h:105
#define Print
Definition emacs.cc:80
#define Warn
Definition emacs.cc:77
int j
Definition facHensel.cc:110
VAR short errorreported
Definition feFopen.cc:23
void WerrorS(const char *s)
Definition feFopen.cc:24
int iiTestConvert(int inputType, int outputType)
Definition gentable.cc:298
const char * Tok2Cmdname(int tok)
Definition gentable.cc:137
@ IDEAL_CMD
Definition grammar.cc:285
@ VALTVARS
Definition grammar.cc:306
@ MATRIX_CMD
Definition grammar.cc:287
@ BIGINTMAT_CMD
Definition grammar.cc:278
@ MAP_CMD
Definition grammar.cc:286
@ INTMAT_CMD
Definition grammar.cc:280
@ MODUL_CMD
Definition grammar.cc:288
@ VECTOR_CMD
Definition grammar.cc:293
@ RESOLUTION_CMD
Definition grammar.cc:291
@ BIGINTVEC_CMD
Definition grammar.cc:279
@ POLY_CMD
Definition grammar.cc:290
@ VMINPOLY
Definition grammar.cc:310
@ RING_CMD
Definition grammar.cc:282
#define idDelete(H)
delete an ideal
Definition ideals.h:29
static BOOLEAN jjA_L_BIGINTVEC(leftv l, leftv r, bigintmat *bim)
Definition ipassign.cc:1819
static BOOLEAN jiA_MATRIX_L(leftv l, leftv r)
Definition ipassign.cc:1892
static BOOLEAN jiA_VECTOR_L(leftv l, leftv r)
Definition ipassign.cc:1615
static BOOLEAN iiAssign_sys(leftv l, leftv r)
Definition ipassign.cc:1515
static BOOLEAN jiAssign_rec(leftv l, leftv r)
Definition ipassign.cc:2076
static BOOLEAN jiAssign_1(leftv l, leftv r, int rt, BOOLEAN toplevel, BOOLEAN is_qring=FALSE)
Definition ipassign.cc:1332
static BOOLEAN jjA_L_LIST(leftv l, leftv r)
Definition ipassign.cc:1656
static BOOLEAN jiA_STRING_L(leftv l, leftv r)
Definition ipassign.cc:1968
static BOOLEAN jjA_L_BIGINTMAT(leftv l, leftv r, bigintmat *bim)
Definition ipassign.cc:1770
static BOOLEAN jiAssign_list(leftv l, leftv r)
Definition ipassign.cc:2004
static BOOLEAN jjA_L_STRING(leftv l, leftv r)
Definition ipassign.cc:1858
static BOOLEAN jiA_INTVEC_L(leftv l, leftv r)
Definition ipassign.cc:1589
static BOOLEAN jjA_L_INTVEC(leftv l, leftv r, intvec *iv)
Definition ipassign.cc:1721
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition ipconv.cc:450
void ipMoveId(idhdl tomove)
Definition ipid.cc:681
#define IDMAP(a)
Definition ipid.h:135
#define IDMATRIX(a)
Definition ipid.h:134
EXTERN_VAR omBin sleftv_bin
Definition ipid.h:145
#define hasFlag(A, F)
Definition ipid.h:112
#define IDINTVEC(a)
Definition ipid.h:128
#define IDBIMAT(a)
Definition ipid.h:129
#define IDFLAG(a)
Definition ipid.h:120
#define FLAG_QRING_DEF
Definition ipid.h:109
#define IDTYP(a)
Definition ipid.h:119
#define IDATTR(a)
Definition ipid.h:123
int exprlist_length(leftv v)
Definition ipshell.cc:551
STATIC_VAR Poly * h
Definition janet.cc:971
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition matpol.cc:37
ip_smatrix * matrix
Definition matpol.h:43
#define omStrDup(s)
#define omFreeBin(addr, bin)
#define omFreeBinAddr(addr)
#define NULL
Definition omList.c:12
#define pMaxComp(p)
Definition polys.h:300
#define pNormalize(p)
Definition polys.h:318
void PrintS(const char *s)
Definition reporter.cc:288
void Werror(const char *fmt,...)
Definition reporter.cc:189
EXTERN_VAR int traceit
Definition reporter.h:24
#define TRACE_ASSIGN
Definition reporter.h:46
idrec * idhdl
Definition ring.h:22
ideal idInit(int idsize, int rank)
initialise an ideal / module
sleftv * leftv
Definition structs.h:53
#define loop
Definition structs.h:71
VAR omBin sSubexpr_bin
Definition subexpr.cc:40
#define IDHDL
Definition tok.h:31
@ ALIAS_CMD
Definition tok.h:34
@ LIST_CMD
Definition tok.h:118
@ VPRINTLEVEL
Definition tok.h:217
@ INTVEC_CMD
Definition tok.h:101
@ CMATRIX_CMD
Definition tok.h:46
@ DEF_CMD
Definition tok.h:58
@ VECHO
Definition tok.h:210
@ STRING_CMD
Definition tok.h:187
@ MAX_TOK
Definition tok.h:220
#define NONE
Definition tok.h:223

◆ iiAssign_sys()

BOOLEAN iiAssign_sys ( leftv l,
leftv r )
static

Definition at line 1515 of file ipassign.cc.

1516{
1517 int rt=r->Typ();
1518
1519 if (rt==0)
1520 {
1521 if (!errorreported) Werror("`%s` is undefined",r->Fullname());
1522 return TRUE;
1523 }
1524 int i=0;
1525 int lt=l->rtyp;
1526 while (((dAssign_sys[i].res!=lt)
1527 || (dAssign_sys[i].arg!=rt))
1528 && (dAssign_sys[i].res!=0)) i++;
1529 if (dAssign_sys[i].res!=0)
1530 {
1531 if (!dAssign_sys[i].p(l,r))
1532 {
1533 // everything ok, clean up
1534 return FALSE;
1535 }
1536 }
1537 // implicite type conversion ----------------------------------------------
1538 if (dAssign_sys[i].res==0)
1539 {
1540 int ri;
1542 BOOLEAN failed=FALSE;
1543 i=0;
1544 while ((dAssign_sys[i].res!=lt)
1545 && (dAssign_sys[i].res!=0)) i++;
1546 while (dAssign_sys[i].res==lt)
1547 {
1548 if ((ri=iiTestConvert(rt,dAssign_sys[i].arg))!=0)
1549 {
1550 failed= ((iiConvert(rt,dAssign_sys[i].arg,ri,r,rn))
1551 || (dAssign_sys[i].p(l,rn)));
1552 // everything done, clean up temp. variables
1553 rn->CleanUp();
1555 if (failed)
1556 {
1557 // leave loop, goto error handling
1558 break;
1559 }
1560 else
1561 {
1562 // everything ok, return
1563 return FALSE;
1564 }
1565 }
1566 i++;
1567 }
1568 // error handling ---------------------------------------------------
1569 if(!errorreported)
1570 {
1571 Werror("`%s` = `%s` is not supported"
1572 ,Tok2Cmdname(lt),Tok2Cmdname(rt));
1573 if (BVERBOSE(V_SHOW_USE))
1574 {
1575 i=0;
1576 while ((dAssign_sys[i].res!=lt)
1577 && (dAssign_sys[i].res!=0)) i++;
1578 while (dAssign_sys[i].res==lt)
1579 {
1580 Werror("expected `%s` = `%s`"
1582 i++;
1583 }
1584 }
1585 }
1586 }
1587 return TRUE;
1588}
int p
Definition cfModGcd.cc:4086
CanonicalForm res
Definition facAbsFact.cc:60
#define omAlloc0Bin(bin)
#define BVERBOSE(a)
Definition options.h:35
#define V_SHOW_USE
Definition options.h:52
const struct sValAssign_sys dAssign_sys[]
Definition table.h:1472

◆ jiA_1x1INTMAT()

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

Definition at line 861 of file ipassign.cc.

862{
863 if (/*(*/ res->rtyp!=INTMAT_CMD /*)*/) /*|| (e!=NULL) - TRUE because of type int */
864 {
865 // no error message: assignment simply fails
866 return TRUE;
867 }
868 intvec* am=(intvec*)a->CopyD(INTMAT_CMD);
869 if ((am->rows()!=1) || (am->cols()!=1))
870 {
871 WerrorS("must be 1x1 intmat");
872 delete am;
873 return TRUE;
874 }
875 intvec* m=(intvec *)res->data;
876 // indices are correct (see ipExprArith3(..,'['..) )
877 int i=e->start;
878 int j=e->next->start;
879 IMATELEM(*m,i,j)=IMATELEM(*am,1,1);
880 delete am;
881 return FALSE;
882}
int m
Definition cfEzgcd.cc:128
int cols() const
Definition intvec.h:96
int rows() const
Definition intvec.h:97
#define IMATELEM(M, I, J)
Definition intvec.h:86

◆ jiA_1x1MATRIX()

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

Definition at line 883 of file ipassign.cc.

884{
885 if (/*(*/ res->rtyp!=MATRIX_CMD /*)*/) /*|| (e!=NULL) - TRUE because of type poly */
886 {
887 // no error message: assignment simply fails
888 return TRUE;
889 }
891 if (errorreported) return TRUE;
892 if ((MATROWS(am)!=1) || (MATCOLS(am)!=1))
893 {
894 WerrorS("must be 1x1 matrix");
895 idDelete((ideal *)&am);
896 return TRUE;
897 }
898 matrix m=(matrix)res->data;
899 // indices are correct (see ipExprArith3(..,'['..) )
900 int i=e->start;
901 int j=e->next->start;
902 pDelete(&MATELEM(m,i,j));
903 pNormalize(MATELEM(am,1,1));
904 MATELEM(m,i,j)=MATELEM(am,1,1);
905 MATELEM(am,1,1)=NULL;
906 idDelete((ideal *)&am);
907 return FALSE;
908}
#define MATELEM(mat, i, j)
1-based access to matrix
Definition matpol.h:29
#define MATROWS(i)
Definition matpol.h:26
#define MATCOLS(i)
Definition matpol.h:27
#define pDelete(p_ptr)
Definition polys.h:187

◆ jiA_BIGINT()

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

Definition at line 667 of file ipassign.cc.

668{
669 number p=(number)a->CopyD(BIGINT_CMD);
670 if (e==NULL)
671 {
672 if (res->data!=NULL) n_Delete((number *)&res->data,coeffs_BIGINT);
673 res->data=(void *)p;
674 }
675 else
676 {
677 int i=e->start-1;
678 if (i<0)
679 {
680 Werror("index[%d] must be positive",i+1);
681 return TRUE;
682 }
683 bigintmat *iv=(bigintmat *)res->data;
684 if ((e->next==NULL)&&(res->rtyp==BIGINTMAT_CMD))
685 {
686 WerrorS("only one index given");
687 return TRUE;
688 }
689 else
690 {
691 int c;
692 if (res->rtyp==BIGINTMAT_CMD) c=e->next->start;
693 else { c=i+1; i=0;}
694 if ((i>=iv->rows())||(c<1)||(c>iv->cols()))
695 {
696 Werror("wrong range [%d,%d] in bigintmat/bigintvec %s(%d,%d)",i+1,c,res->Name(),iv->rows(),iv->cols());
697 return TRUE;
698 }
699 else
700 {
701 n_Delete((number *)&BIMATELEM(*iv,i+1,c),iv->basecoeffs());
702 BIMATELEM(*iv,i+1,c) = p;
703 }
704 }
705 }
706 jiAssignAttr(res,a);
707 return FALSE;
708}
#define BIMATELEM(M, I, J)
Definition bigintmat.h:133
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:461
static void jiAssignAttr(leftv l, leftv r)
Definition ipassign.cc:386
VAR coeffs coeffs_BIGINT
Definition polys.cc:14
@ BIGINT_CMD
Definition tok.h:38

◆ jiA_BIGINT_N()

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

Definition at line 709 of file ipassign.cc.

710{
711 number p=(number)a->Data();
712 number pp=NULL;
713 if (currRing->cf->rep==n_rep_gap_rat)
714 {
715 if (SR_HDL(a) & SR_INT) pp=p;
716 else if (p->s==3) pp=nCopy(p);
717 else
718 {
719 WerrorS("cannot assign to bigint");
720 return TRUE;
721 }
722 }
723 else if (currRing->cf->rep==n_rep_gmp)
724 pp=coeffs_BIGINT->cfInitMPZ((mpz_ptr)p,coeffs_BIGINT);
725 else if (currRing->cf->rep==n_rep_int)
726 pp=coeffs_BIGINT->cfInit((long)p,coeffs_BIGINT);
727 else
728 {
729 WerrorS("cannot assign to bigint");
730 return TRUE;
731 }
732 if (e==NULL)
733 {
734 if (res->data!=NULL) n_Delete((number *)&res->data,coeffs_BIGINT);
735 res->data=(void*)pp;
736 }
737 else
738 {
739 int i=e->start-1;
740 if (i<0)
741 {
742 Werror("index[%d] must be positive",i+1);
743 return TRUE;
744 }
745 bigintmat *iv=(bigintmat *)res->data;
746 if ((e->next==NULL)&&(res->rtyp==BIGINTMAT_CMD))
747 {
748 WerrorS("only one index given");
749 return TRUE;
750 }
751 else
752 {
753 int c;
754 if (res->rtyp==BIGINTMAT_CMD) c=e->next->start;
755 else { c=i+1; i=0;}
756 if ((i>=iv->rows())||(c<1)||(c>iv->cols()))
757 {
758 Werror("wrong range [%d,%d] in bigintmat/bigintvec %s(%d,%d)",i+1,c,res->Name(),iv->rows(),iv->cols());
759 return TRUE;
760 }
761 else
762 {
763 n_Delete((number *)&BIMATELEM(*iv,i+1,c),iv->basecoeffs());
764 BIMATELEM(*iv,i+1,c) = pp;
765 }
766 }
767 }
768 jiAssignAttr(res,a);
769 return FALSE;
770}
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f ).
Definition cf_gcd.cc:676
void * Data()
Definition subexpr.cc:1192
@ n_rep_gap_rat
(number), see longrat.h
Definition coeffs.h:118
@ n_rep_int
(int), see modulop.h
Definition coeffs.h:117
@ n_rep_gmp
(mpz_ptr), see rmodulon,h
Definition coeffs.h:122
#define SR_INT
Definition longrat.h:67
#define nCopy(n)
Definition numbers.h:15
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
#define SR_HDL(A)
Definition tgb.cc:35

◆ jiA_BIGINTMAT()

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

Definition at line 986 of file ipassign.cc.

987{
988 if (res->data!=NULL) delete ((bigintmat *)res->data);
989 res->data=(void *)a->CopyD();
990 jiAssignAttr(res,a);
991 return FALSE;
992}

◆ jiA_BIGINTVEC_IV()

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

Definition at line 993 of file ipassign.cc.

994{
995 if (res->data!=NULL) delete ((bigintmat *)res->data);
996 intvec *aa=(intvec*)a->Data();
997 int l=aa->rows();
999 for(int i=0;i<l;i++)
1000 {
1001 number tp = n_Init((*aa)[i], coeffs_BIGINT);
1002 n_Delete(&BIMATELEM((*bim),1,i+1), coeffs_BIGINT);
1003 BIMATELEM((*bim),1,i+1)=tp;
1004 }
1005 res->data=(void*)bim;
1006 jiAssignAttr(res,a);
1007 return FALSE;
1008}
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:541

◆ jiA_BUCKET()

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

Definition at line 1009 of file ipassign.cc.

1011{
1013 if (errorreported) return TRUE;
1014 poly p; int l;
1016 sleftv tmp;
1017 tmp.Init();
1018 tmp.rtyp=POLY_CMD;
1019 tmp.data=p;
1020 return jiA_POLY(res,&tmp,e);
1021}
int rtyp
Definition subexpr.h:91
void Init()
Definition subexpr.h:107
void * data
Definition subexpr.h:88
static BOOLEAN jiA_POLY(leftv res, leftv a, Subexpr e)
Definition ipassign.cc:792
sBucket * sBucket_pt
Definition sbuckets.h:16
void sBucketDestroyAdd(sBucket_pt bucket, poly *p, int *length)
Definition sbuckets.h:68

◆ jiA_CRING()

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

Definition at line 1312 of file ipassign.cc.

1313{
1314 coeffs r=(coeffs)a->Data();
1315 if (errorreported) return TRUE;
1316 if (r==NULL) return TRUE;
1317 if (res->data!=NULL) nKillChar((coeffs)res->data);
1318 res->data=(void *)a->CopyD(CRING_CMD);
1319 jiAssignAttr(res,a);
1320 return FALSE;
1321}
void nKillChar(coeffs r)
undo all initialisations
Definition numbers.cc:563
The main handler for Singular numbers which are suitable for Singular polynomials.
@ CRING_CMD
Definition tok.h:56

◆ jiA_DEF()

BOOLEAN jiA_DEF ( leftv res,
leftv ,
Subexpr  )
static

Definition at line 1307 of file ipassign.cc.

1308{
1309 res->data=(void *)0;
1310 return FALSE;
1311}

◆ jiA_IDEAL()

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

Definition at line 1022 of file ipassign.cc.

1023{
1024 ideal I=(ideal)a->CopyD(MATRIX_CMD);
1025 if (errorreported) return TRUE;
1026 if (res->data!=NULL) idDelete((ideal*)&res->data);
1027 res->data=(void*)I;
1028 if (a->rtyp!=IDHDL) id_Normalize(I, currRing);
1029 jiAssignAttr(res,a);
1030 if (((res->rtyp==IDEAL_CMD)||(res->rtyp==MODUL_CMD))
1031 && (IDELEMS(I/*(ideal)(res->data)*/)==1)
1032 && (currRing->qideal==NULL)
1033 && (!rIsPluralRing(currRing))
1034 )
1035 {
1037 }
1038 if (TEST_V_QRING && (currRing->qideal!=NULL))
1039 {
1041 else jjNormalizeQRingId(res);
1042 }
1043 return FALSE;
1044}
void jjNormalizeQRingId(leftv I)
Definition ipassign.cc:2461
#define setFlag(A, F)
Definition ipid.h:113
#define FLAG_QRING
Definition ipid.h:108
#define FLAG_STD
Definition ipid.h:106
#define TEST_V_QRING
Definition options.h:133
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406
void id_Normalize(ideal I, const ring r)
normialize all polys in id
#define IDELEMS(i)

◆ jiA_IDEAL_M()

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

Definition at line 1074 of file ipassign.cc.

1075{
1077 if (errorreported) return TRUE;
1078 if (TEST_V_ALLWARN)
1079 if (MATROWS(m)>1)
1080 Warn("assign matrix with %d rows to an ideal in >>%s<<",MATROWS(m),my_yylinebuf);
1081 IDELEMS((ideal)m)=MATROWS(m)*MATCOLS(m);
1082 ((ideal)m)->rank=1;
1083 MATROWS(m)=1;
1084 if (a->rtyp!=IDHDL) id_Normalize((ideal)m, currRing);
1085 if (res->data!=NULL) idDelete((ideal*)&res->data);
1086 res->data=(void *)m;
1087 if (TEST_V_QRING && (currRing->qideal!=NULL))
1088 {
1090 else jjNormalizeQRingId(res);
1091 }
1092 return FALSE;
1093}
VAR char my_yylinebuf[80]
Definition febase.cc:44
#define TEST_V_ALLWARN
Definition options.h:145

◆ jiA_IDEAL_Mo()

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

Definition at line 1094 of file ipassign.cc.

1095{
1096 ideal m=(ideal)a->CopyD(MODUL_CMD);
1097 if (errorreported) return TRUE;
1098 if (m->rank>1)
1099 {
1100 Werror("rank of module is %ld in assignment to ideal",m->rank);
1101 return TRUE;
1102 }
1103 if (res->data!=NULL) idDelete((ideal*)&res->data);
1104 if (a->rtyp!=IDHDL) id_Normalize(m, currRing);
1105 id_Shift(m,-1,currRing);
1106 m->rank=1;
1107 res->data=(void *)m;
1108 if (TEST_V_QRING && (currRing->qideal!=NULL))
1109 {
1111 else jjNormalizeQRingId(res);
1112 }
1113 return FALSE;
1114}
void id_Shift(ideal M, int s, const ring r)

◆ jiA_INT()

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

Definition at line 419 of file ipassign.cc.

420{
421 if (e==NULL)
422 {
423 res->data=(void *)a->Data();
424 jiAssignAttr(res,a);
425 }
426 else
427 {
428 int i=e->start-1;
429 if (i<0)
430 {
431 Werror("index[%d] must be positive",i+1);
432 return TRUE;
433 }
434 intvec *iv=(intvec *)res->data;
435 if (e->next==NULL)
436 {
437 if (i>=iv->length())
438 {
439 intvec *iv1=new intvec(i+1);
440 (*iv1)[i]=(int)((long)(a->Data()));
441 intvec *ivn=ivAdd(iv,iv1);
442 delete iv;
443 delete iv1;
444 res->data=(void *)ivn;
445 }
446 else
447 (*iv)[i]=(int)((long)(a->Data()));
448 }
449 else
450 {
451 int c=e->next->start;
452 if ((i>=iv->rows())||(c<1)||(c>iv->cols()))
453 {
454 Werror("wrong range [%d,%d] in intmat %s(%d,%d)",i+1,c,res->Name(),iv->rows(),iv->cols());
455 return TRUE;
456 }
457 else
458 IMATELEM(*iv,i+1,c) = (int)((long)(a->Data()));
459 }
460 }
461 return FALSE;
462}
intvec * ivAdd(intvec *a, intvec *b)
Definition intvec.cc:249

◆ jiA_INTVEC()

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

Definition at line 949 of file ipassign.cc.

950{
951 //if ((res->data==NULL) || (res->Typ()==a->Typ()))
952 {
953 if (res->data!=NULL) delete ((intvec *)res->data);
954 res->data=(void *)a->CopyD(INTVEC_CMD);
955 jiAssignAttr(res,a);
956 return FALSE;
957 }
958#if 0
959 else
960 {
961 intvec *r=(intvec *)(res->data);
962 intvec *s=(intvec *)(a->Data());
963 int i=si_min(r->length(), s->length())-1;
964 for(;i>=0;i--)
965 {
966 (*r)[i]=(*s)[i];
967 }
968 return FALSE; //(r->length()< s->length());
969 }
970#endif
971}
int length() const
Definition intvec.h:95
const CanonicalForm int s
Definition facAbsFact.cc:51

◆ jiA_INTVEC_BI()

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

Definition at line 972 of file ipassign.cc.

973{
974 //Warn("bigintvec -> intvec in >>%s<<",my_yylinebuf);
975 if (res->data!=NULL) delete ((intvec *)res->data);
976 bigintmat *b=(bigintmat*)a->Data();
977 intvec *iv=new intvec(1,b->cols());
978 for(int i=0;i<b->cols();i++)
979 {
980 (*iv)[i]=n_Int(BIMATELEM(*b,1,i+1),coeffs_BIGINT);
981 }
982 res->data=(void *)iv;
983 jiAssignAttr(res,a);
984 return FALSE;
985}
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
Definition coeffs.h:550

◆ jiA_INTVEC_L()

BOOLEAN jiA_INTVEC_L ( leftv l,
leftv r )
static

Definition at line 1589 of file ipassign.cc.

1590{
1591 /* right side is intvec, left side is list (of int)*/
1592 BOOLEAN nok;
1593 int i=0;
1594 leftv l1=l;
1595 leftv h;
1596 sleftv t;
1597 intvec *iv=(intvec *)r->Data();
1598 memset(&t,0,sizeof(sleftv));
1599 t.rtyp=INT_CMD;
1600 while ((i<iv->length())&&(l!=NULL))
1601 {
1602 t.data=(char *)(long)(*iv)[i];
1603 h=l->next;
1604 l->next=NULL;
1605 nok=jiAssign_1(l,&t,INT_CMD,TRUE);
1606 l->next=h;
1607 if (nok) return TRUE;
1608 i++;
1609 l=h;
1610 }
1611 l1->CleanUp();
1612 r->CleanUp();
1613 return FALSE;
1614}
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257
@ INT_CMD
Definition tok.h:96

◆ jiA_LINK()

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

Definition at line 1115 of file ipassign.cc.

1116{
1117 si_link l=(si_link)res->data;
1118
1119 if (l!=NULL) slCleanUp(l);
1120
1121 if (a->Typ() == STRING_CMD)
1122 {
1123 if (l == NULL)
1124 {
1126 res->data = (void *) l;
1127 }
1128 return slInit(l, (char *) a->Data());
1129 }
1130 else if (a->Typ() == LINK_CMD)
1131 {
1132 if (l != NULL) omFreeBin(l, sip_link_bin);
1133 res->data = slCopy((si_link)a->Data());
1134 return FALSE;
1135 }
1136 return TRUE;
1137}
@ LINK_CMD
Definition tok.h:117

◆ jiA_LIST()

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

Definition at line 783 of file ipassign.cc.

784{
786 if (errorreported) return TRUE;
787 if (res->data!=NULL) ((lists)res->data)->Clean();
788 res->data=(void *)l;
789 jiAssignAttr(res,a);
790 return FALSE;
791}
slists * lists

◆ jiA_LIST_RES()

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

Definition at line 771 of file ipassign.cc.

772{
774 if (errorreported) return TRUE;
775 if (res->data!=NULL) ((lists)res->data)->Clean();
776 int add_row_shift = 0;
777 intvec *weights=(intvec*)atGet(a,"isHomog",INTVEC_CMD);
778 if (weights!=NULL) add_row_shift=weights->min_in();
779 res->data=(void *)syConvRes(r,TRUE,add_row_shift);
780 //jiAssignAttr(res,a);
781 return FALSE;
782}
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition attrib.cc:132
int min_in()
Definition intvec.h:122
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition ipshell.cc:3178
ssyStrategy * syStrategy
Definition syz.h:36

◆ jiA_MAP()

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

Definition at line 1139 of file ipassign.cc.

1140{
1141 if (res->data!=NULL)
1142 {
1143 omFreeBinAddr((ADDRESS)((map)res->data)->preimage);
1144 ((map)res->data)->preimage=NULL;
1145 idDelete((ideal*)&res->data);
1146 }
1147 res->data=(void *)a->CopyD(MAP_CMD);
1148 if (errorreported) return TRUE;
1149 jiAssignAttr(res,a);
1150 return FALSE;
1151}

◆ jiA_MAP_ID()

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

Definition at line 1153 of file ipassign.cc.

1154{
1155 map f=(map)res->data;
1156 char *rn=f->preimage; // save the old/already assigned preimage ring name
1157 f->preimage=NULL;
1158 idDelete((ideal *)&f);
1159 res->data=(void *)a->CopyD(IDEAL_CMD);
1160 if (errorreported) return TRUE;
1161 f=(map)res->data;
1162 id_Normalize((ideal)f, currRing);
1163 f->preimage = rn;
1164 return FALSE;
1165}
FILE * f
Definition checklibs.c:9

◆ jiA_MATRIX_L()

BOOLEAN jiA_MATRIX_L ( leftv l,
leftv r )
static

Definition at line 1892 of file ipassign.cc.

1893{
1894 /* right side is matrix, left side is list (of poly)*/
1895 BOOLEAN nok=FALSE;
1896 int i;
1898 leftv h;
1899 leftv ol=l;
1900 leftv o_r=r;
1901 sleftv t;
1902 memset(&t,0,sizeof(sleftv));
1903 t.rtyp=POLY_CMD;
1904 int mxn=MATROWS(m)*MATCOLS(m);
1905 loop
1906 {
1907 i=0;
1908 while ((i<mxn /*MATROWS(m)*MATCOLS(m)*/)&&(l!=NULL))
1909 {
1910 t.data=(char *)m->m[i];
1911 m->m[i]=NULL;
1912 h=l->next;
1913 l->next=NULL;
1914 idhdl hh=NULL;
1915 if ((l->rtyp==IDHDL)&&(l->Typ()==DEF_CMD)) hh=(idhdl)l->data;
1916 nok=jiAssign_1(l,&t,POLY_CMD,TRUE);
1917 if (hh!=NULL) { ipMoveId(hh);hh=NULL;}
1918 l->next=h;
1919 if (nok)
1920 {
1921 idDelete((ideal *)&m);
1922 goto ende;
1923 }
1924 i++;
1925 l=h;
1926 }
1927 idDelete((ideal *)&m);
1928 h=r;
1929 r=r->next;
1930 if (l==NULL)
1931 {
1932 if (r!=NULL)
1933 {
1934 WarnS("list length mismatch in assign (l>r)");
1935 nok=TRUE;
1936 }
1937 break;
1938 }
1939 else if (r==NULL)
1940 {
1941 WarnS("list length mismatch in assign (l<r)");
1942 nok=TRUE;
1943 break;
1944 }
1945 if ((r->Typ()==IDEAL_CMD)||(r->Typ()==MATRIX_CMD))
1946 {
1947 m=(matrix)r->CopyD(MATRIX_CMD);
1948 mxn=MATROWS(m)*MATCOLS(m);
1949 }
1950 else if (r->Typ()==POLY_CMD)
1951 {
1952 m=mpNew(1,1);
1953 MATELEM(m,1,1)=(poly)r->CopyD(POLY_CMD);
1954 pNormalize(MATELEM(m,1,1));
1955 mxn=1;
1956 }
1957 else
1958 {
1959 nok=TRUE;
1960 break;
1961 }
1962 }
1963ende:
1964 o_r->CleanUp();
1965 ol->CleanUp();
1966 return nok;
1967}
#define WarnS
Definition emacs.cc:78

◆ jiA_MODUL_P()

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

Definition at line 1054 of file ipassign.cc.

1056{
1057 ideal I=idInit(1,1);
1058 I->m[0]=(poly)a->CopyD(POLY_CMD);
1059 if (errorreported) return TRUE;
1060 if (I->m[0]!=NULL)
1061 {
1062 pSetCompP(I->m[0],1);
1063 if(a->rtyp!=IDHDL) pNormalize(I->m[0]);
1064 }
1065 if (res->data!=NULL) idDelete((ideal*)&res->data);
1066 res->data=(void *)I;
1067 if (TEST_V_QRING && (currRing->qideal!=NULL))
1068 {
1070 else jjNormalizeQRingId(res);
1071 }
1072 return FALSE;
1073}
#define pSetCompP(a, i)
Definition polys.h:304

◆ jiA_NUMBER()

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

Definition at line 482 of file ipassign.cc.

483{
484 number p=(number)a->CopyD(NUMBER_CMD);
485 if (errorreported) return TRUE;
486 if (res->data!=NULL) nDelete((number *)&res->data);
487 nNormalize(p);
488 res->data=(void *)p;
489 jiAssignAttr(res,a);
490 return FALSE;
491}
@ NUMBER_CMD
Definition grammar.cc:289
#define nDelete(n)
Definition numbers.h:16
#define nNormalize(n)
Definition numbers.h:30

◆ jiA_PACKAGE()

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

Definition at line 1301 of file ipassign.cc.

1302{
1303 res->data=(void *)a->CopyD(PACKAGE_CMD);
1304 jiAssignAttr(res,a);
1305 return FALSE;
1306}
@ PACKAGE_CMD
Definition tok.h:150

◆ jiA_POLY()

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

Definition at line 792 of file ipassign.cc.

793{
794 poly p=(poly)a->CopyD(POLY_CMD);
795 if (errorreported) return TRUE;
796 pNormalize(p);
797 if (e==NULL)
798 {
799 if ((p!=NULL) && TEST_V_QRING && (currRing->qideal!=NULL)
800 && (!hasFlag(a,FLAG_QRING)))
801 {
804 }
805 if (res->data!=NULL) pDelete((poly*)&res->data);
806 res->data=(void*)p;
807 jiAssignAttr(res,a);
808 }
809 else
810 {
811 int i,j;
812 matrix m=(matrix)res->data;
813 i=e->start;
814 if (e->next==NULL)
815 {
816 j=i; i=1;
817 // for all ideal like data types: check indices
818 if (j>MATCOLS(m))
819 {
820 if (TEST_V_ALLWARN)
821 {
822 Warn("increase ideal %d -> %d in %s(%d):%s",MATCOLS(m),j,VoiceName(),VoiceLine(),my_yylinebuf);
823 }
824 pEnlargeSet(&(m->m),MATCOLS(m),j-MATCOLS(m));
825 MATCOLS(m)=j;
826 }
827 else if (j<=0)
828 {
829 Werror("index[%d] must be positive",j/*e->start*/);
830 return TRUE;
831 }
832 }
833 else
834 {
835 // for matrices: indices are correct (see ipExprArith3(..,'['..) )
836 j=e->next->start;
837 }
838 if ((p!=NULL) && TEST_V_QRING && (currRing->qideal!=NULL))
839 {
841 }
842 if (res->rtyp==SMATRIX_CMD)
843 {
844 p=pSub(p,SMATELEM(m,i-1,j-1,currRing));
845 pSetCompP(p,i);
846 m->m[j-1]=pAdd(m->m[j-1],p);
847 }
848 else
849 {
850 pDelete(&MATELEM(m,i,j));
851 MATELEM(m,i,j)=p;
852 /* for module: update rank */
853 if ((p!=NULL) && (pGetComp(p)!=0))
854 {
855 m->rank=si_max(m->rank,pMaxComp(p));
856 }
857 }
858 }
859 return FALSE;
860}
const char * VoiceName()
Definition fevoices.cc:58
int VoiceLine()
Definition fevoices.cc:66
@ SMATRIX_CMD
Definition grammar.cc:292
#define jjNormalizeQRingP(p)
Definition ipid.h:103
#define SMATELEM(A, i, j, R)
Definition matpol.h:123
void pEnlargeSet(poly **p, int l, int increment)
Definition p_polys.cc:3821
#define pAdd(p, q)
Definition polys.h:204
#define pGetComp(p)
Component.
Definition polys.h:38
#define pSub(a, b)
Definition polys.h:288

◆ jiA_PROC()

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

Definition at line 931 of file ipassign.cc.

932{
933 extern procinfo *iiInitSingularProcinfo(procinfo *pi, const char *libname,
934 const char *procname, int line,
935 long pos, BOOLEAN pstatic=FALSE);
936 if(res->data!=NULL) piKill((procinfo *)res->data);
937 if(a->Typ()==STRING_CMD)
938 {
939 res->data = (void *)omAlloc0Bin(procinfo_bin);
940 ((procinfo *)(res->data))->language=LANG_NONE;
941 iiInitSingularProcinfo((procinfo *)res->data,"",res->name,0,0);
942 ((procinfo *)res->data)->data.s.body=(char *)a->CopyD(STRING_CMD);
943 }
944 else
945 res->data=(void *)a->CopyD(PROC_CMD);
946 jiAssignAttr(res,a);
947 return FALSE;
948}
@ PROC_CMD
Definition grammar.cc:281
BOOLEAN piKill(procinfov pi)
Definition ipid.cc:724
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int, long pos, BOOLEAN pstatic)
Definition iplib.cc:1059
#define pi
Definition libparse.cc:1145
VAR omBin procinfo_bin
Definition subexpr.cc:42
@ LANG_NONE
Definition subexpr.h:22

◆ jiA_QRING()

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

Definition at line 1166 of file ipassign.cc.

1167{
1168 // the follwing can only happen, if:
1169 // - the left side is of type qring AND not an id
1170 if ((e!=NULL)||(res->rtyp!=IDHDL))
1171 {
1172 WerrorS("qring_id expected");
1173 return TRUE;
1174 }
1175
1176 ring old_ring=(ring)res->Data();
1177
1178 coeffs newcf = currRing->cf;
1179 ideal id = (ideal)a->Data(); //?
1180 if (errorreported) return TRUE;
1181 const int cpos = idPosConstant(id);
1183 if (cpos >= 0)
1184 {
1185 newcf = n_CoeffRingQuot1(p_GetCoeff(id->m[cpos], currRing), currRing->cf);
1186 if(newcf == NULL)
1187 return TRUE;
1188 }
1189 //qr=(ring)res->Data();
1190 //if (qr!=NULL) omFreeBin((ADDRESS)qr, ip_sring_bin);
1191 ring qr = rCopy(currRing);
1192 assume(qr->cf == currRing->cf);
1193
1194 if ( qr->cf != newcf )
1195 {
1196 nKillChar ( qr->cf ); // ???
1197 qr->cf = newcf;
1198 }
1199 // we have to fill it, but the copy also allocates space
1200 idhdl h=(idhdl)res->data; // we have res->rtyp==IDHDL
1201 IDRING(h)=qr;
1202
1203 ideal qid;
1204
1205 if((rField_is_Ring(currRing)) && (cpos != -1))
1206 {
1207 int i, j;
1208 int *perm = (int *)omAlloc0((qr->N+1)*sizeof(int));
1209
1210 for(i=qr->N;i>0;i--)
1211 perm[i]=i;
1212
1213 nMapFunc nMap = n_SetMap(currRing->cf, newcf);
1214 qid = idInit(IDELEMS(id)-1,1);
1215 for(i = 0, j = 0; i<IDELEMS(id); i++)
1216 if( i != cpos )
1217 qid->m[j++] = p_PermPoly(id->m[i], perm, currRing, qr, nMap, NULL, 0);
1218 }
1219 else
1220 qid = idrCopyR(id,currRing,qr);
1221
1222 idSkipZeroes(qid);
1223 //idPrint(qid);
1224 if ((idElem(qid)>1) || rIsSCA(currRing) || (currRing->qideal!=NULL))
1225 assumeStdFlag(a);
1226
1227 if (currRing->qideal!=NULL) /* we are already in a qring! */
1228 {
1229 ideal tmp=idSimpleAdd(qid,currRing->qideal);
1230 // both ideals should be GB, so id_SimpleMove is sufficient
1231 idDelete(&qid);
1232 qid=tmp;
1233 // delete the qr copy of quotient ideal!!!
1234 idDelete(&qr->qideal);
1235 }
1236 if (idElem(qid)==0)
1237 {
1238 qr->qideal = NULL;
1239 id_Delete(&qid,currRing);
1240 IDTYP(h)=RING_CMD;
1241 }
1242 else
1243 qr->qideal = qid;
1244
1245 // qr is a copy of currRing with the new qideal!
1246 #ifdef HAVE_PLURAL
1247 if(rIsPluralRing(currRing) &&(qr->qideal!=NULL))
1248 {
1249 if (!hasFlag(a,FLAG_TWOSTD))
1250 {
1251 Warn("%s is no twosided standard basis",a->Name());
1252 }
1253
1255 {
1256// WarnS("error in nc_SetupQuotient");
1257 }
1258 }
1259 #endif
1260 //rWrite(qr);
1261 rSetHdl((idhdl)res->data);
1262 if (old_ring!=NULL)
1263 {
1264 rDelete(old_ring);
1265 }
1266 return FALSE;
1267}
static FORCE_INLINE coeffs n_CoeffRingQuot1(number c, const coeffs r)
Definition coeffs.h:524
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:703
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
#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:107
#define IDRING(a)
Definition ipid.h:127
void rSetHdl(idhdl h)
Definition ipshell.cc:5129
static bool rIsSCA(const ring r)
Definition nc.h:190
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
#define assume(x)
Definition mod2.h:389
#define p_GetCoeff(p, r)
Definition monomials.h:50
Definition qr.h:46
#define omAlloc0(size)
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:4269
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:454
ring rCopy(ring r)
Definition ring.cc:1737
#define rField_is_Ring(R)
Definition ring.h:491
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static int idElem(const ideal F)
number of non-zero polys in F
BOOLEAN assumeStdFlag(leftv h)
Definition subexpr.cc:1587

◆ jiA_RESOLUTION()

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

Definition at line 1045 of file ipassign.cc.

1046{
1048 if (errorreported) return TRUE;
1049 if (res->data!=NULL) syKillComputation((syStrategy)res->data);
1050 res->data=(void*)R;
1051 jiAssignAttr(res,a);
1052 return FALSE;
1053}
#define R
Definition sirandom.c:27
void syKillComputation(syStrategy syzstr, ring r=currRing)
Definition syz1.cc:1496

◆ jiA_RING()

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

Definition at line 1269 of file ipassign.cc.

1270{
1271 BOOLEAN have_id=TRUE;
1272 if ((e!=NULL)||(res->rtyp!=IDHDL))
1273 {
1274 //WerrorS("id expected");
1275 //return TRUE;
1276 have_id=FALSE;
1277 }
1278 ring r=(ring)a->Data();
1279 if ((r==NULL)||(r->cf==NULL)) return TRUE;
1280 if (have_id)
1281 {
1282 idhdl rl=(idhdl)res->data;
1283 if (IDRING(rl)!=NULL) rKill(rl);
1284 IDRING(rl)=r;
1285 if ((IDLEV((idhdl)a->data)!=myynest) && (r==currRing))
1286 currRingHdl=(idhdl)res->data;
1287 }
1288 else
1289 {
1290 if (e==NULL) res->data=(char *)r;
1291 else
1292 {
1293 WerrorS("id expected");
1294 return TRUE;
1295 }
1296 }
1297 rIncRefCnt(r);
1298 jiAssignAttr(res,a);
1299 return FALSE;
1300}
VAR int myynest
Definition febase.cc:41
VAR idhdl currRingHdl
Definition ipid.cc:57
#define IDLEV(a)
Definition ipid.h:121
void rKill(ring r)
Definition ipshell.cc:6181
static ring rIncRefCnt(ring r)
Definition ring.h:854

◆ jiA_STRING()

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

Definition at line 909 of file ipassign.cc.

910{
911 if (e==NULL)
912 {
913 void* tmp = res->data;
914 res->data=(void *)a->CopyD(STRING_CMD);
915 jiAssignAttr(res,a);
916 omfree(tmp);
917 }
918 else
919 {
920 char *s=(char *)res->data;
921 if ((e->start>0)&&(e->start<=(int)strlen(s)))
922 s[e->start-1]=(char)(*((char *)a->Data()));
923 else
924 {
925 Werror("string index %d out of range 1..%d",e->start,(int)strlen(s));
926 return TRUE;
927 }
928 }
929 return FALSE;
930}
#define omfree(addr)

◆ jiA_STRING_L()

BOOLEAN jiA_STRING_L ( leftv l,
leftv r )
static

Definition at line 1968 of file ipassign.cc.

1969{
1970 /*left side are strings, right side is a string*/
1971 /*e.g. s[2..3]="12" */
1972 /*the case s=t[1..4] is handled in iiAssign,
1973 * the case s[2..3]=t[3..4] is handled in iiAssgn_rec*/
1974 BOOLEAN nok=FALSE;
1975 sleftv t;
1976 leftv h,l1=l;
1977 int i=0;
1978 char *ss;
1979 char *s=(char *)r->Data();
1980 int sl=strlen(s);
1981
1982 memset(&t,0,sizeof(sleftv));
1983 t.rtyp=STRING_CMD;
1984 while ((i<sl)&&(l!=NULL))
1985 {
1986 ss=(char *)omAlloc(2);
1987 ss[1]='\0';
1988 ss[0]=s[i];
1989 t.data=ss;
1990 h=l->next;
1991 l->next=NULL;
1992 nok=jiAssign_1(l,&t,STRING_CMD,TRUE);
1993 if (nok)
1994 {
1995 break;
1996 }
1997 i++;
1998 l=h;
1999 }
2000 r->CleanUp();
2001 l1->CleanUp();
2002 return nok;
2003}
#define omAlloc(size)

◆ jiA_VECTOR_L()

BOOLEAN jiA_VECTOR_L ( leftv l,
leftv r )
static

Definition at line 1615 of file ipassign.cc.

1616{
1617 /* right side is vector, left side is list (of poly)*/
1618 BOOLEAN nok;
1619 leftv l1=l;
1620 ideal I=idVec2Ideal((poly)r->Data());
1621 leftv h;
1622 sleftv t;
1623 int i=0;
1624 memset(&t,0,sizeof(sleftv));
1625 while (l!=NULL)
1626 {
1627 t.rtyp=POLY_CMD;
1628 if (i>=IDELEMS(I))
1629 {
1630 t.data=NULL;
1631 }
1632 else
1633 {
1634 t.data=(char *)I->m[i];
1635 I->m[i]=NULL;
1636 }
1637 h=l->next;
1638 l->next=NULL;
1639 nok=jiAssign_1(l,&t,POLY_CMD,TRUE);
1640 l->next=h;
1641 t.CleanUp();
1642 if (nok)
1643 {
1644 idDelete(&I);
1645 return TRUE;
1646 }
1647 i++;
1648 l=h;
1649 }
1650 idDelete(&I);
1651 l1->CleanUp();
1652 r->CleanUp();
1653 //if (TEST_V_QRING && (currRing->qideal!=NULL)) l=jjNormalizeQRingP(l);
1654 return FALSE;
1655}
static ideal idVec2Ideal(poly vec)
Definition ideals.h:173

◆ jiAssign_1()

BOOLEAN jiAssign_1 ( leftv l,
leftv r,
int rt,
BOOLEAN toplevel,
BOOLEAN is_qring = FALSE )
static

Definition at line 1332 of file ipassign.cc.

1333{
1334 if (rt==0)
1335 {
1336 if (!errorreported) Werror("`%s` is undefined",r->Fullname());
1337 return TRUE;
1338 }
1339
1340 int lt=l->Typ();
1341 if (lt==0)
1342 {
1343 if (!errorreported) Werror("left side `%s` is undefined",l->Fullname());
1344 return TRUE;
1345 }
1346 if(rt==NONE)
1347 {
1348 if ((!TEST_V_ASSIGN_NONE)||(lt!=DEF_CMD))
1349 {
1350 Warn("right side is not a datum, assignment to `%s` ignored",l->Name());
1351 Warn("in line >>%s<<",my_yylinebuf);
1352 // if (!errorreported)
1353 // WerrorS("right side is not a datum");
1354 //return TRUE;
1355 }
1356 return FALSE;
1357 }
1358
1359 if (lt==DEF_CMD)
1360 {
1361
1362 if (TEST_V_ALLWARN
1363 && (rt!=RING_CMD)
1364 && (l->name!=NULL)
1365 && (l->e==NULL)
1366 && (iiCurrArgs==NULL) /* not in proc header */
1367 )
1368 {
1369 Warn("use `%s` instead of `def` in %s:%d:%s",Tok2Cmdname(rt),
1371 }
1372 if (l->rtyp==IDHDL)
1373 {
1374 if((currRingHdl==NULL) && RingDependend(rt))
1375 {
1376 WerrorS("basering required");
1377 return TRUE;
1378 }
1379 if (rt==BUCKET_CMD) IDTYP((idhdl)l->data)=POLY_CMD;
1380 else IDTYP((idhdl)l->data)=rt;
1381 }
1382 else if (l->name!=NULL)
1383 {
1384 int rrt;
1385 if (rt==BUCKET_CMD) rrt=POLY_CMD;
1386 else rrt=rt;
1387 sleftv ll;
1388 iiDeclCommand(&ll,l,myynest,rrt,&IDROOT);
1389 memcpy(l,&ll,sizeof(sleftv));
1390 }
1391 else
1392 {
1393 if (rt==BUCKET_CMD) l->rtyp=POLY_CMD;
1394 else l->rtyp=rt;
1395 }
1396 lt=l->Typ();
1397 }
1398 else
1399 {
1400 if ((l->data==r->data)&&(l->e==NULL)&&(r->e==NULL))
1401 return FALSE;
1402 }
1403 leftv ld=l;
1404 if (l->rtyp==IDHDL)
1405 {
1406 if (lt!=RING_CMD)
1407 ld=(leftv)l->data;
1408 }
1409 else if (toplevel)
1410 {
1411 WerrorS("error in assign: left side is not an l-value");
1412 return TRUE;
1413 }
1414 if (lt>MAX_TOK)
1415 {
1416 blackbox *bb=getBlackboxStuff(lt);
1417#ifdef BLACKBOX_DEVEL
1418 Print("bb-assign: bb=%lx\n",bb);
1419#endif
1420 return (bb==NULL) || bb->blackbox_Assign(l,r);
1421 }
1422 if ((is_qring)
1423 &&(lt==RING_CMD)
1424 &&(rt==RING_CMD))
1425 {
1426 Warn("qring .. = <ring>; is misleading in >>%s<<",my_yylinebuf);
1427 }
1428 int start=0;
1429 while ((dAssign[start].res!=lt)
1430 && (dAssign[start].res!=0)) start++;
1431 int i=start;
1432 while ((dAssign[i].res==lt)
1433 && (dAssign[i].arg!=rt)) i++;
1434 if (dAssign[i].res==lt)
1435 {
1436 if (traceit&TRACE_ASSIGN) Print("assign %s=%s\n",Tok2Cmdname(lt),Tok2Cmdname(rt));
1437 BOOLEAN b;
1438 b=dAssign[i].p(ld,r,l->e);
1439 if(l!=ld) /* i.e. l is IDHDL, l->data is ld */
1440 {
1441 l->flag=ld->flag;
1442 l->attribute=ld->attribute;
1443 }
1444 return b;
1445 }
1446 // implicite type conversion ----------------------------------------------
1447 if (dAssign[i].res!=lt)
1448 {
1449 int ri;
1451 BOOLEAN failed=FALSE;
1452 i=start;
1453 //while ((dAssign[i].res!=lt)
1454 // && (dAssign[i].res!=0)) i++;
1455 while (dAssign[i].res==lt)
1456 {
1457 if ((ri=iiTestConvert(rt,dAssign[i].arg))!=0)
1458 {
1459 failed= iiConvert(rt,dAssign[i].arg,ri,r,rn);
1460 if(!failed)
1461 {
1462 failed= dAssign[i].p(ld,rn,l->e);
1464 Print("assign %s=%s ok? %d\n",Tok2Cmdname(lt),Tok2Cmdname(rn->rtyp),!failed);
1465 }
1466 // everything done, clean up temp. variables
1467 rn->CleanUp();
1469 if (failed)
1470 {
1471 // leave loop, goto error handling
1472 break;
1473 }
1474 else
1475 {
1476 if(l!=ld) /* i.e. l is IDHDL, l->data is ld */
1477 {
1478 l->flag=ld->flag;
1479 l->attribute=ld->attribute;
1480 }
1481 // everything ok, return
1482 return FALSE;
1483 }
1484 }
1485 i++;
1486 }
1487 // error handling ---------------------------------------------------
1488 if (!errorreported)
1489 {
1490 if ((l->rtyp==IDHDL) && (l->e==NULL))
1491 Werror("`%s`(%s) = `%s` is not supported",
1492 Tok2Cmdname(lt),l->Name(),Tok2Cmdname(rt));
1493 else
1494 Werror("`%s` = `%s` is not supported"
1495 ,Tok2Cmdname(lt),Tok2Cmdname(rt));
1496 if (BVERBOSE(V_SHOW_USE))
1497 {
1498 i=0;
1499 while ((dAssign[i].res!=lt)
1500 && (dAssign[i].res!=0)) i++;
1501 while (dAssign[i].res==lt)
1502 {
1503 Werror("expected `%s` = `%s`"
1504 ,Tok2Cmdname(lt),Tok2Cmdname(dAssign[i].arg));
1505 i++;
1506 }
1507 }
1508 }
1509 }
1510 return TRUE;
1511}
BITSET flag
Definition subexpr.h:90
attr attribute
Definition subexpr.h:89
VAR int yylineno
Definition febase.cc:40
VAR Voice * currentVoice
Definition fevoices.cc:49
static int RingDependend(int t)
Definition gentable.cc:23
@ BUCKET_CMD
Definition grammar.cc:284
#define IDROOT
Definition ipid.h:19
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition ipshell.cc:1206
VAR leftv iiCurrArgs
Definition ipshell.cc:81
#define TEST_V_ASSIGN_NONE
Definition options.h:136
const struct sValAssign dAssign[]
Definition table.h:1419

◆ jiAssign_list()

BOOLEAN jiAssign_list ( leftv l,
leftv r )
static

Definition at line 2004 of file ipassign.cc.

2005{
2006 int i=l->e->start-1;
2007 if (i<0)
2008 {
2009 Werror("index[%d] must be positive",i+1);
2010 return TRUE;
2011 }
2012 if(l->attribute!=NULL)
2013 {
2014 atKillAll((idhdl)l);
2015 l->attribute=NULL;
2016 }
2017 l->flag=0;
2018 lists li;
2019 if (l->rtyp==IDHDL)
2020 {
2021 li=IDLIST((idhdl)l->data);
2022 }
2023 else
2024 {
2025 li=(lists)l->data;
2026 }
2027 if (i>li->nr)
2028 {
2029 if (TEST_V_ALLWARN)
2030 {
2031 Warn("increase list %d -> %d in %s(%d):%s",li->nr,i,VoiceName(),VoiceLine(),my_yylinebuf);
2032 }
2033 li->m=(leftv)omreallocSize(li->m,(li->nr+1)*sizeof(sleftv),(i+1)*sizeof(sleftv));
2034 memset(&(li->m[li->nr+1]),0,(i-li->nr)*sizeof(sleftv));
2035 int j=li->nr+1;
2036 for(;j<=i;j++)
2037 li->m[j].rtyp=DEF_CMD;
2038 li->nr=i;
2039 }
2040 leftv ld=&(li->m[i]);
2041 ld->e=l->e->next;
2042 BOOLEAN b;
2043 sleftv tmp;
2044 memset(&tmp,0,sizeof(sleftv));
2045 if (/*(ld->rtyp!=LIST_CMD)
2046 &&*/(ld->e==NULL)
2047 && (ld->Typ()!=r->Typ()))
2048 {
2049 ring old_r=jjCheck_FLAG_OTHER_RING(ld);
2050 tmp.rtyp=DEF_CMD;
2051 tmp.flag=ld->flag;
2052 b=iiAssign(&tmp,r,FALSE);
2053 ld->CleanUp(old_r);
2054 memcpy(ld,&tmp,sizeof(sleftv));
2055 }
2056 else if ((ld->e==NULL)
2057 && (ld->Typ()==r->Typ())
2058 && (ld->Typ()<MAX_TOK))
2059 {
2060 ring old_r=jjCheck_FLAG_OTHER_RING(ld);
2061 tmp.rtyp=r->Typ();
2062 tmp.flag=ld->flag;
2063 tmp.data=(char*)idrecDataInit(r->Typ());
2064 b=iiAssign(&tmp,r,FALSE);
2065 ld->CleanUp(old_r);
2066 memcpy(ld,&tmp,sizeof(sleftv));
2067 }
2068 else
2069 {
2070 b=iiAssign(ld,r,FALSE);
2071 if (l->e!=NULL) l->e->next=ld->e;
2072 ld->e=NULL;
2073 }
2074 return b;
2075}
sleftv * m
Definition lists.h:46
int nr
Definition lists.h:44
static ring jjCheck_FLAG_OTHER_RING(leftv res)
Definition ipassign.cc:463
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition ipassign.cc:2099
void * idrecDataInit(int t)
Definition ipid.cc:116
#define IDLIST(a)
Definition ipid.h:137
#define omreallocSize(addr, o_size, size)

◆ jiAssign_rec()

BOOLEAN jiAssign_rec ( leftv l,
leftv r )
static

Definition at line 2076 of file ipassign.cc.

2077{
2078 leftv l1=l;
2079 leftv r1=r;
2080 leftv lrest;
2081 leftv rrest;
2082 BOOLEAN b;
2083 do
2084 {
2085 lrest=l->next;
2086 rrest=r->next;
2087 l->next=NULL;
2088 r->next=NULL;
2089 b=iiAssign(l,r);
2090 l->next=lrest;
2091 r->next=rrest;
2092 l=lrest;
2093 r=rrest;
2094 } while ((!b)&&(l!=NULL));
2095 l1->CleanUp();
2096 r1->CleanUp();
2097 return b;
2098}

◆ jiAssignAttr()

void jiAssignAttr ( leftv l,
leftv r )
static

Definition at line 386 of file ipassign.cc.

387{
388 // get the attribute of th right side
389 // and set it to l
390 leftv rv=r->LData();
391 if (rv!=NULL)
392 {
393 if (rv->e==NULL)
394 {
395 if (rv->attribute!=NULL)
396 {
397 attr la;
398 if (r->rtyp!=IDHDL)
399 {
400 la=rv->attribute;
401 rv->attribute=NULL;
402 }
403 else
404 {
405 la=rv->attribute->Copy();
406 }
407 l->attribute=la;
408 }
409 l->flag=rv->flag;
410 }
411 }
412 if (l->rtyp==IDHDL)
413 {
414 idhdl h=(idhdl)l->data;
415 IDATTR(h)=l->attribute;
416 IDFLAG(h)=l->flag;
417 }
418}
sattr * attr
Definition attrib.h:16
attr Copy()
Definition attrib.cc:33
leftv LData()
Definition subexpr.cc:1519

◆ jj_NormalizeQRingP()

poly jj_NormalizeQRingP ( poly p,
const ring r )

Definition at line 2496 of file ipassign.cc.

2497{
2498 if((p!=NULL) && (r->qideal!=NULL))
2499 {
2500 ring save=currRing;
2501 if (r!=currRing) rChangeCurrRing(r);
2502 ideal F=idInit(1,1);
2503 poly p2=kNF(F,r->qideal,p);
2504 p_Normalize(p2,r);
2505 id_Delete(&F,r);
2506 p_Delete(&p,r);
2507 p=p2;
2508 if (r!=save) rChangeCurrRing(save);
2509 }
2510 return p;
2511}
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition kstd1.cc:3230
void p_Normalize(poly p, const ring r)
Definition p_polys.cc:3952
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
void rChangeCurrRing(ring r)
Definition polys.cc:16

◆ jjA_L_BIGINTMAT()

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

Definition at line 1770 of file ipassign.cc.

1771{
1772 /* left side is bigintmat, right side is list (of int,intvec,intmat)*/
1773 leftv hh=r;
1774 int i = 0;
1775 if (bim->length()==0) { WerrorS("bigintmat is 1x0"); delete bim; return TRUE; }
1776 while (hh!=NULL)
1777 {
1778 if (i>=bim->cols()*bim->rows())
1779 {
1781 {
1782 Warn("expression list length(%d) does not match bigintmat size(%d x %d)",
1783 exprlist_length(hh),bim->rows(),bim->cols());
1784 }
1785 break;
1786 }
1787 if (hh->Typ() == INT_CMD)
1788 {
1789 number tp = n_Init((int)((long)(hh->Data())), coeffs_BIGINT);
1790 bim->set(i++, tp);
1791 n_Delete(&tp, coeffs_BIGINT);
1792 }
1793 else if (hh->Typ() == BIGINT_CMD)
1794 {
1795 bim->set(i++, (number)(hh->Data()));
1796 }
1797 /*
1798 ((hh->Typ() == INTVEC_CMD)
1799 ||(hh->Typ() == INTMAT_CMD))
1800 {
1801 intvec *ivv = (intvec *)(hh->Data());
1802 int ll = 0,l = si_min(ivv->length(),iv->length());
1803 for (; l>0; l--)
1804 {
1805 (*iv)[i++] = (*ivv)[ll++];
1806 }
1807 }*/
1808 else
1809 {
1810 delete bim;
1811 return TRUE;
1812 }
1813 hh = hh->next;
1814 }
1815 if (IDBIMAT((idhdl)l->data)!=NULL) delete IDBIMAT((idhdl)l->data);
1816 IDBIMAT((idhdl)l->data)=bim;
1817 return FALSE;
1818}
int length()
Definition bigintmat.h:143
int cols() const
Definition bigintmat.h:144
int rows() const
Definition bigintmat.h:145
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

◆ jjA_L_BIGINTVEC()

BOOLEAN jjA_L_BIGINTVEC ( leftv l,
leftv r,
bigintmat * bim )
static

Definition at line 1819 of file ipassign.cc.

1820{
1821 /* left side is bigintvec, right side is list (of int,intvec,intmat)*/
1822 leftv hh=r;
1823 int i = 0;
1824 delete bim;
1826 while (hh!=NULL)
1827 {
1828 if (i>=bim->cols())
1829 {
1831 {
1832 Warn("expression list length(%d) does not match bigintvec size(%d)",
1833 exprlist_length(hh),bim->cols());
1834 }
1835 break;
1836 }
1837 if (hh->Typ() == INT_CMD)
1838 {
1839 number tp = n_Init((int)((long)(hh->Data())), coeffs_BIGINT);
1840 bim->set(i++, tp);
1841 n_Delete(&tp, coeffs_BIGINT);
1842 }
1843 else if (hh->Typ() == BIGINT_CMD)
1844 {
1845 bim->set(i++, (number)(hh->Data()));
1846 }
1847 else
1848 {
1849 delete bim;
1850 return TRUE;
1851 }
1852 hh = hh->next;
1853 }
1854 if (IDBIMAT((idhdl)l->data)!=NULL) delete IDBIMAT((idhdl)l->data);
1855 IDBIMAT((idhdl)l->data)=bim;
1856 return bim==NULL;
1857}

◆ jjA_L_INTVEC()

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

Definition at line 1721 of file ipassign.cc.

1722{
1723 /* left side is intvec/intmat, right side is list (of int,intvec,intmat)*/
1724 leftv hh=r;
1725 int i = 0;
1726 while (hh!=NULL)
1727 {
1728 if (i>=iv->length())
1729 {
1731 {
1732 Warn("expression list length(%d) does not match intmat size(%d)",
1733 iv->length()+exprlist_length(hh),iv->length());
1734 }
1735 break;
1736 }
1737 if (hh->Typ() == INT_CMD)
1738 {
1739 (*iv)[i++] = (int)((long)(hh->Data()));
1740 }
1741 else if ((hh->Typ() == INTVEC_CMD)
1742 ||(hh->Typ() == INTMAT_CMD))
1743 {
1744 intvec *ivv = (intvec *)(hh->Data());
1745 int ll = 0,l = si_min(ivv->length(),iv->length());
1746 for (; l>0; l--)
1747 {
1748 (*iv)[i++] = (*ivv)[ll++];
1749 }
1750 }
1751 else
1752 {
1753 delete iv;
1754 return TRUE;
1755 }
1756 hh = hh->next;
1757 }
1758 if (l->rtyp==IDHDL)
1759 {
1760 if (IDINTVEC((idhdl)l->data)!=NULL) delete IDINTVEC((idhdl)l->data);
1761 IDINTVEC((idhdl)l->data)=iv;
1762 }
1763 else
1764 {
1765 if (l->data!=NULL) delete ((intvec*)l->data);
1766 l->data=(char*)iv;
1767 }
1768 return FALSE;
1769}

◆ jjA_L_LIST()

BOOLEAN jjA_L_LIST ( leftv l,
leftv r )
static

Definition at line 1656 of file ipassign.cc.

1660{
1661 int sl = r->listLength();
1663 lists oldL;
1664 leftv h=NULL,o_r=r;
1665 int i;
1666 int rt;
1667
1668 L->Init(sl);
1669 for (i=0;i<sl;i++)
1670 {
1671 if (h!=NULL) { /* e.g. not in the first step:
1672 * h is the pointer to the old sleftv,
1673 * r is the pointer to the next sleftv
1674 * (in this moment) */
1675 h->next=r;
1676 }
1677 h=r;
1678 r=r->next;
1679 h->next=NULL;
1680 rt=h->Typ();
1681 if ((rt==0)||(rt==NONE)||(rt==DEF_CMD))
1682 {
1683 L->Clean();
1684 Werror("`%s` is undefined",h->Fullname());
1685 //listall();
1686 goto err;
1687 }
1688 //if (rt==RING_CMD)
1689 //{
1690 // L->m[i].rtyp=rt;
1691 // L->m[i].data=h->Data();
1692 // ((ring)L->m[i].data)->ref++;
1693 //}
1694 //else
1695 L->m[i].CleanUp();
1696 L->m[i].Copy(h);
1697 if(errorreported)
1698 {
1699 L->Clean();
1700 goto err;
1701 }
1702 }
1703 oldL=(lists)l->Data();
1704 if (oldL!=NULL) oldL->Clean();
1705 if (l->rtyp==IDHDL)
1706 {
1707 IDLIST((idhdl)l->data)=L;
1708 IDTYP((idhdl)l->data)=LIST_CMD; // was possibly DEF_CMD
1709 if (lRingDependend(L)) ipMoveId((idhdl)l->data);
1710 }
1711 else
1712 {
1713 l->LData()->data=L;
1714 if ((l->e!=NULL) && (l->rtyp==DEF_CMD))
1715 l->rtyp=LIST_CMD;
1716 }
1717err:
1718 o_r->CleanUp();
1719 return errorreported;
1720}
void Copy(leftv e)
Definition subexpr.cc:689
void Clean(ring r=currRing)
Definition lists.h:26
INLINE_THIS void Init(int l=0)
VAR omBin slists_bin
Definition lists.cc:23
BOOLEAN lRingDependend(lists L)
Definition lists.cc:222
#define omAllocBin(bin)

◆ jjA_L_STRING()

BOOLEAN jjA_L_STRING ( leftv l,
leftv r )
static

Definition at line 1858 of file ipassign.cc.

1859{
1860 /* left side is string, right side is list of string*/
1861 leftv hh=r;
1862 int sl = 1;
1863 char *s;
1864 char *t;
1865 int tl;
1866 /* find the length */
1867 while (hh!=NULL)
1868 {
1869 if (hh->Typ()!= STRING_CMD)
1870 {
1871 return TRUE;
1872 }
1873 sl += strlen((char *)hh->Data());
1874 hh = hh->next;
1875 }
1876 s = (char * )omAlloc(sl);
1877 sl=0;
1878 hh = r;
1879 while (hh!=NULL)
1880 {
1881 t=(char *)hh->Data();
1882 tl=strlen(t);
1883 memcpy(s+sl,t,tl);
1884 sl+=tl;
1885 hh = hh->next;
1886 }
1887 s[sl]='\0';
1888 omFree((ADDRESS)IDDATA((idhdl)(l->data)));
1889 IDDATA((idhdl)(l->data))=s;
1890 return FALSE;
1891}
#define IDDATA(a)
Definition ipid.h:126
#define omFree(addr)

◆ jjCheck_FLAG_OTHER_RING()

ring jjCheck_FLAG_OTHER_RING ( leftv res)
inlinestatic

Definition at line 463 of file ipassign.cc.

464{
465 ring old_r=currRing;
466 if (Sy_inset(FLAG_RING,res->flag))
467 {
468 if ((res-1)->data!=currRing)
469 {
470 if ((res-1)->data!=NULL)
471 {
472 old_r=(ring)(res-1)->data;
473 rDecRefCnt(old_r);
474 }
475 (res-1)->data=rIncRefCnt(currRing);
476 (res-1)->rtyp=RING_CMD;
477 }
478 }
480 return old_r;
481}
#define FLAG_OTHER_RING
Definition ipid.h:110
#define FLAG_RING
Definition ipid.h:111
#define Sy_inset(x, s)
Definition options.h:33
#define Sy_bit(x)
Definition options.h:31
static void rDecRefCnt(ring r)
Definition ring.h:855

◆ jjCOLMAX()

BOOLEAN jjCOLMAX ( leftv ,
leftv a )
static

Definition at line 63 of file ipassign.cc.

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

◆ jjECHO()

BOOLEAN jjECHO ( leftv ,
leftv a )
static

Definition at line 53 of file ipassign.cc.

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

◆ jjIMPORTFROM()

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

Definition at line 2512 of file ipassign.cc.

2513{
2514 //Print("importfrom %s::%s ->.\n",v->Name(),u->Name() );
2515 assume(u->Typ()==PACKAGE_CMD);
2516 char *vn=(char *)v->Name();
2517 idhdl h=((package)(u->Data()))->idroot->get(vn /*v->Name()*/, myynest);
2518 if (h!=NULL)
2519 {
2520 //check for existence
2521 if (((package)(u->Data()))==basePack)
2522 {
2523 WarnS("source and destination packages are identical");
2524 return FALSE;
2525 }
2526 idhdl t=basePack->idroot->get(vn /*v->Name()*/, myynest);
2527 if (t!=NULL)
2528 {
2529 if (BVERBOSE(V_REDEFINE)) Warn("redefining %s (%s)",vn,my_yylinebuf);
2530 killhdl(t);
2531 }
2532 sleftv tmp_expr;
2533 if (iiDeclCommand(&tmp_expr,v,myynest,DEF_CMD,&IDROOT)) return TRUE;
2534 sleftv h_expr;
2535 memset(&h_expr,0,sizeof(h_expr));
2536 h_expr.rtyp=IDHDL;
2537 h_expr.data=h;
2538 h_expr.name=vn;
2539 return iiAssign(&tmp_expr,&h_expr);
2540 }
2541 else
2542 {
2543 Werror("`%s` not found in `%s`",v->Name(), u->Name());
2544 return TRUE;
2545 }
2546 return FALSE;
2547}
const char * name
Definition subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
VAR package basePack
Definition ipid.cc:56
void killhdl(idhdl h, package proot)
Definition ipid.cc:391
#define V_REDEFINE
Definition options.h:45
ip_package * package
Definition structs.h:39

◆ jjMAXDEG()

BOOLEAN jjMAXDEG ( leftv ,
leftv a )
static

Definition at line 82 of file ipassign.cc.

83{
84 Kstd1_deg=(int)((long)(a->Data()));
85 if (Kstd1_deg!=0)
87 else
89 return FALSE;
90}
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:70
VAR unsigned si_opt_1
Definition options.c:5
#define OPT_DEGBOUND
Definition options.h:91

◆ jjMAXMULT()

BOOLEAN jjMAXMULT ( leftv ,
leftv a )
static

Definition at line 91 of file ipassign.cc.

92{
93 Kstd1_mu=(int)((long)(a->Data()));
94 if (Kstd1_mu!=0)
96 else
98 return FALSE;
99}
EXTERN_VAR int Kstd1_mu
Definition kstd1.h:70
#define OPT_MULTBOUND
Definition options.h:90

◆ jjMINPOLY()

BOOLEAN jjMINPOLY ( leftv ,
leftv a )
static

Definition at line 243 of file ipassign.cc.

244{
245 if( !nCoeff_is_transExt(currRing->cf) && (currRing->idroot == NULL) && n_IsZero((number)a->Data(), currRing->cf) )
246 {
247#ifndef SING_NDEBUG
248 WarnS("Set minpoly over non-transcendental ground field to 0?!");
249 Warn("in >>%s<<",my_yylinebuf);
250#endif
251 return FALSE;
252 }
253
254
255 if ( !nCoeff_is_transExt(currRing->cf) )
256 {
257 WarnS("Trying to set minpoly over non-transcendental ground field...");
258 if(!nCoeff_is_algExt(currRing->cf) )
259 {
260 WerrorS("cannot set minpoly for these coeffients");
261 return TRUE;
262 }
263 }
264 if ((rVar(currRing->cf->extRing)!=1)
265 && !n_IsZero((number)a->Data(), currRing->cf) )
266 {
267 WerrorS("only univarite minpoly allowed");
268 return TRUE;
269 }
270
271 BOOLEAN redefine_from_algext=FALSE;
272 if ( currRing->idroot != NULL )
273 {
274 redefine_from_algext=(currRing->cf->extRing->qideal!=NULL);
275#ifndef SING_NDEBUG
276// idhdl p = currRing->idroot;
277//
278// WarnS("no minpoly allowed if there are local objects belonging to the basering: ");
279//
280// while(p != NULL)
281// {
282// PrintS(p->String(TRUE)); Print("(%s)\n",IDID(p));
283// p = p->next;
284// }
285#endif
286 }
287
288// assume (currRing->idroot==NULL);
289
290 number p = (number)a->CopyD(NUMBER_CMD);
291 n_Normalize(p, currRing->cf);
292
293 if (n_IsZero(p, currRing->cf))
294 {
295 n_Delete(&p, currRing->cf);
297 {
298#ifndef SING_NDEBUG
299 WarnS("minpoly is already 0...");
300#endif
301 return FALSE;
302 }
303 WarnS("cannot set minpoly to 0 / alg. extension?");
304 return TRUE;
305 }
306
307 // remove all object currently in the ring
308 while(currRing->idroot!=NULL)
309 {
310#ifndef SING_NDEBUG
311// Warn("killing a local object due to minpoly change: %s", IDID(currRing->idroot));
312#endif
313 killhdl2(currRing->idroot,&(currRing->idroot),currRing);
314 }
315
317
318 A.r = rCopy(currRing->cf->extRing); // Copy ground field!
319 // if minpoly was already set:
320 if( currRing->cf->extRing->qideal != NULL ) id_Delete(&(A.r->qideal),A.r);
321 ideal q = idInit(1,1);
322 if ((p==NULL) ||(NUM((fraction)p)==NULL))
323 {
324 WerrorS("Could not construct the alg. extension: minpoly==0");
325 // cleanup A: TODO
326 rDelete( A.r );
327 return TRUE;
328 }
329 if (!redefine_from_algext && (DEN((fraction)(p)) != NULL)) // minpoly must be a fraction with poly numerator...!!
330 {
331 poly n=DEN((fraction)(p));
332 if(!p_IsConstant(n,currRing->cf->extRing))
333 {
334 WarnS("denominator must be constant - ignoring it");
335 }
336 p_Delete(&n,currRing->cf->extRing);
337 DEN((fraction)(p))=NULL;
338 }
339
340 if (redefine_from_algext) q->m[0]=(poly)p;
341 else q->m[0] = NUM((fraction)p);
342 A.r->qideal = q;
343
344#if 0
345 PrintS("\nTrying to conver the currRing into an algebraic field: ");
346 PrintS("Ground poly. ring: \n");
347 rWrite( A.r );
348 PrintS("\nGiven MinPOLY: ");
349 p_Write( A.i->m[0], A.r );
350#endif
351
352 // :(
353// NUM((fractionObject *)p) = NULL; // makes 0/ NULL fraction - which should not happen!
354// n_Delete(&p, currRing->cf); // doesn't expect 0/ NULL :(
355 if (!redefine_from_algext)
356 {
358 NUM((fractionObject *)p) = NULL; // not necessary, but still...
360 }
361
362 coeffs new_cf = nInitChar(n_algExt, &A);
363 if (new_cf==NULL)
364 {
365 WerrorS("Could not construct the alg. extension: llegal minpoly?");
366 // cleanup A: TODO
367 rDelete( A.r );
368 return TRUE;
369 }
370 else
371 {
372 nKillChar(currRing->cf); currRing->cf=new_cf;
373 }
374 return FALSE;
375}
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:35
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition numbers.cc:412
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition coeffs.h:470
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition coeffs.h:908
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition coeffs.h:581
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition coeffs.h:916
#define EXTERN_VAR
Definition globaldefs.h:6
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition ipid.cc:422
omBin_t * omBin
Definition omStructs.h:12
void p_Write(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:342
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition p_polys.h:1985
#define NUM
Definition readcf.cc:180
void rWrite(ring r, BOOLEAN details)
Definition ring.cc:227
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:603
VAR omBin fractionObjectBin
Definition transext.cc:89

◆ jjMINPOLY_red()

void jjMINPOLY_red ( idhdl h)
static

Definition at line 128 of file ipassign.cc.

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

◆ jjNOETHER()

BOOLEAN jjNOETHER ( leftv ,
leftv a )
static

Definition at line 378 of file ipassign.cc.

379{
380 poly p=(poly)a->CopyD(POLY_CMD);
381 pDelete(&(currRing->ppNoether));
382 (currRing->ppNoether)=p;
383 return FALSE;
384}

◆ jjNormalizeQRingId()

void jjNormalizeQRingId ( leftv I)

Definition at line 2461 of file ipassign.cc.

2462{
2463 assume ((currRing->qideal!=NULL) && (!hasFlag(I,FLAG_QRING)));
2464 {
2465 if (I->e==NULL)
2466 {
2467 ideal I0=(ideal)I->Data();
2468 switch (I->Typ())
2469 {
2470 case IDEAL_CMD:
2471 case MODUL_CMD:
2472 {
2473 ideal F=idInit(1,1);
2474 ideal II=kNF(F,currRing->qideal,I0);
2475 idDelete(&F);
2476 if (I->rtyp!=IDHDL)
2477 {
2478 idDelete((ideal*)&(I0));
2479 I->data=II;
2480 }
2481 else
2482 {
2483 idhdl h=(idhdl)I->data;
2484 idDelete((ideal*)&IDIDEAL(h));
2485 IDIDEAL(h)=II;
2487 }
2488 break;
2489 }
2490 default: break;
2491 }
2493 }
2494 }
2495}
#define IDIDEAL(a)
Definition ipid.h:133

◆ jjPRINTLEVEL()

BOOLEAN jjPRINTLEVEL ( leftv ,
leftv a )
static

Definition at line 58 of file ipassign.cc.

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

◆ jjRTIMER()

BOOLEAN jjRTIMER ( leftv ,
leftv a )
static

Definition at line 75 of file ipassign.cc.

76{
77 rtimerv=(int)((long)(a->Data()));
78 initRTimer();
79 return FALSE;
80}
void initRTimer()
Definition timer.cc:136
VAR int rtimerv
Definition timer.cc:126

◆ jjSetMinpoly()

coeffs jjSetMinpoly ( coeffs cf,
number a )

Definition at line 176 of file ipassign.cc.

177{
178 if ( !nCoeff_is_transExt(cf) )
179 {
180 if(!nCoeff_is_algExt(cf) )
181 {
182 WerrorS("cannot set minpoly for these coeffients");
183 return NULL;
184 }
185 }
186 if (rVar(cf->extRing)!=1)
187 {
188 WerrorS("only univariate minpoly allowed");
189 return NULL;
190 }
191
192 number p = n_Copy(a,cf);
193 n_Normalize(p, cf);
194
195 if (n_IsZero(p, cf))
196 {
197 n_Delete(&p, cf);
198 return cf;
199 }
200
202
203 A.r = rCopy(cf->extRing); // Copy ground field!
204 // if minpoly was already set:
205 if( cf->extRing->qideal != NULL ) id_Delete(&(A.r->qideal),A.r);
206 ideal q = idInit(1,1);
207 if ((p==NULL) ||(NUM((fraction)p)==NULL))
208 {
209 WerrorS("Could not construct the alg. extension: minpoly==0");
210 // cleanup A: TODO
211 rDelete( A.r );
212 return NULL;
213 }
214 if (DEN((fraction)(p)) != NULL) // minpoly must be a fraction with poly numerator...!!
215 {
216 poly n=DEN((fraction)(p));
217 if(!p_IsConstant(n,cf->extRing))
218 {
219 WarnS("denominator must be constant - ignoring it");
220 }
221 p_Delete(&n,cf->extRing);
222 DEN((fraction)(p))=NULL;
223 }
224
225 q->m[0] = NUM((fraction)p);
226 A.r->qideal = q;
227
229 NUM((fractionObject *)p) = NULL; // not necessary, but still...
231
232 coeffs new_cf = nInitChar(n_algExt, &A);
233 if (new_cf==NULL)
234 {
235 WerrorS("Could not construct the alg. extension: illegal minpoly?");
236 // cleanup A: TODO
237 rDelete( A.r );
238 return NULL;
239 }
240 return new_cf;
241}
CanonicalForm cf
Definition cfModGcd.cc:4091
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition coeffs.h:457

◆ jjSHORTOUT()

BOOLEAN jjSHORTOUT ( leftv ,
leftv a )
static

Definition at line 105 of file ipassign.cc.

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

◆ jjTIMER()

BOOLEAN jjTIMER ( leftv ,
leftv a )
static

Definition at line 68 of file ipassign.cc.

69{
70 timerv=(int)((long)(a->Data()));
71 startTimer();
72 return FALSE;
73}
int startTimer()
Definition timer.cc:66
VAR int timerv
Definition timer.cc:17

◆ jjTRACE()

BOOLEAN jjTRACE ( leftv ,
leftv a )
static

Definition at line 100 of file ipassign.cc.

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