My Project
Macros | Functions | Variables
extra.cc File Reference
#include "kernel/mod2.h"
#include "misc/sirandom.h"
#include "resources/omFindExec.h"
#include "factory/factory.h"
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include "misc/options.h"
#include "coeffs/coeffs.h"
#include "coeffs/mpr_complex.h"
#include "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 143 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 2383 of file extra.cc.

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

◆ jjSYSTEM()

BOOLEAN jjSYSTEM ( leftv  res,
leftv  args 
)

Definition at line 232 of file extra.cc.

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

211{
212 poly result = NULL;
213 for (int i = 0; i <= degree; i++)
214 {
215 if ((int)polyCoeffs[i] != 0)
216 {
217 poly term = p_ISet((int)polyCoeffs[i], currRing);
218 if (i > 0)
219 {
220 p_SetExp(term, 1, i, currRing);
222 }
224 }
225 }
226 return result;
227}
int degree(const CanonicalForm &f)
Definition: int_poly.h:33
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1297
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:936
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:488
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:233

◆ singularMatrixToLongMatrix()

unsigned long ** singularMatrixToLongMatrix ( matrix  singularMatrix)

Definition at line 178 of file extra.cc.

179{
180 int n = singularMatrix->rows();
181 assume(n == singularMatrix->cols());
182 unsigned long **longMatrix = 0;
183 longMatrix = new unsigned long *[n] ;
184 for (int i = 0 ; i < n; i++)
185 longMatrix[i] = new unsigned long [n];
186 number entry;
187 for (int r = 0; r < n; r++)
188 for (int c = 0; c < n; c++)
189 {
190 poly p=MATELEM(singularMatrix, r + 1, c + 1);
191 int entryAsInt;
192 if (p!=NULL)
193 {
194 entry = p_GetCoeff(p, currRing);
195 entryAsInt = n_Int(entry, currRing->cf);
196 if (entryAsInt < 0) entryAsInt += n_GetChar(currRing->cf);
197 }
198 else
199 entryAsInt=0;
200 longMatrix[r][c] = (unsigned long)entryAsInt;
201 }
202 return longMatrix;
203}
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:544
#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 171 of file extra.cc.