Macros | Functions
extra.cc File Reference
#include "kernel/mod2.h"
#include "misc/sirandom.h"
#include "resources/omFindExec.h"
#include "factory/factory.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/weight.h"
#include "polys/shiftop.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/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 "links/ssiLink.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/fglm.h"
#include "hc_newton.h"
#include "polys/mod_raw.h"
#include "kernel/GBEngine/shiftgb.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 142 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 2350 of file extra.cc.

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

◆ jjSYSTEM()

BOOLEAN jjSYSTEM ( leftv  res,
leftv  args 
)

Definition at line 231 of file extra.cc.

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

◆ longCoeffsToSingularPoly()

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

Definition at line 208 of file extra.cc.

209 {
210  poly result = NULL;
211  for (int i = 0; i <= degree; i++)
212  {
213  if ((int)polyCoeffs[i] != 0)
214  {
215  poly term = p_ISet((int)polyCoeffs[i], currRing);
216  if (i > 0)
217  {
218  p_SetExp(term, 1, i, currRing);
219  p_Setm(term, currRing);
220  }
221  result = p_Add_q(result, term, currRing);
222  }
223  }
224  return result;
225 }
Definition: int_poly.h:33
int i
Definition: cfEzgcd.cc:125
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:487
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
int degree(const CanonicalForm &f)
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1287
return result
Definition: facAbsBiFact.cc:76

◆ singularMatrixToLongMatrix()

unsigned long** singularMatrixToLongMatrix ( matrix  singularMatrix)

Definition at line 176 of file extra.cc.

177 {
178  int n = singularMatrix->rows();
179  assume(n == singularMatrix->cols());
180  unsigned long **longMatrix = 0;
181  longMatrix = new unsigned long *[n] ;
182  for (int i = 0 ; i < n; i++)
183  longMatrix[i] = new unsigned long [n];
184  number entry;
185  for (int r = 0; r < n; r++)
186  for (int c = 0; c < n; c++)
187  {
188  poly p=MATELEM(singularMatrix, r + 1, c + 1);
189  int entryAsInt;
190  if (p!=NULL)
191  {
192  entry = p_GetCoeff(p, currRing);
193  entryAsInt = n_Int(entry, currRing->cf);
194  if (entryAsInt < 0) entryAsInt += n_GetChar(currRing->cf);
195  }
196  else
197  entryAsInt=0;
198  longMatrix[r][c] = (unsigned long)entryAsInt;
199  }
200  return longMatrix;
201 }
int & rows()
Definition: matpol.h:23
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:444
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:547
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
int & cols()
Definition: matpol.h:24
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define p_GetCoeff(p, r)
Definition: monomials.h:50
int p
Definition: cfModGcd.cc:4019
#define MATELEM(mat, i, j)
1-based access to matrix
Definition: matpol.h:29