My Project
Loading...
Searching...
No Matches
Macros | Functions | Variables
extra.cc File Reference
#include <errno.h>
#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 "resources/feResource.h"
#include "polys/monomials/ring.h"
#include "kernel/polys.h"
#include "polys/monomials/maps.h"
#include "polys/matpol.h"
#include "polys/pCoeff.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/GBEngine/kverify.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 "misc/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"

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 SINGULAR_PROCS_DIR   "/libexec/singular/MOD"
 
#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)
 

Variables

EXTERN_VAR BOOLEAN FE_OPT_NO_SHELL_FLAG
 

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.

◆ SINGULAR_PROCS_DIR

#define SINGULAR_PROCS_DIR   "/libexec/singular/MOD"

◆ 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 2393 of file extra.cc.

2394{
2395 if(h->Typ() == STRING_CMD)
2396 {
2397 char *sys_cmd=(char *)(h->Data());
2398 h=h->next;
2399 /*==================== test syz strat =================*/
2400 if (strcmp(sys_cmd, "syz") == 0)
2401 {
2402 if ((h!=NULL) && (h->Typ()==STRING_CMD))
2403 {
2404 const char *s=(const char *)h->Data();
2405 if (strcmp(s,"posInT_EcartFDegpLength")==0)
2407 else if (strcmp(s,"posInT_FDegpLength")==0)
2409 else if (strcmp(s,"posInT_pLength")==0)
2411 else if (strcmp(s,"posInT0")==0)
2413 else if (strcmp(s,"posInT1")==0)
2415 else if (strcmp(s,"posInT2")==0)
2417 else if (strcmp(s,"posInT11")==0)
2419 else if (strcmp(s,"posInT110")==0)
2421 else if (strcmp(s,"posInT13")==0)
2423 else if (strcmp(s,"posInT15")==0)
2425 else if (strcmp(s,"posInT17")==0)
2427 else if (strcmp(s,"posInT17_c")==0)
2429 else if (strcmp(s,"posInT19")==0)
2431 else PrintS("valid posInT:0,1,2,11,110,13,15,17,17_c,19,_EcartFDegpLength,_FDegpLength,_pLength,_EcartpLength\n");
2432 }
2433 else
2434 {
2437 }
2438 si_opt_2|=Sy_bit(23);
2439 return FALSE;
2440 }
2441 else
2442 /*==================== locNF ======================================*/
2443 if(strcmp(sys_cmd,"locNF")==0)
2444 {
2445 const short t[]={4,VECTOR_CMD,MODUL_CMD,INT_CMD,INTVEC_CMD};
2446 if (iiCheckTypes(h,t,1))
2447 {
2448 poly f=(poly)h->Data();
2449 h=h->next;
2450 ideal m=(ideal)h->Data();
2452 h=h->next;
2453 int n=(int)((long)h->Data());
2454 h=h->next;
2455 intvec *v=(intvec *)h->Data();
2456
2457 /* == now the work starts == */
2458
2459 int * iv=iv2array(v, currRing);
2460 poly r=0;
2461 poly hp=ppJetW(f,n,iv);
2462 int s=MATCOLS(m);
2463 int j=0;
2464 matrix T=mp_InitI(s,1,0, currRing);
2465
2466 while (hp != NULL)
2467 {
2468 if (pDivisibleBy(m->m[j],hp))
2469 {
2470 if (MATELEM(T,j+1,1)==0)
2471 {
2472 MATELEM(T,j+1,1)=pDivideM(pHead(hp),pHead(m->m[j]));
2473 }
2474 else
2475 {
2476 pAdd(MATELEM(T,j+1,1),pDivideM(pHead(hp),pHead(m->m[j])));
2477 }
2478 hp=ppJetW(ksOldSpolyRed(m->m[j],hp,0),n,iv);
2479 j=0;
2480 }
2481 else
2482 {
2483 if (j==s-1)
2484 {
2485 r=pAdd(r,pHead(hp));
2486 hp=pLmDeleteAndNext(hp); /* hp=pSub(hp,pHead(hp));*/
2487 j=0;
2488 }
2489 else
2490 {
2491 j++;
2492 }
2493 }
2494 }
2495
2498 for (int k=1;k<=MATROWS(Temp);k++)
2499 {
2500 MATELEM(R,k,1)=MATELEM(Temp,k,1);
2501 }
2502
2504 L->Init(2);
2505 L->m[0].rtyp=MATRIX_CMD; L->m[0].data=(void *)R;
2506 L->m[1].rtyp=MATRIX_CMD; L->m[1].data=(void *)T;
2507 res->data=L;
2508 res->rtyp=LIST_CMD;
2509 // iv aufraeumen
2510 omFree(iv);
2511 return FALSE;
2512 }
2513 else
2514 return TRUE;
2515 }
2516 else
2517 /*==================== poly debug ==================================*/
2518 if(strcmp(sys_cmd,"p")==0)
2519 {
2520# ifdef RDEBUG
2521 p_DebugPrint((poly)h->Data(), currRing);
2522# else
2523 WarnS("Sorry: not available for release build!");
2524# endif
2525 return FALSE;
2526 }
2527 else
2528 /*==================== setsyzcomp ==================================*/
2529 if(strcmp(sys_cmd,"setsyzcomp")==0)
2530 {
2531 if ((h!=NULL) && (h->Typ()==INT_CMD))
2532 {
2533 int k = (int)(long)h->Data();
2534 if ( currRing->order[0] == ringorder_s )
2535 {
2537 }
2538 }
2539 }
2540 /*==================== ring debug ==================================*/
2541 if(strcmp(sys_cmd,"r")==0)
2542 {
2543# ifdef RDEBUG
2544 rDebugPrint((ring)h->Data());
2545# else
2546 WarnS("Sorry: not available for release build!");
2547# endif
2548 return FALSE;
2549 }
2550 else
2551 /*==================== changeRing ========================*/
2552 /* The following code changes the names of the variables in the
2553 current ring to "x1", "x2", ..., "xN", where N is the number
2554 of variables in the current ring.
2555 The purpose of this rewriting is to eliminate indexed variables,
2556 as they may cause problems when generating scripts for Magma,
2557 Maple, or Macaulay2. */
2558 if(strcmp(sys_cmd,"changeRing")==0)
2559 {
2560 int varN = currRing->N;
2561 char h[10];
2562 for (int i = 1; i <= varN; i++)
2563 {
2564 omFree(currRing->names[i - 1]);
2565 snprintf(h,10, "x%d", i);
2566 currRing->names[i - 1] = omStrDup(h);
2567 }
2569 res->rtyp = INT_CMD;
2570 res->data = (void*)0L;
2571 return FALSE;
2572 }
2573 else
2574 /*==================== mtrack ==================================*/
2575 if(strcmp(sys_cmd,"mtrack")==0)
2576 {
2577 #ifdef OM_TRACK
2578 om_Opts.MarkAsStatic = 1;
2579 FILE *fd = NULL;
2580 int max = 5;
2581 while (h != NULL)
2582 {
2584 if (fd == NULL && h->Typ()==STRING_CMD)
2585 {
2586 char *fn=(char*) h->Data();
2587 fd = fopen(fn, "w");
2588 if (fd == NULL)
2589 Warn("Can not open %s for writing og mtrack. Using stdout",fn);
2590 }
2591 else if (h->Typ() == INT_CMD)
2592 {
2593 max = (int)(long)h->Data();
2594 }
2595 h = h->Next();
2596 }
2598 if (fd != NULL) fclose(fd);
2599 om_Opts.MarkAsStatic = 0;
2600 return FALSE;
2601 #else
2602 WerrorS("system(\"mtrack\",..) is not implemented in this version");
2603 return TRUE;
2604 #endif
2605 }
2606 else
2607 /*==================== backtrace ==================================*/
2608 #ifndef OM_NDEBUG
2609 if(strcmp(sys_cmd,"backtrace")==0)
2610 {
2612 return FALSE;
2613 }
2614 else
2615 #endif
2616
2617#if !defined(OM_NDEBUG)
2618 /*==================== omMemoryTest ==================================*/
2619 if (strcmp(sys_cmd,"omMemoryTest")==0)
2620 {
2621
2622#ifdef OM_STATS_H
2623 PrintS("\n[om_Info]: \n");
2624 omUpdateInfo();
2625#define OM_PRINT(name) Print(" %-22s : %10ld \n", #name, om_Info . name)
2626 OM_PRINT(MaxBytesSystem);
2627 OM_PRINT(CurrentBytesSystem);
2628 OM_PRINT(MaxBytesSbrk);
2629 OM_PRINT(CurrentBytesSbrk);
2630 OM_PRINT(MaxBytesMmap);
2631 OM_PRINT(CurrentBytesMmap);
2632 OM_PRINT(UsedBytes);
2633 OM_PRINT(AvailBytes);
2634 OM_PRINT(UsedBytesMalloc);
2635 OM_PRINT(AvailBytesMalloc);
2636 OM_PRINT(MaxBytesFromMalloc);
2637 OM_PRINT(CurrentBytesFromMalloc);
2638 OM_PRINT(MaxBytesFromValloc);
2639 OM_PRINT(CurrentBytesFromValloc);
2640 OM_PRINT(UsedBytesFromValloc);
2641 OM_PRINT(AvailBytesFromValloc);
2642 OM_PRINT(MaxPages);
2643 OM_PRINT(UsedPages);
2644 OM_PRINT(AvailPages);
2645 OM_PRINT(MaxRegionsAlloc);
2646 OM_PRINT(CurrentRegionsAlloc);
2647#undef OM_PRINT
2648#endif
2649
2650#ifdef OM_OPTS_H
2651 PrintS("\n[om_Opts]: \n");
2652#define OM_PRINT(format, name) Print(" %-22s : %10" format"\n", #name, om_Opts . name)
2653 OM_PRINT("d", MinTrack);
2654 OM_PRINT("d", MinCheck);
2655 OM_PRINT("d", MaxTrack);
2656 OM_PRINT("d", MaxCheck);
2657 OM_PRINT("d", Keep);
2658 OM_PRINT("d", HowToReportErrors);
2659 OM_PRINT("d", MarkAsStatic);
2660 OM_PRINT("u", PagesPerRegion);
2661 OM_PRINT("p", OutOfMemoryFunc);
2662 OM_PRINT("p", MemoryLowFunc);
2663 OM_PRINT("p", ErrorHook);
2664#undef OM_PRINT
2665#endif
2666
2667#ifdef OM_ERROR_H
2668 Print("\n\n[om_ErrorStatus] : '%s' (%s)\n",
2671 Print("[om_InternalErrorStatus]: '%s' (%s)\n",
2674
2675#endif
2676
2677// omTestMemory(1);
2678// omtTestErrors();
2679 return FALSE;
2680 }
2681 else
2682#endif
2683 /*==================== red =============================*/
2684 #if 0
2685 if(strcmp(sys_cmd,"red")==0)
2686 {
2687 if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
2688 {
2689 res->rtyp=IDEAL_CMD;
2690 res->data=(void *)kStdred((ideal)h->Data(),NULL,testHomog,NULL);
2692 return FALSE;
2693 }
2694 else
2695 WerrorS("ideal expected");
2696 }
2697 else
2698 #endif
2699 /*==================== fastcomb =============================*/
2700 if(strcmp(sys_cmd,"fastcomb")==0)
2701 {
2702 if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
2703 {
2704 if (h->next!=NULL)
2705 {
2706 if (h->next->Typ()!=POLY_CMD)
2707 {
2708 WarnS("Wrong types for poly= comb(ideal,poly)");
2709 }
2710 }
2711 res->rtyp=POLY_CMD;
2712 res->data=(void *) fglmLinearCombination(
2713 (ideal)h->Data(),(poly)h->next->Data());
2714 return FALSE;
2715 }
2716 else
2717 WerrorS("ideal expected");
2718 }
2719 else
2720 /*==================== comb =============================*/
2721 if(strcmp(sys_cmd,"comb")==0)
2722 {
2723 if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
2724 {
2725 if (h->next!=NULL)
2726 {
2727 if (h->next->Typ()!=POLY_CMD)
2728 {
2729 WarnS("Wrong types for poly= comb(ideal,poly)");
2730 }
2731 }
2732 res->rtyp=POLY_CMD;
2733 res->data=(void *)fglmNewLinearCombination(
2734 (ideal)h->Data(),(poly)h->next->Data());
2735 return FALSE;
2736 }
2737 else
2738 WerrorS("ideal expected");
2739 }
2740 else
2741 #if 0 /* debug only */
2742 /*==================== listall ===================================*/
2743 if(strcmp(sys_cmd,"listall")==0)
2744 {
2745 void listall(int showproc);
2746 int showproc=0;
2747 if ((h!=NULL) && (h->Typ()==INT_CMD)) showproc=(int)((long)h->Data());
2749 return FALSE;
2750 }
2751 else
2752 #endif
2753 #if 0 /* debug only */
2754 /*==================== proclist =================================*/
2755 if(strcmp(sys_cmd,"proclist")==0)
2756 {
2757 void piShowProcList();
2759 return FALSE;
2760 }
2761 else
2762 #endif
2763 /* ==================== newton ================================*/
2764 #ifdef HAVE_NEWTON
2765 if(strcmp(sys_cmd,"newton")==0)
2766 {
2767 if ((h->Typ()!=POLY_CMD)
2768 || (h->next->Typ()!=INT_CMD)
2769 || (h->next->next->Typ()!=INT_CMD))
2770 {
2771 WerrorS("system(\"newton\",<poly>,<int>,<int>) expected");
2772 return TRUE;
2773 }
2774 poly p=(poly)(h->Data());
2775 int l=pLength(p);
2776 short *points=(short *)omAlloc(currRing->N*l*sizeof(short));
2777 int i,j,k;
2778 k=0;
2779 poly pp=p;
2780 for (i=0;pp!=NULL;i++)
2781 {
2782 for(j=1;j<=currRing->N;j++)
2783 {
2784 points[k]=pGetExp(pp,j);
2785 k++;
2786 }
2787 pIter(pp);
2788 }
2789 hc_ERG r=hc_KOENIG(currRing->N, // dimension
2790 l, // number of points
2791 (short*) points, // points: x_1, y_1,z_1, x_2,y_2,z2,...
2792 currRing->OrdSgn==-1,
2793 (int) (h->next->Data()), // 1: Milnor, 0: Newton
2794 (int) (h->next->next->Data()) // debug
2795 );
2796 //----<>---Output-----------------------
2797
2798
2799 // PrintS("Bin jetzt in extra.cc bei der Auswertung.\n"); // **********
2800
2801
2803 L->Init(6);
2804 L->m[0].rtyp=STRING_CMD; // newtonnumber;
2805 L->m[0].data=(void *)omStrDup(r.nZahl);
2806 L->m[1].rtyp=INT_CMD;
2807 L->m[1].data=(void *)(long)r.achse; // flag for unoccupied axes
2808 L->m[2].rtyp=INT_CMD;
2809 L->m[2].data=(void *)(long)r.deg; // #degenerations
2810 if ( r.deg != 0) // only if degenerations exist
2811 {
2812 L->m[3].rtyp=INT_CMD;
2813 L->m[3].data=(void *)(long)r.anz_punkte; // #points
2814 //---<>--number of points------
2815 int anz = r.anz_punkte; // number of points
2816 int dim = (currRing->N); // dimension
2817 intvec* v = new intvec( anz*dim );
2818 for (i=0; i<anz*dim; i++) // copy points
2819 (*v)[i] = r.pu[i];
2820 L->m[4].rtyp=INTVEC_CMD;
2821 L->m[4].data=(void *)v;
2822 //---<>--degenerations---------
2823 int deg = r.deg; // number of points
2824 intvec* w = new intvec( r.speicher ); // necessary memory
2825 i=0; // start copying
2826 do
2827 {
2828 (*w)[i] = r.deg_tab[i];
2829 i++;
2830 }
2831 while (r.deg_tab[i-1] != -2); // mark for end of list
2832 L->m[5].rtyp=INTVEC_CMD;
2833 L->m[5].data=(void *)w;
2834 }
2835 else
2836 {
2837 L->m[3].rtyp=INT_CMD; L->m[3].data=(char *)0;
2838 L->m[4].rtyp=DEF_CMD;
2839 L->m[5].rtyp=DEF_CMD;
2840 }
2841
2842 res->data=(void *)L;
2843 res->rtyp=LIST_CMD;
2844 // free all pointer in r:
2845 delete[] r.nZahl;
2846 delete[] r.pu;
2847 delete[] r.deg_tab; // Ist das ein Problem??
2848
2849 omFreeSize((ADDRESS)points,currRing->N*l*sizeof(short));
2850 return FALSE;
2851 }
2852 else
2853 #endif
2854 /*==== connection to Sebastian Jambor's code ======*/
2855 /* This code connects Sebastian Jambor's code for
2856 computing the minimal polynomial of an (n x n) matrix
2857 with entries in F_p to SINGULAR. Two conversion methods
2858 are needed; see further up in this file:
2859 (1) conversion of a matrix with long entries to
2860 a SINGULAR matrix with number entries, where
2861 the numbers are coefficients in currRing;
2862 (2) conversion of an array of longs (encoding the
2863 coefficients of the minimal polynomial) to a
2864 SINGULAR poly living in currRing. */
2865 if (strcmp(sys_cmd, "minpoly") == 0)
2866 {
2867 if ((h == NULL) || (h->Typ() != MATRIX_CMD) || h->next != NULL)
2868 {
2869 Werror("expected exactly one argument: %s",
2870 "a square matrix with number entries");
2871 return TRUE;
2872 }
2873 else
2874 {
2875 matrix m = (matrix)h->Data();
2876 int n = m->rows();
2877 unsigned long p = (unsigned long)n_GetChar(currRing->cf);
2878 if (n != m->cols())
2879 {
2880 WerrorS("expected exactly one argument: "
2881 "a square matrix with number entries");
2882 return TRUE;
2883 }
2884 unsigned long** ml = singularMatrixToLongMatrix(m);
2885 unsigned long* polyCoeffs = computeMinimalPolynomial(ml, n, p);
2887 res->rtyp = POLY_CMD;
2888 res->data = (void *)theMinPoly;
2889 for (int i = 0; i < n; i++) delete[] ml[i];
2890 delete[] ml;
2891 delete[] polyCoeffs;
2892 return FALSE;
2893 }
2894 }
2895 else
2896 /*==================== sdb_flags =================*/
2897 #ifdef HAVE_SDB
2898 if (strcmp(sys_cmd, "sdb_flags") == 0)
2899 {
2900 if ((h!=NULL) && (h->Typ()==INT_CMD))
2901 {
2902 sdb_flags=(int)((long)h->Data());
2903 }
2904 else
2905 {
2906 WerrorS("system(\"sdb_flags\",`int`) expected");
2907 return TRUE;
2908 }
2909 return FALSE;
2910 }
2911 else
2912 #endif
2913 /*==================== sdb_edit =================*/
2914 #ifdef HAVE_SDB
2915 if (strcmp(sys_cmd, "sdb_edit") == 0)
2916 {
2918 {
2919 WerrorS("shell execution is disallowed in restricted mode");
2920 return TRUE;
2921 }
2922 if ((h!=NULL) && (h->Typ()==PROC_CMD))
2923 {
2924 procinfov p=(procinfov)h->Data();
2925 sdb_edit(p);
2926 }
2927 else
2928 {
2929 WerrorS("system(\"sdb_edit\",`proc`) expected");
2930 return TRUE;
2931 }
2932 return FALSE;
2933 }
2934 else
2935 #endif
2936 /*==================== GF =================*/
2937 #if 0 // for testing only
2938 if (strcmp(sys_cmd, "GF") == 0)
2939 {
2940 if ((h!=NULL) && (h->Typ()==POLY_CMD))
2941 {
2942 int c=rChar(currRing);
2943 setCharacteristic( c,nfMinPoly[0], currRing->parameter[0][0] );
2944 CanonicalForm F( convSingGFFactoryGF( (poly)h->Data(), currRing ) );
2945 res->rtyp=POLY_CMD;
2946 res->data=convFactoryGFSingGF( F, currRing );
2947 return FALSE;
2948 }
2949 else { WerrorS("wrong typ"); return TRUE;}
2950 }
2951 else
2952 #endif
2953 /*==================== SVD =================*/
2954 #ifdef HAVE_SVD
2955 if (strcmp(sys_cmd, "svd") == 0)
2956 {
2957 extern lists testsvd(matrix M);
2958 res->rtyp=LIST_CMD;
2959 res->data=(char*)(testsvd((matrix)h->Data()));
2960 return FALSE;
2961 }
2962 else
2963 #endif
2964 /*==================== redNF_ring =================*/
2965 if (strcmp(sys_cmd, "redNF_ring")==0)
2966 {
2967 ring r = currRing;
2968 poly f = (poly) h->Data();
2969 h = h->next;
2970 ideal G = (ideal) h->Data();
2971 res->rtyp=POLY_CMD;
2972 res->data=(poly) ringRedNF(f, G, r);
2973 return(FALSE);
2974 }
2975 else
2976 /*==================== Roune Hilb =================*/
2977 if (strcmp(sys_cmd, "hilbroune") == 0)
2978 {
2979 if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
2980 {
2981 slicehilb((ideal)h->Data());
2982 }
2983 else return TRUE;
2984 return FALSE;
2985 }
2986 else
2987 /*==================== F5 Implementation =================*/
2988 #ifdef HAVE_F5
2989 if (strcmp(sys_cmd, "f5")==0)
2990 {
2991 if (h->Typ()!=IDEAL_CMD)
2992 {
2993 WerrorS("ideal expected");
2994 return TRUE;
2995 }
2996
2997 ring r = currRing;
2998 ideal G = (ideal) h->Data();
2999 h = h->next;
3000 int opt;
3001 if(h != NULL) {
3002 opt = (int) (long) h->Data();
3003 }
3004 else {
3005 opt = 2;
3006 }
3007 h = h->next;
3008 int plus;
3009 if(h != NULL) {
3010 plus = (int) (long) h->Data();
3011 }
3012 else {
3013 plus = 0;
3014 }
3015 h = h->next;
3016 int termination;
3017 if(h != NULL) {
3018 termination = (int) (long) h->Data();
3019 }
3020 else {
3021 termination = 0;
3022 }
3023 res->rtyp=IDEAL_CMD;
3024 res->data=(ideal) F5main(G,r,opt,plus,termination);
3025 return FALSE;
3026 }
3027 else
3028 #endif
3029 /*==================== Testing groebner basis =================*/
3030 if (strcmp(sys_cmd, "NF_ring")==0)
3031 {
3032 ring r = currRing;
3033 poly f = (poly) h->Data();
3034 h = h->next;
3035 ideal G = (ideal) h->Data();
3036 res->rtyp=POLY_CMD;
3037 res->data=(poly) ringNF(f, G, r);
3038 return(FALSE);
3039 }
3040 else
3041 if (strcmp(sys_cmd, "spoly")==0)
3042 {
3043 poly f = pCopy((poly) h->Data());
3044 h = h->next;
3045 poly g = pCopy((poly) h->Data());
3046
3047 res->rtyp=POLY_CMD;
3048 res->data=(poly) plain_spoly(f,g);
3049 return(FALSE);
3050 }
3051 else
3052 if (strcmp(sys_cmd, "testGB")==0)
3053 {
3054 ideal I = (ideal) h->Data();
3055 h = h->next;
3056 ideal GI = (ideal) h->Data();
3057 res->rtyp = INT_CMD;
3058 res->data = (void *)(long) testGB(I, GI);
3059 return(FALSE);
3060 }
3061 else
3062 /*==================== sca:AltVar ==================================*/
3063 #ifdef HAVE_PLURAL
3064 if ( (strcmp(sys_cmd, "AltVarStart") == 0) || (strcmp(sys_cmd, "AltVarEnd") == 0) )
3065 {
3066 ring r = currRing;
3067
3068 if((h!=NULL) && (h->Typ()==RING_CMD)) r = (ring)h->Data(); else
3069 {
3070 WerrorS("`system(\"AltVarStart/End\"[,<ring>])` expected");
3071 return TRUE;
3072 }
3073
3074 res->rtyp=INT_CMD;
3075
3076 if (rIsSCA(r))
3077 {
3078 if(strcmp(sys_cmd, "AltVarStart") == 0)
3079 res->data = (void*)(long)scaFirstAltVar(r);
3080 else
3081 res->data = (void*)(long)scaLastAltVar(r);
3082 return FALSE;
3083 }
3084
3085 WerrorS("`system(\"AltVarStart/End\",<ring>) requires a SCA ring");
3086 return TRUE;
3087 }
3088 else
3089 #endif
3090 /*==================== RatNF, noncomm rational coeffs =================*/
3091 #ifdef HAVE_RATGRING
3092 if (strcmp(sys_cmd, "intratNF") == 0)
3093 {
3094 poly p;
3095 poly *q;
3096 ideal I;
3097 int is, k, id;
3098 if ((h!=NULL) && (h->Typ()==POLY_CMD))
3099 {
3100 p=(poly)h->CopyD();
3101 h=h->next;
3102 // PrintS("poly is done\n");
3103 }
3104 else return TRUE;
3105 if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
3106 {
3107 I=(ideal)h->CopyD();
3108 q = I->m;
3109 h=h->next;
3110 // PrintS("ideal is done\n");
3111 }
3112 else return TRUE;
3113 if ((h!=NULL) && (h->Typ()==INT_CMD))
3114 {
3115 is=(int)((long)(h->Data()));
3116 // res->rtyp=INT_CMD;
3117 // PrintS("int is done\n");
3118 // res->rtyp=IDEAL_CMD;
3120 {
3121 id = IDELEMS(I);
3122 int *pl=(int*)omAlloc0(IDELEMS(I)*sizeof(int));
3123 for(k=0; k < id; k++)
3124 {
3125 pl[k] = pLength(I->m[k]);
3126 }
3127 PrintS("starting redRat\n");
3128 //res->data = (char *)
3129 redRat(&p, q, pl, (int)IDELEMS(I),is,currRing);
3130 res->data=p;
3131 res->rtyp=POLY_CMD;
3132 // res->data = ncGCD(p,q,currRing);
3133 }
3134 else
3135 {
3136 res->rtyp=POLY_CMD;
3137 res->data=p;
3138 }
3139 }
3140 else return TRUE;
3141 return FALSE;
3142 }
3143 else
3144 /*==================== RatNF, noncomm rational coeffs =================*/
3145 if (strcmp(sys_cmd, "ratNF") == 0)
3146 {
3147 poly p,q;
3148 int is, htype;
3149 if ((h!=NULL) && ( (h->Typ()==POLY_CMD) || (h->Typ()==VECTOR_CMD) ) )
3150 {
3151 p=(poly)h->CopyD();
3152 h=h->next;
3153 htype = h->Typ();
3154 }
3155 else return TRUE;
3156 if ((h!=NULL) && ( (h->Typ()==POLY_CMD) || (h->Typ()==VECTOR_CMD) ) )
3157 {
3158 q=(poly)h->CopyD();
3159 h=h->next;
3160 }
3161 else return TRUE;
3162 if ((h!=NULL) && (h->Typ()==INT_CMD))
3163 {
3164 is=(int)((long)(h->Data()));
3165 res->rtyp=htype;
3166 // res->rtyp=IDEAL_CMD;
3168 {
3169 res->data = nc_rat_ReduceSpolyNew(q,p,is, currRing);
3170 // res->data = ncGCD(p,q,currRing);
3171 }
3172 else res->data=p;
3173 }
3174 else return TRUE;
3175 return FALSE;
3176 }
3177 else
3178 /*==================== RatSpoly, noncomm rational coeffs =================*/
3179 if (strcmp(sys_cmd, "ratSpoly") == 0)
3180 {
3181 poly p,q;
3182 int is;
3183 if ((h!=NULL) && (h->Typ()==POLY_CMD))
3184 {
3185 p=(poly)h->CopyD();
3186 h=h->next;
3187 }
3188 else return TRUE;
3189 if ((h!=NULL) && (h->Typ()==POLY_CMD))
3190 {
3191 q=(poly)h->CopyD();
3192 h=h->next;
3193 }
3194 else return TRUE;
3195 if ((h!=NULL) && (h->Typ()==INT_CMD))
3196 {
3197 is=(int)((long)(h->Data()));
3198 res->rtyp=POLY_CMD;
3199 // res->rtyp=IDEAL_CMD;
3201 {
3202 res->data = nc_rat_CreateSpoly(p,q,is,currRing);
3203 // res->data = ncGCD(p,q,currRing);
3204 }
3205 else res->data=p;
3206 }
3207 else return TRUE;
3208 return FALSE;
3209 }
3210 else
3211 #endif // HAVE_RATGRING
3212 /*==================== Rat def =================*/
3213 if (strcmp(sys_cmd, "ratVar") == 0)
3214 {
3215 int start,end;
3216 if ((h!=NULL) && (h->Typ()==POLY_CMD))
3217 {
3218 start=pIsPurePower((poly)h->Data());
3219 h=h->next;
3220 }
3221 else return TRUE;
3222 if ((h!=NULL) && (h->Typ()==POLY_CMD))
3223 {
3224 end=pIsPurePower((poly)h->Data());
3225 h=h->next;
3226 }
3227 else return TRUE;
3228 currRing->real_var_start=start;
3229 currRing->real_var_end=end;
3230 return (start==0)||(end==0)||(start>end);
3231 }
3232 else
3233 /*==================== t-rep-GB ==================================*/
3234 if (strcmp(sys_cmd, "unifastmult")==0)
3235 {
3236 poly f = (poly)h->Data();
3237 h=h->next;
3238 poly g=(poly)h->Data();
3239 res->rtyp=POLY_CMD;
3240 res->data=unifastmult(f,g,currRing);
3241 return(FALSE);
3242 }
3243 else
3244 if (strcmp(sys_cmd, "multifastmult")==0)
3245 {
3246 poly f = (poly)h->Data();
3247 h=h->next;
3248 poly g=(poly)h->Data();
3249 res->rtyp=POLY_CMD;
3250 res->data=multifastmult(f,g,currRing);
3251 return(FALSE);
3252 }
3253 else
3254 if (strcmp(sys_cmd, "mults")==0)
3255 {
3256 res->rtyp=INT_CMD ;
3257 res->data=(void*)(long) Mults();
3258 return(FALSE);
3259 }
3260 else
3261 if (strcmp(sys_cmd, "fastpower")==0)
3262 {
3263 ring r = currRing;
3264 poly f = (poly)h->Data();
3265 h=h->next;
3266 int n=(int)((long)h->Data());
3267 res->rtyp=POLY_CMD ;
3268 res->data=(void*) pFastPower(f,n,r);
3269 return(FALSE);
3270 }
3271 else
3272 if (strcmp(sys_cmd, "normalpower")==0)
3273 {
3274 poly f = (poly)h->Data();
3275 h=h->next;
3276 int n=(int)((long)h->Data());
3277 res->rtyp=POLY_CMD ;
3278 res->data=(void*) pPower(pCopy(f),n);
3279 return(FALSE);
3280 }
3281 else
3282 if (strcmp(sys_cmd, "MCpower")==0)
3283 {
3284 ring r = currRing;
3285 poly f = (poly)h->Data();
3286 h=h->next;
3287 int n=(int)((long)h->Data());
3288 res->rtyp=POLY_CMD ;
3289 res->data=(void*) pFastPowerMC(f,n,r);
3290 return(FALSE);
3291 }
3292 else
3293 if (strcmp(sys_cmd, "bit_subst")==0)
3294 {
3295 ring r = currRing;
3296 poly outer = (poly)h->Data();
3297 h=h->next;
3298 poly inner=(poly)h->Data();
3299 res->rtyp=POLY_CMD ;
3300 res->data=(void*) uni_subst_bits(outer, inner,r);
3301 return(FALSE);
3302 }
3303 else
3304 /*==================== gcd-varianten =================*/
3305 if (strcmp(sys_cmd, "gcd") == 0)
3306 {
3307 if (h==NULL)
3308 {
3309 #if 0
3310 Print("FLINT_P:%d (use Flints gcd for polynomials in char p)\n",isOn(SW_USE_FL_GCD_P));
3311 Print("FLINT_0:%d (use Flints gcd for polynomials in char 0)\n",isOn(SW_USE_FL_GCD_0));
3312 #endif
3313 Print("EZGCD:%d (use EZGCD for gcd of polynomials in char 0)\n",isOn(SW_USE_EZGCD));
3314 Print("EZGCD_P:%d (use EZGCD_P for gcd of polynomials in char p)\n",isOn(SW_USE_EZGCD_P));
3315 Print("CRGCD:%d (use chinese Remainder for gcd of polynomials in char 0)\n",isOn(SW_USE_CHINREM_GCD));
3316 #ifndef __CYGWIN__
3317 Print("homog:%d (use homog. test for factorization of polynomials)\n",singular_homog_flag);
3318 #endif
3319 return FALSE;
3320 }
3321 else
3322 if ((h!=NULL) && (h->Typ()==STRING_CMD)
3323 && (h->next!=NULL) && (h->next->Typ()==INT_CMD))
3324 {
3325 int d=(int)(long)h->next->Data();
3326 char *s=(char *)h->Data();
3327 #if 0
3328 if (strcmp(s,"FLINT_P")==0) { if (d) On(SW_USE_FL_GCD_P); else Off(SW_USE_FL_GCD_P); } else
3329 if (strcmp(s,"FLINT_0")==0) { if (d) On(SW_USE_FL_GCD_0); else Off(SW_USE_FL_GCD_0); } else
3330 #endif
3331 if (strcmp(s,"EZGCD")==0) { if (d) On(SW_USE_EZGCD); else Off(SW_USE_EZGCD); } else
3332 if (strcmp(s,"EZGCD_P")==0) { if (d) On(SW_USE_EZGCD_P); else Off(SW_USE_EZGCD_P); } else
3333 if (strcmp(s,"CRGCD")==0) { if (d) On(SW_USE_CHINREM_GCD); else Off(SW_USE_CHINREM_GCD); } else
3334 #ifndef __CYGWIN__
3335 if (strcmp(s,"homog")==0) { if (d) singular_homog_flag=1; else singular_homog_flag=0; } else
3336 #endif
3337 return TRUE;
3338 return FALSE;
3339 }
3340 else return TRUE;
3341 }
3342 else
3343 /*==================== subring =================*/
3344 if (strcmp(sys_cmd, "subring") == 0)
3345 {
3346 if (h!=NULL)
3347 {
3348 extern ring rSubring(ring r,leftv v); /* ipshell.cc*/
3349 res->data=(char *)rSubring(currRing,h);
3350 res->rtyp=RING_CMD;
3351 return res->data==NULL;
3352 }
3353 else return TRUE;
3354 }
3355 else
3356 /*==================== HNF =================*/
3357 #ifdef HAVE_NTL
3358 if (strcmp(sys_cmd, "HNF") == 0)
3359 {
3360 if (h!=NULL)
3361 {
3362 res->rtyp=h->Typ();
3363 if (h->Typ()==MATRIX_CMD)
3364 {
3365 res->data=(char *)singntl_HNF((matrix)h->Data(), currRing);
3366 return FALSE;
3367 }
3368 else if (h->Typ()==INTMAT_CMD)
3369 {
3370 res->data=(char *)singntl_HNF((intvec*)h->Data());
3371 return FALSE;
3372 }
3373 else if (h->Typ()==INTMAT_CMD)
3374 {
3375 res->data=(char *)singntl_HNF((intvec*)h->Data());
3376 return FALSE;
3377 }
3378 else
3379 {
3380 WerrorS("expected `system(\"HNF\",<matrix|intmat|bigintmat>)`");
3381 return TRUE;
3382 }
3383 }
3384 else return TRUE;
3385 }
3386 else
3387 /*================= probIrredTest ======================*/
3388 if (strcmp (sys_cmd, "probIrredTest") == 0)
3389 {
3390 if (h!=NULL && (h->Typ()== POLY_CMD) && ((h->next != NULL) && h->next->Typ() == STRING_CMD))
3391 {
3392 CanonicalForm F= convSingPFactoryP((poly)(h->Data()), currRing);
3393 char *s=(char *)h->next->Data();
3394 double error= atof (s);
3395 int irred= probIrredTest (F, error);
3396 res->rtyp= INT_CMD;
3397 res->data= (void*)(long)irred;
3398 return FALSE;
3399 }
3400 else return TRUE;
3401 }
3402 else
3403 #endif
3404 /*==================== mpz_t loader ======================*/
3405 if(strcmp(sys_cmd, "GNUmpLoad")==0)
3406 {
3407 if ((h != NULL) && (h->Typ() == STRING_CMD))
3408 {
3409 char* filename = (char*)h->Data();
3410 FILE* f = fopen(filename, "r");
3411 if (f == NULL)
3412 {
3413 WerrorS( "invalid file name (in paths use '/')");
3414 return FALSE;
3415 }
3416 mpz_t m; mpz_init(m);
3417 mpz_inp_str(m, f, 10);
3418 fclose(f);
3420 res->rtyp = BIGINT_CMD;
3421 res->data = (void*)n;
3422 return FALSE;
3423 }
3424 else
3425 {
3426 WerrorS( "expected valid file name as a string");
3427 return TRUE;
3428 }
3429 }
3430 else
3431 /*==================== intvec matching ======================*/
3432 /* Given two non-empty intvecs, the call
3433 'system("intvecMatchingSegments", ivec, jvec);'
3434 computes all occurences of jvec in ivec, i.e., it returns
3435 a list of int indices k such that ivec[k..size(jvec)+k-1] = jvec.
3436 If no such k exists (e.g. when ivec is shorter than jvec), an
3437 intvec with the single entry 0 is being returned. */
3438 if(strcmp(sys_cmd, "intvecMatchingSegments")==0)
3439 {
3440 if ((h != NULL) && (h->Typ() == INTVEC_CMD) &&
3441 (h->next != NULL) && (h->next->Typ() == INTVEC_CMD) &&
3442 (h->next->next == NULL))
3443 {
3444 intvec* ivec = (intvec*)h->Data();
3445 intvec* jvec = (intvec*)h->next->Data();
3446 intvec* r = new intvec(1); (*r)[0] = 0;
3447 int validEntries = 0;
3448 for (int k = 0; k <= ivec->rows() - jvec->rows(); k++)
3449 {
3450 if (memcmp(&(*ivec)[k], &(*jvec)[0],
3451 sizeof(int) * jvec->rows()) == 0)
3452 {
3453 if (validEntries == 0)
3454 (*r)[0] = k + 1;
3455 else
3456 {
3457 r->resize(validEntries + 1);
3458 (*r)[validEntries] = k + 1;
3459 }
3460 validEntries++;
3461 }
3462 }
3463 res->rtyp = INTVEC_CMD;
3464 res->data = (void*)r;
3465 return FALSE;
3466 }
3467 else
3468 {
3469 WerrorS("expected two non-empty intvecs as arguments");
3470 return TRUE;
3471 }
3472 }
3473 else
3474 /* ================== intvecOverlap ======================= */
3475 /* Given two non-empty intvecs, the call
3476 'system("intvecOverlap", ivec, jvec);'
3477 computes the longest intvec kvec such that ivec ends with kvec
3478 and jvec starts with kvec. The length of this overlap is being
3479 returned. If there is no overlap at all, then 0 is being returned. */
3480 if(strcmp(sys_cmd, "intvecOverlap")==0)
3481 {
3482 if ((h != NULL) && (h->Typ() == INTVEC_CMD) &&
3483 (h->next != NULL) && (h->next->Typ() == INTVEC_CMD) &&
3484 (h->next->next == NULL))
3485 {
3486 intvec* ivec = (intvec*)h->Data();
3487 intvec* jvec = (intvec*)h->next->Data();
3488 int ir = ivec->rows(); int jr = jvec->rows();
3489 int r = jr; if (ir < jr) r = ir; /* r = min{ir, jr} */
3490 while ((r >= 1) && (memcmp(&(*ivec)[ir - r], &(*jvec)[0],
3491 sizeof(int) * r) != 0))
3492 r--;
3493 res->rtyp = INT_CMD;
3494 res->data = (void*)(long)r;
3495 return FALSE;
3496 }
3497 else
3498 {
3499 WerrorS("expected two non-empty intvecs as arguments");
3500 return TRUE;
3501 }
3502 }
3503 else
3504 /*==================== Hensel's lemma ======================*/
3505 if(strcmp(sys_cmd, "henselfactors")==0)
3506 {
3507 if ((h != NULL) && (h->Typ() == INT_CMD) &&
3508 (h->next != NULL) && (h->next->Typ() == INT_CMD) &&
3509 (h->next->next != NULL) && (h->next->next->Typ() == POLY_CMD) &&
3510 (h->next->next->next != NULL) &&
3511 (h->next->next->next->Typ() == POLY_CMD) &&
3512 (h->next->next->next->next != NULL) &&
3513 (h->next->next->next->next->Typ() == POLY_CMD) &&
3514 (h->next->next->next->next->next != NULL) &&
3515 (h->next->next->next->next->next->Typ() == INT_CMD) &&
3516 (h->next->next->next->next->next->next == NULL))
3517 {
3518 int xIndex = (int)(long)h->Data();
3519 int yIndex = (int)(long)h->next->Data();
3520 poly hh = (poly)h->next->next->Data();
3521 poly f0 = (poly)h->next->next->next->Data();
3522 poly g0 = (poly)h->next->next->next->next->Data();
3523 int d = (int)(long)h->next->next->next->next->next->Data();
3524 poly f; poly g;
3525 henselFactors(xIndex, yIndex, hh, f0, g0, d, f, g);
3527 L->Init(2);
3528 L->m[0].rtyp = POLY_CMD; L->m[0].data=(void*)f;
3529 L->m[1].rtyp = POLY_CMD; L->m[1].data=(void*)g;
3530 res->rtyp = LIST_CMD;
3531 res->data = (char *)L;
3532 return FALSE;
3533 }
3534 else
3535 {
3536 WerrorS( "expected argument list (int, int, poly, poly, poly, int)");
3537 return TRUE;
3538 }
3539 }
3540 else
3541 /*==================== Approx_Step =================*/
3542 #ifdef HAVE_PLURAL
3543 if (strcmp(sys_cmd, "astep") == 0)
3544 {
3545 ideal I;
3546 if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
3547 {
3548 I=(ideal)h->CopyD();
3549 res->rtyp=IDEAL_CMD;
3550 if (rIsPluralRing(currRing)) res->data=Approx_Step(I);
3551 else res->data=I;
3553 }
3554 else return TRUE;
3555 return FALSE;
3556 }
3557 else
3558 #endif
3559 /*==================== PrintMat =================*/
3560 #ifdef HAVE_PLURAL
3561 if (strcmp(sys_cmd, "PrintMat") == 0)
3562 {
3563 int a=0;
3564 int b=0;
3565 ring r=NULL;
3566 int metric=0;
3567 if (h!=NULL)
3568 {
3569 if (h->Typ()==INT_CMD)
3570 {
3571 a=(int)((long)(h->Data()));
3572 h=h->next;
3573 }
3574 else if (h->Typ()==INT_CMD)
3575 {
3576 b=(int)((long)(h->Data()));
3577 h=h->next;
3578 }
3579 else if (h->Typ()==RING_CMD)
3580 {
3581 r=(ring)h->Data();
3582 h=h->next;
3583 }
3584 else
3585 return TRUE;
3586 }
3587 else
3588 return TRUE;
3589 if ((h!=NULL) && (h->Typ()==INT_CMD))
3590 {
3591 metric=(int)((long)(h->Data()));
3592 }
3593 res->rtyp=MATRIX_CMD;
3594 if (rIsPluralRing(r)) res->data=nc_PrintMat(a,b,r,metric);
3595 else res->data=NULL;
3596 return FALSE;
3597 }
3598 else
3599 #endif
3600/* ============ NCUseExtensions ======================== */
3601 #ifdef HAVE_PLURAL
3602 if(strcmp(sys_cmd,"NCUseExtensions")==0)
3603 {
3604 if ((h!=NULL) && (h->Typ()==INT_CMD))
3605 res->data=(void *)(long)setNCExtensions( (int)((long)(h->Data())) );
3606 else
3607 res->data=(void *)(long)getNCExtensions();
3608 res->rtyp=INT_CMD;
3609 return FALSE;
3610 }
3611 else
3612 #endif
3613/* ============ NCGetType ======================== */
3614 #ifdef HAVE_PLURAL
3615 if(strcmp(sys_cmd,"NCGetType")==0)
3616 {
3617 res->rtyp=INT_CMD;
3618 if( rIsPluralRing(currRing) )
3619 res->data=(void *)(long)ncRingType(currRing);
3620 else
3621 res->data=(void *)(-1L);
3622 return FALSE;
3623 }
3624 else
3625 #endif
3626/* ============ ForceSCA ======================== */
3627 #ifdef HAVE_PLURAL
3628 if(strcmp(sys_cmd,"ForceSCA")==0)
3629 {
3630 if( !rIsPluralRing(currRing) )
3631 return TRUE;
3632 int b, e;
3633 if ((h!=NULL) && (h->Typ()==INT_CMD))
3634 {
3635 b = (int)((long)(h->Data()));
3636 h=h->next;
3637 }
3638 else return TRUE;
3639 if ((h!=NULL) && (h->Typ()==INT_CMD))
3640 {
3641 e = (int)((long)(h->Data()));
3642 }
3643 else return TRUE;
3644 if( !sca_Force(currRing, b, e) )
3645 return TRUE;
3646 return FALSE;
3647 }
3648 else
3649 #endif
3650/* ============ ForceNewNCMultiplication ======================== */
3651 #ifdef HAVE_PLURAL
3652 if(strcmp(sys_cmd,"ForceNewNCMultiplication")==0)
3653 {
3654 if( !rIsPluralRing(currRing) )
3655 return TRUE;
3656 if( !ncInitSpecialPairMultiplication(currRing) ) // No Plural!
3657 return TRUE;
3658 return FALSE;
3659 }
3660 else
3661 #endif
3662/* ============ ForceNewOldNCMultiplication ======================== */
3663 #ifdef HAVE_PLURAL
3664 if(strcmp(sys_cmd,"ForceNewOldNCMultiplication")==0)
3665 {
3666 if( !rIsPluralRing(currRing) )
3667 return TRUE;
3668 if( !ncInitSpecialPowersMultiplication(currRing) ) // Enable Formula for Plural (depends on swiches)!
3669 return TRUE;
3670 return FALSE;
3671 }
3672 else
3673 #endif
3674/*==================== test64 =================*/
3675 #if 0
3676 if(strcmp(sys_cmd,"test64")==0)
3677 {
3678 long l=8;int i;
3679 for(i=1;i<62;i++)
3680 {
3681 l=l<<1;
3683 Print("%ld= ",l);n_Print(n,coeffs_BIGINT);
3687 PrintS(" F:");
3689 PrintLn();
3691 }
3692 Print("SIZEOF_LONG=%d\n",SIZEOF_LONG);
3693 return FALSE;
3694 }
3695 else
3696 #endif
3697/*==================== n_SwitchChinRem =================*/
3698 if(strcmp(sys_cmd,"cache_chinrem")==0)
3699 {
3701 Print("caching inverse in chines remainder:%d\n",n_SwitchChinRem);
3702 if ((h!=NULL)&&(h->Typ()==INT_CMD))
3703 n_SwitchChinRem=(int)(long)h->Data();
3704 return FALSE;
3705 }
3706 else
3707/*==================== LU for bigintmat =================*/
3708#ifdef SINGULAR_4_2
3709 if(strcmp(sys_cmd,"LU")==0)
3710 {
3711 if ((h!=NULL) && (h->Typ()==CMATRIX_CMD))
3712 {
3713 // get the argument:
3714 bigintmat *b=(bigintmat *)h->Data();
3715 // just for tests: simply transpose
3716 bigintmat *bb=b->transpose();
3717 // return the result:
3718 res->rtyp=CMATRIX_CMD;
3719 res->data=(char*)bb;
3720 return FALSE;
3721 }
3722 else
3723 {
3724 WerrorS("system(\"LU\",<cmatrix>) expected");
3725 return TRUE;
3726 }
3727 }
3728 else
3729#endif
3730/*==================== sort =================*/
3731 if(strcmp(sys_cmd,"sort")==0)
3732 {
3733 extern BOOLEAN jjSORTLIST(leftv,leftv);
3734 if (h->Typ()==LIST_CMD)
3735 return jjSORTLIST(res,h);
3736 else
3737 return TRUE;
3738 }
3739 else
3740/*==================== uniq =================*/
3741 if(strcmp(sys_cmd,"uniq")==0)
3742 {
3743 extern BOOLEAN jjUNIQLIST(leftv, leftv);
3744 if (h->Typ()==LIST_CMD)
3745 return jjUNIQLIST(res,h);
3746 else
3747 return TRUE;
3748 }
3749 else
3750/*==================== GF(p,n) ==================================*/
3751 if(strcmp(sys_cmd,"GF")==0)
3752 {
3753 const short t[]={3,INT_CMD,INT_CMD,STRING_CMD};
3754 if (iiCheckTypes(h,t,1))
3755 {
3756 int p=(int)(long)h->Data();
3757 int n=(int)(long)h->next->Data();
3758 char *v=(char*)h->next->next->CopyD();
3759 GFInfo param;
3760 param.GFChar = p;
3761 param.GFDegree = n;
3762 param.GFPar_name = v;
3764 res->rtyp=CRING_CMD;
3765 res->data=cf;
3766 return FALSE;
3767 }
3768 else
3769 return TRUE;
3770 }
3771 else
3772/*==================== power* ==================================*/
3773 #if 0
3774 if(strcmp(sys_cmd,"power1")==0)
3775 {
3776 res->rtyp=POLY_CMD;
3777 poly f=(poly)h->CopyD();
3778 poly g=pPower(f,2000);
3779 res->data=(void *)g;
3780 return FALSE;
3781 }
3782 else
3783 if(strcmp(sys_cmd,"power2")==0)
3784 {
3785 res->rtyp=POLY_CMD;
3786 poly f=(poly)h->Data();
3787 poly g=pOne();
3788 for(int i=0;i<2000;i++)
3789 g=pMult(g,pCopy(f));
3790 res->data=(void *)g;
3791 return FALSE;
3792 }
3793 if(strcmp(sys_cmd,"power3")==0)
3794 {
3795 res->rtyp=POLY_CMD;
3796 poly f=(poly)h->Data();
3797 poly p2=pMult(pCopy(f),pCopy(f));
3798 poly p4=pMult(pCopy(p2),pCopy(p2));
3799 poly p8=pMult(pCopy(p4),pCopy(p4));
3800 poly p16=pMult(pCopy(p8),pCopy(p8));
3801 poly p32=pMult(pCopy(p16),pCopy(p16));
3802 poly p64=pMult(pCopy(p32),pCopy(p32));
3803 poly p128=pMult(pCopy(p64),pCopy(p64));
3804 poly p256=pMult(pCopy(p128),pCopy(p128));
3805 poly p512=pMult(pCopy(p256),pCopy(p256));
3806 poly p1024=pMult(pCopy(p512),pCopy(p512));
3807 poly p1536=pMult(p1024,p512);
3808 poly p1792=pMult(p1536,p256);
3809 poly p1920=pMult(p1792,p128);
3810 poly p1984=pMult(p1920,p64);
3811 poly p2000=pMult(p1984,p16);
3812 res->data=(void *)p2000;
3813 pDelete(&p2);
3814 pDelete(&p4);
3815 pDelete(&p8);
3816 //pDelete(&p16);
3817 pDelete(&p32);
3818 //pDelete(&p64);
3819 //pDelete(&p128);
3820 //pDelete(&p256);
3821 //pDelete(&p512);
3822 //pDelete(&p1024);
3823 //pDelete(&p1536);
3824 //pDelete(&p1792);
3825 //pDelete(&p1920);
3826 //pDelete(&p1984);
3827 return FALSE;
3828 }
3829 else
3830 #endif
3831/* ccluster --------------------------------------------------------------*/
3832#ifdef HAVE_CCLUSTER
3833 if(strcmp(sys_cmd,"ccluster")==0)
3834 {
3835 if ((currRing!=NULL)
3837 {
3840
3841// printf("test t : %d\n", h->Typ()==POLY_CMD);
3842// printf("test t : %d\n", h->next->Typ()==POLY_CMD);
3844 if (h->next->Typ()==POLY_CMD)
3846
3847 if ( (pol_with_complex_coeffs==0 && iiCheckTypes(h,t,1))
3848 ||(pol_with_complex_coeffs==1 && iiCheckTypes(h,t2,1)) )
3849 {
3850 // convert first arg. to fmpq_poly_t
3852 convSingPFlintP(fre,(poly)h->Data(),currRing); h=h->next;
3854 { // convert second arg. to fmpq_poly_t
3855 convSingPFlintP(fim,(poly)h->Data(),currRing); h=h->next;
3856 }
3857 // convert box-center(re,im), box-size, epsilon
3859 convSingNFlintN(center_re,(number)h->Data(),currRing->cf); h=h->next;
3860 convSingNFlintN(center_im,(number)h->Data(),currRing->cf); h=h->next;
3861 convSingNFlintN(boxsize,(number)h->Data(),currRing->cf); h=h->next;
3862 convSingNFlintN(eps,(number)h->Data(),currRing->cf); h=h->next;
3863 // alloc arrays
3864 int n=fmpq_poly_length(fre);
3865 fmpq_t* re_part=(fmpq_t*)omAlloc(n*sizeof(fmpq_t));
3866 fmpq_t* im_part=(fmpq_t*)omAlloc(n*sizeof(fmpq_t));
3867 int *mult =(int*) omAlloc(n*sizeof(int));
3868 for(int i=0; i<n;i++)
3870 // call cccluster, adjust n
3871 int verbosity =0; //nothing is printed
3872 int strategy = 23; //default strategy
3873 int nn=0;
3876// printf("nb threads: %ld\n", nb_threads);
3877// printf("strategy: %ld\n", strategy);
3880 else
3882 // convert to list
3884 l->Init(nn);
3885 for(int i=0; i<nn;i++)
3886 {
3888 l->m[i].rtyp=LIST_CMD;
3889 l->m[i].data=ll;
3890 ll->Init(3);
3891 ll->m[0].rtyp=NUMBER_CMD;
3892 ll->m[1].rtyp=NUMBER_CMD;
3893 ll->m[2].rtyp=INT_CMD;
3894 ll->m[0].data=convFlintNSingN(re_part[i],currRing->cf);
3895 ll->m[1].data=convFlintNSingN(im_part[i],currRing->cf);
3896 ll->m[2].data=(void *)(long)mult[i];
3897 }
3898 //clear re, im, mults, fre, fim
3899 for(int i=n-1;i>=0;i--) { fmpq_clear(re_part[i]); fmpq_clear(im_part[i]); }
3900 omFree(re_part);
3901 omFree(im_part);
3902 omFree(mult);
3906 // result
3907 res->rtyp=LIST_CMD;
3908 res->data=l;
3909 return FALSE;
3910 }
3911 }
3912 return TRUE;
3913 }
3914 else
3915#endif
3916/* ====== maEvalAt ============================*/
3917 if(strcmp(sys_cmd,"evaluate")==0)
3918 {
3919 extern number maEvalAt(const poly p,const number* pt, const ring r);
3920 if (h->Typ()!=POLY_CMD)
3921 {
3922 WerrorS("expected system(\"evaluate\",<poly>,..)");
3923 return TRUE;
3924 }
3925 poly p=(poly)h->Data();
3926 number *pt=(number*)omAlloc(sizeof(number)*currRing->N);
3927 for(int i=0;i<currRing->N;i++)
3928 {
3929 h=h->next;
3930 if ((h==NULL)||(h->Typ()!=NUMBER_CMD))
3931 {
3932 WerrorS("system(\"evaluate\",<poly>,<number>..) - expect number");
3933 return TRUE;
3934 }
3935 pt[i]=(number)h->Data();
3936 }
3937 res->data=maEvalAt(p,pt,currRing);
3938 res->rtyp=NUMBER_CMD;
3939 return FALSE;
3940 }
3941 else
3942/* ====== DivRem ============================*/
3943 if(strcmp(sys_cmd,"DivRem")==0)
3944 {
3945 const short t1[]={2,POLY_CMD,POLY_CMD};
3946 if (iiCheckTypes(h,t1,1))
3947 {
3948 poly p=(poly)h->CopyD();
3949 poly q=(poly)h->next->CopyD();
3950 poly rest;
3951 res->data=p_DivRem(p,q,rest,currRing);
3952 res->rtyp=POLY_CMD;
3953 PrintS("rest:");pWrite(rest);
3954 return FALSE;
3955 }
3956 else
3957 {
3958 WerrorS("expected system(\"DivRem\",<poly>,<poly>)");
3959 return TRUE;
3960 }
3961 }
3962 else
3963/* ====== DivRemId ============================*/
3964 if(strcmp(sys_cmd,"DivRemIdU")==0)
3965 {
3966 const short t1[]={2,IDEAL_CMD,IDEAL_CMD};
3967 const short t2[]={2,MODUL_CMD,MODUL_CMD};
3968 if (iiCheckTypes(h,t1,0)
3969 || iiCheckTypes(h,t2,0))
3970 {
3971 ideal p=(ideal)h->CopyD();
3972 ideal q=(ideal)h->next->CopyD();
3973 ideal factors;
3974 ideal unit;
3976 //matrix T = id_Module2Matrix(factors,currRing);
3977 //matrix U = id_Module2Matrix(unit,currRing);
3979 L->Init(3);
3980 //L->m[0].rtyp=h->Typ(); L->m[0].data=(void *)rest;
3981 L->m[0].rtyp=MODUL_CMD; L->m[0].data=(void *)rest;
3982 L->m[1].rtyp=MODUL_CMD; L->m[1].data=(void *)factors;
3983 L->m[2].rtyp=MODUL_CMD; L->m[2].data=(void *)unit;
3984 res->rtyp=LIST_CMD;
3985 res->data=L;
3986 return FALSE;
3987 }
3988 else
3989 {
3990 WerrorS("expected system(\"DivRemId\",<ideal>,<ideal>)");
3991 return TRUE;
3992 }
3993 }
3994 else
3995 if(strcmp(sys_cmd,"DivRemId")==0)
3996 {
3997 const short t1[]={2,IDEAL_CMD,IDEAL_CMD};
3998 const short t2[]={2,MODUL_CMD,MODUL_CMD};
3999 if (iiCheckTypes(h,t1,0)
4000 || iiCheckTypes(h,t2,0))
4001 {
4002 ideal p=(ideal)h->CopyD();
4003 ideal q=(ideal)h->next->CopyD();
4004 ideal rest;
4008 L->Init(2);
4009 L->m[0].rtyp=IDEAL_CMD; L->m[0].data=(void *)quot;
4010 L->m[1].rtyp=MATRIX_CMD; L->m[1].data=(void *)T;
4011 res->rtyp=LIST_CMD;
4012 res->data=L;
4013 return FALSE;
4014 }
4015 else
4016 {
4017 WerrorS("expected system(\"DivRemId\",<ideal>,<ideal>)");
4018 return TRUE;
4019 }
4020 }
4021 else
4022/* ====== CoeffTerm ============================*/
4023 if(strcmp(sys_cmd,"CoeffTerm")==0)
4024 {
4025 const short t1[]={2,POLY_CMD,POLY_CMD};
4026 const short t2[]={2,VECTOR_CMD,VECTOR_CMD};
4027 const short t3[]={2,IDEAL_CMD,POLY_CMD};
4028 const short t4[]={2,MODUL_CMD,VECTOR_CMD};
4029 const short t5[]={2,VECTOR_CMD,POLY_CMD};
4030 const short t6[]={2,MODUL_CMD,POLY_CMD};
4031 const short t7[]={2,VECTOR_CMD,IDEAL_CMD};
4032 const short t8[]={2,VECTOR_CMD,MODUL_CMD};
4033 if (iiCheckTypes(h,t1,0)
4034 || iiCheckTypes(h,t2,0))
4035 {
4036 poly p=(poly)h->Data();
4037 poly q=(poly)h->next->Data();
4038 res->data=p_CoeffTerm(p,q,currRing);
4039 res->rtyp=NUMBER_CMD;
4040 return FALSE;
4041 }
4042 else if (iiCheckTypes(h,t3,0)
4043 || iiCheckTypes(h,t4,0))
4044 {
4045 ideal p=(ideal)h->Data();
4046 poly q=(poly)h->next->Data();
4047 res->data=id_CoeffTerm(p,q,currRing);
4048 res->rtyp=h->Typ();
4049 return FALSE;
4050 }
4051 else if (iiCheckTypes(h,t5,0))
4052 {
4053 poly p=(poly)h->Data();
4054 poly q=(poly)h->next->Data();
4055 res->data=p_CoeffTermV(p,q,currRing);
4056 res->rtyp=VECTOR_CMD;
4057 return FALSE;
4058 }
4059 else if (iiCheckTypes(h,t6,0))
4060 {
4061 ideal p=(ideal)h->Data();
4062 poly q=(poly)h->next->Data();
4063 res->data=id_CoeffTermV(p,q,currRing);
4064 res->rtyp=MODUL_CMD;
4065 return FALSE;
4066 }
4067 else if (iiCheckTypes(h,t7,0)) /* vector,ideal*/
4068 {
4069 poly p=(poly)h->Data();
4070 ideal q=(ideal)h->next->Data();
4072 res->rtyp=VECTOR_CMD;
4073 return FALSE;
4074 }
4075 else if (iiCheckTypes(h,t8,0)) /* vector,module*/
4076 {
4077 poly p=(poly)h->Data();
4078 ideal q=(ideal)h->next->Data();
4080 res->rtyp=VECTOR_CMD;
4081 return FALSE;
4082 }
4083 else
4084 {
4085 WerrorS("expected system(\"CoeffTerm\",<poly>/<vector>,<poly>/<vector>)" "\n or <ideal>/<module>,<poly>/<vector>");
4086 return TRUE;
4087 }
4088 }
4089 else
4090/*==================== sat1 =================*/
4091 if(strcmp(sys_cmd,"sat1")==0)
4092 {
4093 ideal I= (ideal)h->Data();
4094 ideal J=(ideal)h->next->Data();
4095 res->rtyp=IDEAL_CMD;
4096 res->data=(void*)id_Sat_principal(I,J,currRing);
4097 return FALSE;
4098 }
4099 else
4100/*==================== minres_with_map =================*/
4101 if(strcmp(sys_cmd,"minres_with_map")==0)
4102 {
4103 syStrategy r= syCopy((syStrategy)h->Data());
4104 ideal trans;
4105 res->rtyp=RESOLUTION_CMD;
4107 res->data=(void*)r;
4109 res->next->data=(void*)trans;
4110 res->next->rtyp=MODUL_CMD;
4111 return FALSE;
4112 }
4113 else
4114/*==================== sat =================*/
4115#if 0
4116 if(strcmp(sys_cmd,"sat_with_exp")==0)
4117 {
4118 ideal I= (ideal)h->Data();
4119 ideal J=(ideal)h->next->Data();
4120 int k;
4121 ideal S=idSaturate(I,J,k,h->Typ()==IDEAL_CMD);
4123 L->Init(2);
4124 L->m[0].rtyp = h->Typ(); L->m[0].data=(void*)S; // ideal or module
4125 setFlag(&(L->m[0]),FLAG_STD);
4126 L->m[1].rtyp = INT_CMD; L->m[1].data=(void*)(long)k;
4127 res->rtyp=LIST_CMD;
4128 res->data=(void*)L;
4129 return FALSE;
4130 }
4131 else
4132#endif
4133/*==================== Error =================*/
4134 Werror( "(extended) system(\"%s\",...) %s", sys_cmd, feNotImplemented );
4135 }
4136 return TRUE;
4137}
int BOOLEAN
Definition auxiliary.h:88
#define TRUE
Definition auxiliary.h:101
#define FALSE
Definition auxiliary.h:97
lists testsvd(matrix M)
Definition calcSVD.cc:27
bool isOn(int sw)
switches
void On(int sw)
switches
void Off(int sw)
switches
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition cf_gcd.cc:676
void FACTORY_PUBLIC setCharacteristic(int c)
Definition cf_char.cc:28
int l
Definition cfEzgcd.cc:100
int m
Definition cfEzgcd.cc:128
int i
Definition cfEzgcd.cc:132
int k
Definition cfEzgcd.cc:99
int p
Definition cfModGcd.cc:4086
g
Definition cfModGcd.cc:4098
CanonicalForm cf
Definition cfModGcd.cc:4091
CanonicalForm b
Definition cfModGcd.cc:4111
EXTERN_VAR int singular_homog_flag
static const int SW_USE_CHINREM_GCD
set to 1 to use modular gcd over Z
Definition cf_defs.h:41
static const int SW_USE_FL_GCD_P
set to 1 to use Flints gcd over F_p
Definition cf_defs.h:47
static const int SW_USE_EZGCD_P
set to 1 to use EZGCD over F_q
Definition cf_defs.h:37
static const int SW_USE_EZGCD
set to 1 to use EZGCD over Z
Definition cf_defs.h:35
static const int SW_USE_FL_GCD_0
set to 1 to use Flints gcd over Q/Z
Definition cf_defs.h:49
FILE * f
Definition checklibs.c:9
CanonicalForm convSingPFactoryP(poly p, const ring r)
Definition clapconv.cc:138
matrix singntl_HNF(matrix m, const ring s)
Definition clapsing.cc:1819
factory's main class
Matrices of numbers.
Definition bigintmat.h:51
void resize(int new_length)
Definition intvec.cc:106
Class used for (list of) interpreter objects.
Definition subexpr.h:83
int rtyp
Definition subexpr.h:91
void * data
Definition subexpr.h:88
Definition lists.h:24
sleftv * m
Definition lists.h:46
INLINE_THIS void Init(int l=0)
@ n_GF
\GF{p^n < 2^16}
Definition coeffs.h:32
static FORCE_INLINE number n_convFactoryNSingN(const CanonicalForm n, const coeffs r)
Definition coeffs.h:975
void n_Print(number &a, const coeffs r)
print a number (BEWARE of string buffers!) mostly for debugging
Definition numbers.cc:655
static FORCE_INLINE CanonicalForm n_convSingNFactoryN(number n, BOOLEAN setChar, const coeffs r)
Definition coeffs.h:978
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition numbers.cc:406
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition coeffs.h:448
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:459
static FORCE_INLINE number n_InitMPZ(mpz_t n, const coeffs r)
conversion of a GMP integer to number
Definition coeffs.h:543
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition coeffs.h:539
Creation data needed for finite fields.
Definition coeffs.h:100
poly uni_subst_bits(poly outer_uni, poly inner_multi, ring r)
Definition digitech.cc:47
#define Print
Definition emacs.cc:80
#define Warn
Definition emacs.cc:77
#define WarnS
Definition emacs.cc:78
unsigned long ** singularMatrixToLongMatrix(matrix singularMatrix)
Definition extra.cc:177
poly longCoeffsToSingularPoly(unsigned long *polyCoeffs, const int degree)
Definition extra.cc:209
EXTERN_VAR BOOLEAN FE_OPT_NO_SHELL_FLAG
Definition extra.cc:170
ideal F5main(ideal id, ring r, int opt, int plus, int termination)
Definition f5gb.cc:1889
const CanonicalForm int s
Definition facAbsFact.cc:51
CanonicalForm res
Definition facAbsFact.cc:60
const CanonicalForm & w
Definition facAbsFact.cc:51
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
CFList int bool & irred
[in,out] Is A irreducible?
int j
Definition facHensel.cc:110
int probIrredTest(const CanonicalForm &F, double error)
given some error probIrredTest detects irreducibility or reducibility of F with confidence level 1-er...
poly unifastmult(poly f, poly g, ring r)
Definition fast_mult.cc:272
poly pFastPowerMC(poly f, int n, ring r)
Definition fast_mult.cc:588
static int max(int a, int b)
Definition fast_mult.cc:264
poly pFastPower(poly f, int n, ring r)
Definition fast_mult.cc:342
int Mults()
Definition fast_mult.cc:14
poly multifastmult(poly f, poly g, ring r)
Definition fast_mult.cc:290
void WerrorS(const char *s)
Definition feFopen.cc:24
static void * feOptValue(feOptIndex opt)
Definition feOpt.h:40
STATIC_VAR int nfMinPoly[16]
Definition ffields.cc:545
void convSingPFlintP(fmpq_poly_t res, poly p, const ring r)
void convSingNFlintN(fmpz_t f, mpz_t z)
void convFlintNSingN(mpz_t z, fmpz_t f)
number maEvalAt(const poly p, const number *pt, const ring r)
evaluate the polynomial p at the pt given by the array pt
Definition gen_maps.cc:170
#define EXTERN_VAR
Definition globaldefs.h:6
@ IDEAL_CMD
Definition grammar.cc:285
@ MATRIX_CMD
Definition grammar.cc:287
@ PROC_CMD
Definition grammar.cc:281
@ INTMAT_CMD
Definition grammar.cc:280
@ MODUL_CMD
Definition grammar.cc:288
@ VECTOR_CMD
Definition grammar.cc:293
@ RESOLUTION_CMD
Definition grammar.cc:291
@ NUMBER_CMD
Definition grammar.cc:289
@ POLY_CMD
Definition grammar.cc:290
@ RING_CMD
Definition grammar.cc:282
void slicehilb(ideal I)
Definition hilb.cc:666
ideal id_Sat_principal(ideal I, ideal J, const ring origR)
Definition ideals.cc:3372
ideal idSaturate(ideal I, ideal J, int &k, BOOLEAN isIdeal)
Definition ideals.cc:3452
STATIC_VAR coordinates * points
BOOLEAN jjSORTLIST(leftv, leftv arg)
Definition iparith.cc:10475
BOOLEAN jjUNIQLIST(leftv, leftv arg)
Definition iparith.cc:10484
VAR coeffs coeffs_BIGINT
Definition ipid.cc:50
EXTERN_VAR omBin sleftv_bin
Definition ipid.h:145
#define setFlag(A, F)
Definition ipid.h:113
#define FLAG_STD
Definition ipid.h:106
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:6559
ring rSubring(ring org_ring, sleftv *rv)
Definition ipshell.cc:6002
STATIC_VAR jList * T
Definition janet.cc:30
STATIC_VAR TreeM * G
Definition janet.cc:31
STATIC_VAR Poly * h
Definition janet.cc:971
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition kInline.h:1171
ideal idDivRem(ideal A, const ideal quot, ideal &factor, ideal *unit, int lazyReduce)
Definition kLiftstd.cc:347
poly fglmLinearCombination(ideal source, poly monset)
Definition fglmcomb.cc:415
poly fglmNewLinearCombination(ideal source, poly monset)
Definition fglmcomb.cc:153
VAR int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition kstd2.cc:83
VAR int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition kstd2.cc:82
int posInT17(const TSet set, const int length, LObject &p)
Definition kutil.cc:5282
int posInT11(const TSet set, const int length, LObject &p)
Definition kutil.cc:4957
int posInT1(const TSet set, const int length, LObject &p)
Definition kutil.cc:4900
int posInT0(const TSet, const int length, LObject &)
Definition kutil.cc:4889
int posInT2(const TSet set, const int length, LObject &p)
Definition kutil.cc:4929
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11463
int posInT13(const TSet set, const int length, LObject &p)
Definition kutil.cc:5121
int posInT17_c(const TSet set, const int length, LObject &p)
Definition kutil.cc:5388
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11372
int posInT15(const TSet set, const int length, LObject &p)
Definition kutil.cc:5188
int posInT110(const TSet set, const int length, LObject &p)
Definition kutil.cc:5033
int posInT19(const TSet set, const int length, LObject &p)
Definition kutil.cc:5514
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11426
static bool rIsSCA(const ring r)
Definition nc.h:190
int & getNCExtensions()
Definition old.gring.cc:82
static nc_type & ncRingType(nc_struct *p)
Definition nc.h:159
int setNCExtensions(int iMask)
Definition old.gring.cc:87
matrix nc_PrintMat(int a, int b, ring r, int metric)
returns matrix with the info on noncomm multiplication
bool sca_Force(ring rGR, int b, int e)
Definition sca.cc:1159
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,...
VAR omBin slists_bin
Definition lists.cc:23
VAR int n_SwitchChinRem
Definition longrat.cc:3085
matrix mp_Transp(matrix a, const ring R)
Definition matpol.cc:247
matrix mp_InitI(int r, int c, int v, const ring R)
make it a v * unit matrix
Definition matpol.cc:122
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition matpol.cc:37
#define MATELEM(mat, i, j)
1-based access to matrix
Definition matpol.h:29
ip_smatrix * matrix
Definition matpol.h:43
#define MATROWS(i)
Definition matpol.h:26
#define MATCOLS(i)
Definition matpol.h:27
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition minpoly.cc:647
unsigned long * computeMinimalPolynomial(unsigned long **matrix, unsigned n, unsigned long p)
Definition minpoly.cc:428
#define pIter(p)
Definition monomials.h:37
#define error(a)
slists * lists
The main handler for Singular numbers which are suitable for Singular polynomials.
bool ncInitSpecialPowersMultiplication(ring r)
BOOLEAN ncInitSpecialPairMultiplication(ring r)
Definition ncSAMult.cc:266
ideal Approx_Step(ideal L)
Ann: ???
Definition nc.cc:250
#define omStrDup(s)
#define omFreeSize(addr, size)
#define omAlloc(size)
#define omAllocBin(bin)
#define omAlloc0Bin(bin)
#define omFree(addr)
#define omAlloc0(size)
omError_t om_ErrorStatus
Definition omError.c:13
const char * omError2String(omError_t error)
Definition omError.c:54
const char * omError2Serror(omError_t error)
Definition omError.c:65
omError_t om_InternalErrorStatus
Definition omError.c:14
#define NULL
Definition omList.c:12
omOpts_t om_Opts
Definition omOpts.c:13
#define omPrintCurrentBackTrace(fd)
Definition omRet2Info.h:39
VAR unsigned si_opt_2
Definition options.c:6
#define Sy_bit(x)
Definition options.h:31
poly p_CoeffTermMo(poly v, ideal m, int n, const ring r)
find coeffs of a vector of a matrix(module) of given monomials, n>=max_comp(v)
Definition pCoeff.cc:113
poly p_CoeffTermId(poly v, ideal m, int n, const ring r)
find coeffs of a vector of a list of given monomials, n>=max_comp(v)
Definition pCoeff.cc:86
number p_CoeffTerm(poly p, poly m, const ring r)
find coeff of (polynomial) m in polynomial p find coeff of (vector) m in vector p
Definition pCoeff.cc:22
ideal id_CoeffTermV(ideal M, poly m, const ring r)
find coeffs of (polynomial) m in all vectors from I
Definition pCoeff.cc:75
ideal id_CoeffTerm(ideal I, poly m, const ring r)
find coeffs of (polynomial) m in all polynomials from I find coeffs of (vector) m in all vectors from...
Definition pCoeff.cc:63
poly p_CoeffTermV(poly v, poly m, const ring r)
find vector of coeffs of (polynomial) m in vector v
Definition pCoeff.cc:39
static int pLength(poly a)
Definition p_polys.h:190
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition p_polys.h:293
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
poly p_DivRem(poly p, poly q, poly &rest, const ring r)
Definition polys.cc:316
#define pAdd(p, q)
Definition polys.h:203
#define pDelete(p_ptr)
Definition polys.h:186
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition polys.h:67
#define pLmDeleteAndNext(p)
like pLmDelete, returns pNext(p)
Definition polys.h:78
#define ppJetW(p, m, iv)
Definition polys.h:368
#define pDivideM(a, b)
Definition polys.h:294
#define pPower(p, q)
Definition polys.h:204
#define pMult(p, q)
Definition polys.h:207
void pWrite(poly p)
Definition polys.h:308
#define pGetExp(p, i)
Exponent.
Definition polys.h:41
#define pIsPurePower(p)
Definition polys.h:248
#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
#define pCopy(p)
return a copy of the poly
Definition polys.h:185
#define pOne()
Definition polys.h:315
poly nc_rat_CreateSpoly(poly pp1, poly pp2, int ishift, const ring r)
Definition ratgring.cc:340
int redRat(poly *h, poly *reducer, int *red_length, int rl, int ishift, ring r)
Definition ratgring.cc:593
poly nc_rat_ReduceSpolyNew(const poly p1, poly p2, int ishift, const ring r)
Definition ratgring.cc:465
const char feNotImplemented[]
Definition reporter.cc:54
void PrintS(const char *s)
Definition reporter.cc:284
void PrintLn()
Definition reporter.cc:310
void Werror(const char *fmt,...)
Definition reporter.cc:189
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:3481
void p_DebugPrint(poly p, const ring r)
Definition ring.cc:4374
int rChar(ring r)
Definition ring.cc:716
void rDebugPrint(const ring r)
Definition ring.cc:4169
void rSetSyzComp(int k, const ring r)
Definition ring.cc:5185
static BOOLEAN rField_is_R(const ring r)
Definition ring.h:523
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:405
@ ringorder_s
s?
Definition ring.h:76
static BOOLEAN rField_is_Q(const ring r)
Definition ring.h:511
static BOOLEAN rField_is_long_R(const ring r)
Definition ring.h:547
poly ringNF(poly f, ideal G, ring r)
Definition ringgb.cc:196
poly plain_spoly(poly f, poly g)
Definition ringgb.cc:163
poly ringRedNF(poly f, ideal G, ring r)
Definition ringgb.cc:116
int testGB(ideal I, ideal GI)
Definition ringgb.cc:223
static short scaLastAltVar(ring r)
Definition sca.h:25
static short scaFirstAltVar(ring r)
Definition sca.h:18
VAR int sdb_flags
Definition sdb.cc:31
void sdb_edit(procinfo *pi)
Definition sdb.cc:109
int status int fd
Definition si_signals.h:69
ideal id_Vec2Ideal(poly vec, const ring R)
matrix id_Module2Matrix(ideal mod, const ring R)
#define IDELEMS(i)
#define R
Definition sirandom.c:27
#define M
Definition sirandom.c:25
sleftv * leftv
Definition structs.h:53
@ testHomog
Definition structs.h:34
procinfo * procinfov
Definition structs.h:56
BOOLEAN assumeStdFlag(leftv h)
Definition subexpr.cc:1587
void syMinimize_with_map(syStrategy res, ideal &trans)
Definition syz.cc:1185
syStrategy syCopy(syStrategy syzstr)
Definition syz1.cc:1885
@ BIGINT_CMD
Definition tok.h:38
@ CRING_CMD
Definition tok.h:56
@ LIST_CMD
Definition tok.h:118
@ INTVEC_CMD
Definition tok.h:101
@ CMATRIX_CMD
Definition tok.h:46
@ DEF_CMD
Definition tok.h:58
@ STRING_CMD
Definition tok.h:187
@ INT_CMD
Definition tok.h:96
int dim(ideal I, ring r)
int * iv2array(intvec *iv, const ring R)
Definition weight.cc:200
#define omMarkAsStaticAddr(A)
Definition xalloc.h:245
#define omPrintUsedTrackAddrs(F, max)
Definition xalloc.h:266
#define omUpdateInfo()
Definition xalloc.h:230

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

◆ longCoeffsToSingularPoly()

poly longCoeffsToSingularPoly ( unsigned long polyCoeffs,
const int  degree 
)

Definition at line 209 of file extra.cc.

210{
211 poly result = NULL;
212 for (int i = 0; i <= degree; i++)
213 {
214 if ((int)polyCoeffs[i] != 0)
215 {
216 poly term = p_ISet((int)polyCoeffs[i], currRing);
217 if (i > 0)
218 {
219 p_SetExp(term, 1, i, currRing);
221 }
223 }
224 }
225 return result;
226}
int degree(const CanonicalForm &f)
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition p_polys.cc:1298
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:937
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition p_polys.h:489
static void p_Setm(poly p, const ring r)
Definition p_polys.h:234

◆ singularMatrixToLongMatrix()

unsigned long ** singularMatrixToLongMatrix ( matrix  singularMatrix)

Definition at line 177 of file extra.cc.

178{
179 int n = singularMatrix->rows();
180 assume(n == singularMatrix->cols());
181 unsigned long **longMatrix = 0;
182 longMatrix = new unsigned long *[n] ;
183 for (int i = 0 ; i < n; i++)
184 longMatrix[i] = new unsigned long [n];
186 for (int r = 0; r < n; r++)
187 for (int c = 0; c < n; c++)
188 {
189 poly p=MATELEM(singularMatrix, r + 1, c + 1);
190 int entryAsInt;
191 if (p!=NULL)
192 {
195 if (entryAsInt < 0) entryAsInt += n_GetChar(currRing->cf);
196 }
197 else
198 entryAsInt=0;
199 longMatrix[r][c] = (unsigned long)entryAsInt;
200 }
201 return longMatrix;
202}
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:548
#define assume(x)
Definition mod2.h:389
#define p_GetCoeff(p, r)
Definition monomials.h:50

Variable Documentation

◆ FE_OPT_NO_SHELL_FLAG

EXTERN_VAR BOOLEAN FE_OPT_NO_SHELL_FLAG

Definition at line 170 of file extra.cc.