Macros | Functions
extra.cc File Reference
#include <kernel/mod2.h>
#include <misc/sirandom.h>
#include <resources/omFindExec.h>
#include <factory/factory.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <signal.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include <misc/options.h>
#include <coeffs/coeffs.h>
#include <coeffs/mpr_complex.h>
#include "coeffs/AE.h"
#include "coeffs/AEp.h"
#include "coeffs/AEQ.h"
#include <resources/feResource.h>
#include <polys/monomials/ring.h>
#include <kernel/polys.h>
#include <polys/monomials/maps.h>
#include <polys/matpol.h>
#include <polys/prCopy.h>
#include <polys/weight.h>
#include <coeffs/bigintmat.h>
#include <kernel/fast_mult.h>
#include <kernel/digitech.h>
#include <kernel/combinatorics/stairc.h>
#include <kernel/ideals.h>
#include <kernel/GBEngine/kstd1.h>
#include <kernel/GBEngine/syz.h>
#include <kernel/GBEngine/kutil.h>
#include <kernel/GBEngine/shiftgb.h>
#include <kernel/linear_algebra/linearAlgebra.h>
#include <kernel/combinatorics/hutil.h>
#include <kernel/GBEngine/tgb.h>
#include <kernel/linear_algebra/minpoly.h>
#include <numeric/mpr_base.h>
#include "tok.h"
#include "ipid.h"
#include "lists.h"
#include "cntrlc.h"
#include "ipshell.h"
#include "sdb.h"
#include "feOpt.h"
#include "fehelp.h"
#include "distrib.h"
#include "misc_ip.h"
#include "attrib.h"
#include "links/silink.h"
#include "walk.h"
#include <Singular/newstruct.h>
#include <Singular/blackbox.h>
#include <Singular/pyobject_setup.h>
#include <kernel/GBEngine/ringgb.h>
#include <kernel/GBEngine/f5gb.h>
#include <kernel/spectrum/spectrum.h>
#include <polys/nc/nc.h>
#include <polys/nc/ncSAMult.h>
#include <polys/nc/sca.h>
#include <kernel/GBEngine/nc.h>
#include "ipconv.h"
#include <kernel/GBEngine/ratgring.h>
#include <polys/flintconv.h>
#include <polys/clapconv.h>
#include <kernel/GBEngine/kstdfac.h>
#include <polys/clapsing.h>
#include "eigenval_ip.h"
#include "gms.h"
#include "Singular/links/simpleipc.h"
#include "pcv.h"
#include <kernel/fglm/fglmcomb.cc>
#include <kernel/fglm/fglm.h>
#include <hc_newton.h>
#include <polys/mod_raw.h>

Go to the source code of this file.

Macros

#define HAVE_WALK   1
 
#define HAVE_EXTENDED_SYSTEM   1
 
#define TEST_FOR(A)   if(strcmp(s,A)==0) res->data=(void *)1; else
 
#define HAVE_SHEAFCOH_TRICKS   1
 

Functions

static BOOLEAN jjEXTENDED_SYSTEM (leftv res, leftv h)
 
unsigned long ** singularMatrixToLongMatrix (matrix singularMatrix)
 
poly longCoeffsToSingularPoly (unsigned long *polyCoeffs, const int degree)
 
BOOLEAN jjSYSTEM (leftv res, leftv args)
 

Macro Definition Documentation

§ HAVE_EXTENDED_SYSTEM

#define HAVE_EXTENDED_SYSTEM   1

Definition at line 146 of file extra.cc.

§ HAVE_SHEAFCOH_TRICKS

#define HAVE_SHEAFCOH_TRICKS   1

§ HAVE_WALK

#define HAVE_WALK   1

Definition at line 11 of file extra.cc.

§ TEST_FOR

#define TEST_FOR (   A)    if(strcmp(s,A)==0) res->data=(void *)1; else

Function Documentation

§ jjEXTENDED_SYSTEM()

static BOOLEAN jjEXTENDED_SYSTEM ( leftv  res,
leftv  h 
)
static

Definition at line 2290 of file extra.cc.

2291 {
2292  if(h->Typ() == STRING_CMD)
2293  {
2294  char *sys_cmd=(char *)(h->Data());
2295  h=h->next;
2296  /*==================== test syz strat =================*/
2297  if (strcmp(sys_cmd, "syz") == 0)
2298  {
2299  if ((h!=NULL) && (h->Typ()==STRING_CMD))
2300  {
2301  const char *s=(const char *)h->Data();
2302  if (strcmp(s,"posInT_EcartFDegpLength")==0)
2304  else if (strcmp(s,"posInT_FDegpLength")==0)
2306  else if (strcmp(s,"posInT_pLength")==0)
2308  else if (strcmp(s,"posInT0")==0)
2310  else if (strcmp(s,"posInT1")==0)
2312  else if (strcmp(s,"posInT2")==0)
2314  else if (strcmp(s,"posInT11")==0)
2316  else if (strcmp(s,"posInT110")==0)
2318  else if (strcmp(s,"posInT13")==0)
2320  else if (strcmp(s,"posInT15")==0)
2322  else if (strcmp(s,"posInT17")==0)
2324  else if (strcmp(s,"posInT17_c")==0)
2326  else if (strcmp(s,"posInT19")==0)
2328  else PrintS("valid posInT:0,1,2,11,110,13,15,17,17_c,19,_EcartFDegpLength,_FDegpLength,_pLength,_EcartpLength\n");
2329  }
2330  else
2331  {
2332  test_PosInT=NULL;
2333  test_PosInL=NULL;
2334  }
2335  si_opt_2|=Sy_bit(23);
2336  return FALSE;
2337  }
2338  else
2339  /*==================== locNF ======================================*/
2340  if(strcmp(sys_cmd,"locNF")==0)
2341  {
2342  const short t[]={4,VECTOR_CMD,MODUL_CMD,INT_CMD,INTVEC_CMD};
2343  if (iiCheckTypes(h,t,1))
2344  {
2345  poly f=(poly)h->Data();
2346  h=h->next;
2347  ideal m=(ideal)h->Data();
2348  assumeStdFlag(h);
2349  h=h->next;
2350  int n=(int)((long)h->Data());
2351  h=h->next;
2352  intvec *v=(intvec *)h->Data();
2353 
2354  /* == now the work starts == */
2355 
2356  short * iv=iv2array(v, currRing);
2357  poly r=0;
2358  poly hp=ppJetW(f,n,iv);
2359  int s=MATCOLS(m);
2360  int j=0;
2361  matrix T=mp_InitI(s,1,0, currRing);
2362 
2363  while (hp != NULL)
2364  {
2365  if (pDivisibleBy(m->m[j],hp))
2366  {
2367  if (MATELEM(T,j+1,1)==0)
2368  {
2369  MATELEM(T,j+1,1)=pDivideM(pHead(hp),pHead(m->m[j]));
2370  }
2371  else
2372  {
2373  pAdd(MATELEM(T,j+1,1),pDivideM(pHead(hp),pHead(m->m[j])));
2374  }
2375  hp=ppJetW(ksOldSpolyRed(m->m[j],hp,0),n,iv);
2376  j=0;
2377  }
2378  else
2379  {
2380  if (j==s-1)
2381  {
2382  r=pAdd(r,pHead(hp));
2383  hp=pLmDeleteAndNext(hp); /* hp=pSub(hp,pHead(hp));*/
2384  j=0;
2385  }
2386  else
2387  {
2388  j++;
2389  }
2390  }
2391  }
2392 
2395  for (int k=1;k<=MATROWS(Temp);k++)
2396  {
2397  MATELEM(R,k,1)=MATELEM(Temp,k,1);
2398  }
2399 
2401  L->Init(2);
2402  L->m[0].rtyp=MATRIX_CMD; L->m[0].data=(void *)R;
2403  L->m[1].rtyp=MATRIX_CMD; L->m[1].data=(void *)T;
2404  res->data=L;
2405  res->rtyp=LIST_CMD;
2406  // iv aufraeumen
2407  omFree(iv);
2408  return FALSE;
2409  }
2410  else
2411  return TRUE;
2412  }
2413  else
2414  /*==================== poly debug ==================================*/
2415  if(strcmp(sys_cmd,"p")==0)
2416  {
2417 # ifdef RDEBUG
2418  p_DebugPrint((poly)h->Data(), currRing);
2419 # else
2420  Warn("Sorry: not available for release build!");
2421 # endif
2422  return FALSE;
2423  }
2424  else
2425  /*==================== setsyzcomp ==================================*/
2426  if(strcmp(sys_cmd,"setsyzcomp")==0)
2427  {
2428  if ((h!=NULL) && (h->Typ()==INT_CMD))
2429  {
2430  int k = (int)(long)h->Data();
2431  if ( currRing->order[0] == ringorder_s )
2432  {
2433  rSetSyzComp(k, currRing);
2434  }
2435  }
2436  }
2437  /*==================== ring debug ==================================*/
2438  if(strcmp(sys_cmd,"r")==0)
2439  {
2440 # ifdef RDEBUG
2441  rDebugPrint((ring)h->Data());
2442 # else
2443  Warn("Sorry: not available for release build!");
2444 # endif
2445  return FALSE;
2446  }
2447  else
2448  /*==================== changeRing ========================*/
2449  /* The following code changes the names of the variables in the
2450  current ring to "x1", "x2", ..., "xN", where N is the number
2451  of variables in the current ring.
2452  The purpose of this rewriting is to eliminate indexed variables,
2453  as they may cause problems when generating scripts for Magma,
2454  Maple, or Macaulay2. */
2455  if(strcmp(sys_cmd,"changeRing")==0)
2456  {
2457  int varN = currRing->N;
2458  char h[10];
2459  for (int i = 1; i <= varN; i++)
2460  {
2461  omFree(currRing->names[i - 1]);
2462  sprintf(h, "x%d", i);
2463  currRing->names[i - 1] = omStrDup(h);
2464  }
2466  res->rtyp = INT_CMD;
2467  res->data = (void*)0L;
2468  return FALSE;
2469  }
2470  else
2471  /*==================== mtrack ==================================*/
2472  if(strcmp(sys_cmd,"mtrack")==0)
2473  {
2474  #ifdef OM_TRACK
2475  om_Opts.MarkAsStatic = 1;
2476  FILE *fd = NULL;
2477  int max = 5;
2478  while (h != NULL)
2479  {
2480  omMarkAsStaticAddr(h);
2481  if (fd == NULL && h->Typ()==STRING_CMD)
2482  {
2483  fd = fopen((char*) h->Data(), "w");
2484  if (fd == NULL)
2485  Warn("Can not open %s for writing og mtrack. Using stdout"); // %s ???
2486  }
2487  if (h->Typ() == INT_CMD)
2488  {
2489  max = (int)(long)h->Data();
2490  }
2491  h = h->Next();
2492  }
2493  omPrintUsedTrackAddrs((fd == NULL ? stdout : fd), max);
2494  if (fd != NULL) fclose(fd);
2495  om_Opts.MarkAsStatic = 0;
2496  return FALSE;
2497  #endif
2498  }
2499  /*==================== mtrack_all ==================================*/
2500  if(strcmp(sys_cmd,"mtrack_all")==0)
2501  {
2502  #ifdef OM_TRACK
2503  om_Opts.MarkAsStatic = 1;
2504  FILE *fd = NULL;
2505  if ((h!=NULL) &&(h->Typ()==STRING_CMD))
2506  {
2507  fd = fopen((char*) h->Data(), "w");
2508  if (fd == NULL)
2509  Warn("Can not open %s for writing og mtrack. Using stdout");
2510  omMarkAsStaticAddr(h);
2511  }
2512  // OB: TBC print to fd
2513  omPrintUsedAddrs((fd == NULL ? stdout : fd), 5);
2514  if (fd != NULL) fclose(fd);
2515  om_Opts.MarkAsStatic = 0;
2516  return FALSE;
2517  #endif
2518  }
2519  else
2520  /*==================== backtrace ==================================*/
2521  #ifndef OM_NDEBUG
2522  if(strcmp(sys_cmd,"backtrace")==0)
2523  {
2524  omPrintCurrentBackTrace(stdout);
2525  return FALSE;
2526  }
2527  else
2528  #endif
2529 
2530 #if !defined(OM_NDEBUG)
2531  /*==================== omMemoryTest ==================================*/
2532  if (strcmp(sys_cmd,"omMemoryTest")==0)
2533  {
2534 
2535 #ifdef OM_STATS_H
2536  PrintS("\n[om_Info]: \n");
2537  omUpdateInfo();
2538 #define OM_PRINT(name) Print(" %-22s : %10ld \n", #name, om_Info . name)
2539  OM_PRINT(MaxBytesSystem);
2540  OM_PRINT(CurrentBytesSystem);
2541  OM_PRINT(MaxBytesSbrk);
2542  OM_PRINT(CurrentBytesSbrk);
2543  OM_PRINT(MaxBytesMmap);
2544  OM_PRINT(CurrentBytesMmap);
2545  OM_PRINT(UsedBytes);
2546  OM_PRINT(AvailBytes);
2547  OM_PRINT(UsedBytesMalloc);
2548  OM_PRINT(AvailBytesMalloc);
2549  OM_PRINT(MaxBytesFromMalloc);
2550  OM_PRINT(CurrentBytesFromMalloc);
2551  OM_PRINT(MaxBytesFromValloc);
2552  OM_PRINT(CurrentBytesFromValloc);
2553  OM_PRINT(UsedBytesFromValloc);
2554  OM_PRINT(AvailBytesFromValloc);
2555  OM_PRINT(MaxPages);
2556  OM_PRINT(UsedPages);
2557  OM_PRINT(AvailPages);
2558  OM_PRINT(MaxRegionsAlloc);
2559  OM_PRINT(CurrentRegionsAlloc);
2560 #undef OM_PRINT
2561 #endif
2562 
2563 #ifdef OM_OPTS_H
2564  PrintS("\n[om_Opts]: \n");
2565 #define OM_PRINT(format, name) Print(" %-22s : %10" format"\n", #name, om_Opts . name)
2566  OM_PRINT("d", MinTrack);
2567  OM_PRINT("d", MinCheck);
2568  OM_PRINT("d", MaxTrack);
2569  OM_PRINT("d", MaxCheck);
2570  OM_PRINT("d", Keep);
2571  OM_PRINT("d", HowToReportErrors);
2572  OM_PRINT("d", MarkAsStatic);
2573  OM_PRINT("u", PagesPerRegion);
2574  OM_PRINT("p", OutOfMemoryFunc);
2575  OM_PRINT("p", MemoryLowFunc);
2576  OM_PRINT("p", ErrorHook);
2577 #undef OM_PRINT
2578 #endif
2579 
2580 #ifdef OM_ERROR_H
2581  Print("\n\n[om_ErrorStatus] : '%s' (%s)\n",
2584  Print("[om_InternalErrorStatus]: '%s' (%s)\n",
2587 
2588 #endif
2589 
2590 // omTestMemory(1);
2591 // omtTestErrors();
2592  return FALSE;
2593  }
2594  else
2595 #endif
2596  /*==================== pDivStat =============================*/
2597  #if defined(PDEBUG) || defined(PDIV_DEBUG)
2598  if(strcmp(sys_cmd,"pDivStat")==0)
2599  {
2600  extern void pPrintDivisbleByStat();
2602  return FALSE;
2603  }
2604  else
2605  #endif
2606  /*==================== alarm ==================================*/
2607  #ifdef unix
2608  if(strcmp(sys_cmd,"alarm")==0)
2609  {
2610  if ((h!=NULL) &&(h->Typ()==INT_CMD))
2611  {
2612  // standard variant -> SIGALARM (standard: abort)
2613  //alarm((unsigned)h->next->Data());
2614  // process time (user +system): SIGVTALARM
2615  struct itimerval t,o;
2616  memset(&t,0,sizeof(t));
2617  t.it_value.tv_sec =(unsigned)((unsigned long)h->Data());
2618  setitimer(ITIMER_VIRTUAL,&t,&o);
2619  return FALSE;
2620  }
2621  else
2622  WerrorS("int expected");
2623  }
2624  else
2625  #endif
2626  /*==================== red =============================*/
2627  #if 0
2628  if(strcmp(sys_cmd,"red")==0)
2629  {
2630  if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
2631  {
2632  res->rtyp=IDEAL_CMD;
2633  res->data=(void *)kStdred((ideal)h->Data(),NULL,testHomog,NULL);
2634  setFlag(res,FLAG_STD);
2635  return FALSE;
2636  }
2637  else
2638  WerrorS("ideal expected");
2639  }
2640  else
2641  #endif
2642  /*==================== fastcomb =============================*/
2643  if(strcmp(sys_cmd,"fastcomb")==0)
2644  {
2645  if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
2646  {
2647  if (h->next!=NULL)
2648  {
2649  if (h->next->Typ()!=POLY_CMD)
2650  {
2651  Warn("Wrong types for poly= comb(ideal,poly)");
2652  }
2653  }
2654  res->rtyp=POLY_CMD;
2655  res->data=(void *) fglmLinearCombination(
2656  (ideal)h->Data(),(poly)h->next->Data());
2657  return FALSE;
2658  }
2659  else
2660  WerrorS("ideal expected");
2661  }
2662  else
2663  /*==================== comb =============================*/
2664  if(strcmp(sys_cmd,"comb")==0)
2665  {
2666  if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
2667  {
2668  if (h->next!=NULL)
2669  {
2670  if (h->next->Typ()!=POLY_CMD)
2671  {
2672  Warn("Wrong types for poly= comb(ideal,poly)");
2673  }
2674  }
2675  res->rtyp=POLY_CMD;
2676  res->data=(void *)fglmNewLinearCombination(
2677  (ideal)h->Data(),(poly)h->next->Data());
2678  return FALSE;
2679  }
2680  else
2681  WerrorS("ideal expected");
2682  }
2683  else
2684  #if 0 /* debug only */
2685  /*==================== listall ===================================*/
2686  if(strcmp(sys_cmd,"listall")==0)
2687  {
2688  void listall(int showproc);
2689  int showproc=0;
2690  if ((h!=NULL) && (h->Typ()==INT_CMD)) showproc=(int)((long)h->Data());
2691  listall(showproc);
2692  return FALSE;
2693  }
2694  else
2695  #endif
2696  #if 0 /* debug only */
2697  /*==================== proclist =================================*/
2698  if(strcmp(sys_cmd,"proclist")==0)
2699  {
2700  void piShowProcList();
2701  piShowProcList();
2702  return FALSE;
2703  }
2704  else
2705  #endif
2706  /* ==================== newton ================================*/
2707  #ifdef HAVE_NEWTON
2708  if(strcmp(sys_cmd,"newton")==0)
2709  {
2710  if ((h->Typ()!=POLY_CMD)
2711  || (h->next->Typ()!=INT_CMD)
2712  || (h->next->next->Typ()!=INT_CMD))
2713  {
2714  WerrorS("system(\"newton\",<poly>,<int>,<int>) expected");
2715  return TRUE;
2716  }
2717  poly p=(poly)(h->Data());
2718  int l=pLength(p);
2719  short *points=(short *)omAlloc(currRing->N*l*sizeof(short));
2720  int i,j,k;
2721  k=0;
2722  poly pp=p;
2723  for (i=0;pp!=NULL;i++)
2724  {
2725  for(j=1;j<=currRing->N;j++)
2726  {
2727  points[k]=pGetExp(pp,j);
2728  k++;
2729  }
2730  pIter(pp);
2731  }
2732  hc_ERG r=hc_KOENIG(currRing->N, // dimension
2733  l, // number of points
2734  (short*) points, // points: x_1, y_1,z_1, x_2,y_2,z2,...
2735  currRing->OrdSgn==-1,
2736  (int) (h->next->Data()), // 1: Milnor, 0: Newton
2737  (int) (h->next->next->Data()) // debug
2738  );
2739  //----<>---Output-----------------------
2740 
2741 
2742  // PrintS("Bin jetzt in extra.cc bei der Auswertung.\n"); // **********
2743 
2744 
2746  L->Init(6);
2747  L->m[0].rtyp=STRING_CMD; // newtonnumber;
2748  L->m[0].data=(void *)omStrDup(r.nZahl);
2749  L->m[1].rtyp=INT_CMD;
2750  L->m[1].data=(void *)(long)r.achse; // flag for unoccupied axes
2751  L->m[2].rtyp=INT_CMD;
2752  L->m[2].data=(void *)(long)r.deg; // #degenerations
2753  if ( r.deg != 0) // only if degenerations exist
2754  {
2755  L->m[3].rtyp=INT_CMD;
2756  L->m[3].data=(void *)(long)r.anz_punkte; // #points
2757  //---<>--number of points------
2758  int anz = r.anz_punkte; // number of points
2759  int dim = (currRing->N); // dimension
2760  intvec* v = new intvec( anz*dim );
2761  for (i=0; i<anz*dim; i++) // copy points
2762  (*v)[i] = r.pu[i];
2763  L->m[4].rtyp=INTVEC_CMD;
2764  L->m[4].data=(void *)v;
2765  //---<>--degenerations---------
2766  int deg = r.deg; // number of points
2767  intvec* w = new intvec( r.speicher ); // necessary memory
2768  i=0; // start copying
2769  do
2770  {
2771  (*w)[i] = r.deg_tab[i];
2772  i++;
2773  }
2774  while (r.deg_tab[i-1] != -2); // mark for end of list
2775  L->m[5].rtyp=INTVEC_CMD;
2776  L->m[5].data=(void *)w;
2777  }
2778  else
2779  {
2780  L->m[3].rtyp=INT_CMD; L->m[3].data=(char *)0;
2781  L->m[4].rtyp=DEF_CMD;
2782  L->m[5].rtyp=DEF_CMD;
2783  }
2784 
2785  res->data=(void *)L;
2786  res->rtyp=LIST_CMD;
2787  // free all pointer in r:
2788  delete[] r.nZahl;
2789  delete[] r.pu;
2790  delete[] r.deg_tab; // Ist das ein Problem??
2791 
2792  omFreeSize((ADDRESS)points,currRing->N*l*sizeof(short));
2793  return FALSE;
2794  }
2795  else
2796  #endif
2797  /*==== connection to Sebastian Jambor's code ======*/
2798  /* This code connects Sebastian Jambor's code for
2799  computing the minimal polynomial of an (n x n) matrix
2800  with entries in F_p to SINGULAR. Two conversion methods
2801  are needed; see further up in this file:
2802  (1) conversion of a matrix with long entries to
2803  a SINGULAR matrix with number entries, where
2804  the numbers are coefficients in currRing;
2805  (2) conversion of an array of longs (encoding the
2806  coefficients of the minimal polynomial) to a
2807  SINGULAR poly living in currRing. */
2808  if (strcmp(sys_cmd, "minpoly") == 0)
2809  {
2810  if ((h == NULL) || (h->Typ() != MATRIX_CMD) || h->next != NULL)
2811  {
2812  Werror("expected exactly one argument: %s",
2813  "a square matrix with number entries");
2814  return TRUE;
2815  }
2816  else
2817  {
2818  matrix m = (matrix)h->Data();
2819  int n = m->rows();
2820  unsigned long p = (unsigned long)n_GetChar(currRing->cf);
2821  if (n != m->cols())
2822  {
2823  WerrorS("expected exactly one argument: "
2824  "a square matrix with number entries");
2825  return TRUE;
2826  }
2827  unsigned long** ml = singularMatrixToLongMatrix(m);
2828  unsigned long* polyCoeffs = computeMinimalPolynomial(ml, n, p);
2829  poly theMinPoly = longCoeffsToSingularPoly(polyCoeffs, n);
2830  res->rtyp = POLY_CMD;
2831  res->data = (void *)theMinPoly;
2832  for (int i = 0; i < n; i++) delete[] ml[i];
2833  delete[] ml;
2834  delete[] polyCoeffs;
2835  return FALSE;
2836  }
2837  }
2838  else
2839  /*==================== sdb_flags =================*/
2840  #ifdef HAVE_SDB
2841  if (strcmp(sys_cmd, "sdb_flags") == 0)
2842  {
2843  if ((h!=NULL) && (h->Typ()==INT_CMD))
2844  {
2845  sdb_flags=(int)((long)h->Data());
2846  }
2847  else
2848  {
2849  WerrorS("system(\"sdb_flags\",`int`) expected");
2850  return TRUE;
2851  }
2852  return FALSE;
2853  }
2854  else
2855  #endif
2856  /*==================== sdb_edit =================*/
2857  #ifdef HAVE_SDB
2858  if (strcmp(sys_cmd, "sdb_edit") == 0)
2859  {
2860  if ((h!=NULL) && (h->Typ()==PROC_CMD))
2861  {
2862  procinfov p=(procinfov)h->Data();
2863  sdb_edit(p);
2864  }
2865  else
2866  {
2867  WerrorS("system(\"sdb_edit\",`proc`) expected");
2868  return TRUE;
2869  }
2870  return FALSE;
2871  }
2872  else
2873  #endif
2874  /*==================== GF =================*/
2875  #if 0 // for testing only
2876  if (strcmp(sys_cmd, "GF") == 0)
2877  {
2878  if ((h!=NULL) && (h->Typ()==POLY_CMD))
2879  {
2880  int c=rChar(currRing);
2881  setCharacteristic( c,nfMinPoly[0], currRing->parameter[0][0] );
2882  CanonicalForm F( convSingGFFactoryGF( (poly)h->Data(), currRing ) );
2883  res->rtyp=POLY_CMD;
2884  res->data=convFactoryGFSingGF( F, currRing );
2885  return FALSE;
2886  }
2887  else { WerrorS("wrong typ"); return TRUE;}
2888  }
2889  else
2890  #endif
2891  /*==================== SVD =================*/
2892  #ifdef HAVE_SVD
2893  if (strcmp(sys_cmd, "svd") == 0)
2894  {
2895  extern lists testsvd(matrix M);
2896  res->rtyp=LIST_CMD;
2897  res->data=(char*)(testsvd((matrix)h->Data()));
2898  eturn FALSE;
2899  }
2900  else
2901  #endif
2902 
2903 
2904  /*==================== DLL =================*/
2905  #ifdef __CYGWIN__
2906  #ifdef HAVE_DL
2907  /* testing the DLL functionality under Win32 */
2908  if (strcmp(sys_cmd, "DLL") == 0)
2909  {
2910  typedef void (*Void_Func)();
2911  typedef int (*Int_Func)(int);
2912  void *hh=dynl_open("WinDllTest.dll");
2913  if ((h!=NULL) && (h->Typ()==INT_CMD))
2914  {
2915  int (*f)(int);
2916  if (hh!=NULL)
2917  {
2918  int (*f)(int);
2919  f=(Int_Func)dynl_sym(hh,"PlusDll");
2920  int i=10;
2921  if (f!=NULL) printf("%d\n",f(i));
2922  else PrintS("cannot find PlusDll\n");
2923  }
2924  }
2925  else
2926  {
2927  void (*f)();
2928  f= (Void_Func)dynl_sym(hh,"TestDll");
2929  if (f!=NULL) f();
2930  else PrintS("cannot find TestDll\n");
2931  }
2932  return FALSE;
2933  }
2934  else
2935  #endif
2936  #endif
2937  #ifdef HAVE_RING2TOM
2938  /*==================== ring-GB ==================================*/
2939  if (strcmp(sys_cmd, "findZeroPoly")==0)
2940  {
2941  ring r = currRing;
2942  poly f = (poly) h->Data();
2943  res->rtyp=POLY_CMD;
2944  res->data=(poly) kFindZeroPoly(f, r, r);
2945  return(FALSE);
2946  }
2947  else
2948  /*==================== Creating zero polynomials =================*/
2949  #ifdef HAVE_VANIDEAL
2950  if (strcmp(sys_cmd, "createG0")==0)
2951  {
2952  /* long exp[50];
2953  int N = 0;
2954  while (h != NULL)
2955  {
2956  N += 1;
2957  exp[N] = (long) h->Data();
2958  // if (exp[i] % 2 != 0) exp[i] -= 1;
2959  h = h->next;
2960  }
2961  for (int k = 1; N + k <= currRing->N; k++) exp[k] = 0;
2962 
2963  poly t_p;
2964  res->rtyp=POLY_CMD;
2965  res->data= (poly) kCreateZeroPoly(exp, -1, &t_p, currRing, currRing);
2966  return(FALSE); */
2967 
2968  res->rtyp = IDEAL_CMD;
2969  res->data = (ideal) createG0();
2970  return(FALSE);
2971  }
2972  else
2973  #endif
2974  /*==================== redNF_ring =================*/
2975  if (strcmp(sys_cmd, "redNF_ring")==0)
2976  {
2977  ring r = currRing;
2978  poly f = (poly) h->Data();
2979  h = h->next;
2980  ideal G = (ideal) h->Data();
2981  res->rtyp=POLY_CMD;
2982  res->data=(poly) ringRedNF(f, G, r);
2983  return(FALSE);
2984  }
2985  else
2986  #endif
2987  /*==================== Roune Hilb =================*/
2988  if (strcmp(sys_cmd, "hilbroune") == 0)
2989  {
2990  ideal I;
2991  if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
2992  {
2993  I=(ideal)h->CopyD();
2994  slicehilb(I);
2995  }
2996  else return TRUE;
2997  return FALSE;
2998  }
2999  else
3000  /*==================== F5 Implementation =================*/
3001  #ifdef HAVE_F5
3002  if (strcmp(sys_cmd, "f5")==0)
3003  {
3004  if (h->Typ()!=IDEAL_CMD)
3005  {
3006  WerrorS("ideal expected");
3007  return TRUE;
3008  }
3009 
3010  ring r = currRing;
3011  ideal G = (ideal) h->Data();
3012  h = h->next;
3013  int opt;
3014  if(h != NULL) {
3015  opt = (int) (long) h->Data();
3016  }
3017  else {
3018  opt = 2;
3019  }
3020  h = h->next;
3021  int plus;
3022  if(h != NULL) {
3023  plus = (int) (long) h->Data();
3024  }
3025  else {
3026  plus = 0;
3027  }
3028  h = h->next;
3029  int termination;
3030  if(h != NULL) {
3031  termination = (int) (long) h->Data();
3032  }
3033  else {
3034  termination = 0;
3035  }
3036  res->rtyp=IDEAL_CMD;
3037  res->data=(ideal) F5main(G,r,opt,plus,termination);
3038  return FALSE;
3039  }
3040  else
3041  #endif
3042  /*==================== Testing groebner basis =================*/
3043  #ifdef HAVE_RINGS
3044  if (strcmp(sys_cmd, "NF_ring")==0)
3045  {
3046  ring r = currRing;
3047  poly f = (poly) h->Data();
3048  h = h->next;
3049  ideal G = (ideal) h->Data();
3050  res->rtyp=POLY_CMD;
3051  res->data=(poly) ringNF(f, G, r);
3052  return(FALSE);
3053  }
3054  else
3055  if (strcmp(sys_cmd, "spoly")==0)
3056  {
3057  poly f = pCopy((poly) h->Data());
3058  h = h->next;
3059  poly g = pCopy((poly) h->Data());
3060 
3061  res->rtyp=POLY_CMD;
3062  res->data=(poly) plain_spoly(f,g);
3063  return(FALSE);
3064  }
3065  else
3066  if (strcmp(sys_cmd, "testGB")==0)
3067  {
3068  ideal I = (ideal) h->Data();
3069  h = h->next;
3070  ideal GI = (ideal) h->Data();
3071  res->rtyp = INT_CMD;
3072  res->data = (void *)(long) testGB(I, GI);
3073  return(FALSE);
3074  }
3075  else
3076  #endif
3077  /*==================== sca:AltVar ==================================*/
3078  #ifdef HAVE_PLURAL
3079  if ( (strcmp(sys_cmd, "AltVarStart") == 0) || (strcmp(sys_cmd, "AltVarEnd") == 0) )
3080  {
3081  ring r = currRing;
3082 
3083  if((h!=NULL) && (h->Typ()==RING_CMD)) r = (ring)h->Data(); else
3084  {
3085  WerrorS("`system(\"AltVarStart/End\"[,<ring>])` expected");
3086  return TRUE;
3087  }
3088 
3089  res->rtyp=INT_CMD;
3090 
3091  if (rIsSCA(r))
3092  {
3093  if(strcmp(sys_cmd, "AltVarStart") == 0)
3094  res->data = (void*)(long)scaFirstAltVar(r);
3095  else
3096  res->data = (void*)(long)scaLastAltVar(r);
3097  return FALSE;
3098  }
3099 
3100  WerrorS("`system(\"AltVarStart/End\",<ring>) requires a SCA ring");
3101  return TRUE;
3102  }
3103  else
3104  #endif
3105  /*==================== RatNF, noncomm rational coeffs =================*/
3106  #ifdef HAVE_RATGRING
3107  if (strcmp(sys_cmd, "intratNF") == 0)
3108  {
3109  poly p;
3110  poly *q;
3111  ideal I;
3112  int is, k, id;
3113  if ((h!=NULL) && (h->Typ()==POLY_CMD))
3114  {
3115  p=(poly)h->CopyD();
3116  h=h->next;
3117  // PrintS("poly is done\n");
3118  }
3119  else return TRUE;
3120  if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
3121  {
3122  I=(ideal)h->CopyD();
3123  q = I->m;
3124  h=h->next;
3125  // PrintS("ideal is done\n");
3126  }
3127  else return TRUE;
3128  if ((h!=NULL) && (h->Typ()==INT_CMD))
3129  {
3130  is=(int)((long)(h->Data()));
3131  // res->rtyp=INT_CMD;
3132  // PrintS("int is done\n");
3133  // res->rtyp=IDEAL_CMD;
3134  if (rIsPluralRing(currRing))
3135  {
3136  id = IDELEMS(I);
3137  int *pl=(int*)omAlloc0(IDELEMS(I)*sizeof(int));
3138  for(k=0; k < id; k++)
3139  {
3140  pl[k] = pLength(I->m[k]);
3141  }
3142  PrintS("starting redRat\n");
3143  //res->data = (char *)
3144  redRat(&p, q, pl, (int)IDELEMS(I),is,currRing);
3145  res->data=p;
3146  res->rtyp=POLY_CMD;
3147  // res->data = ncGCD(p,q,currRing);
3148  }
3149  else
3150  {
3151  res->rtyp=POLY_CMD;
3152  res->data=p;
3153  }
3154  }
3155  else return TRUE;
3156  return FALSE;
3157  }
3158  else
3159  /*==================== RatNF, noncomm rational coeffs =================*/
3160  if (strcmp(sys_cmd, "ratNF") == 0)
3161  {
3162  poly p,q;
3163  int is, htype;
3164  if ((h!=NULL) && ( (h->Typ()==POLY_CMD) || (h->Typ()==VECTOR_CMD) ) )
3165  {
3166  p=(poly)h->CopyD();
3167  h=h->next;
3168  htype = h->Typ();
3169  }
3170  else return TRUE;
3171  if ((h!=NULL) && ( (h->Typ()==POLY_CMD) || (h->Typ()==VECTOR_CMD) ) )
3172  {
3173  q=(poly)h->CopyD();
3174  h=h->next;
3175  }
3176  else return TRUE;
3177  if ((h!=NULL) && (h->Typ()==INT_CMD))
3178  {
3179  is=(int)((long)(h->Data()));
3180  res->rtyp=htype;
3181  // res->rtyp=IDEAL_CMD;
3182  if (rIsPluralRing(currRing))
3183  {
3184  res->data = nc_rat_ReduceSpolyNew(q,p,is, currRing);
3185  // res->data = ncGCD(p,q,currRing);
3186  }
3187  else res->data=p;
3188  }
3189  else return TRUE;
3190  return FALSE;
3191  }
3192  else
3193  /*==================== RatSpoly, noncomm rational coeffs =================*/
3194  if (strcmp(sys_cmd, "ratSpoly") == 0)
3195  {
3196  poly p,q;
3197  int is;
3198  if ((h!=NULL) && (h->Typ()==POLY_CMD))
3199  {
3200  p=(poly)h->CopyD();
3201  h=h->next;
3202  }
3203  else return TRUE;
3204  if ((h!=NULL) && (h->Typ()==POLY_CMD))
3205  {
3206  q=(poly)h->CopyD();
3207  h=h->next;
3208  }
3209  else return TRUE;
3210  if ((h!=NULL) && (h->Typ()==INT_CMD))
3211  {
3212  is=(int)((long)(h->Data()));
3213  res->rtyp=POLY_CMD;
3214  // res->rtyp=IDEAL_CMD;
3215  if (rIsPluralRing(currRing))
3216  {
3217  res->data = nc_rat_CreateSpoly(p,q,is,currRing);
3218  // res->data = ncGCD(p,q,currRing);
3219  }
3220  else res->data=p;
3221  }
3222  else return TRUE;
3223  return FALSE;
3224  }
3225  else
3226  #endif // HAVE_RATGRING
3227  /*==================== Rat def =================*/
3228  if (strcmp(sys_cmd, "ratVar") == 0)
3229  {
3230  int start,end;
3231  if ((h!=NULL) && (h->Typ()==POLY_CMD))
3232  {
3233  start=pIsPurePower((poly)h->Data());
3234  h=h->next;
3235  }
3236  else return TRUE;
3237  if ((h!=NULL) && (h->Typ()==POLY_CMD))
3238  {
3239  end=pIsPurePower((poly)h->Data());
3240  h=h->next;
3241  }
3242  else return TRUE;
3243  currRing->real_var_start=start;
3244  currRing->real_var_end=end;
3245  return (start==0)||(end==0)||(start>end);
3246  }
3247  else
3248  /*==================== t-rep-GB ==================================*/
3249  if (strcmp(sys_cmd, "unifastmult")==0)
3250  {
3251  poly f = (poly)h->Data();
3252  h=h->next;
3253  poly g=(poly)h->Data();
3254  res->rtyp=POLY_CMD;
3255  res->data=unifastmult(f,g,currRing);
3256  return(FALSE);
3257  }
3258  else
3259  if (strcmp(sys_cmd, "multifastmult")==0)
3260  {
3261  poly f = (poly)h->Data();
3262  h=h->next;
3263  poly g=(poly)h->Data();
3264  res->rtyp=POLY_CMD;
3265  res->data=multifastmult(f,g,currRing);
3266  return(FALSE);
3267  }
3268  else
3269  if (strcmp(sys_cmd, "mults")==0)
3270  {
3271  res->rtyp=INT_CMD ;
3272  res->data=(void*)(long) Mults();
3273  return(FALSE);
3274  }
3275  else
3276  if (strcmp(sys_cmd, "fastpower")==0)
3277  {
3278  ring r = currRing;
3279  poly f = (poly)h->Data();
3280  h=h->next;
3281  int n=(int)((long)h->Data());
3282  res->rtyp=POLY_CMD ;
3283  res->data=(void*) pFastPower(f,n,r);
3284  return(FALSE);
3285  }
3286  else
3287  if (strcmp(sys_cmd, "normalpower")==0)
3288  {
3289  poly f = (poly)h->Data();
3290  h=h->next;
3291  int n=(int)((long)h->Data());
3292  res->rtyp=POLY_CMD ;
3293  res->data=(void*) pPower(pCopy(f),n);
3294  return(FALSE);
3295  }
3296  else
3297  if (strcmp(sys_cmd, "MCpower")==0)
3298  {
3299  ring r = currRing;
3300  poly f = (poly)h->Data();
3301  h=h->next;
3302  int n=(int)((long)h->Data());
3303  res->rtyp=POLY_CMD ;
3304  res->data=(void*) pFastPowerMC(f,n,r);
3305  return(FALSE);
3306  }
3307  else
3308  if (strcmp(sys_cmd, "bit_subst")==0)
3309  {
3310  ring r = currRing;
3311  poly outer = (poly)h->Data();
3312  h=h->next;
3313  poly inner=(poly)h->Data();
3314  res->rtyp=POLY_CMD ;
3315  res->data=(void*) uni_subst_bits(outer, inner,r);
3316  return(FALSE);
3317  }
3318  else
3319  /*==================== gcd-varianten =================*/
3320  if (strcmp(sys_cmd, "gcd") == 0)
3321  {
3322  if (h==NULL)
3323  {
3324 #ifdef HAVE_PLURAL
3325  Print("EZGCD:%d (use EZGCD for gcd of polynomials in char 0)\n",isOn(SW_USE_EZGCD));
3326  Print("EZGCD_P:%d (use EZGCD_P for gcd of polynomials in char p)\n",isOn(SW_USE_EZGCD_P));
3327  Print("CRGCD:%d (use chinese Remainder for gcd of polynomials in char 0)\n",isOn(SW_USE_CHINREM_GCD));
3328  Print("QGCD:%d (use QGCD for gcd of polynomials in alg. ext.)\n",isOn(SW_USE_QGCD));
3329 #endif
3330  Print("homog:%d (use homog. test for factorization of polynomials)\n",singular_homog_flag);
3331  return FALSE;
3332  }
3333  else
3334  if ((h!=NULL) && (h->Typ()==STRING_CMD)
3335  && (h->next!=NULL) && (h->next->Typ()==INT_CMD))
3336  {
3337  int d=(int)(long)h->next->Data();
3338  char *s=(char *)h->Data();
3339 #ifdef HAVE_PLURAL
3340  if (strcmp(s,"EZGCD")==0) { if (d) On(SW_USE_EZGCD); else Off(SW_USE_EZGCD); } else
3341  if (strcmp(s,"EZGCD_P")==0) { if (d) On(SW_USE_EZGCD_P); else Off(SW_USE_EZGCD_P); } else
3342  if (strcmp(s,"CRGCD")==0) { if (d) On(SW_USE_CHINREM_GCD); else Off(SW_USE_CHINREM_GCD); } else
3343  if (strcmp(s,"QGCD")==0) { if (d) On(SW_USE_QGCD); else Off(SW_USE_QGCD); } else
3344 #endif
3345  if (strcmp(s,"homog")==0) { if (d) singular_homog_flag=1; else singular_homog_flag=0; } else
3346  return TRUE;
3347  return FALSE;
3348  }
3349  else return TRUE;
3350  }
3351  else
3352  /*==================== subring =================*/
3353  if (strcmp(sys_cmd, "subring") == 0)
3354  {
3355  if (h!=NULL)
3356  {
3357  extern ring rSubring(ring r,leftv v); /* ipshell.cc*/
3358  res->data=(char *)rSubring(currRing,h);
3359  res->rtyp=RING_CMD;
3360  return res->data==NULL;
3361  }
3362  else return TRUE;
3363  }
3364  else
3365  /*==================== HNF =================*/
3366  #ifdef HAVE_NTL
3367  if (strcmp(sys_cmd, "HNF") == 0)
3368  {
3369  if (h!=NULL)
3370  {
3371  res->rtyp=h->Typ();
3372  if (h->Typ()==MATRIX_CMD)
3373  {
3374  res->data=(char *)singntl_HNF((matrix)h->Data(), currRing);
3375  return FALSE;
3376  }
3377  else if (h->Typ()==INTMAT_CMD)
3378  {
3379  res->data=(char *)singntl_HNF((intvec*)h->Data());
3380  return FALSE;
3381  }
3382  else if (h->Typ()==INTMAT_CMD)
3383  {
3384  res->data=(char *)singntl_HNF((intvec*)h->Data());
3385  return FALSE;
3386  }
3387  else
3388  {
3389  WerrorS("expected `system(\"HNF\",<matrix|intmat|bigintmat>)`");
3390  return TRUE;
3391  }
3392  }
3393  else return TRUE;
3394  }
3395  else
3396  /*================= probIrredTest ======================*/
3397  if (strcmp (sys_cmd, "probIrredTest") == 0)
3398  {
3399  if (h!=NULL && (h->Typ()== POLY_CMD) && ((h->next != NULL) && h->next->Typ() == STRING_CMD))
3400  {
3401  CanonicalForm F= convSingPFactoryP((poly)(h->Data()), currRing);
3402  char *s=(char *)h->next->Data();
3403  double error= atof (s);
3404  int irred= probIrredTest (F, error);
3405  res->rtyp= INT_CMD;
3406  res->data= (void*)(long)irred;
3407  return FALSE;
3408  }
3409  else return TRUE;
3410  }
3411  else
3412  #endif
3413  #ifdef __CYGWIN__
3414  /*==================== Python Singular =================*/
3415  if (strcmp(sys_cmd, "python") == 0)
3416  {
3417  const char* c;
3418  if ((h!=NULL) && (h->Typ()==STRING_CMD))
3419  {
3420  c=(const char*)h->Data();
3421  if (!PyInitialized) {
3422  PyInitialized = 1;
3423  // Py_Initialize();
3424  // initPySingular();
3425  }
3426  // PyRun_SimpleString(c);
3427  return FALSE;
3428  }
3429  else return TRUE;
3430  }
3431  else
3432  /*==================== Python Singular =================
3433  if (strcmp(sys_cmd, "ipython") == 0)
3434  {
3435  const char* c;
3436  {
3437  if (!PyInitialized)
3438  {
3439  PyInitialized = 1;
3440  Py_Initialize();
3441  initPySingular();
3442  }
3443  PyRun_SimpleString(
3444  "try: \n\
3445  __IPYTHON__ \n\
3446  except NameError: \n\
3447  argv = [''] \n\
3448  banner = exit_msg = '' \n\
3449  else: \n\
3450  # Command-line options for IPython (a list like sys.argv) \n\
3451  argv = ['-pi1','In <\\#>:','-pi2',' .\\D.:','-po','Out<\\#>:'] \n\
3452  banner = '*** Nested interpreter ***' \n\
3453  exit_msg = '*** Back in main IPython ***' \n\
3454  \n\
3455  # First import the embeddable shell class \n\
3456  from IPython.Shell import IPShellEmbed \n\
3457  # Now create the IPython shell instance. Put ipshell() anywhere in your code \n\
3458  # where you want it to open. \n\
3459  ipshell = IPShellEmbed(argv,banner=banner,exit_msg=exit_msg) \n\
3460  ipshell()");
3461  return FALSE;
3462  }
3463  }
3464  else
3465  */
3466 
3467  #endif
3468  /*==================== mpz_t loader ======================*/
3469  if(strcmp(sys_cmd, "GNUmpLoad")==0)
3470  {
3471  if ((h != NULL) && (h->Typ() == STRING_CMD))
3472  {
3473  char* filename = (char*)h->Data();
3474  FILE* f = fopen(filename, "r");
3475  if (f == NULL)
3476  {
3477  WerrorS( "invalid file name (in paths use '/')");
3478  return FALSE;
3479  }
3480  mpz_t m; mpz_init(m);
3481  mpz_inp_str(m, f, 10);
3482  fclose(f);
3483  number n = n_InitMPZ(m, coeffs_BIGINT);
3484  res->rtyp = BIGINT_CMD;
3485  res->data = (void*)n;
3486  return FALSE;
3487  }
3488  else
3489  {
3490  WerrorS( "expected valid file name as a string");
3491  return TRUE;
3492  }
3493  }
3494  else
3495  /*==================== intvec matching ======================*/
3496  /* Given two non-empty intvecs, the call
3497  'system("intvecMatchingSegments", ivec, jvec);'
3498  computes all occurences of jvec in ivec, i.e., it returns
3499  a list of int indices k such that ivec[k..size(jvec)+k-1] = jvec.
3500  If no such k exists (e.g. when ivec is shorter than jvec), an
3501  intvec with the single entry 0 is being returned. */
3502  if(strcmp(sys_cmd, "intvecMatchingSegments")==0)
3503  {
3504  if ((h != NULL) && (h->Typ() == INTVEC_CMD) &&
3505  (h->next != NULL) && (h->next->Typ() == INTVEC_CMD) &&
3506  (h->next->next == NULL))
3507  {
3508  intvec* ivec = (intvec*)h->Data();
3509  intvec* jvec = (intvec*)h->next->Data();
3510  intvec* r = new intvec(1); (*r)[0] = 0;
3511  int validEntries = 0;
3512  for (int k = 0; k <= ivec->rows() - jvec->rows(); k++)
3513  {
3514  if (memcmp(&(*ivec)[k], &(*jvec)[0],
3515  sizeof(int) * jvec->rows()) == 0)
3516  {
3517  if (validEntries == 0)
3518  (*r)[0] = k + 1;
3519  else
3520  {
3521  r->resize(validEntries + 1);
3522  (*r)[validEntries] = k + 1;
3523  }
3524  validEntries++;
3525  }
3526  }
3527  res->rtyp = INTVEC_CMD;
3528  res->data = (void*)r;
3529  return FALSE;
3530  }
3531  else
3532  {
3533  WerrorS("expected two non-empty intvecs as arguments");
3534  return TRUE;
3535  }
3536  }
3537  else
3538  /* ================== intvecOverlap ======================= */
3539  /* Given two non-empty intvecs, the call
3540  'system("intvecOverlap", ivec, jvec);'
3541  computes the longest intvec kvec such that ivec ends with kvec
3542  and jvec starts with kvec. The length of this overlap is being
3543  returned. If there is no overlap at all, then 0 is being returned. */
3544  if(strcmp(sys_cmd, "intvecOverlap")==0)
3545  {
3546  if ((h != NULL) && (h->Typ() == INTVEC_CMD) &&
3547  (h->next != NULL) && (h->next->Typ() == INTVEC_CMD) &&
3548  (h->next->next == NULL))
3549  {
3550  intvec* ivec = (intvec*)h->Data();
3551  intvec* jvec = (intvec*)h->next->Data();
3552  int ir = ivec->rows(); int jr = jvec->rows();
3553  int r = jr; if (ir < jr) r = ir; /* r = min{ir, jr} */
3554  while ((r >= 1) && (memcmp(&(*ivec)[ir - r], &(*jvec)[0],
3555  sizeof(int) * r) != 0))
3556  r--;
3557  res->rtyp = INT_CMD;
3558  res->data = (void*)(long)r;
3559  return FALSE;
3560  }
3561  else
3562  {
3563  WerrorS("expected two non-empty intvecs as arguments");
3564  return TRUE;
3565  }
3566  }
3567  else
3568  /*==================== Hensel's lemma ======================*/
3569  if(strcmp(sys_cmd, "henselfactors")==0)
3570  {
3571  if ((h != NULL) && (h->Typ() == INT_CMD) &&
3572  (h->next != NULL) && (h->next->Typ() == INT_CMD) &&
3573  (h->next->next != NULL) && (h->next->next->Typ() == POLY_CMD) &&
3574  (h->next->next->next != NULL) &&
3575  (h->next->next->next->Typ() == POLY_CMD) &&
3576  (h->next->next->next->next != NULL) &&
3577  (h->next->next->next->next->Typ() == POLY_CMD) &&
3578  (h->next->next->next->next->next != NULL) &&
3579  (h->next->next->next->next->next->Typ() == INT_CMD) &&
3580  (h->next->next->next->next->next->next == NULL))
3581  {
3582  int xIndex = (int)(long)h->Data();
3583  int yIndex = (int)(long)h->next->Data();
3584  poly hh = (poly)h->next->next->Data();
3585  poly f0 = (poly)h->next->next->next->Data();
3586  poly g0 = (poly)h->next->next->next->next->Data();
3587  int d = (int)(long)h->next->next->next->next->next->Data();
3588  poly f; poly g;
3589  henselFactors(xIndex, yIndex, hh, f0, g0, d, f, g);
3591  L->Init(2);
3592  L->m[0].rtyp = POLY_CMD; L->m[0].data=(void*)f;
3593  L->m[1].rtyp = POLY_CMD; L->m[1].data=(void*)g;
3594  res->rtyp = LIST_CMD;
3595  res->data = (char *)L;
3596  return FALSE;
3597  }
3598  else
3599  {
3600  WerrorS( "expected argument list (int, int, poly, poly, poly, int)");
3601  return TRUE;
3602  }
3603  }
3604  else
3605  /*==================== neworder =============================*/
3606  if(strcmp(sys_cmd,"neworder")==0)
3607  {
3608  if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
3609  {
3610  res->rtyp=STRING_CMD;
3611  res->data=(void *)singclap_neworder((ideal)h->Data(), currRing);
3612  return FALSE;
3613  }
3614  else
3615  WerrorS("ideal expected");
3616  }
3617  else
3618  /*==================== Approx_Step =================*/
3619  #ifdef HAVE_PLURAL
3620  if (strcmp(sys_cmd, "astep") == 0)
3621  {
3622  ideal I;
3623  if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
3624  {
3625  I=(ideal)h->CopyD();
3626  res->rtyp=IDEAL_CMD;
3627  if (rIsPluralRing(currRing)) res->data=Approx_Step(I);
3628  else res->data=I;
3629  setFlag(res,FLAG_STD);
3630  }
3631  else return TRUE;
3632  return FALSE;
3633  }
3634  else
3635  #endif
3636  /*==================== PrintMat =================*/
3637  #ifdef HAVE_PLURAL
3638  if (strcmp(sys_cmd, "PrintMat") == 0)
3639  {
3640  int a;
3641  int b;
3642  ring r;
3643  int metric;
3644  if (h!=NULL)
3645  {
3646  if (h->Typ()==INT_CMD)
3647  {
3648  a=(int)((long)(h->Data()));
3649  h=h->next;
3650  }
3651  else if (h->Typ()==INT_CMD)
3652  {
3653  b=(int)((long)(h->Data()));
3654  h=h->next;
3655  }
3656  else if (h->Typ()==RING_CMD)
3657  {
3658  r=(ring)h->Data();
3659  h=h->next;
3660  }
3661  else
3662  return TRUE;
3663  }
3664  else
3665  return TRUE;
3666  if ((h!=NULL) && (h->Typ()==INT_CMD))
3667  {
3668  metric=(int)((long)(h->Data()));
3669  }
3670  res->rtyp=MATRIX_CMD;
3671  if (rIsPluralRing(r)) res->data=nc_PrintMat(a,b,r,metric);
3672  else res->data=NULL;
3673  return FALSE;
3674  }
3675  else
3676  #endif
3677 /* ============ NCUseExtensions ======================== */
3678  #ifdef HAVE_PLURAL
3679  if(strcmp(sys_cmd,"NCUseExtensions")==0)
3680  {
3681  if ((h!=NULL) && (h->Typ()==INT_CMD))
3682  res->data=(void *)(long)setNCExtensions( (int)((long)(h->Data())) );
3683  else
3684  res->data=(void *)(long)getNCExtensions();
3685  res->rtyp=INT_CMD;
3686  return FALSE;
3687  }
3688  else
3689  #endif
3690 /* ============ NCGetType ======================== */
3691  #ifdef HAVE_PLURAL
3692  if(strcmp(sys_cmd,"NCGetType")==0)
3693  {
3694  res->rtyp=INT_CMD;
3695  if( rIsPluralRing(currRing) )
3696  res->data=(void *)(long)ncRingType(currRing);
3697  else
3698  res->data=(void *)(-1L);
3699  return FALSE;
3700  }
3701  else
3702  #endif
3703 /* ============ ForceSCA ======================== */
3704  #ifdef HAVE_PLURAL
3705  if(strcmp(sys_cmd,"ForceSCA")==0)
3706  {
3707  if( !rIsPluralRing(currRing) )
3708  return TRUE;
3709  int b, e;
3710  if ((h!=NULL) && (h->Typ()==INT_CMD))
3711  {
3712  b = (int)((long)(h->Data()));
3713  h=h->next;
3714  }
3715  else return TRUE;
3716  if ((h!=NULL) && (h->Typ()==INT_CMD))
3717  {
3718  e = (int)((long)(h->Data()));
3719  }
3720  else return TRUE;
3721  if( !sca_Force(currRing, b, e) )
3722  return TRUE;
3723  return FALSE;
3724  }
3725  else
3726  #endif
3727 /* ============ ForceNewNCMultiplication ======================== */
3728  #ifdef HAVE_PLURAL
3729  if(strcmp(sys_cmd,"ForceNewNCMultiplication")==0)
3730  {
3731  if( !rIsPluralRing(currRing) )
3732  return TRUE;
3733  if( !ncInitSpecialPairMultiplication(currRing) ) // No Plural!
3734  return TRUE;
3735  return FALSE;
3736  }
3737  else
3738  #endif
3739 /* ============ ForceNewOldNCMultiplication ======================== */
3740  #ifdef HAVE_PLURAL
3741  if(strcmp(sys_cmd,"ForceNewOldNCMultiplication")==0)
3742  {
3743  if( !rIsPluralRing(currRing) )
3744  return TRUE;
3745  if( !ncInitSpecialPowersMultiplication(currRing) ) // Enable Formula for Plural (depends on swiches)!
3746  return TRUE;
3747  return FALSE;
3748  }
3749  else
3750  #endif
3751 /*==================== test64 =================*/
3752  #if 0
3753  if(strcmp(sys_cmd,"test64")==0)
3754  {
3755  long l=8;int i;
3756  for(i=1;i<62;i++)
3757  {
3758  l=l<<1;
3759  number n=n_Init(l,coeffs_BIGINT);
3760  Print("%ld= ",l);n_Print(n,coeffs_BIGINT);
3762  n_Delete(&n,coeffs_BIGINT);
3764  PrintS(" F:");
3766  PrintLn();
3767  n_Delete(&n,coeffs_BIGINT);
3768  }
3769  Print("SIZEOF_LONG=%d\n",SIZEOF_LONG);
3770  return FALSE;
3771  }
3772  else
3773  #endif
3774 /*==================== n_SwitchChinRem =================*/
3775  if(strcmp(sys_cmd,"cache_chinrem")==0)
3776  {
3777  extern int n_SwitchChinRem;
3778  Print("caching inverse in chines remainder:%d\n",n_SwitchChinRem);
3779  if ((h!=NULL)&&(h->Typ()==INT_CMD))
3780  n_SwitchChinRem=(int)(long)h->Data();
3781  return FALSE;
3782  }
3783  else
3784 /*==================== LU for bigintmat =================*/
3785 #ifdef SINGULAR_4_1
3786  if(strcmp(sys_cmd,"LU")==0)
3787  {
3788  if ((h!=NULL) && (h->Typ()==CMATRIX_CMD))
3789  {
3790  // get the argument:
3791  bigintmat *b=(bigintmat *)h->Data();
3792  // just for tests: simply transpose
3793  bigintmat *bb=b->transpose();
3794  // return the result:
3795  res->rtyp=CMATRIX_CMD;
3796  res->data=(char*)bb;
3797  return FALSE;
3798  }
3799  else
3800  {
3801  WerrorS("system(\"LU\",<cmatrix>) expected");
3802  return TRUE;
3803  }
3804  }
3805  else
3806 #endif
3807 /*==================== sort =================*/
3808  if(strcmp(sys_cmd,"sort")==0)
3809  {
3810  extern BOOLEAN jjSORTLIST(leftv,leftv);
3811  if (h->Typ()==LIST_CMD)
3812  return jjSORTLIST(res,h);
3813  else
3814  return TRUE;
3815  }
3816  else
3817 /*==================== uniq =================*/
3818  if(strcmp(sys_cmd,"uniq")==0)
3819  {
3820  extern BOOLEAN jjUNIQLIST(leftv, leftv);
3821  if (h->Typ()==LIST_CMD)
3822  return jjUNIQLIST(res,h);
3823  else
3824  return TRUE;
3825  }
3826  else
3827 /*==================== power* ==================================*/
3828  #if 0
3829  if(strcmp(sys_cmd,"power1")==0)
3830  {
3831  res->rtyp=POLY_CMD;
3832  poly f=(poly)h->CopyD();
3833  poly g=pPower(f,2000);
3834  res->data=(void *)g;
3835  return FALSE;
3836  }
3837  else
3838  if(strcmp(sys_cmd,"power2")==0)
3839  {
3840  res->rtyp=POLY_CMD;
3841  poly f=(poly)h->Data();
3842  poly g=pOne();
3843  for(int i=0;i<2000;i++)
3844  g=pMult(g,pCopy(f));
3845  res->data=(void *)g;
3846  return FALSE;
3847  }
3848  if(strcmp(sys_cmd,"power3")==0)
3849  {
3850  res->rtyp=POLY_CMD;
3851  poly f=(poly)h->Data();
3852  poly p2=pMult(pCopy(f),pCopy(f));
3853  poly p4=pMult(pCopy(p2),pCopy(p2));
3854  poly p8=pMult(pCopy(p4),pCopy(p4));
3855  poly p16=pMult(pCopy(p8),pCopy(p8));
3856  poly p32=pMult(pCopy(p16),pCopy(p16));
3857  poly p64=pMult(pCopy(p32),pCopy(p32));
3858  poly p128=pMult(pCopy(p64),pCopy(p64));
3859  poly p256=pMult(pCopy(p128),pCopy(p128));
3860  poly p512=pMult(pCopy(p256),pCopy(p256));
3861  poly p1024=pMult(pCopy(p512),pCopy(p512));
3862  poly p1536=pMult(p1024,p512);
3863  poly p1792=pMult(p1536,p256);
3864  poly p1920=pMult(p1792,p128);
3865  poly p1984=pMult(p1920,p64);
3866  poly p2000=pMult(p1984,p16);
3867  res->data=(void *)p2000;
3868  pDelete(&p2);
3869  pDelete(&p4);
3870  pDelete(&p8);
3871  //pDelete(&p16);
3872  pDelete(&p32);
3873  //pDelete(&p64);
3874  //pDelete(&p128);
3875  //pDelete(&p256);
3876  //pDelete(&p512);
3877  //pDelete(&p1024);
3878  //pDelete(&p1536);
3879  //pDelete(&p1792);
3880  //pDelete(&p1920);
3881  //pDelete(&p1984);
3882  return FALSE;
3883  }
3884  else
3885  #endif
3886 /*==================== Error =================*/
3887  Werror( "(extended) system(\"%s\",...) %s", sys_cmd, feNotImplemented );
3888  }
3889  return TRUE;
3890 }
bigintmat * transpose()
Definition: bigintmat.cc:38
int & rows()
Definition: matpol.h:24
int status int fd
Definition: si_signals.h:59
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11774
#define pIsPurePower(p)
Definition: polys.h:231
const CanonicalForm int s
Definition: facAbsFact.cc:55
sleftv * m
Definition: lists.h:45
poly pFastPower(poly f, int n, ring r)
Definition: fast_mult.cc:342
void p_DebugPrint(poly p, const ring r)
Definition: ring.cc:4203
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
const char * omError2String(omError_t error)
Definition: omError.c:52
ring rSubring(ring org_ring, sleftv *rv)
Definition: ipshell.cc:5886
void resize(int new_length)
Definition: intvec.cc:107
const poly a
Definition: syzextra.cc:212
int sdb_flags
Definition: sdb.cc:32
void PrintLn()
Definition: reporter.cc:310
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5374
#define Print
Definition: emacs.cc:83
BOOLEAN jjSORTLIST(leftv, leftv arg)
Definition: iparith.cc:9355
Definition: tok.h:95
#define pAdd(p, q)
Definition: polys.h:186
void Off(int sw)
switches
Definition: lists.h:22
void henselFactors(const int xIndex, const int yIndex, const poly h, const poly f0, const poly g0, const int d, poly &f, poly &g)
Computes a factorization of a polynomial h(x, y) in K[[x]][y] up to a certain degree in x...
#define FALSE
Definition: auxiliary.h:95
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5346
Definition: tok.h:38
return P p
Definition: myNF.cc:203
short * iv2array(intvec *iv, const ring R)
Definition: weight.cc:208
Matrices of numbers.
Definition: bigintmat.h:51
number n_convFactoryNSingN(const CanonicalForm n, const coeffs r)
Definition: numbers.cc:579
lists testsvd(matrix M)
Definition: calcSVD.cc:27
void sdb_edit(procinfo *pi)
Definition: sdb.cc:110
void slicehilb(ideal I)
Definition: hilb.cc:1089
int & getNCExtensions()
Definition: old.gring.cc:87
static const int SW_USE_EZGCD_P
set to 1 to use EZGCD over F_q
Definition: cf_defs.h:34
int setNCExtensions(int iMask)
Definition: old.gring.cc:92
int n_SwitchChinRem
Definition: longrat.cc:2922
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:542
int rows() const
Definition: intvec.h:88
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int rChar(ring r)
Definition: ring.cc:684
poly pFastPowerMC(poly f, int n, ring r)
Definition: fast_mult.cc:588
unsigned long ** singularMatrixToLongMatrix(matrix singularMatrix)
Definition: extra.cc:190
omError_t om_InternalErrorStatus
Definition: omError.c:12
poly nc_rat_ReduceSpolyNew(const poly p1, poly p2, int ishift, const ring r)
Definition: ratgring.cc:466
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:448
factory&#39;s main class
Definition: canonicalform.h:75
#define TRUE
Definition: auxiliary.h:99
void * ADDRESS
Definition: auxiliary.h:116
static coordinates * points
void * dynl_sym(void *handle, const char *symbol)
Definition: mod_raw.cc:167
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:93
int testGB(ideal I, ideal GI)
Definition: ringgb.cc:230
static TreeM * G
Definition: janet.cc:38
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5714
coeffs coeffs_BIGINT
Definition: ipid.cc:54
int Typ()
Definition: subexpr.cc:1004
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define Sy_bit(x)
Definition: options.h:30
void setCharacteristic(int c)
Definition: cf_char.cc:23
CanonicalForm n_convSingNFactoryN(number n, BOOLEAN setChar, const coeffs r)
Definition: numbers.cc:584
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5335
poly pp
Definition: myNF.cc:296
void * dynl_open(char *filename)
Definition: mod_raw.cc:153
omOpts_t om_Opts
Definition: omOpts.c:11
static poly fglmNewLinearCombination(ideal source, poly monset)
Definition: fglmcomb.cc:155
void * data
Definition: subexpr.h:89
#define pIter(p)
Definition: monomials.h:44
matrix mp_Transp(matrix a, const ring R)
Definition: matpol.cc:267
bool sca_Force(ring rGR, int b, int e)
Definition: sca.cc:1174
#define M
Definition: sirandom.c:24
unsigned long * computeMinimalPolynomial(unsigned long **matrix, unsigned n, unsigned long p)
Definition: minpoly.cc:430
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5404
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5916
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3351
matrix nc_PrintMat(int a, int b, ring r, int metric)
returns matrix with the info on noncomm multiplication
Definition: old.gring.cc:2458
int j
Definition: myNF.cc:70
static int max(int a, int b)
Definition: fast_mult.cc:264
Definition: tok.h:58
poly uni_subst_bits(poly outer_uni, poly inner_multi, ring r)
Definition: digitech.cc:47
#define omFree(addr)
Definition: omAllocDecl.h:261
poly multifastmult(poly f, poly g, ring r)
Definition: fast_mult.cc:290
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
omError_t om_ErrorStatus
Definition: omError.c:11
int Mults()
Definition: fast_mult.cc:14
#define pDivideM(a, b)
Definition: polys.h:277
const ring R
Definition: DebugPrint.cc:36
const char feNotImplemented[]
Definition: reporter.cc:54
BOOLEAN jjUNIQLIST(leftv, leftv arg)
Definition: iparith.cc:9364
const char * omError2Serror(omError_t error)
Definition: omError.c:63
ip_smatrix * matrix
static FORCE_INLINE number n_InitMPZ(mpz_t n, const coeffs r)
conversion of a GMP integer to number
Definition: coeffs.h:546
#define setFlag(A, F)
Definition: ipid.h:110
int m
Definition: cfEzgcd.cc:119
bool isOn(int sw)
switches
poly nc_rat_CreateSpoly(poly pp1, poly pp2, int ishift, const ring r)
Definition: ratgring.cc:341
void On(int sw)
switches
int dim(ideal I, ring r)
void rDebugPrint(const ring r)
Definition: ring.cc:3998
FILE * f
Definition: checklibs.c:7
BOOLEAN assumeStdFlag(leftv h)
Definition: subexpr.cc:1483
poly longCoeffsToSingularPoly(unsigned long *polyCoeffs, const int degree)
Definition: extra.cc:222
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:298
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5809
static const int SW_USE_CHINREM_GCD
set to 1 to use modular gcd over Z
Definition: cf_defs.h:38
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix singntl_HNF(matrix m, const ring s)
Definition: clapsing.cc:1639
static short scaFirstAltVar(ring r)
Definition: sca.h:18
poly ringRedNF(poly f, ideal G, ring r)
Definition: ringgb.cc:121
int singular_homog_flag
Definition: cf_factor.cc:377
#define FLAG_STD
Definition: ipid.h:106
poly kFindZeroPoly(poly input_p, ring leadRing, ring tailRing)
Definition: kstd2.cc:318
leftv next
Definition: subexpr.h:87
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4954
ideal Approx_Step(ideal L)
Ann: ???
Definition: nc.cc:253
poly plain_spoly(poly f, poly g)
Definition: ringgb.cc:172
INLINE_THIS void Init(int l=0)
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11683
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
int & cols()
Definition: matpol.h:25
matrix mp_InitI(int r, int c, int v, const ring R)
make it a v * unit matrix
Definition: matpol.cc:139
#define error(a)
Definition: mpr_numeric.cc:978
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
CanonicalForm convSingPFactoryP(poly p, const ring r)
Definition: clapconv.cc:88
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
slists * lists
Definition: mpr_numeric.h:146
#define pMult(p, q)
Definition: polys.h:190
int probIrredTest(const CanonicalForm &F, double error)
given some error probIrredTest detects irreducibility or reducibility of F with confidence level 1-er...
Definition: facIrredTest.cc:63
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition: ipshell.cc:6464
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5557
static const int SW_USE_QGCD
set to 1 to use Encarnacion GCD over Q(a)
Definition: cf_defs.h:40
void omUpdateInfo()
Definition: omStats.c:24
static const int SW_USE_EZGCD
set to 1 to use EZGCD over Z
Definition: cf_defs.h:32
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pDelete(p_ptr)
Definition: polys.h:169
static short scaLastAltVar(ring r)
Definition: sca.h:25
int rtyp
Definition: subexpr.h:92
static bool rIsSCA(const ring r)
Definition: nc.h:206
void * Data()
Definition: subexpr.cc:1146
BOOLEAN ncInitSpecialPairMultiplication(ring r)
Definition: ncSAMult.cc:266
CFList int bool & irred
[in,out] Is A irreducible?
Definition: facFactorize.h:31
bool ncInitSpecialPowersMultiplication(ring r)
Definition: ncSAFormula.cc:50
Definition: tok.h:117
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition: kstd2.cc:82
#define omPrintCurrentBackTrace(fd)
Definition: omRet2Info.h:39
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1053
int redRat(poly *h, poly *reducer, int *red_length, int rl, int ishift, ring r)
Definition: ratgring.cc:594
#define pLmDeleteAndNext(p)
like pLmDelete, returns pNext(p)
Definition: polys.h:78
omBin slists_bin
Definition: lists.cc:23
void pPrintDivisbleByStat()
Definition: pDebug.cc:412
void omPrintUsedTrackAddrs(FILE *fd, int max_frames)
Definition: omDebugCheck.c:568
#define pPower(p, q)
Definition: polys.h:187
void omMarkAsStaticAddr(void *addr)
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
void omPrintUsedAddrs(FILE *fd, int max_frames)
Definition: omDebugCheck.c:557
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6043
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kstd2.cc:83
#define MATROWS(i)
Definition: matpol.h:27
ideal createG0()
Definition: kutil.cc:4545
ideal id_Vec2Ideal(poly vec, const ring R)
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
char * singclap_neworder(ideal I, const ring r)
Definition: clapsing.cc:1487
poly ringNF(poly f, ideal G, ring r)
Definition: ringgb.cc:203
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11737
unsigned si_opt_2
Definition: options.c:6
int BOOLEAN
Definition: auxiliary.h:86
s?
Definition: ring.h:84
const poly b
Definition: syzextra.cc:213
#define ppJetW(p, m, iv)
Definition: polys.h:352
void Werror(const char *fmt,...)
Definition: reporter.cc:189
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
int nfMinPoly[16]
Definition: ffields.cc:580
procinfo * procinfov
Definition: structs.h:63
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5646
poly unifastmult(poly f, poly g, ring r)
Definition: fast_mult.cc:272
static poly fglmLinearCombination(ideal source, poly monset)
Definition: fglmcomb.cc:419
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
#define MATELEM(mat, i, j)
Definition: matpol.h:29
void n_Print(number &a, const coeffs r)
print a number (BEWARE of string buffers!) mostly for debugging
Definition: numbers.cc:568
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
ideal F5main(ideal id, ring r, int opt, int plus, int termination)
Definition: f5gb.cc:1893

§ jjSYSTEM()

BOOLEAN jjSYSTEM ( leftv  res,
leftv  args 
)

Definition at line 245 of file extra.cc.

246 {
247  if(args->Typ() == STRING_CMD)
248  {
249  const char *sys_cmd=(char *)(args->Data());
250  leftv h=args->next;
251 // ONLY documented system calls go here
252 // Undocumented system calls go down into jjEXTENDED_SYSTEM (#ifdef HAVE_EXTENDED_SYSTEM)
253 /*==================== nblocks ==================================*/
254  if (strcmp(sys_cmd, "nblocks") == 0)
255  {
256  ring r;
257  if (h == NULL)
258  {
259  if (currRingHdl != NULL)
260  {
261  r = IDRING(currRingHdl);
262  }
263  else
264  {
265  WerrorS("no ring active");
266  return TRUE;
267  }
268  }
269  else
270  {
271  if (h->Typ() != RING_CMD)
272  {
273  WerrorS("ring expected");
274  return TRUE;
275  }
276  r = (ring) h->Data();
277  }
278  res->rtyp = INT_CMD;
279  res->data = (void*) (long)(rBlocks(r) - 1);
280  return FALSE;
281  }
282 /*==================== version ==================================*/
283  if(strcmp(sys_cmd,"version")==0)
284  {
285  res->rtyp=INT_CMD;
286  res->data=(void *)SINGULAR_VERSION;
287  return FALSE;
288  }
289  else
290 /*==================== cpu ==================================*/
291  if(strcmp(sys_cmd,"cpu")==0)
292  {
293  long cpu=1; //feOptValue(FE_OPT_CPUS);
294  #ifdef _SC_NPROCESSORS_ONLN
295  cpu=sysconf(_SC_NPROCESSORS_ONLN);
296  #elif defined(_SC_NPROCESSORS_CONF)
297  cpu=sysconf(_SC_NPROCESSORS_CONF);
298  #endif
299  res->data=(void *)cpu;
300  res->rtyp=INT_CMD;
301  return FALSE;
302  }
303  else
304 /*==================== executable ==================================*/
305  if(strcmp(sys_cmd,"executable")==0)
306  {
307  if ((h!=NULL) && (h->Typ()==STRING_CMD))
308  {
309  char tbuf[MAXPATHLEN];
310  char *s=omFindExec((char*)h->Data(),tbuf);
311  if(s==NULL) s=(char*)"";
312  res->data=(void *)omStrDup(s);
313  res->rtyp=STRING_CMD;
314  return FALSE;
315  }
316  return TRUE;
317  }
318  else
319 /*===== nc_hilb ===============================================*/
320  // Hilbert series of non-commutative monomial algebras
321  if(strcmp(sys_cmd,"nc_hilb") == 0)
322  {
323  ideal i;
324  int lV;
325  bool ig = FALSE;
326  if((h != NULL)&&(h->Typ() == IDEAL_CMD))
327  i = (ideal)h->Data();
328  else
329  {
330  WerrorS("ideal expected");
331  return TRUE;
332  }
333  h = h->next;
334  if((h != NULL)&&(h->Typ() == INT_CMD))
335  lV = (int)(long)h->Data();
336  else
337  {
338  WerrorS("int expected");
339  return TRUE;
340  }
341  h = h->next;
342  if(h != NULL)
343  ig = TRUE;
344  HilbertSeries_OrbitData(i,lV,ig);
345  return(FALSE);
346  }
347  else
348 /*==================== sh ==================================*/
349  if(strcmp(sys_cmd,"sh")==0)
350  {
351  if (feOptValue(FE_OPT_NO_SHELL))
352  {
353  WerrorS("shell execution is disallowed in restricted mode");
354  return TRUE;
355  }
356  res->rtyp=INT_CMD;
357  if (h==NULL) res->data = (void *)(long) system("sh");
358  else if (h->Typ()==STRING_CMD)
359  res->data = (void*)(long) system((char*)(h->Data()));
360  else
361  WerrorS("string expected");
362  return FALSE;
363  }
364  else
365 /*========reduce procedure like the global one but with jet bounds=======*/
366  if(strcmp(sys_cmd,"reduce_bound")==0)
367  {
368  poly p;
369  ideal pid=NULL;
370  const short t1[]={3,POLY_CMD,IDEAL_CMD,INT_CMD};
371  const short t2[]={3,IDEAL_CMD,IDEAL_CMD,INT_CMD};
372  const short t3[]={3,VECTOR_CMD,MODUL_CMD,INT_CMD};
373  const short t4[]={3,MODUL_CMD,MODUL_CMD,INT_CMD};
374  if ((iiCheckTypes(h,t1,0))||((iiCheckTypes(h,t3,0))))
375  {
376  p = (poly)h->CopyD();
377  }
378  else if ((iiCheckTypes(h,t2,0))||(iiCheckTypes(h,t4,1)))
379  {
380  pid = (ideal)h->CopyD();
381  }
382  else return TRUE;
383  //int htype;
384  res->rtyp= h->Typ(); /*htype*/
385  ideal q = (ideal)h->next->CopyD();
386  int bound = (int)(long)h->next->next->Data();
387  if (pid==NULL) /*(htype == POLY_CMD || htype == VECTOR_CMD)*/
388  res->data = (char *)kNFBound(q,currRing->qideal,p,bound);
389  else /*(htype == IDEAL_CMD || htype == MODUL_CMD)*/
390  res->data = (char *)kNFBound(q,currRing->qideal,pid,bound);
391  return FALSE;
392  }
393  else
394 /*==================== uname ==================================*/
395  if(strcmp(sys_cmd,"uname")==0)
396  {
397  res->rtyp=STRING_CMD;
398  res->data = omStrDup(S_UNAME);
399  return FALSE;
400  }
401  else
402 /*==================== with ==================================*/
403  if(strcmp(sys_cmd,"with")==0)
404  {
405  if (h==NULL)
406  {
407  res->rtyp=STRING_CMD;
408  res->data=(void *)versionString();
409  return FALSE;
410  }
411  else if (h->Typ()==STRING_CMD)
412  {
413  #define TEST_FOR(A) if(strcmp(s,A)==0) res->data=(void *)1; else
414  char *s=(char *)h->Data();
415  res->rtyp=INT_CMD;
416  #ifdef HAVE_DBM
417  TEST_FOR("DBM")
418  #endif
419  #ifdef HAVE_DLD
420  TEST_FOR("DLD")
421  #endif
422  //TEST_FOR("factory")
423  //TEST_FOR("libfac")
424  #ifdef HAVE_READLINE
425  TEST_FOR("readline")
426  #endif
427  #ifdef TEST_MAC_ORDER
428  TEST_FOR("MAC_ORDER")
429  #endif
430  // unconditional since 3-1-0-6
431  TEST_FOR("Namespaces")
432  #ifdef HAVE_DYNAMIC_LOADING
433  TEST_FOR("DynamicLoading")
434  #endif
435  #ifdef HAVE_EIGENVAL
436  TEST_FOR("eigenval")
437  #endif
438  #ifdef HAVE_GMS
439  TEST_FOR("gms")
440  #endif
441  #ifdef OM_NDEBUG
442  TEST_FOR("om_ndebug")
443  #endif
444  #ifdef SING_NDEBUG
445  TEST_FOR("ndebug")
446  #endif
447  {};
448  return FALSE;
449  #undef TEST_FOR
450  }
451  return TRUE;
452  }
453  else
454  /*==================== browsers ==================================*/
455  if (strcmp(sys_cmd,"browsers")==0)
456  {
457  res->rtyp = STRING_CMD;
458  StringSetS("");
460  res->data = StringEndS();
461  return FALSE;
462  }
463  else
464  /*==================== pid ==================================*/
465  if (strcmp(sys_cmd,"pid")==0)
466  {
467  res->rtyp=INT_CMD;
468  res->data=(void *)(long) getpid();
469  return FALSE;
470  }
471  else
472  /*==================== getenv ==================================*/
473  if (strcmp(sys_cmd,"getenv")==0)
474  {
475  if ((h!=NULL) && (h->Typ()==STRING_CMD))
476  {
477  res->rtyp=STRING_CMD;
478  const char *r=getenv((char *)h->Data());
479  if (r==NULL) r="";
480  res->data=(void *)omStrDup(r);
481  return FALSE;
482  }
483  else
484  {
485  WerrorS("string expected");
486  return TRUE;
487  }
488  }
489  else
490  /*==================== setenv ==================================*/
491  if (strcmp(sys_cmd,"setenv")==0)
492  {
493  #ifdef HAVE_SETENV
494  const short t[]={2,STRING_CMD,STRING_CMD};
495  if (iiCheckTypes(h,t,1))
496  {
497  res->rtyp=STRING_CMD;
498  setenv((char *)h->Data(), (char *)h->next->Data(), 1);
499  res->data=(void *)omStrDup((char *)h->next->Data());
501  return FALSE;
502  }
503  else
504  {
505  return TRUE;
506  }
507  #else
508  WerrorS("setenv not supported on this platform");
509  return TRUE;
510  #endif
511  }
512  else
513  /*==================== Singular ==================================*/
514  if (strcmp(sys_cmd, "Singular") == 0)
515  {
516  res->rtyp=STRING_CMD;
517  const char *r=feResource("Singular");
518  if (r == NULL) r="";
519  res->data = (void*) omStrDup( r );
520  return FALSE;
521  }
522  else
523  if (strcmp(sys_cmd, "SingularLib") == 0)
524  {
525  res->rtyp=STRING_CMD;
526  const char *r=feResource("SearchPath");
527  if (r == NULL) r="";
528  res->data = (void*) omStrDup( r );
529  return FALSE;
530  }
531  else
532  /*==================== options ==================================*/
533  if (strstr(sys_cmd, "--") == sys_cmd)
534  {
535  if (strcmp(sys_cmd, "--") == 0)
536  {
538  return FALSE;
539  }
540  feOptIndex opt = feGetOptIndex(&sys_cmd[2]);
541  if (opt == FE_OPT_UNDEF)
542  {
543  Werror("Unknown option %s", sys_cmd);
544  WerrorS("Use 'system(\"--\");' for listing of available options");
545  return TRUE;
546  }
547  // for Untyped Options (help version),
548  // setting it just triggers action
549  if (feOptSpec[opt].type == feOptUntyped)
550  {
551  feSetOptValue(opt,0);
552  return FALSE;
553  }
554  if (h == NULL)
555  {
556  if (feOptSpec[opt].type == feOptString)
557  {
558  res->rtyp = STRING_CMD;
559  const char *r=(const char*)feOptSpec[opt].value;
560  if (r == NULL) r="";
561  res->data = omStrDup(r);
562  }
563  else
564  {
565  res->rtyp = INT_CMD;
566  res->data = feOptSpec[opt].value;
567  }
568  return FALSE;
569  }
570  if (h->Typ() != STRING_CMD &&
571  h->Typ() != INT_CMD)
572  {
573  WerrorS("Need string or int argument to set option value");
574  return TRUE;
575  }
576  const char* errormsg;
577  if (h->Typ() == INT_CMD)
578  {
579  if (feOptSpec[opt].type == feOptString)
580  {
581  Werror("Need string argument to set value of option %s", sys_cmd);
582  return TRUE;
583  }
584  errormsg = feSetOptValue(opt, (int)((long) h->Data()));
585  if (errormsg != NULL)
586  Werror("Option '--%s=%d' %s", sys_cmd, (int) ((long)h->Data()), errormsg);
587  }
588  else
589  {
590  errormsg = feSetOptValue(opt, (char*) h->Data());
591  if (errormsg != NULL)
592  Werror("Option '--%s=%s' %s", sys_cmd, (char*) h->Data(), errormsg);
593  }
594  if (errormsg != NULL) return TRUE;
595  return FALSE;
596  }
597  else
598  /*==================== HC ==================================*/
599  if (strcmp(sys_cmd,"HC")==0)
600  {
601  res->rtyp=INT_CMD;
602  res->data=(void *)(long) HCord;
603  return FALSE;
604  }
605  else
606  /*==================== random ==================================*/
607  if(strcmp(sys_cmd,"random")==0)
608  {
609  const short t[]={1,INT_CMD};
610  if (h!=NULL)
611  {
612  if (iiCheckTypes(h,t,1))
613  {
614  siRandomStart=(int)((long)h->Data());
617  return FALSE;
618  }
619  else
620  {
621  return TRUE;
622  }
623  }
624  res->rtyp=INT_CMD;
625  res->data=(void*)(long) siSeed;
626  return FALSE;
627  }
628  else
629  /*==================== std_syz =================*/
630  if (strcmp(sys_cmd, "std_syz") == 0)
631  {
632  ideal i1;
633  int i2;
634  if ((h!=NULL) && (h->Typ()==MODUL_CMD))
635  {
636  i1=(ideal)h->CopyD();
637  h=h->next;
638  }
639  else return TRUE;
640  if ((h!=NULL) && (h->Typ()==INT_CMD))
641  {
642  i2=(int)((long)h->Data());
643  }
644  else return TRUE;
645  res->rtyp=MODUL_CMD;
646  res->data=idXXX(i1,i2);
647  return FALSE;
648  }
649  else
650  /*======================= demon_list =====================*/
651  if (strcmp(sys_cmd,"denom_list")==0)
652  {
653  res->rtyp=LIST_CMD;
654  extern lists get_denom_list();
655  res->data=(lists)get_denom_list();
656  return FALSE;
657  }
658  else
659  /*==================== complexNearZero ======================*/
660  if(strcmp(sys_cmd,"complexNearZero")==0)
661  {
662  const short t[]={2,NUMBER_CMD,INT_CMD};
663  if (iiCheckTypes(h,t,1))
664  {
665  if ( !rField_is_long_C(currRing) )
666  {
667  WerrorS( "unsupported ground field!");
668  return TRUE;
669  }
670  else
671  {
672  res->rtyp=INT_CMD;
673  res->data=(void*)complexNearZero((gmp_complex*)h->Data(),
674  (int)((long)(h->next->Data())));
675  return FALSE;
676  }
677  }
678  else
679  {
680  return TRUE;
681  }
682  }
683  else
684  /*==================== getPrecDigits ======================*/
685  if(strcmp(sys_cmd,"getPrecDigits")==0)
686  {
687  if ( (currRing==NULL)
689  {
690  WerrorS( "unsupported ground field!");
691  return TRUE;
692  }
693  res->rtyp=INT_CMD;
694  res->data=(void*)(long)gmp_output_digits;
695  //if (gmp_output_digits!=getGMPFloatDigits())
696  //{ Print("%d, %d\n",getGMPFloatDigits(),gmp_output_digits);}
697  return FALSE;
698  }
699  else
700  /*==================== lduDecomp ======================*/
701  if(strcmp(sys_cmd, "lduDecomp")==0)
702  {
703  const short t[]={1,MATRIX_CMD};
704  if (iiCheckTypes(h,t,1))
705  {
706  matrix aMat = (matrix)h->Data();
707  matrix pMat; matrix lMat; matrix dMat; matrix uMat;
708  poly l; poly u; poly prodLU;
709  lduDecomp(aMat, pMat, lMat, dMat, uMat, l, u, prodLU);
711  L->Init(7);
712  L->m[0].rtyp = MATRIX_CMD; L->m[0].data=(void*)pMat;
713  L->m[1].rtyp = MATRIX_CMD; L->m[1].data=(void*)lMat;
714  L->m[2].rtyp = MATRIX_CMD; L->m[2].data=(void*)dMat;
715  L->m[3].rtyp = MATRIX_CMD; L->m[3].data=(void*)uMat;
716  L->m[4].rtyp = POLY_CMD; L->m[4].data=(void*)l;
717  L->m[5].rtyp = POLY_CMD; L->m[5].data=(void*)u;
718  L->m[6].rtyp = POLY_CMD; L->m[6].data=(void*)prodLU;
719  res->rtyp = LIST_CMD;
720  res->data = (char *)L;
721  return FALSE;
722  }
723  else
724  {
725  return TRUE;
726  }
727  }
728  else
729  /*==================== lduSolve ======================*/
730  if(strcmp(sys_cmd, "lduSolve")==0)
731  {
732  /* for solving a linear equation system A * x = b, via the
733  given LDU-decomposition of the matrix A;
734  There is one valid parametrisation:
735  1) exactly eight arguments P, L, D, U, l, u, lTimesU, b;
736  P, L, D, and U realise the LDU-decomposition of A, that is,
737  P * A = L * D^(-1) * U, and P, L, D, and U satisfy the
738  properties decribed in method 'luSolveViaLDUDecomp' in
739  linearAlgebra.h; see there;
740  l, u, and lTimesU are as described in the same location;
741  b is the right-hand side vector of the linear equation system;
742  The method will return a list of either 1 entry or three entries:
743  1) [0] if there is no solution to the system;
744  2) [1, x, H] if there is at least one solution;
745  x is any solution of the given linear system,
746  H is the matrix with column vectors spanning the homogeneous
747  solution space.
748  The method produces an error if matrix and vector sizes do not
749  fit. */
750  const short t[]={7,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD,POLY_CMD,POLY_CMD,MATRIX_CMD};
751  if (!iiCheckTypes(h,t,1))
752  {
753  return TRUE;
754  }
756  {
757  WerrorS("field required");
758  return TRUE;
759  }
760  matrix pMat = (matrix)h->Data();
761  matrix lMat = (matrix)h->next->Data();
762  matrix dMat = (matrix)h->next->next->Data();
763  matrix uMat = (matrix)h->next->next->next->Data();
764  poly l = (poly) h->next->next->next->next->Data();
765  poly u = (poly) h->next->next->next->next->next->Data();
766  poly lTimesU = (poly) h->next->next->next->next->next->next->Data();
767  matrix bVec = (matrix)h->next->next->next->next->next->next->next->Data();
768  matrix xVec; int solvable; matrix homogSolSpace;
769  if (pMat->rows() != pMat->cols())
770  {
771  Werror("first matrix (%d x %d) is not quadratic",
772  pMat->rows(), pMat->cols());
773  return TRUE;
774  }
775  if (lMat->rows() != lMat->cols())
776  {
777  Werror("second matrix (%d x %d) is not quadratic",
778  lMat->rows(), lMat->cols());
779  return TRUE;
780  }
781  if (dMat->rows() != dMat->cols())
782  {
783  Werror("third matrix (%d x %d) is not quadratic",
784  dMat->rows(), dMat->cols());
785  return TRUE;
786  }
787  if (dMat->cols() != uMat->rows())
788  {
789  Werror("third matrix (%d x %d) and fourth matrix (%d x %d) %s",
790  dMat->rows(), dMat->cols(), uMat->rows(), uMat->cols(),
791  "do not t");
792  return TRUE;
793  }
794  if (uMat->rows() != bVec->rows())
795  {
796  Werror("fourth matrix (%d x %d) and vector (%d x 1) do not fit",
797  uMat->rows(), uMat->cols(), bVec->rows());
798  return TRUE;
799  }
800  solvable = luSolveViaLDUDecomp(pMat, lMat, dMat, uMat, l, u, lTimesU,
801  bVec, xVec, homogSolSpace);
802 
803  /* build the return structure; a list with either one or
804  three entries */
806  if (solvable)
807  {
808  ll->Init(3);
809  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
810  ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)xVec;
811  ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)homogSolSpace;
812  }
813  else
814  {
815  ll->Init(1);
816  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
817  }
818  res->rtyp = LIST_CMD;
819  res->data=(char*)ll;
820  return FALSE;
821  }
822  else
823  /*==== countedref: reference and shared ====*/
824  if (strcmp(sys_cmd, "shared") == 0)
825  {
826  #ifndef SI_COUNTEDREF_AUTOLOAD
827  void countedref_shared_load();
829  #endif
830  res->rtyp = NONE;
831  return FALSE;
832  }
833  else if (strcmp(sys_cmd, "reference") == 0)
834  {
835  #ifndef SI_COUNTEDREF_AUTOLOAD
838  #endif
839  res->rtyp = NONE;
840  return FALSE;
841  }
842  else
843 /*==================== semaphore =================*/
844 #ifdef HAVE_SIMPLEIPC
845  if (strcmp(sys_cmd,"semaphore")==0)
846  {
847  if((h!=NULL) && (h->Typ()==STRING_CMD) && (h->next!=NULL) && (h->next->Typ()==INT_CMD))
848  {
849  int v=1;
850  if ((h->next->next!=NULL)&& (h->next->next->Typ()==INT_CMD))
851  v=(int)(long)h->next->next->Data();
852  res->data=(char *)(long)simpleipc_cmd((char *)h->Data(),(int)(long)h->next->Data(),v);
853  res->rtyp=INT_CMD;
854  return FALSE;
855  }
856  else
857  {
858  WerrorS("Usage: system(\"semaphore\",<cmd>,int)");
859  return TRUE;
860  }
861  }
862  else
863 #endif
864 /*==================== reserved port =================*/
865  if (strcmp(sys_cmd,"reserve")==0)
866  {
867  int ssiReservePort(int clients);
868  const short t[]={1,INT_CMD};
869  if (iiCheckTypes(h,t,1))
870  {
871  res->rtyp=INT_CMD;
872  int p=ssiReservePort((int)(long)h->Data());
873  res->data=(void*)(long)p;
874  return (p==0);
875  }
876  return TRUE;
877  }
878  else
879 /*==================== reserved link =================*/
880  if (strcmp(sys_cmd,"reservedLink")==0)
881  {
882  extern si_link ssiCommandLink();
883  res->rtyp=LINK_CMD;
885  res->data=(void*)p;
886  return (p==NULL);
887  }
888  else
889 /*==================== install newstruct =================*/
890  if (strcmp(sys_cmd,"install")==0)
891  {
892  const short t[]={4,STRING_CMD,STRING_CMD,PROC_CMD,INT_CMD};
893  if (iiCheckTypes(h,t,1))
894  {
895  return newstruct_set_proc((char*)h->Data(),(char*)h->next->Data(),
896  (int)(long)h->next->next->next->Data(),
897  (procinfov)h->next->next->Data());
898  }
899  return TRUE;
900  }
901  else
902 /*==================== newstruct =================*/
903  if (strcmp(sys_cmd,"newstruct")==0)
904  {
905  const short t[]={1,STRING_CMD};
906  if (iiCheckTypes(h,t,1))
907  {
908  int id=0;
909  char *n=(char*)h->Data();
910  blackboxIsCmd(n,id);
911  if (id>0)
912  {
913  blackbox *bb=getBlackboxStuff(id);
914  if (BB_LIKE_LIST(bb))
915  {
916  newstruct_desc desc=(newstruct_desc)bb->data;
917  newstructShow(desc);
918  return FALSE;
919  }
920  else Werror("'%s' is not a newstruct",n);
921  }
922  else Werror("'%s' is not a blackbox object",n);
923  }
924  return TRUE;
925  }
926  else
927 /*==================== blackbox =================*/
928  if (strcmp(sys_cmd,"blackbox")==0)
929  {
931  return FALSE;
932  }
933  else
934  /*================= absBiFact ======================*/
935  #ifdef HAVE_NTL
936  if (strcmp(sys_cmd, "absFact") == 0)
937  {
938  const short t[]={1,POLY_CMD};
939  if (iiCheckTypes(h,t,1)
940  && (currRing!=NULL)
941  && (getCoeffType(currRing->cf)==n_transExt))
942  {
943  res->rtyp=LIST_CMD;
944  intvec *v=NULL;
945  ideal mipos= NULL;
946  int n= 0;
947  ideal f=singclap_absFactorize((poly)(h->Data()), mipos, &v, n, currRing);
948  if (f==NULL) return TRUE;
949  ivTest(v);
951  l->Init(4);
952  l->m[0].rtyp=IDEAL_CMD;
953  l->m[0].data=(void *)f;
954  l->m[1].rtyp=INTVEC_CMD;
955  l->m[1].data=(void *)v;
956  l->m[2].rtyp=IDEAL_CMD;
957  l->m[2].data=(void*) mipos;
958  l->m[3].rtyp=INT_CMD;
959  l->m[3].data=(void*) (long) n;
960  res->data=(void *)l;
961  return FALSE;
962  }
963  else return TRUE;
964  }
965  else
966  #endif
967  /* =================== LLL via NTL ==============================*/
968  #ifdef HAVE_NTL
969  if (strcmp(sys_cmd, "LLL") == 0)
970  {
971  if (h!=NULL)
972  {
973  res->rtyp=h->Typ();
974  if (h->Typ()==MATRIX_CMD)
975  {
976  res->data=(char *)singntl_LLL((matrix)h->Data(), currRing);
977  return FALSE;
978  }
979  else if (h->Typ()==INTMAT_CMD)
980  {
981  res->data=(char *)singntl_LLL((intvec*)h->Data());
982  return FALSE;
983  }
984  else return TRUE;
985  }
986  else return TRUE;
987  }
988  else
989  #endif
990  /* =================== LLL via Flint ==============================*/
991  #ifdef HAVE_FLINT
992  #if __FLINT_RELEASE >= 20500
993  if (strcmp(sys_cmd, "LLL_Flint") == 0)
994  {
995  if (h!=NULL)
996  {
997  if(h->next == NULL)
998  {
999  res->rtyp=h->Typ();
1000  if (h->Typ()==BIGINTMAT_CMD)
1001  {
1002  res->data=(char *)singflint_LLL((bigintmat*)h->Data(), NULL);
1003  return FALSE;
1004  }
1005  else if (h->Typ()==INTMAT_CMD)
1006  {
1007  res->data=(char *)singflint_LLL((intvec*)h->Data(), NULL);
1008  return FALSE;
1009  }
1010  else return TRUE;
1011  }
1012  if(h->next->Typ()!= INT_CMD)
1013  {
1014  WerrorS("matrix,int or bigint,int expected");
1015  return TRUE;
1016  }
1017  if(h->next->Typ()== INT_CMD)
1018  {
1019  if(((int)((long)(h->next->Data())) != 0) && (int)((long)(h->next->Data()) != 1))
1020  {
1021  WerrorS("int is different from 0, 1");
1022  return TRUE;
1023  }
1024  res->rtyp=h->Typ();
1025  if((long)(h->next->Data()) == 0)
1026  {
1027  if (h->Typ()==BIGINTMAT_CMD)
1028  {
1029  res->data=(char *)singflint_LLL((bigintmat*)h->Data(), NULL);
1030  return FALSE;
1031  }
1032  else if (h->Typ()==INTMAT_CMD)
1033  {
1034  res->data=(char *)singflint_LLL((intvec*)h->Data(), NULL);
1035  return FALSE;
1036  }
1037  else return TRUE;
1038  }
1039  // This will give also the transformation matrix U s.t. res = U * m
1040  if((long)(h->next->Data()) == 1)
1041  {
1042  if (h->Typ()==BIGINTMAT_CMD)
1043  {
1044  bigintmat* m = (bigintmat*)h->Data();
1045  bigintmat* T = new bigintmat(m->rows(),m->rows(),m->basecoeffs());
1046  for(int i = 1; i<=m->rows(); i++)
1047  {
1048  n_Delete(&(BIMATELEM(*T,i,i)),T->basecoeffs());
1049  BIMATELEM(*T,i,i)=n_Init(1, T->basecoeffs());
1050  }
1051  m = singflint_LLL(m,T);
1053  L->Init(2);
1054  L->m[0].rtyp = BIGINTMAT_CMD; L->m[0].data = (void*)m;
1055  L->m[1].rtyp = BIGINTMAT_CMD; L->m[1].data = (void*)T;
1056  res->data=L;
1057  res->rtyp=LIST_CMD;
1058  return FALSE;
1059  }
1060  else if (h->Typ()==INTMAT_CMD)
1061  {
1062  intvec* m = (intvec*)h->Data();
1063  intvec* T = new intvec(m->rows(),m->rows(),(int)0);
1064  for(int i = 1; i<=m->rows(); i++)
1065  IMATELEM(*T,i,i)=1;
1066  m = singflint_LLL(m,T);
1068  L->Init(2);
1069  L->m[0].rtyp = INTMAT_CMD; L->m[0].data = (void*)m;
1070  L->m[1].rtyp = INTMAT_CMD; L->m[1].data = (void*)T;
1071  res->data=L;
1072  res->rtyp=LIST_CMD;
1073  return FALSE;
1074  }
1075  else return TRUE;
1076  }
1077  }
1078 
1079  }
1080  else return TRUE;
1081  }
1082  else
1083  #endif
1084  #endif
1085  /*==================== shift-test for freeGB =================*/
1086  #ifdef HAVE_SHIFTBBA
1087  if (strcmp(sys_cmd, "stest") == 0)
1088  {
1089  const short t[]={4,POLY_CMD,INT_CMD,INT_CMD,INT_CMD};
1090  if (iiCheckTypes(h,t,1))
1091  {
1092  poly p=(poly)h->CopyD();
1093  h=h->next;
1094  int sh=(int)((long)(h->Data()));
1095  h=h->next;
1096  int uptodeg=(int)((long)(h->Data()));
1097  h=h->next;
1098  int lVblock=(int)((long)(h->Data()));
1099  if (sh<0)
1100  {
1101  WerrorS("negative shift for pLPshift");
1102  return TRUE;
1103  }
1104  int L = pmLastVblock(p,lVblock);
1105  if (L+sh-1 > uptodeg)
1106  {
1107  WerrorS("pLPshift: too big shift requested\n");
1108  return TRUE;
1109  }
1110  res->data = pLPshift(p,sh,uptodeg,lVblock);
1111  res->rtyp = POLY_CMD;
1112  return FALSE;
1113  }
1114  else return TRUE;
1115  }
1116  else
1117  #endif
1118  /*==================== block-test for freeGB =================*/
1119  #ifdef HAVE_SHIFTBBA
1120  if (strcmp(sys_cmd, "btest") == 0)
1121  {
1122  const short t[]={2,POLY_CMD,INT_CMD};
1123  if (iiCheckTypes(h,t,1))
1124  {
1125  poly p=(poly)h->CopyD();
1126  h=h->next;
1127  int lV=(int)((long)(h->Data()));
1128  res->rtyp = INT_CMD;
1129  res->data = (void*)(long)pLastVblock(p, lV);
1130  return FALSE;
1131  }
1132  else return TRUE;
1133  }
1134  else
1135  #endif
1136  /*==================== shrink-test for freeGB =================*/
1137  #ifdef HAVE_SHIFTBBA
1138  if (strcmp(sys_cmd, "shrinktest") == 0)
1139  {
1140  const short t[]={2,POLY_CMD,INT_CMD};
1141  if (iiCheckTypes(h,t,1))
1142  {
1143  poly p=(poly)h->Data();
1144  h=h->next;
1145  int lV=(int)((long)(h->Data()));
1146  res->rtyp = POLY_CMD;
1147  // res->data = p_mShrink(p, lV, currRing);
1148  // kStrategy strat=new skStrategy;
1149  // strat->tailRing = currRing;
1150  res->data = p_Shrink(p, lV, currRing);
1151  return FALSE;
1152  }
1153  else return TRUE;
1154  }
1155  else
1156  #endif
1157  /*==================== pcv ==================================*/
1158  #ifdef HAVE_PCV
1159  if(strcmp(sys_cmd,"pcvLAddL")==0)
1160  {
1161  return pcvLAddL(res,h);
1162  }
1163  else
1164  if(strcmp(sys_cmd,"pcvPMulL")==0)
1165  {
1166  return pcvPMulL(res,h);
1167  }
1168  else
1169  if(strcmp(sys_cmd,"pcvMinDeg")==0)
1170  {
1171  return pcvMinDeg(res,h);
1172  }
1173  else
1174  if(strcmp(sys_cmd,"pcvP2CV")==0)
1175  {
1176  return pcvP2CV(res,h);
1177  }
1178  else
1179  if(strcmp(sys_cmd,"pcvCV2P")==0)
1180  {
1181  return pcvCV2P(res,h);
1182  }
1183  else
1184  if(strcmp(sys_cmd,"pcvDim")==0)
1185  {
1186  return pcvDim(res,h);
1187  }
1188  else
1189  if(strcmp(sys_cmd,"pcvBasis")==0)
1190  {
1191  return pcvBasis(res,h);
1192  }
1193  else
1194  #endif
1195  /*==================== hessenberg/eigenvalues ==================================*/
1196  #ifdef HAVE_EIGENVAL
1197  if(strcmp(sys_cmd,"hessenberg")==0)
1198  {
1199  return evHessenberg(res,h);
1200  }
1201  else
1202  #endif
1203  /*==================== eigenvalues ==================================*/
1204  #ifdef HAVE_EIGENVAL
1205  if(strcmp(sys_cmd,"eigenvals")==0)
1206  {
1207  return evEigenvals(res,h);
1208  }
1209  else
1210  #endif
1211  /*==================== rowelim ==================================*/
1212  #ifdef HAVE_EIGENVAL
1213  if(strcmp(sys_cmd,"rowelim")==0)
1214  {
1215  return evRowElim(res,h);
1216  }
1217  else
1218  #endif
1219  /*==================== rowcolswap ==================================*/
1220  #ifdef HAVE_EIGENVAL
1221  if(strcmp(sys_cmd,"rowcolswap")==0)
1222  {
1223  return evSwap(res,h);
1224  }
1225  else
1226  #endif
1227  /*==================== Gauss-Manin system ==================================*/
1228  #ifdef HAVE_GMS
1229  if(strcmp(sys_cmd,"gmsnf")==0)
1230  {
1231  return gmsNF(res,h);
1232  }
1233  else
1234  #endif
1235  /*==================== contributors =============================*/
1236  if(strcmp(sys_cmd,"contributors") == 0)
1237  {
1238  res->rtyp=STRING_CMD;
1239  res->data=(void *)omStrDup(
1240  "Olaf Bachmann, Michael Brickenstein, Hubert Grassmann, Kai Krueger, Victor Levandovskyy, Wolfgang Neumann, Thomas Nuessler, Wilfred Pohl, Jens Schmidt, Mathias Schulze, Thomas Siebert, Ruediger Stobbe, Moritz Wenk, Tim Wichmann");
1241  return FALSE;
1242  }
1243  else
1244  /*==================== spectrum =============================*/
1245  #ifdef HAVE_SPECTRUM
1246  if(strcmp(sys_cmd,"spectrum") == 0)
1247  {
1248  if ((h==NULL) || (h->Typ()!=POLY_CMD))
1249  {
1250  WerrorS("poly expected");
1251  return TRUE;
1252  }
1253  if (h->next==NULL)
1254  return spectrumProc(res,h);
1255  if (h->next->Typ()!=INT_CMD)
1256  {
1257  WerrorS("poly,int expected");
1258  return TRUE;
1259  }
1260  if(((long)h->next->Data())==1L)
1261  return spectrumfProc(res,h);
1262  return spectrumProc(res,h);
1263  }
1264  else
1265  /*==================== semic =============================*/
1266  if(strcmp(sys_cmd,"semic") == 0)
1267  {
1268  if ((h->next!=NULL)
1269  && (h->Typ()==LIST_CMD)
1270  && (h->next->Typ()==LIST_CMD))
1271  {
1272  if (h->next->next==NULL)
1273  return semicProc(res,h,h->next);
1274  else if (h->next->next->Typ()==INT_CMD)
1275  return semicProc3(res,h,h->next,h->next->next);
1276  }
1277  return TRUE;
1278  }
1279  else
1280  /*==================== spadd =============================*/
1281  if(strcmp(sys_cmd,"spadd") == 0)
1282  {
1283  const short t[]={2,LIST_CMD,LIST_CMD};
1284  if (iiCheckTypes(h,t,1))
1285  {
1286  return spaddProc(res,h,h->next);
1287  }
1288  return TRUE;
1289  }
1290  else
1291  /*==================== spmul =============================*/
1292  if(strcmp(sys_cmd,"spmul") == 0)
1293  {
1294  const short t[]={2,LIST_CMD,INT_CMD};
1295  if (iiCheckTypes(h,t,1))
1296  {
1297  return spmulProc(res,h,h->next);
1298  }
1299  return TRUE;
1300  }
1301  else
1302  #endif
1303 /*==================== tensorModuleMult ========================= */
1304  #define HAVE_SHEAFCOH_TRICKS 1
1305 
1306  #ifdef HAVE_SHEAFCOH_TRICKS
1307  if(strcmp(sys_cmd,"tensorModuleMult")==0)
1308  {
1309  const short t[]={2,INT_CMD,MODUL_CMD};
1310  // WarnS("tensorModuleMult!");
1311  if (iiCheckTypes(h,t,1))
1312  {
1313  int m = (int)( (long)h->Data() );
1314  ideal M = (ideal)h->next->Data();
1315  res->rtyp=MODUL_CMD;
1316  res->data=(void *)id_TensorModuleMult(m, M, currRing);
1317  return FALSE;
1318  }
1319  return TRUE;
1320  }
1321  else
1322  #endif
1323  /*==================== twostd =================*/
1324  #ifdef HAVE_PLURAL
1325  if (strcmp(sys_cmd, "twostd") == 0)
1326  {
1327  ideal I;
1328  if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
1329  {
1330  I=(ideal)h->CopyD();
1331  res->rtyp=IDEAL_CMD;
1332  if (rIsPluralRing(currRing)) res->data=twostd(I);
1333  else res->data=I;
1334  setFlag(res,FLAG_TWOSTD);
1335  setFlag(res,FLAG_STD);
1336  }
1337  else return TRUE;
1338  return FALSE;
1339  }
1340  else
1341  #endif
1342  /*==================== lie bracket =================*/
1343  #ifdef HAVE_PLURAL
1344  if (strcmp(sys_cmd, "bracket") == 0)
1345  {
1346  const short t[]={2,POLY_CMD,POLY_CMD};
1347  if (iiCheckTypes(h,t,1))
1348  {
1349  poly p=(poly)h->CopyD();
1350  h=h->next;
1351  poly q=(poly)h->Data();
1352  res->rtyp=POLY_CMD;
1354  return FALSE;
1355  }
1356  return TRUE;
1357  }
1358  else
1359  #endif
1360  /*==================== env ==================================*/
1361  #ifdef HAVE_PLURAL
1362  if (strcmp(sys_cmd, "env")==0)
1363  {
1364  if ((h!=NULL) && (h->Typ()==RING_CMD))
1365  {
1366  ring r = (ring)h->Data();
1367  res->data = rEnvelope(r);
1368  res->rtyp = RING_CMD;
1369  return FALSE;
1370  }
1371  else
1372  {
1373  WerrorS("`system(\"env\",<ring>)` expected");
1374  return TRUE;
1375  }
1376  }
1377  else
1378  #endif
1379 /* ============ opp ======================== */
1380  #ifdef HAVE_PLURAL
1381  if (strcmp(sys_cmd, "opp")==0)
1382  {
1383  if ((h!=NULL) && (h->Typ()==RING_CMD))
1384  {
1385  ring r=(ring)h->Data();
1386  res->data=rOpposite(r);
1387  res->rtyp=RING_CMD;
1388  return FALSE;
1389  }
1390  else
1391  {
1392  WerrorS("`system(\"opp\",<ring>)` expected");
1393  return TRUE;
1394  }
1395  }
1396  else
1397  #endif
1398  /*==================== oppose ==================================*/
1399  #ifdef HAVE_PLURAL
1400  if (strcmp(sys_cmd, "oppose")==0)
1401  {
1402  if ((h!=NULL) && (h->Typ()==RING_CMD)
1403  && (h->next!= NULL))
1404  {
1405  ring Rop = (ring)h->Data();
1406  h = h->next;
1407  idhdl w;
1408  if ((w=Rop->idroot->get(h->Name(),myynest))!=NULL)
1409  {
1410  poly p = (poly)IDDATA(w);
1411  res->data = pOppose(Rop, p, currRing); // into CurrRing?
1412  res->rtyp = POLY_CMD;
1413  return FALSE;
1414  }
1415  }
1416  else
1417  {
1418  WerrorS("`system(\"oppose\",<ring>,<poly>)` expected");
1419  return TRUE;
1420  }
1421  }
1422  else
1423  #endif
1424  /*==================== freeGB, twosided GB in free algebra =================*/
1425  #ifdef HAVE_PLURAL
1426  #ifdef HAVE_SHIFTBBA
1427  if (strcmp(sys_cmd, "freegb") == 0)
1428  {
1429  const short t[]={3,IDEAL_CMD,INT_CMD,INT_CMD};
1430  if (iiCheckTypes(h,t,1))
1431  {
1432  ideal I=(ideal)h->CopyD();
1433  h=h->next;
1434  int uptodeg=(int)((long)(h->Data()));
1435  h=h->next;
1436  int lVblock=(int)((long)(h->Data()));
1437  res->data = freegb(I,uptodeg,lVblock);
1438  if (res->data == NULL)
1439  {
1440  /* that is there were input errors */
1441  res->data = I;
1442  }
1443  res->rtyp = IDEAL_CMD;
1444  return FALSE;
1445  }
1446  else return TRUE;
1447  }
1448  else
1449  #endif /*SHIFTBBA*/
1450  #endif /*PLURAL*/
1451  /*==================== walk stuff =================*/
1452  /*==================== walkNextWeight =================*/
1453  #ifdef HAVE_WALK
1454  #ifdef OWNW
1455  if (strcmp(sys_cmd, "walkNextWeight") == 0)
1456  {
1457  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1458  if (!iiCheckTypes(h,t,1)) return TRUE;
1459  if (((intvec*) h->Data())->length() != currRing->N ||
1460  ((intvec*) h->next->Data())->length() != currRing->N)
1461  {
1462  Werror("system(\"walkNextWeight\" ...) intvecs not of length %d\n",
1463  currRing->N);
1464  return TRUE;
1465  }
1466  res->data = (void*) walkNextWeight(((intvec*) h->Data()),
1467  ((intvec*) h->next->Data()),
1468  (ideal) h->next->next->Data());
1469  if (res->data == NULL || res->data == (void*) 1L)
1470  {
1471  res->rtyp = INT_CMD;
1472  }
1473  else
1474  {
1475  res->rtyp = INTVEC_CMD;
1476  }
1477  return FALSE;
1478  }
1479  else
1480  #endif
1481  #endif
1482  /*==================== walkNextWeight =================*/
1483  #ifdef HAVE_WALK
1484  #ifdef OWNW
1485  if (strcmp(sys_cmd, "walkInitials") == 0)
1486  {
1487  if (h == NULL || h->Typ() != IDEAL_CMD)
1488  {
1489  WerrorS("system(\"walkInitials\", ideal) expected");
1490  return TRUE;
1491  }
1492  res->data = (void*) walkInitials((ideal) h->Data());
1493  res->rtyp = IDEAL_CMD;
1494  return FALSE;
1495  }
1496  else
1497  #endif
1498  #endif
1499  /*==================== walkAddIntVec =================*/
1500  #ifdef HAVE_WALK
1501  #ifdef WAIV
1502  if (strcmp(sys_cmd, "walkAddIntVec") == 0)
1503  {
1504  const short t[]={2,INTVEC_CMD,INTVEC_CMD};
1505  if (!iiCheckTypes(h,t,1)) return TRUE;
1506  intvec* arg1 = (intvec*) h->Data();
1507  intvec* arg2 = (intvec*) h->next->Data();
1508  res->data = (intvec*) walkAddIntVec(arg1, arg2);
1509  res->rtyp = INTVEC_CMD;
1510  return FALSE;
1511  }
1512  else
1513  #endif
1514  #endif
1515  /*==================== MwalkNextWeight =================*/
1516  #ifdef HAVE_WALK
1517  #ifdef MwaklNextWeight
1518  if (strcmp(sys_cmd, "MwalkNextWeight") == 0)
1519  {
1520  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1521  if (!iiCheckTypes(h,t,1)) return TRUE;
1522  if (((intvec*) h->Data())->length() != currRing->N ||
1523  ((intvec*) h->next->Data())->length() != currRing->N)
1524  {
1525  Werror("system(\"MwalkNextWeight\" ...) intvecs not of length %d\n",
1526  currRing->N);
1527  return TRUE;
1528  }
1529  intvec* arg1 = (intvec*) h->Data();
1530  intvec* arg2 = (intvec*) h->next->Data();
1531  ideal arg3 = (ideal) h->next->next->Data();
1532  intvec* result = (intvec*) MwalkNextWeight(arg1, arg2, arg3);
1533  res->rtyp = INTVEC_CMD;
1534  res->data = result;
1535  return FALSE;
1536  }
1537  else
1538  #endif //MWalkNextWeight
1539  #endif
1540  /*==================== Mivdp =================*/
1541  #ifdef HAVE_WALK
1542  if(strcmp(sys_cmd, "Mivdp") == 0)
1543  {
1544  if (h == NULL || h->Typ() != INT_CMD)
1545  {
1546  WerrorS("system(\"Mivdp\", int) expected");
1547  return TRUE;
1548  }
1549  if ((int) ((long)(h->Data())) != currRing->N)
1550  {
1551  Werror("system(\"Mivdp\" ...) intvecs not of length %d\n",
1552  currRing->N);
1553  return TRUE;
1554  }
1555  int arg1 = (int) ((long)(h->Data()));
1556  intvec* result = (intvec*) Mivdp(arg1);
1557  res->rtyp = INTVEC_CMD;
1558  res->data = result;
1559  return FALSE;
1560  }
1561  else
1562  #endif
1563  /*==================== Mivlp =================*/
1564  #ifdef HAVE_WALK
1565  if(strcmp(sys_cmd, "Mivlp") == 0)
1566  {
1567  if (h == NULL || h->Typ() != INT_CMD)
1568  {
1569  WerrorS("system(\"Mivlp\", int) expected");
1570  return TRUE;
1571  }
1572  if ((int) ((long)(h->Data())) != currRing->N)
1573  {
1574  Werror("system(\"Mivlp\" ...) intvecs not of length %d\n",
1575  currRing->N);
1576  return TRUE;
1577  }
1578  int arg1 = (int) ((long)(h->Data()));
1579  intvec* result = (intvec*) Mivlp(arg1);
1580  res->rtyp = INTVEC_CMD;
1581  res->data = result;
1582  return FALSE;
1583  }
1584  else
1585  #endif
1586  /*==================== MpDiv =================*/
1587  #ifdef HAVE_WALK
1588  #ifdef MpDiv
1589  if(strcmp(sys_cmd, "MpDiv") == 0)
1590  {
1591  const short t[]={2,POLY_CMD,POLY_CMD};
1592  if (!iiCheckTypes(h,t,1)) return TRUE;
1593  poly arg1 = (poly) h->Data();
1594  poly arg2 = (poly) h->next->Data();
1595  poly result = MpDiv(arg1, arg2);
1596  res->rtyp = POLY_CMD;
1597  res->data = result;
1598  return FALSE;
1599  }
1600  else
1601  #endif
1602  #endif
1603  /*==================== MpMult =================*/
1604  #ifdef HAVE_WALK
1605  #ifdef MpMult
1606  if(strcmp(sys_cmd, "MpMult") == 0)
1607  {
1608  const short t[]={2,POLY_CMD,POLY_CMD};
1609  if (!iiCheckTypes(h,t,1)) return TRUE;
1610  poly arg1 = (poly) h->Data();
1611  poly arg2 = (poly) h->next->Data();
1612  poly result = MpMult(arg1, arg2);
1613  res->rtyp = POLY_CMD;
1614  res->data = result;
1615  return FALSE;
1616  }
1617  else
1618  #endif
1619  #endif
1620  /*==================== MivSame =================*/
1621  #ifdef HAVE_WALK
1622  if (strcmp(sys_cmd, "MivSame") == 0)
1623  {
1624  const short t[]={2,INTVEC_CMD,INTVEC_CMD};
1625  if (!iiCheckTypes(h,t,1)) return TRUE;
1626  /*
1627  if (((intvec*) h->Data())->length() != currRing->N ||
1628  ((intvec*) h->next->Data())->length() != currRing->N)
1629  {
1630  Werror("system(\"MivSame\" ...) intvecs not of length %d\n",
1631  currRing->N);
1632  return TRUE;
1633  }
1634  */
1635  intvec* arg1 = (intvec*) h->Data();
1636  intvec* arg2 = (intvec*) h->next->Data();
1637  /*
1638  poly result = (poly) MivSame(arg1, arg2);
1639  res->rtyp = POLY_CMD;
1640  res->data = (poly) result;
1641  */
1642  res->rtyp = INT_CMD;
1643  res->data = (void*)(long) MivSame(arg1, arg2);
1644  return FALSE;
1645  }
1646  else
1647  #endif
1648  /*==================== M3ivSame =================*/
1649  #ifdef HAVE_WALK
1650  if (strcmp(sys_cmd, "M3ivSame") == 0)
1651  {
1652  const short t[]={3,INTVEC_CMD,INTVEC_CMD,INTVEC_CMD};
1653  if (!iiCheckTypes(h,t,1)) return TRUE;
1654  /*
1655  if (((intvec*) h->Data())->length() != currRing->N ||
1656  ((intvec*) h->next->Data())->length() != currRing->N ||
1657  ((intvec*) h->next->next->Data())->length() != currRing->N )
1658  {
1659  Werror("system(\"M3ivSame\" ...) intvecs not of length %d\n",
1660  currRing->N);
1661  return TRUE;
1662  }
1663  */
1664  intvec* arg1 = (intvec*) h->Data();
1665  intvec* arg2 = (intvec*) h->next->Data();
1666  intvec* arg3 = (intvec*) h->next->next->Data();
1667  /*
1668  poly result = (poly) M3ivSame(arg1, arg2, arg3);
1669  res->rtyp = POLY_CMD;
1670  res->data = (poly) result;
1671  */
1672  res->rtyp = INT_CMD;
1673  res->data = (void*)(long) M3ivSame(arg1, arg2, arg3);
1674  return FALSE;
1675  }
1676  else
1677  #endif
1678  /*==================== MwalkInitialForm =================*/
1679  #ifdef HAVE_WALK
1680  if(strcmp(sys_cmd, "MwalkInitialForm") == 0)
1681  {
1682  const short t[]={2,IDEAL_CMD,INTVEC_CMD};
1683  if (!iiCheckTypes(h,t,1)) return TRUE;
1684  if(((intvec*) h->next->Data())->length() != currRing->N)
1685  {
1686  Werror("system \"MwalkInitialForm\"...) intvec not of length %d\n",
1687  currRing->N);
1688  return TRUE;
1689  }
1690  ideal id = (ideal) h->Data();
1691  intvec* int_w = (intvec*) h->next->Data();
1692  ideal result = (ideal) MwalkInitialForm(id, int_w);
1693  res->rtyp = IDEAL_CMD;
1694  res->data = result;
1695  return FALSE;
1696  }
1697  else
1698  #endif
1699  /*==================== MivMatrixOrder =================*/
1700  #ifdef HAVE_WALK
1701  /************** Perturbation walk **********/
1702  if(strcmp(sys_cmd, "MivMatrixOrder") == 0)
1703  {
1704  if(h==NULL || h->Typ() != INTVEC_CMD)
1705  {
1706  WerrorS("system(\"MivMatrixOrder\",intvec) expected");
1707  return TRUE;
1708  }
1709  intvec* arg1 = (intvec*) h->Data();
1710  intvec* result = MivMatrixOrder(arg1);
1711  res->rtyp = INTVEC_CMD;
1712  res->data = result;
1713  return FALSE;
1714  }
1715  else
1716  #endif
1717  /*==================== MivMatrixOrderdp =================*/
1718  #ifdef HAVE_WALK
1719  if(strcmp(sys_cmd, "MivMatrixOrderdp") == 0)
1720  {
1721  if(h==NULL || h->Typ() != INT_CMD)
1722  {
1723  WerrorS("system(\"MivMatrixOrderdp\",intvec) expected");
1724  return TRUE;
1725  }
1726  int arg1 = (int) ((long)(h->Data()));
1727  intvec* result = (intvec*) MivMatrixOrderdp(arg1);
1728  res->rtyp = INTVEC_CMD;
1729  res->data = result;
1730  return FALSE;
1731  }
1732  else
1733  #endif
1734  /*==================== MPertVectors =================*/
1735  #ifdef HAVE_WALK
1736  if(strcmp(sys_cmd, "MPertVectors") == 0)
1737  {
1738  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INT_CMD};
1739  if (!iiCheckTypes(h,t,1)) return TRUE;
1740  ideal arg1 = (ideal) h->Data();
1741  intvec* arg2 = (intvec*) h->next->Data();
1742  int arg3 = (int) ((long)(h->next->next->Data()));
1743  intvec* result = (intvec*) MPertVectors(arg1, arg2, arg3);
1744  res->rtyp = INTVEC_CMD;
1745  res->data = result;
1746  return FALSE;
1747  }
1748  else
1749  #endif
1750  /*==================== MPertVectorslp =================*/
1751  #ifdef HAVE_WALK
1752  if(strcmp(sys_cmd, "MPertVectorslp") == 0)
1753  {
1754  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INT_CMD};
1755  if (!iiCheckTypes(h,t,1)) return TRUE;
1756  ideal arg1 = (ideal) h->Data();
1757  intvec* arg2 = (intvec*) h->next->Data();
1758  int arg3 = (int) ((long)(h->next->next->Data()));
1759  intvec* result = (intvec*) MPertVectorslp(arg1, arg2, arg3);
1760  res->rtyp = INTVEC_CMD;
1761  res->data = result;
1762  return FALSE;
1763  }
1764  else
1765  #endif
1766  /************** fractal walk **********/
1767  #ifdef HAVE_WALK
1768  if(strcmp(sys_cmd, "Mfpertvector") == 0)
1769  {
1770  const short t[]={2,IDEAL_CMD,INTVEC_CMD};
1771  if (!iiCheckTypes(h,t,1)) return TRUE;
1772  ideal arg1 = (ideal) h->Data();
1773  intvec* arg2 = (intvec*) h->next->Data();
1774  intvec* result = Mfpertvector(arg1, arg2);
1775  res->rtyp = INTVEC_CMD;
1776  res->data = result;
1777  return FALSE;
1778  }
1779  else
1780  #endif
1781  /*==================== MivUnit =================*/
1782  #ifdef HAVE_WALK
1783  if(strcmp(sys_cmd, "MivUnit") == 0)
1784  {
1785  const short t[]={1,INT_CMD};
1786  if (!iiCheckTypes(h,t,1)) return TRUE;
1787  int arg1 = (int) ((long)(h->Data()));
1788  intvec* result = (intvec*) MivUnit(arg1);
1789  res->rtyp = INTVEC_CMD;
1790  res->data = result;
1791  return FALSE;
1792  }
1793  else
1794  #endif
1795  /*==================== MivWeightOrderlp =================*/
1796  #ifdef HAVE_WALK
1797  if(strcmp(sys_cmd, "MivWeightOrderlp") == 0)
1798  {
1799  const short t[]={1,INTVEC_CMD};
1800  if (!iiCheckTypes(h,t,1)) return TRUE;
1801  intvec* arg1 = (intvec*) h->Data();
1802  intvec* result = MivWeightOrderlp(arg1);
1803  res->rtyp = INTVEC_CMD;
1804  res->data = result;
1805  return FALSE;
1806  }
1807  else
1808  #endif
1809  /*==================== MivWeightOrderdp =================*/
1810  #ifdef HAVE_WALK
1811  if(strcmp(sys_cmd, "MivWeightOrderdp") == 0)
1812  {
1813  if(h==NULL || h->Typ() != INTVEC_CMD)
1814  {
1815  WerrorS("system(\"MivWeightOrderdp\",intvec) expected");
1816  return TRUE;
1817  }
1818  intvec* arg1 = (intvec*) h->Data();
1819  //int arg2 = (int) h->next->Data();
1820  intvec* result = MivWeightOrderdp(arg1);
1821  res->rtyp = INTVEC_CMD;
1822  res->data = result;
1823  return FALSE;
1824  }
1825  else
1826  #endif
1827  /*==================== MivMatrixOrderlp =================*/
1828  #ifdef HAVE_WALK
1829  if(strcmp(sys_cmd, "MivMatrixOrderlp") == 0)
1830  {
1831  if(h==NULL || h->Typ() != INT_CMD)
1832  {
1833  WerrorS("system(\"MivMatrixOrderlp\",int) expected");
1834  return TRUE;
1835  }
1836  int arg1 = (int) ((long)(h->Data()));
1837  intvec* result = (intvec*) MivMatrixOrderlp(arg1);
1838  res->rtyp = INTVEC_CMD;
1839  res->data = result;
1840  return FALSE;
1841  }
1842  else
1843  #endif
1844  /*==================== MkInterRedNextWeight =================*/
1845  #ifdef HAVE_WALK
1846  if (strcmp(sys_cmd, "MkInterRedNextWeight") == 0)
1847  {
1848  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1849  if (!iiCheckTypes(h,t,1)) return TRUE;
1850  if (((intvec*) h->Data())->length() != currRing->N ||
1851  ((intvec*) h->next->Data())->length() != currRing->N)
1852  {
1853  Werror("system(\"MkInterRedNextWeight\" ...) intvecs not of length %d\n",
1854  currRing->N);
1855  return TRUE;
1856  }
1857  intvec* arg1 = (intvec*) h->Data();
1858  intvec* arg2 = (intvec*) h->next->Data();
1859  ideal arg3 = (ideal) h->next->next->Data();
1860  intvec* result = (intvec*) MkInterRedNextWeight(arg1, arg2, arg3);
1861  res->rtyp = INTVEC_CMD;
1862  res->data = result;
1863  return FALSE;
1864  }
1865  else
1866  #endif
1867  /*==================== MPertNextWeight =================*/
1868  #ifdef HAVE_WALK
1869  #ifdef MPertNextWeight
1870  if (strcmp(sys_cmd, "MPertNextWeight") == 0)
1871  {
1872  const short t[]={3,INTVEC_CMD,IDEAL_CMD,INT_CMD};
1873  if (!iiCheckTypes(h,t,1)) return TRUE;
1874  if (((intvec*) h->Data())->length() != currRing->N)
1875  {
1876  Werror("system(\"MPertNextWeight\" ...) intvecs not of length %d\n",
1877  currRing->N);
1878  return TRUE;
1879  }
1880  intvec* arg1 = (intvec*) h->Data();
1881  ideal arg2 = (ideal) h->next->Data();
1882  int arg3 = (int) h->next->next->Data();
1883  intvec* result = (intvec*) MPertNextWeight(arg1, arg2, arg3);
1884  res->rtyp = INTVEC_CMD;
1885  res->data = result;
1886  return FALSE;
1887  }
1888  else
1889  #endif //MPertNextWeight
1890  #endif
1891  /*==================== Mivperttarget =================*/
1892  #ifdef HAVE_WALK
1893  #ifdef Mivperttarget
1894  if (strcmp(sys_cmd, "Mivperttarget") == 0)
1895  {
1896  const short t[]={2,IDEAL_CMD,INT_CMD};
1897  if (!iiCheckTypes(h,t,1)) return TRUE;
1898  ideal arg1 = (ideal) h->Data();
1899  int arg2 = (int) h->next->Data();
1900  intvec* result = (intvec*) Mivperttarget(arg1, arg2);
1901  res->rtyp = INTVEC_CMD;
1902  res->data = result;
1903  return FALSE;
1904  }
1905  else
1906  #endif //Mivperttarget
1907  #endif
1908  /*==================== Mwalk =================*/
1909  #ifdef HAVE_WALK
1910  if (strcmp(sys_cmd, "Mwalk") == 0)
1911  {
1912  const short t[]={6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,RING_CMD,INT_CMD,INT_CMD};
1913  if (!iiCheckTypes(h,t,1)) return TRUE;
1914  if (((intvec*) h->next->Data())->length() != currRing->N &&
1915  ((intvec*) h->next->next->Data())->length() != currRing->N )
1916  {
1917  Werror("system(\"Mwalk\" ...) intvecs not of length %d\n",
1918  currRing->N);
1919  return TRUE;
1920  }
1921  ideal arg1 = (ideal) h->CopyD();
1922  intvec* arg2 = (intvec*) h->next->Data();
1923  intvec* arg3 = (intvec*) h->next->next->Data();
1924  ring arg4 = (ring) h->next->next->next->Data();
1925  int arg5 = (int) (long) h->next->next->next->next->Data();
1926  int arg6 = (int) (long) h->next->next->next->next->next->Data();
1927  ideal result = (ideal) Mwalk(arg1, arg2, arg3, arg4, arg5, arg6);
1928  res->rtyp = IDEAL_CMD;
1929  res->data = result;
1930  return FALSE;
1931  }
1932  else
1933  #endif
1934  /*==================== Mpwalk =================*/
1935  #ifdef HAVE_WALK
1936  #ifdef MPWALK_ORIG
1937  if (strcmp(sys_cmd, "Mwalk") == 0)
1938  {
1939  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,RING_CMD};
1940  if (!iiCheckTypes(h,t,1)) return TRUE;
1941  if ((((intvec*) h->next->Data())->length() != currRing->N &&
1942  ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
1943  (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
1944  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N)))
1945  {
1946  Werror("system(\"Mwalk\" ...) intvecs not of length %d or %d\n",
1947  currRing->N,(currRing->N)*(currRing->N));
1948  return TRUE;
1949  }
1950  ideal arg1 = (ideal) h->Data();
1951  intvec* arg2 = (intvec*) h->next->Data();
1952  intvec* arg3 = (intvec*) h->next->next->Data();
1953  ring arg4 = (ring) h->next->next->next->Data();
1954  ideal result = (ideal) Mwalk(arg1, arg2, arg3,arg4);
1955  res->rtyp = IDEAL_CMD;
1956  res->data = result;
1957  return FALSE;
1958  }
1959  else
1960  #else
1961  if (strcmp(sys_cmd, "Mpwalk") == 0)
1962  {
1963  const short t[]={8,IDEAL_CMD,INT_CMD,INT_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,INT_CMD};
1964  if (!iiCheckTypes(h,t,1)) return TRUE;
1965  if(((intvec*) h->next->next->next->Data())->length() != currRing->N &&
1966  ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
1967  {
1968  Werror("system(\"Mpwalk\" ...) intvecs not of length %d\n",currRing->N);
1969  return TRUE;
1970  }
1971  ideal arg1 = (ideal) h->Data();
1972  int arg2 = (int) (long) h->next->Data();
1973  int arg3 = (int) (long) h->next->next->Data();
1974  intvec* arg4 = (intvec*) h->next->next->next->Data();
1975  intvec* arg5 = (intvec*) h->next->next->next->next->Data();
1976  int arg6 = (int) (long) h->next->next->next->next->next->Data();
1977  int arg7 = (int) (long) h->next->next->next->next->next->next->Data();
1978  int arg8 = (int) (long) h->next->next->next->next->next->next->next->Data();
1979  ideal result = (ideal) Mpwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
1980  res->rtyp = IDEAL_CMD;
1981  res->data = result;
1982  return FALSE;
1983  }
1984  else
1985  #endif
1986  #endif
1987  /*==================== Mrwalk =================*/
1988  #ifdef HAVE_WALK
1989  if (strcmp(sys_cmd, "Mrwalk") == 0)
1990  {
1991  const short t[]={7,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,INT_CMD,INT_CMD};
1992  if (!iiCheckTypes(h,t,1)) return TRUE;
1993  if(((intvec*) h->next->Data())->length() != currRing->N &&
1994  ((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
1995  ((intvec*) h->next->next->Data())->length() != currRing->N &&
1996  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) )
1997  {
1998  Werror("system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
1999  currRing->N,(currRing->N)*(currRing->N));
2000  return TRUE;
2001  }
2002  ideal arg1 = (ideal) h->Data();
2003  intvec* arg2 = (intvec*) h->next->Data();
2004  intvec* arg3 = (intvec*) h->next->next->Data();
2005  int arg4 = (int)(long) h->next->next->next->Data();
2006  int arg5 = (int)(long) h->next->next->next->next->Data();
2007  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2008  int arg7 = (int)(long) h->next->next->next->next->next->next->Data();
2009  ideal result = (ideal) Mrwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
2010  res->rtyp = IDEAL_CMD;
2011  res->data = result;
2012  return FALSE;
2013  }
2014  else
2015  #endif
2016  /*==================== MAltwalk1 =================*/
2017  #ifdef HAVE_WALK
2018  if (strcmp(sys_cmd, "MAltwalk1") == 0)
2019  {
2020  const short t[]={5,IDEAL_CMD,INT_CMD,INT_CMD,INTVEC_CMD,INTVEC_CMD};
2021  if (!iiCheckTypes(h,t,1)) return TRUE;
2022  if (((intvec*) h->next->next->next->Data())->length() != currRing->N &&
2023  ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
2024  {
2025  Werror("system(\"MAltwalk1\" ...) intvecs not of length %d\n",
2026  currRing->N);
2027  return TRUE;
2028  }
2029  ideal arg1 = (ideal) h->Data();
2030  int arg2 = (int) ((long)(h->next->Data()));
2031  int arg3 = (int) ((long)(h->next->next->Data()));
2032  intvec* arg4 = (intvec*) h->next->next->next->Data();
2033  intvec* arg5 = (intvec*) h->next->next->next->next->Data();
2034  ideal result = (ideal) MAltwalk1(arg1, arg2, arg3, arg4, arg5);
2035  res->rtyp = IDEAL_CMD;
2036  res->data = result;
2037  return FALSE;
2038  }
2039  else
2040  #endif
2041  /*==================== MAltwalk1 =================*/
2042  #ifdef HAVE_WALK
2043  #ifdef MFWALK_ALT
2044  if (strcmp(sys_cmd, "Mfwalk_alt") == 0)
2045  {
2046  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
2047  if (!iiCheckTypes(h,t,1)) return TRUE;
2048  if (((intvec*) h->next->Data())->length() != currRing->N &&
2049  ((intvec*) h->next->next->Data())->length() != currRing->N )
2050  {
2051  Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
2052  currRing->N);
2053  return TRUE;
2054  }
2055  ideal arg1 = (ideal) h->Data();
2056  intvec* arg2 = (intvec*) h->next->Data();
2057  intvec* arg3 = (intvec*) h->next->next->Data();
2058  int arg4 = (int) h->next->next->next->Data();
2059  ideal result = (ideal) Mfwalk_alt(arg1, arg2, arg3, arg4);
2060  res->rtyp = IDEAL_CMD;
2061  res->data = result;
2062  return FALSE;
2063  }
2064  else
2065  #endif
2066  #endif
2067  /*==================== Mfwalk =================*/
2068  #ifdef HAVE_WALK
2069  if (strcmp(sys_cmd, "Mfwalk") == 0)
2070  {
2071  const short t[]={5,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD};
2072  if (!iiCheckTypes(h,t,1)) return TRUE;
2073  if (((intvec*) h->next->Data())->length() != currRing->N &&
2074  ((intvec*) h->next->next->Data())->length() != currRing->N )
2075  {
2076  Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
2077  currRing->N);
2078  return TRUE;
2079  }
2080  ideal arg1 = (ideal) h->Data();
2081  intvec* arg2 = (intvec*) h->next->Data();
2082  intvec* arg3 = (intvec*) h->next->next->Data();
2083  int arg4 = (int)(long) h->next->next->next->Data();
2084  int arg5 = (int)(long) h->next->next->next->next->Data();
2085  ideal result = (ideal) Mfwalk(arg1, arg2, arg3, arg4, arg5);
2086  res->rtyp = IDEAL_CMD;
2087  res->data = result;
2088  return FALSE;
2089  }
2090  else
2091  #endif
2092  /*==================== Mfrwalk =================*/
2093  #ifdef HAVE_WALK
2094  if (strcmp(sys_cmd, "Mfrwalk") == 0)
2095  {
2096  const short t[]={6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,INT_CMD};
2097  if (!iiCheckTypes(h,t,1)) return TRUE;
2098 /*
2099  if (((intvec*) h->next->Data())->length() != currRing->N &&
2100  ((intvec*) h->next->next->Data())->length() != currRing->N)
2101  {
2102  Werror("system(\"Mfrwalk\" ...) intvecs not of length %d\n",currRing->N);
2103  return TRUE;
2104  }
2105 */
2106  if((((intvec*) h->next->Data())->length() != currRing->N &&
2107  ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
2108  (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
2109  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) ))
2110  {
2111  Werror("system(\"Mfrwalk\" ...) intvecs not of length %d or %d\n",
2112  currRing->N,(currRing->N)*(currRing->N));
2113  return TRUE;
2114  }
2115 
2116  ideal arg1 = (ideal) h->Data();
2117  intvec* arg2 = (intvec*) h->next->Data();
2118  intvec* arg3 = (intvec*) h->next->next->Data();
2119  int arg4 = (int)(long) h->next->next->next->Data();
2120  int arg5 = (int)(long) h->next->next->next->next->Data();
2121  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2122  ideal result = (ideal) Mfrwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2123  res->rtyp = IDEAL_CMD;
2124  res->data = result;
2125  return FALSE;
2126  }
2127  else
2128  /*==================== Mprwalk =================*/
2129  if (strcmp(sys_cmd, "Mprwalk") == 0)
2130  {
2131  const short t[]={9,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,INT_CMD,INT_CMD,INT_CMD,INT_CMD};
2132  if (!iiCheckTypes(h,t,1)) return TRUE;
2133  if((((intvec*) h->next->Data())->length() != currRing->N &&
2134  ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
2135  (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
2136  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) ))
2137  {
2138  Werror("system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
2139  currRing->N,(currRing->N)*(currRing->N));
2140  return TRUE;
2141  }
2142  ideal arg1 = (ideal) h->Data();
2143  intvec* arg2 = (intvec*) h->next->Data();
2144  intvec* arg3 = (intvec*) h->next->next->Data();
2145  int arg4 = (int)(long) h->next->next->next->Data();
2146  int arg5 = (int)(long) h->next->next->next->next->Data();
2147  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2148  int arg7 = (int)(long) h->next->next->next->next->next->next->Data();
2149  int arg8 = (int)(long) h->next->next->next->next->next->next->next->Data();
2150  int arg9 = (int)(long) h->next->next->next->next->next->next->next->next->Data();
2151  ideal result = (ideal) Mprwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
2152  res->rtyp = IDEAL_CMD;
2153  res->data = result;
2154  return FALSE;
2155  }
2156  else
2157  #endif
2158  /*==================== TranMImprovwalk =================*/
2159  #ifdef HAVE_WALK
2160  #ifdef TRAN_Orig
2161  if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
2162  {
2163  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};
2164  if (!iiCheckTypes(h,t,1)) return TRUE;
2165  if (((intvec*) h->next->Data())->length() != currRing->N &&
2166  ((intvec*) h->next->next->Data())->length() != currRing->N )
2167  {
2168  Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2169  currRing->N);
2170  return TRUE;
2171  }
2172  ideal arg1 = (ideal) h->Data();
2173  intvec* arg2 = (intvec*) h->next->Data();
2174  intvec* arg3 = (intvec*) h->next->next->Data();
2175  ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3);
2176  res->rtyp = IDEAL_CMD;
2177  res->data = result;
2178  return FALSE;
2179  }
2180  else
2181  #endif
2182  #endif
2183  /*==================== MAltwalk2 =================*/
2184  #ifdef HAVE_WALK
2185  if (strcmp(sys_cmd, "MAltwalk2") == 0)
2186  {
2187  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};
2188  if (!iiCheckTypes(h,t,1)) return TRUE;
2189  if (((intvec*) h->next->Data())->length() != currRing->N &&
2190  ((intvec*) h->next->next->Data())->length() != currRing->N )
2191  {
2192  Werror("system(\"MAltwalk2\" ...) intvecs not of length %d\n",
2193  currRing->N);
2194  return TRUE;
2195  }
2196  ideal arg1 = (ideal) h->Data();
2197  intvec* arg2 = (intvec*) h->next->Data();
2198  intvec* arg3 = (intvec*) h->next->next->Data();
2199  ideal result = (ideal) MAltwalk2(arg1, arg2, arg3);
2200  res->rtyp = IDEAL_CMD;
2201  res->data = result;
2202  return FALSE;
2203  }
2204  else
2205  #endif
2206  /*==================== MAltwalk2 =================*/
2207  #ifdef HAVE_WALK
2208  if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
2209  {
2210  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
2211  if (!iiCheckTypes(h,t,1)) return TRUE;
2212  if (((intvec*) h->next->Data())->length() != currRing->N &&
2213  ((intvec*) h->next->next->Data())->length() != currRing->N )
2214  {
2215  Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2216  currRing->N);
2217  return TRUE;
2218  }
2219  ideal arg1 = (ideal) h->Data();
2220  intvec* arg2 = (intvec*) h->next->Data();
2221  intvec* arg3 = (intvec*) h->next->next->Data();
2222  int arg4 = (int) ((long)(h->next->next->next->Data()));
2223  ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3, arg4);
2224  res->rtyp = IDEAL_CMD;
2225  res->data = result;
2226  return FALSE;
2227  }
2228  else
2229  #endif
2230  /*==================== TranMrImprovwalk =================*/
2231  #if 0
2232  #ifdef HAVE_WALK
2233  if (strcmp(sys_cmd, "TranMrImprovwalk") == 0)
2234  {
2235  if (h == NULL || h->Typ() != IDEAL_CMD ||
2236  h->next == NULL || h->next->Typ() != INTVEC_CMD ||
2237  h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ||
2238  h->next->next->next == NULL || h->next->next->next->Typ() != INT_CMD ||
2239  h->next->next->next == NULL || h->next->next->next->next->Typ() != INT_CMD ||
2240  h->next->next->next == NULL || h->next->next->next->next->next->Typ() != INT_CMD)
2241  {
2242  WerrorS("system(\"TranMrImprovwalk\", ideal, intvec, intvec) expected");
2243  return TRUE;
2244  }
2245  if (((intvec*) h->next->Data())->length() != currRing->N &&
2246  ((intvec*) h->next->next->Data())->length() != currRing->N )
2247  {
2248  Werror("system(\"TranMrImprovwalk\" ...) intvecs not of length %d\n", currRing->N);
2249  return TRUE;
2250  }
2251  ideal arg1 = (ideal) h->Data();
2252  intvec* arg2 = (intvec*) h->next->Data();
2253  intvec* arg3 = (intvec*) h->next->next->Data();
2254  int arg4 = (int)(long) h->next->next->next->Data();
2255  int arg5 = (int)(long) h->next->next->next->next->Data();
2256  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2257  ideal result = (ideal) TranMrImprovwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2258  res->rtyp = IDEAL_CMD;
2259  res->data = result;
2260  return FALSE;
2261  }
2262  else
2263  #endif
2264  #endif
2265  /*================= Extended system call ========================*/
2266  {
2267  #ifndef MAKE_DISTRIBUTION
2268  return(jjEXTENDED_SYSTEM(res, args));
2269  #else
2270  Werror( "system(\"%s\",...) %s", sys_cmd, feNotImplemented );
2271  #endif
2272  }
2273  } /* typ==string */
2274  return TRUE;
2275 }
feOptIndex
Definition: feOptGen.h:15
int & rows()
Definition: matpol.h:24
lists get_denom_list()
Definition: denom_list.cc:8
poly pOppose(ring Rop_src, poly p, const ring Rop_dst)
opposes a vector p from Rop to currRing (dst!)
Definition: old.gring.cc:3426
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
const CanonicalForm int s
Definition: facAbsFact.cc:55
ring rEnvelope(ring R)
Definition: ring.cc:5478
sleftv * m
Definition: lists.h:45
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:972
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2307
void factoryseed(int s)
random seed initializer
Definition: cf_random.cc:176
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define MAXPATHLEN
Definition: omRet2Info.c:22
int HCord
Definition: kutil.cc:235
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
matrix singntl_LLL(matrix m, const ring s)
Definition: clapsing.cc:1737
intvec * Mfpertvector(ideal G, intvec *ivtarget)
Definition: walk.cc:1521
Definition: tok.h:95
static void * feOptValue(feOptIndex opt)
Definition: feOpt.h:40
matrix evRowElim(matrix M, int i, int j, int k)
Definition: eigenval.cc:47
Definition: lists.h:22
ideal Mpwalk(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight, int nP, int reduction, int printout)
Definition: walk.cc:5956
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:39
char * versionString()
Definition: misc_ip.cc:778
#define FALSE
Definition: auxiliary.h:95
return P p
Definition: myNF.cc:203
intvec * MivWeightOrderlp(intvec *ivstart)
Definition: walk.cc:1445
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
Definition: ipshell.cc:4420
Matrices of numbers.
Definition: bigintmat.h:51
#define SINGULAR_VERSION
Definition: mod2.h:92
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:258
int rows() const
Definition: bigintmat.h:146
lists pcvPMulL(poly p, lists l1)
Definition: pcv.cc:56
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:542
int rows() const
Definition: intvec.h:88
ring rOpposite(ring src)
Definition: ring.cc:5150
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
int siRandomStart
Definition: cntrlc.cc:103
ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing)
char * getenv()
BOOLEAN spectrumProc(leftv result, leftv first)
Definition: ipshell.cc:4042
#define TRUE
Definition: auxiliary.h:99
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:902
intvec * MivWeightOrderdp(intvec *ivstart)
Definition: walk.cc:1465
BOOLEAN spmulProc(leftv result, leftv first, leftv second)
Definition: ipshell.cc:4379
void * value
Definition: fegetopt.h:93
const char * feSetOptValue(feOptIndex opt, char *optarg)
Definition: feOpt.cc:153
void WerrorS(const char *s)
Definition: feFopen.cc:24
gmp_complex numbers based on
Definition: mpr_complex.h:178
char * StringEndS()
Definition: reporter.cc:151
bool complexNearZero(gmp_complex *c, int digits)
Definition: mpr_complex.cc:767
void lduDecomp(const matrix aMat, matrix &pMat, matrix &lMat, matrix &dMat, matrix &uMat, poly &l, poly &u, poly &lTimesU)
LU-decomposition of a given (m x n)-matrix with performing only those divisions that yield zero remai...
int Typ()
Definition: subexpr.cc:1004
const char * Name()
Definition: subexpr.h:121
matrix evSwap(matrix M, int i, int j)
Definition: eigenval.cc:25
Definition: idrec.h:34
#define ivTest(v)
Definition: intvec.h:149
idhdl get(const char *s, int lev)
Definition: ipid.cc:91
intvec * MPertVectorslp(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1308
void * data
Definition: subexpr.h:89
void printBlackboxTypes()
list all defined type (for debugging)
Definition: blackbox.cc:206
void feStringAppendBrowsers(int warn)
Definition: fehelp.cc:352
ideal Mfwalk(ideal G, intvec *ivstart, intvec *ivtarget, int reduction, int printout)
Definition: walk.cc:8040
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:373
int myynest
Definition: febase.cc:46
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static int rBlocks(ring r)
Definition: ring.h:556
const ring r
Definition: syzextra.cc:208
ideal MAltwalk1(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight)
Definition: walk.cc:9680
#define FLAG_TWOSTD
Definition: ipid.h:107
Definition: intvec.h:14
int pcvDim(int d0, int d1)
Definition: pcv.cc:361
void newstructShow(newstruct_desc d)
Definition: newstruct.cc:830
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
void StringSetS(const char *st)
Definition: reporter.cc:128
#define pLPshift(p, sh, uptodeg, lV)
Definition: shiftgb.h:30
static BOOLEAN jjEXTENDED_SYSTEM(leftv res, leftv h)
Definition: extra.cc:2290
#define pmLastVblock(p, lV)
Definition: shiftgb.h:35
int M3ivSame(intvec *temp, intvec *u, intvec *v)
Definition: walk.cc:923
const char feNotImplemented[]
Definition: reporter.cc:54
struct fe_option feOptSpec[]
intvec * MwalkNextWeight(intvec *curr_weight, intvec *target_weight, ideal G)
ideal Mwalk(ideal Go, intvec *orig_M, intvec *target_M, ring baseRing, int reduction, int printout)
Definition: walk.cc:5311
ip_smatrix * matrix
intvec * MPertNextWeight(intvec *iva, ideal G, int deg)
void system(sys)
idhdl currRingHdl
Definition: ipid.cc:65
#define setFlag(A, F)
Definition: ipid.h:110
int simpleipc_cmd(char *cmd, int id, int v)
Definition: semaphore.c:167
int m
Definition: cfEzgcd.cc:119
void fePrintOptValues()
Definition: feOpt.cc:319
poly pcvCV2P(poly cv, int d0, int d1)
Definition: pcv.cc:263
FILE * f
Definition: checklibs.c:7
int i
Definition: cfEzgcd.cc:123
intvec * Mivperttarget(ideal G, int ndeg)
BOOLEAN spectrumfProc(leftv result, leftv first)
Definition: ipshell.cc:4093
lists pcvLAddL(lists l1, lists l2)
Definition: pcv.cc:31
int pcvBasis(lists b, int i, poly m, int d, int n)
Definition: pcv.cc:391
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1097
poly kNFBound(ideal F, ideal Q, poly p, int bound, int syzComp, int lazyReduce)
Definition: kstd1.cc:3017
ideal freegb(ideal I, int uptodeg, int lVblock)
Definition: kstd2.cc:4347
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:425
#define FLAG_STD
Definition: ipid.h:106
leftv next
Definition: subexpr.h:87
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:534
intvec * Mivdp(int nR)
Definition: walk.cc:1016
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:134
INLINE_THIS void Init(int l=0)
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
matrix evHessenberg(matrix M)
Definition: eigenval.cc:100
int & cols()
Definition: matpol.h:25
#define pLastVblock(p, lV)
Definition: shiftgb.h:33
Definition: tok.h:116
lists evEigenvals(matrix M)
Definition: eigenval_ip.cc:118
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
BOOLEAN semicProc(leftv res, leftv u, leftv v)
Definition: ipshell.cc:4460
int siSeed
Definition: sirandom.c:29
bool luSolveViaLDUDecomp(const matrix pMat, const matrix lMat, const matrix dMat, const matrix uMat, const poly l, const poly u, const poly lTimesU, const matrix bVec, matrix &xVec, matrix &H)
Solves the linear system A * x = b, where A is an (m x n)-matrix which is given by its LDU-decomposit...
void HilbertSeries_OrbitData(ideal S, int lV, bool IG_CASE)
Definition: hilb.cc:1863
ideal TranMImprovwalk(ideal G, intvec *curr_weight, intvec *target_tmp, int nP)
Definition: walk.cc:8405
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition: ipshell.cc:6464
coeffs basecoeffs() const
Definition: bigintmat.h:147
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:531
#define IDRING(a)
Definition: ipid.h:124
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
Definition: blackbox.cc:189
const CanonicalForm & w
Definition: facAbsFact.cc:55
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1426
int rtyp
Definition: subexpr.h:92
#define TEST_FOR(A)
void * Data()
Definition: subexpr.cc:1146
ideal MAltwalk2(ideal Go, intvec *curr_weight, intvec *target_weight)
Definition: walk.cc:4289
ideal Mrwalk(ideal Go, intvec *orig_M, intvec *target_M, int weight_rad, int pert_deg, int reduction, int printout)
Definition: walk.cc:5612
poly pcvP2CV(poly p, int d0, int d1)
Definition: pcv.cc:246
Definition: tok.h:117
char * omFindExec(const char *name, char *exec)
Definition: omFindExec.c:251
omBin slists_bin
Definition: lists.cc:23
BOOLEAN spaddProc(leftv result, leftv first, leftv second)
Definition: ipshell.cc:4337
intvec * MivUnit(int nV)
Definition: walk.cc:1505
ideal idXXX(ideal h1, int k)
Definition: ideals.cc:657
ideal singclap_absFactorize(poly f, ideal &mipos, intvec **exps, int &numFactors, const ring r)
Definition: clapsing.cc:1793
BOOLEAN newstruct_set_proc(const char *bbname, const char *func, int args, procinfov pr)
Definition: newstruct.cc:850
size_t gmp_output_digits
Definition: mpr_complex.cc:44
ideal Mprwalk(ideal Go, intvec *orig_M, intvec *target_M, int weight_rad, int op_deg, int tp_deg, int nP, int reduction, int printout)
Definition: walk.cc:6397
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
lists gmsNF(ideal p, ideal g, matrix B, int D, int K)
Definition: gms.cc:22
feOptIndex feGetOptIndex(const char *name)
Definition: feOpt.cc:104
void countedref_reference_load()
Initialize blackbox types &#39;reference&#39; and &#39;shared&#39;, or both.
Definition: countedref.cc:700
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
#define IDDATA(a)
Definition: ipid.h:123
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:770
ideal Mfrwalk(ideal G, intvec *ivstart, intvec *ivtarget, int weight_rad, int reduction, int printout)
Definition: walk.cc:8221
static Poly * h
Definition: janet.cc:978
#define IMATELEM(M, I, J)
Definition: intvec.h:77
#define NONE
Definition: tok.h:218
void feReInitResources()
Definition: feResource.cc:207
void Werror(const char *fmt,...)
Definition: reporter.cc:189
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1410
void * CopyD(int t)
Definition: subexpr.cc:714
int pcvMinDeg(poly p)
Definition: pcv.cc:108
void countedref_shared_load()
Definition: countedref.cc:724
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
intvec * Mivlp(int nR)
Definition: walk.cc:1031
procinfo * procinfov
Definition: structs.h:63
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2579
ideal twostd(ideal I)
Compute two-sided GB:
Definition: nc.cc:21
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ longCoeffsToSingularPoly()

poly longCoeffsToSingularPoly ( unsigned long *  polyCoeffs,
const int  degree 
)

Definition at line 222 of file extra.cc.

223 {
224  poly result = NULL;
225  for (int i = 0; i <= degree; i++)
226  {
227  if ((int)polyCoeffs[i] != 0)
228  {
229  poly term = p_ISet((int)polyCoeffs[i], currRing);
230  if (i > 0)
231  {
232  p_SetExp(term, 1, i, currRing);
233  p_Setm(term, currRing);
234  }
235  result = p_Add_q(result, term, currRing);
236  }
237  }
238  return result;
239 }
Definition: int_poly.h:33
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define NULL
Definition: omList.c:10
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
int degree(const CanonicalForm &f)
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1296
return result
Definition: facAbsBiFact.cc:76

§ singularMatrixToLongMatrix()

unsigned long** singularMatrixToLongMatrix ( matrix  singularMatrix)

Definition at line 190 of file extra.cc.

191 {
192  int n = singularMatrix->rows();
193  assume(n == singularMatrix->cols());
194  unsigned long **longMatrix = 0;
195  longMatrix = new unsigned long *[n] ;
196  for (int i = 0 ; i < n; i++)
197  longMatrix[i] = new unsigned long [n];
198  number entry;
199  for (int r = 0; r < n; r++)
200  for (int c = 0; c < n; c++)
201  {
202  poly p=MATELEM(singularMatrix, r + 1, c + 1);
203  int entryAsInt;
204  if (p!=NULL)
205  {
206  entry = p_GetCoeff(p, currRing);
207  entryAsInt = n_Int(entry, currRing->cf);
208  if (entryAsInt < 0) entryAsInt += n_GetChar(currRing->cf);
209  }
210  else
211  entryAsInt=0;
212  longMatrix[r][c] = (unsigned long)entryAsInt;
213  }
214  return longMatrix;
215 }
int & rows()
Definition: matpol.h:24
return P p
Definition: myNF.cc:203
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:448
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
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:551
#define assume(x)
Definition: mod2.h:403
int i
Definition: cfEzgcd.cc:123
int & cols()
Definition: matpol.h:25
#define NULL
Definition: omList.c:10
#define p_GetCoeff(p, r)
Definition: monomials.h:57
polyrec * poly
Definition: hilb.h:10
#define MATELEM(mat, i, j)
Definition: matpol.h:29