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

2381{
2382 if(h->Typ() == STRING_CMD)
2383 {
2384 char *sys_cmd=(char *)(h->Data());
2385 h=h->next;
2386 /*==================== test syz strat =================*/
2387 if (strcmp(sys_cmd, "syz") == 0)
2388 {
2389 if ((h!=NULL) && (h->Typ()==STRING_CMD))
2390 {
2391 const char *s=(const char *)h->Data();
2392 if (strcmp(s,"posInT_EcartFDegpLength")==0)
2394 else if (strcmp(s,"posInT_FDegpLength")==0)
2396 else if (strcmp(s,"posInT_pLength")==0)
2398 else if (strcmp(s,"posInT0")==0)
2400 else if (strcmp(s,"posInT1")==0)
2402 else if (strcmp(s,"posInT2")==0)
2404 else if (strcmp(s,"posInT11")==0)
2406 else if (strcmp(s,"posInT110")==0)
2408 else if (strcmp(s,"posInT13")==0)
2410 else if (strcmp(s,"posInT15")==0)
2412 else if (strcmp(s,"posInT17")==0)
2414 else if (strcmp(s,"posInT17_c")==0)
2416 else if (strcmp(s,"posInT19")==0)
2418 else PrintS("valid posInT:0,1,2,11,110,13,15,17,17_c,19,_EcartFDegpLength,_FDegpLength,_pLength,_EcartpLength\n");
2419 }
2420 else
2421 {
2424 }
2425 si_opt_2|=Sy_bit(23);
2426 return FALSE;
2427 }
2428 else
2429 /*==================== locNF ======================================*/
2430 if(strcmp(sys_cmd,"locNF")==0)
2431 {
2432 const short t[]={4,VECTOR_CMD,MODUL_CMD,INT_CMD,INTVEC_CMD};
2433 if (iiCheckTypes(h,t,1))
2434 {
2435 poly f=(poly)h->Data();
2436 h=h->next;
2437 ideal m=(ideal)h->Data();
2439 h=h->next;
2440 int n=(int)((long)h->Data());
2441 h=h->next;
2442 intvec *v=(intvec *)h->Data();
2443
2444 /* == now the work starts == */
2445
2446 int * iv=iv2array(v, currRing);
2447 poly r=0;
2448 poly hp=ppJetW(f,n,iv);
2449 int s=MATCOLS(m);
2450 int j=0;
2451 matrix T=mp_InitI(s,1,0, currRing);
2452
2453 while (hp != NULL)
2454 {
2455 if (pDivisibleBy(m->m[j],hp))
2456 {
2457 if (MATELEM(T,j+1,1)==0)
2458 {
2459 MATELEM(T,j+1,1)=pDivideM(pHead(hp),pHead(m->m[j]));
2460 }
2461 else
2462 {
2463 pAdd(MATELEM(T,j+1,1),pDivideM(pHead(hp),pHead(m->m[j])));
2464 }
2465 hp=ppJetW(ksOldSpolyRed(m->m[j],hp,0),n,iv);
2466 j=0;
2467 }
2468 else
2469 {
2470 if (j==s-1)
2471 {
2472 r=pAdd(r,pHead(hp));
2473 hp=pLmDeleteAndNext(hp); /* hp=pSub(hp,pHead(hp));*/
2474 j=0;
2475 }
2476 else
2477 {
2478 j++;
2479 }
2480 }
2481 }
2482
2485 for (int k=1;k<=MATROWS(Temp);k++)
2486 {
2487 MATELEM(R,k,1)=MATELEM(Temp,k,1);
2488 }
2489
2491 L->Init(2);
2492 L->m[0].rtyp=MATRIX_CMD; L->m[0].data=(void *)R;
2493 L->m[1].rtyp=MATRIX_CMD; L->m[1].data=(void *)T;
2494 res->data=L;
2495 res->rtyp=LIST_CMD;
2496 // iv aufraeumen
2497 omFree(iv);
2498 return FALSE;
2499 }
2500 else
2501 return TRUE;
2502 }
2503 else
2504 /*==================== poly debug ==================================*/
2505 if(strcmp(sys_cmd,"p")==0)
2506 {
2507# ifdef RDEBUG
2508 p_DebugPrint((poly)h->Data(), currRing);
2509# else
2510 WarnS("Sorry: not available for release build!");
2511# endif
2512 return FALSE;
2513 }
2514 else
2515 /*==================== setsyzcomp ==================================*/
2516 if(strcmp(sys_cmd,"setsyzcomp")==0)
2517 {
2518 if ((h!=NULL) && (h->Typ()==INT_CMD))
2519 {
2520 int k = (int)(long)h->Data();
2521 if ( currRing->order[0] == ringorder_s )
2522 {
2524 }
2525 }
2526 }
2527 /*==================== ring debug ==================================*/
2528 if(strcmp(sys_cmd,"r")==0)
2529 {
2530# ifdef RDEBUG
2531 rDebugPrint((ring)h->Data());
2532# else
2533 WarnS("Sorry: not available for release build!");
2534# endif
2535 return FALSE;
2536 }
2537 else
2538 /*==================== changeRing ========================*/
2539 /* The following code changes the names of the variables in the
2540 current ring to "x1", "x2", ..., "xN", where N is the number
2541 of variables in the current ring.
2542 The purpose of this rewriting is to eliminate indexed variables,
2543 as they may cause problems when generating scripts for Magma,
2544 Maple, or Macaulay2. */
2545 if(strcmp(sys_cmd,"changeRing")==0)
2546 {
2547 int varN = currRing->N;
2548 char h[10];
2549 for (int i = 1; i <= varN; i++)
2550 {
2551 omFree(currRing->names[i - 1]);
2552 sprintf(h, "x%d", i);
2553 currRing->names[i - 1] = omStrDup(h);
2554 }
2556 res->rtyp = INT_CMD;
2557 res->data = (void*)0L;
2558 return FALSE;
2559 }
2560 else
2561 /*==================== mtrack ==================================*/
2562 if(strcmp(sys_cmd,"mtrack")==0)
2563 {
2564 #ifdef OM_TRACK
2565 om_Opts.MarkAsStatic = 1;
2566 FILE *fd = NULL;
2567 int max = 5;
2568 while (h != NULL)
2569 {
2571 if (fd == NULL && h->Typ()==STRING_CMD)
2572 {
2573 char *fn=(char*) h->Data();
2574 fd = fopen(fn, "w");
2575 if (fd == NULL)
2576 Warn("Can not open %s for writing og mtrack. Using stdout",fn);
2577 }
2578 else if (h->Typ() == INT_CMD)
2579 {
2580 max = (int)(long)h->Data();
2581 }
2582 h = h->Next();
2583 }
2584 omPrintUsedTrackAddrs((fd == NULL ? stdout : fd), max);
2585 if (fd != NULL) fclose(fd);
2586 om_Opts.MarkAsStatic = 0;
2587 return FALSE;
2588 #else
2589 WerrorS("system(\"mtrack\",..) is not implemented in this version");
2590 return TRUE;
2591 #endif
2592 }
2593 else
2594 /*==================== backtrace ==================================*/
2595 #ifndef OM_NDEBUG
2596 if(strcmp(sys_cmd,"backtrace")==0)
2597 {
2599 return FALSE;
2600 }
2601 else
2602 #endif
2603
2604#if !defined(OM_NDEBUG)
2605 /*==================== omMemoryTest ==================================*/
2606 if (strcmp(sys_cmd,"omMemoryTest")==0)
2607 {
2608
2609#ifdef OM_STATS_H
2610 PrintS("\n[om_Info]: \n");
2611 omUpdateInfo();
2612#define OM_PRINT(name) Print(" %-22s : %10ld \n", #name, om_Info . name)
2613 OM_PRINT(MaxBytesSystem);
2614 OM_PRINT(CurrentBytesSystem);
2615 OM_PRINT(MaxBytesSbrk);
2616 OM_PRINT(CurrentBytesSbrk);
2617 OM_PRINT(MaxBytesMmap);
2618 OM_PRINT(CurrentBytesMmap);
2619 OM_PRINT(UsedBytes);
2620 OM_PRINT(AvailBytes);
2621 OM_PRINT(UsedBytesMalloc);
2622 OM_PRINT(AvailBytesMalloc);
2623 OM_PRINT(MaxBytesFromMalloc);
2624 OM_PRINT(CurrentBytesFromMalloc);
2625 OM_PRINT(MaxBytesFromValloc);
2626 OM_PRINT(CurrentBytesFromValloc);
2627 OM_PRINT(UsedBytesFromValloc);
2628 OM_PRINT(AvailBytesFromValloc);
2629 OM_PRINT(MaxPages);
2630 OM_PRINT(UsedPages);
2631 OM_PRINT(AvailPages);
2632 OM_PRINT(MaxRegionsAlloc);
2633 OM_PRINT(CurrentRegionsAlloc);
2634#undef OM_PRINT
2635#endif
2636
2637#ifdef OM_OPTS_H
2638 PrintS("\n[om_Opts]: \n");
2639#define OM_PRINT(format, name) Print(" %-22s : %10" format"\n", #name, om_Opts . name)
2640 OM_PRINT("d", MinTrack);
2641 OM_PRINT("d", MinCheck);
2642 OM_PRINT("d", MaxTrack);
2643 OM_PRINT("d", MaxCheck);
2644 OM_PRINT("d", Keep);
2645 OM_PRINT("d", HowToReportErrors);
2646 OM_PRINT("d", MarkAsStatic);
2647 OM_PRINT("u", PagesPerRegion);
2648 OM_PRINT("p", OutOfMemoryFunc);
2649 OM_PRINT("p", MemoryLowFunc);
2650 OM_PRINT("p", ErrorHook);
2651#undef OM_PRINT
2652#endif
2653
2654#ifdef OM_ERROR_H
2655 Print("\n\n[om_ErrorStatus] : '%s' (%s)\n",
2658 Print("[om_InternalErrorStatus]: '%s' (%s)\n",
2661
2662#endif
2663
2664// omTestMemory(1);
2665// omtTestErrors();
2666 return FALSE;
2667 }
2668 else
2669#endif
2670 /*==================== red =============================*/
2671 #if 0
2672 if(strcmp(sys_cmd,"red")==0)
2673 {
2674 if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
2675 {
2676 res->rtyp=IDEAL_CMD;
2677 res->data=(void *)kStdred((ideal)h->Data(),NULL,testHomog,NULL);
2679 return FALSE;
2680 }
2681 else
2682 WerrorS("ideal expected");
2683 }
2684 else
2685 #endif
2686 /*==================== fastcomb =============================*/
2687 if(strcmp(sys_cmd,"fastcomb")==0)
2688 {
2689 if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
2690 {
2691 if (h->next!=NULL)
2692 {
2693 if (h->next->Typ()!=POLY_CMD)
2694 {
2695 WarnS("Wrong types for poly= comb(ideal,poly)");
2696 }
2697 }
2698 res->rtyp=POLY_CMD;
2699 res->data=(void *) fglmLinearCombination(
2700 (ideal)h->Data(),(poly)h->next->Data());
2701 return FALSE;
2702 }
2703 else
2704 WerrorS("ideal expected");
2705 }
2706 else
2707 /*==================== comb =============================*/
2708 if(strcmp(sys_cmd,"comb")==0)
2709 {
2710 if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
2711 {
2712 if (h->next!=NULL)
2713 {
2714 if (h->next->Typ()!=POLY_CMD)
2715 {
2716 WarnS("Wrong types for poly= comb(ideal,poly)");
2717 }
2718 }
2719 res->rtyp=POLY_CMD;
2720 res->data=(void *)fglmNewLinearCombination(
2721 (ideal)h->Data(),(poly)h->next->Data());
2722 return FALSE;
2723 }
2724 else
2725 WerrorS("ideal expected");
2726 }
2727 else
2728 #if 0 /* debug only */
2729 /*==================== listall ===================================*/
2730 if(strcmp(sys_cmd,"listall")==0)
2731 {
2732 void listall(int showproc);
2733 int showproc=0;
2734 if ((h!=NULL) && (h->Typ()==INT_CMD)) showproc=(int)((long)h->Data());
2735 listall(showproc);
2736 return FALSE;
2737 }
2738 else
2739 #endif
2740 #if 0 /* debug only */
2741 /*==================== proclist =================================*/
2742 if(strcmp(sys_cmd,"proclist")==0)
2743 {
2744 void piShowProcList();
2745 piShowProcList();
2746 return FALSE;
2747 }
2748 else
2749 #endif
2750 /* ==================== newton ================================*/
2751 #ifdef HAVE_NEWTON
2752 if(strcmp(sys_cmd,"newton")==0)
2753 {
2754 if ((h->Typ()!=POLY_CMD)
2755 || (h->next->Typ()!=INT_CMD)
2756 || (h->next->next->Typ()!=INT_CMD))
2757 {
2758 WerrorS("system(\"newton\",<poly>,<int>,<int>) expected");
2759 return TRUE;
2760 }
2761 poly p=(poly)(h->Data());
2762 int l=pLength(p);
2763 short *points=(short *)omAlloc(currRing->N*l*sizeof(short));
2764 int i,j,k;
2765 k=0;
2766 poly pp=p;
2767 for (i=0;pp!=NULL;i++)
2768 {
2769 for(j=1;j<=currRing->N;j++)
2770 {
2771 points[k]=pGetExp(pp,j);
2772 k++;
2773 }
2774 pIter(pp);
2775 }
2776 hc_ERG r=hc_KOENIG(currRing->N, // dimension
2777 l, // number of points
2778 (short*) points, // points: x_1, y_1,z_1, x_2,y_2,z2,...
2779 currRing->OrdSgn==-1,
2780 (int) (h->next->Data()), // 1: Milnor, 0: Newton
2781 (int) (h->next->next->Data()) // debug
2782 );
2783 //----<>---Output-----------------------
2784
2785
2786 // PrintS("Bin jetzt in extra.cc bei der Auswertung.\n"); // **********
2787
2788
2790 L->Init(6);
2791 L->m[0].rtyp=STRING_CMD; // newtonnumber;
2792 L->m[0].data=(void *)omStrDup(r.nZahl);
2793 L->m[1].rtyp=INT_CMD;
2794 L->m[1].data=(void *)(long)r.achse; // flag for unoccupied axes
2795 L->m[2].rtyp=INT_CMD;
2796 L->m[2].data=(void *)(long)r.deg; // #degenerations
2797 if ( r.deg != 0) // only if degenerations exist
2798 {
2799 L->m[3].rtyp=INT_CMD;
2800 L->m[3].data=(void *)(long)r.anz_punkte; // #points
2801 //---<>--number of points------
2802 int anz = r.anz_punkte; // number of points
2803 int dim = (currRing->N); // dimension
2804 intvec* v = new intvec( anz*dim );
2805 for (i=0; i<anz*dim; i++) // copy points
2806 (*v)[i] = r.pu[i];
2807 L->m[4].rtyp=INTVEC_CMD;
2808 L->m[4].data=(void *)v;
2809 //---<>--degenerations---------
2810 int deg = r.deg; // number of points
2811 intvec* w = new intvec( r.speicher ); // necessary memory
2812 i=0; // start copying
2813 do
2814 {
2815 (*w)[i] = r.deg_tab[i];
2816 i++;
2817 }
2818 while (r.deg_tab[i-1] != -2); // mark for end of list
2819 L->m[5].rtyp=INTVEC_CMD;
2820 L->m[5].data=(void *)w;
2821 }
2822 else
2823 {
2824 L->m[3].rtyp=INT_CMD; L->m[3].data=(char *)0;
2825 L->m[4].rtyp=DEF_CMD;
2826 L->m[5].rtyp=DEF_CMD;
2827 }
2828
2829 res->data=(void *)L;
2830 res->rtyp=LIST_CMD;
2831 // free all pointer in r:
2832 delete[] r.nZahl;
2833 delete[] r.pu;
2834 delete[] r.deg_tab; // Ist das ein Problem??
2835
2836 omFreeSize((ADDRESS)points,currRing->N*l*sizeof(short));
2837 return FALSE;
2838 }
2839 else
2840 #endif
2841 /*==== connection to Sebastian Jambor's code ======*/
2842 /* This code connects Sebastian Jambor's code for
2843 computing the minimal polynomial of an (n x n) matrix
2844 with entries in F_p to SINGULAR. Two conversion methods
2845 are needed; see further up in this file:
2846 (1) conversion of a matrix with long entries to
2847 a SINGULAR matrix with number entries, where
2848 the numbers are coefficients in currRing;
2849 (2) conversion of an array of longs (encoding the
2850 coefficients of the minimal polynomial) to a
2851 SINGULAR poly living in currRing. */
2852 if (strcmp(sys_cmd, "minpoly") == 0)
2853 {
2854 if ((h == NULL) || (h->Typ() != MATRIX_CMD) || h->next != NULL)
2855 {
2856 Werror("expected exactly one argument: %s",
2857 "a square matrix with number entries");
2858 return TRUE;
2859 }
2860 else
2861 {
2862 matrix m = (matrix)h->Data();
2863 int n = m->rows();
2864 unsigned long p = (unsigned long)n_GetChar(currRing->cf);
2865 if (n != m->cols())
2866 {
2867 WerrorS("expected exactly one argument: "
2868 "a square matrix with number entries");
2869 return TRUE;
2870 }
2871 unsigned long** ml = singularMatrixToLongMatrix(m);
2872 unsigned long* polyCoeffs = computeMinimalPolynomial(ml, n, p);
2873 poly theMinPoly = longCoeffsToSingularPoly(polyCoeffs, n);
2874 res->rtyp = POLY_CMD;
2875 res->data = (void *)theMinPoly;
2876 for (int i = 0; i < n; i++) delete[] ml[i];
2877 delete[] ml;
2878 delete[] polyCoeffs;
2879 return FALSE;
2880 }
2881 }
2882 else
2883 /*==================== sdb_flags =================*/
2884 #ifdef HAVE_SDB
2885 if (strcmp(sys_cmd, "sdb_flags") == 0)
2886 {
2887 if ((h!=NULL) && (h->Typ()==INT_CMD))
2888 {
2889 sdb_flags=(int)((long)h->Data());
2890 }
2891 else
2892 {
2893 WerrorS("system(\"sdb_flags\",`int`) expected");
2894 return TRUE;
2895 }
2896 return FALSE;
2897 }
2898 else
2899 #endif
2900 /*==================== sdb_edit =================*/
2901 #ifdef HAVE_SDB
2902 if (strcmp(sys_cmd, "sdb_edit") == 0)
2903 {
2905 {
2906 WerrorS("shell execution is disallowed in restricted mode");
2907 return TRUE;
2908 }
2909 if ((h!=NULL) && (h->Typ()==PROC_CMD))
2910 {
2911 procinfov p=(procinfov)h->Data();
2912 sdb_edit(p);
2913 }
2914 else
2915 {
2916 WerrorS("system(\"sdb_edit\",`proc`) expected");
2917 return TRUE;
2918 }
2919 return FALSE;
2920 }
2921 else
2922 #endif
2923 /*==================== GF =================*/
2924 #if 0 // for testing only
2925 if (strcmp(sys_cmd, "GF") == 0)
2926 {
2927 if ((h!=NULL) && (h->Typ()==POLY_CMD))
2928 {
2929 int c=rChar(currRing);
2930 setCharacteristic( c,nfMinPoly[0], currRing->parameter[0][0] );
2931 CanonicalForm F( convSingGFFactoryGF( (poly)h->Data(), currRing ) );
2932 res->rtyp=POLY_CMD;
2933 res->data=convFactoryGFSingGF( F, currRing );
2934 return FALSE;
2935 }
2936 else { WerrorS("wrong typ"); return TRUE;}
2937 }
2938 else
2939 #endif
2940 /*==================== SVD =================*/
2941 #ifdef HAVE_SVD
2942 if (strcmp(sys_cmd, "svd") == 0)
2943 {
2944 extern lists testsvd(matrix M);
2945 res->rtyp=LIST_CMD;
2946 res->data=(char*)(testsvd((matrix)h->Data()));
2947 return FALSE;
2948 }
2949 else
2950 #endif
2951 /*==================== redNF_ring =================*/
2952 #ifdef HAVE_RINGS
2953 if (strcmp(sys_cmd, "redNF_ring")==0)
2954 {
2955 ring r = currRing;
2956 poly f = (poly) h->Data();
2957 h = h->next;
2958 ideal G = (ideal) h->Data();
2959 res->rtyp=POLY_CMD;
2960 res->data=(poly) ringRedNF(f, G, r);
2961 return(FALSE);
2962 }
2963 else
2964 #endif
2965 /*==================== Roune Hilb =================*/
2966 if (strcmp(sys_cmd, "hilbroune") == 0)
2967 {
2968 if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
2969 {
2970 slicehilb((ideal)h->Data());
2971 }
2972 else return TRUE;
2973 return FALSE;
2974 }
2975 else
2976 /*==================== F5 Implementation =================*/
2977 #ifdef HAVE_F5
2978 if (strcmp(sys_cmd, "f5")==0)
2979 {
2980 if (h->Typ()!=IDEAL_CMD)
2981 {
2982 WerrorS("ideal expected");
2983 return TRUE;
2984 }
2985
2986 ring r = currRing;
2987 ideal G = (ideal) h->Data();
2988 h = h->next;
2989 int opt;
2990 if(h != NULL) {
2991 opt = (int) (long) h->Data();
2992 }
2993 else {
2994 opt = 2;
2995 }
2996 h = h->next;
2997 int plus;
2998 if(h != NULL) {
2999 plus = (int) (long) h->Data();
3000 }
3001 else {
3002 plus = 0;
3003 }
3004 h = h->next;
3005 int termination;
3006 if(h != NULL) {
3007 termination = (int) (long) h->Data();
3008 }
3009 else {
3010 termination = 0;
3011 }
3012 res->rtyp=IDEAL_CMD;
3013 res->data=(ideal) F5main(G,r,opt,plus,termination);
3014 return FALSE;
3015 }
3016 else
3017 #endif
3018 /*==================== Testing groebner basis =================*/
3019 #ifdef HAVE_RINGS
3020 if (strcmp(sys_cmd, "NF_ring")==0)
3021 {
3022 ring r = currRing;
3023 poly f = (poly) h->Data();
3024 h = h->next;
3025 ideal G = (ideal) h->Data();
3026 res->rtyp=POLY_CMD;
3027 res->data=(poly) ringNF(f, G, r);
3028 return(FALSE);
3029 }
3030 else
3031 if (strcmp(sys_cmd, "spoly")==0)
3032 {
3033 poly f = pCopy((poly) h->Data());
3034 h = h->next;
3035 poly g = pCopy((poly) h->Data());
3036
3037 res->rtyp=POLY_CMD;
3038 res->data=(poly) plain_spoly(f,g);
3039 return(FALSE);
3040 }
3041 else
3042 if (strcmp(sys_cmd, "testGB")==0)
3043 {
3044 ideal I = (ideal) h->Data();
3045 h = h->next;
3046 ideal GI = (ideal) h->Data();
3047 res->rtyp = INT_CMD;
3048 res->data = (void *)(long) testGB(I, GI);
3049 return(FALSE);
3050 }
3051 else
3052 #endif
3053 /*==================== sca:AltVar ==================================*/
3054 #ifdef HAVE_PLURAL
3055 if ( (strcmp(sys_cmd, "AltVarStart") == 0) || (strcmp(sys_cmd, "AltVarEnd") == 0) )
3056 {
3057 ring r = currRing;
3058
3059 if((h!=NULL) && (h->Typ()==RING_CMD)) r = (ring)h->Data(); else
3060 {
3061 WerrorS("`system(\"AltVarStart/End\"[,<ring>])` expected");
3062 return TRUE;
3063 }
3064
3065 res->rtyp=INT_CMD;
3066
3067 if (rIsSCA(r))
3068 {
3069 if(strcmp(sys_cmd, "AltVarStart") == 0)
3070 res->data = (void*)(long)scaFirstAltVar(r);
3071 else
3072 res->data = (void*)(long)scaLastAltVar(r);
3073 return FALSE;
3074 }
3075
3076 WerrorS("`system(\"AltVarStart/End\",<ring>) requires a SCA ring");
3077 return TRUE;
3078 }
3079 else
3080 #endif
3081 /*==================== RatNF, noncomm rational coeffs =================*/
3082 #ifdef HAVE_RATGRING
3083 if (strcmp(sys_cmd, "intratNF") == 0)
3084 {
3085 poly p;
3086 poly *q;
3087 ideal I;
3088 int is, k, id;
3089 if ((h!=NULL) && (h->Typ()==POLY_CMD))
3090 {
3091 p=(poly)h->CopyD();
3092 h=h->next;
3093 // PrintS("poly is done\n");
3094 }
3095 else return TRUE;
3096 if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
3097 {
3098 I=(ideal)h->CopyD();
3099 q = I->m;
3100 h=h->next;
3101 // PrintS("ideal is done\n");
3102 }
3103 else return TRUE;
3104 if ((h!=NULL) && (h->Typ()==INT_CMD))
3105 {
3106 is=(int)((long)(h->Data()));
3107 // res->rtyp=INT_CMD;
3108 // PrintS("int is done\n");
3109 // res->rtyp=IDEAL_CMD;
3111 {
3112 id = IDELEMS(I);
3113 int *pl=(int*)omAlloc0(IDELEMS(I)*sizeof(int));
3114 for(k=0; k < id; k++)
3115 {
3116 pl[k] = pLength(I->m[k]);
3117 }
3118 PrintS("starting redRat\n");
3119 //res->data = (char *)
3120 redRat(&p, q, pl, (int)IDELEMS(I),is,currRing);
3121 res->data=p;
3122 res->rtyp=POLY_CMD;
3123 // res->data = ncGCD(p,q,currRing);
3124 }
3125 else
3126 {
3127 res->rtyp=POLY_CMD;
3128 res->data=p;
3129 }
3130 }
3131 else return TRUE;
3132 return FALSE;
3133 }
3134 else
3135 /*==================== RatNF, noncomm rational coeffs =================*/
3136 if (strcmp(sys_cmd, "ratNF") == 0)
3137 {
3138 poly p,q;
3139 int is, htype;
3140 if ((h!=NULL) && ( (h->Typ()==POLY_CMD) || (h->Typ()==VECTOR_CMD) ) )
3141 {
3142 p=(poly)h->CopyD();
3143 h=h->next;
3144 htype = h->Typ();
3145 }
3146 else return TRUE;
3147 if ((h!=NULL) && ( (h->Typ()==POLY_CMD) || (h->Typ()==VECTOR_CMD) ) )
3148 {
3149 q=(poly)h->CopyD();
3150 h=h->next;
3151 }
3152 else return TRUE;
3153 if ((h!=NULL) && (h->Typ()==INT_CMD))
3154 {
3155 is=(int)((long)(h->Data()));
3156 res->rtyp=htype;
3157 // res->rtyp=IDEAL_CMD;
3159 {
3160 res->data = nc_rat_ReduceSpolyNew(q,p,is, currRing);
3161 // res->data = ncGCD(p,q,currRing);
3162 }
3163 else res->data=p;
3164 }
3165 else return TRUE;
3166 return FALSE;
3167 }
3168 else
3169 /*==================== RatSpoly, noncomm rational coeffs =================*/
3170 if (strcmp(sys_cmd, "ratSpoly") == 0)
3171 {
3172 poly p,q;
3173 int is;
3174 if ((h!=NULL) && (h->Typ()==POLY_CMD))
3175 {
3176 p=(poly)h->CopyD();
3177 h=h->next;
3178 }
3179 else return TRUE;
3180 if ((h!=NULL) && (h->Typ()==POLY_CMD))
3181 {
3182 q=(poly)h->CopyD();
3183 h=h->next;
3184 }
3185 else return TRUE;
3186 if ((h!=NULL) && (h->Typ()==INT_CMD))
3187 {
3188 is=(int)((long)(h->Data()));
3189 res->rtyp=POLY_CMD;
3190 // res->rtyp=IDEAL_CMD;
3192 {
3193 res->data = nc_rat_CreateSpoly(p,q,is,currRing);
3194 // res->data = ncGCD(p,q,currRing);
3195 }
3196 else res->data=p;
3197 }
3198 else return TRUE;
3199 return FALSE;
3200 }
3201 else
3202 #endif // HAVE_RATGRING
3203 /*==================== Rat def =================*/
3204 if (strcmp(sys_cmd, "ratVar") == 0)
3205 {
3206 int start,end;
3207 if ((h!=NULL) && (h->Typ()==POLY_CMD))
3208 {
3209 start=pIsPurePower((poly)h->Data());
3210 h=h->next;
3211 }
3212 else return TRUE;
3213 if ((h!=NULL) && (h->Typ()==POLY_CMD))
3214 {
3215 end=pIsPurePower((poly)h->Data());
3216 h=h->next;
3217 }
3218 else return TRUE;
3219 currRing->real_var_start=start;
3220 currRing->real_var_end=end;
3221 return (start==0)||(end==0)||(start>end);
3222 }
3223 else
3224 /*==================== t-rep-GB ==================================*/
3225 if (strcmp(sys_cmd, "unifastmult")==0)
3226 {
3227 poly f = (poly)h->Data();
3228 h=h->next;
3229 poly g=(poly)h->Data();
3230 res->rtyp=POLY_CMD;
3231 res->data=unifastmult(f,g,currRing);
3232 return(FALSE);
3233 }
3234 else
3235 if (strcmp(sys_cmd, "multifastmult")==0)
3236 {
3237 poly f = (poly)h->Data();
3238 h=h->next;
3239 poly g=(poly)h->Data();
3240 res->rtyp=POLY_CMD;
3241 res->data=multifastmult(f,g,currRing);
3242 return(FALSE);
3243 }
3244 else
3245 if (strcmp(sys_cmd, "mults")==0)
3246 {
3247 res->rtyp=INT_CMD ;
3248 res->data=(void*)(long) Mults();
3249 return(FALSE);
3250 }
3251 else
3252 if (strcmp(sys_cmd, "fastpower")==0)
3253 {
3254 ring r = currRing;
3255 poly f = (poly)h->Data();
3256 h=h->next;
3257 int n=(int)((long)h->Data());
3258 res->rtyp=POLY_CMD ;
3259 res->data=(void*) pFastPower(f,n,r);
3260 return(FALSE);
3261 }
3262 else
3263 if (strcmp(sys_cmd, "normalpower")==0)
3264 {
3265 poly f = (poly)h->Data();
3266 h=h->next;
3267 int n=(int)((long)h->Data());
3268 res->rtyp=POLY_CMD ;
3269 res->data=(void*) pPower(pCopy(f),n);
3270 return(FALSE);
3271 }
3272 else
3273 if (strcmp(sys_cmd, "MCpower")==0)
3274 {
3275 ring r = currRing;
3276 poly f = (poly)h->Data();
3277 h=h->next;
3278 int n=(int)((long)h->Data());
3279 res->rtyp=POLY_CMD ;
3280 res->data=(void*) pFastPowerMC(f,n,r);
3281 return(FALSE);
3282 }
3283 else
3284 if (strcmp(sys_cmd, "bit_subst")==0)
3285 {
3286 ring r = currRing;
3287 poly outer = (poly)h->Data();
3288 h=h->next;
3289 poly inner=(poly)h->Data();
3290 res->rtyp=POLY_CMD ;
3291 res->data=(void*) uni_subst_bits(outer, inner,r);
3292 return(FALSE);
3293 }
3294 else
3295 /*==================== gcd-varianten =================*/
3296 if (strcmp(sys_cmd, "gcd") == 0)
3297 {
3298 if (h==NULL)
3299 {
3300 #if 0
3301 Print("FLINT_P:%d (use Flints gcd for polynomials in char p)\n",isOn(SW_USE_FL_GCD_P));
3302 Print("FLINT_0:%d (use Flints gcd for polynomials in char 0)\n",isOn(SW_USE_FL_GCD_0));
3303 #endif
3304 Print("EZGCD:%d (use EZGCD for gcd of polynomials in char 0)\n",isOn(SW_USE_EZGCD));
3305 Print("EZGCD_P:%d (use EZGCD_P for gcd of polynomials in char p)\n",isOn(SW_USE_EZGCD_P));
3306 Print("CRGCD:%d (use chinese Remainder for gcd of polynomials in char 0)\n",isOn(SW_USE_CHINREM_GCD));
3307 #ifndef __CYGWIN__
3308 Print("homog:%d (use homog. test for factorization of polynomials)\n",singular_homog_flag);
3309 #endif
3310 return FALSE;
3311 }
3312 else
3313 if ((h!=NULL) && (h->Typ()==STRING_CMD)
3314 && (h->next!=NULL) && (h->next->Typ()==INT_CMD))
3315 {
3316 int d=(int)(long)h->next->Data();
3317 char *s=(char *)h->Data();
3318 #if 0
3319 if (strcmp(s,"FLINT_P")==0) { if (d) On(SW_USE_FL_GCD_P); else Off(SW_USE_FL_GCD_P); } else
3320 if (strcmp(s,"FLINT_0")==0) { if (d) On(SW_USE_FL_GCD_0); else Off(SW_USE_FL_GCD_0); } else
3321 #endif
3322 if (strcmp(s,"EZGCD")==0) { if (d) On(SW_USE_EZGCD); else Off(SW_USE_EZGCD); } else
3323 if (strcmp(s,"EZGCD_P")==0) { if (d) On(SW_USE_EZGCD_P); else Off(SW_USE_EZGCD_P); } else
3324 if (strcmp(s,"CRGCD")==0) { if (d) On(SW_USE_CHINREM_GCD); else Off(SW_USE_CHINREM_GCD); } else
3325 #ifndef __CYGWIN__
3326 if (strcmp(s,"homog")==0) { if (d) singular_homog_flag=1; else singular_homog_flag=0; } else
3327 #endif
3328 return TRUE;
3329 return FALSE;
3330 }
3331 else return TRUE;
3332 }
3333 else
3334 /*==================== subring =================*/
3335 if (strcmp(sys_cmd, "subring") == 0)
3336 {
3337 if (h!=NULL)
3338 {
3339 extern ring rSubring(ring r,leftv v); /* ipshell.cc*/
3340 res->data=(char *)rSubring(currRing,h);
3341 res->rtyp=RING_CMD;
3342 return res->data==NULL;
3343 }
3344 else return TRUE;
3345 }
3346 else
3347 /*==================== HNF =================*/
3348 #ifdef HAVE_NTL
3349 if (strcmp(sys_cmd, "HNF") == 0)
3350 {
3351 if (h!=NULL)
3352 {
3353 res->rtyp=h->Typ();
3354 if (h->Typ()==MATRIX_CMD)
3355 {
3356 res->data=(char *)singntl_HNF((matrix)h->Data(), currRing);
3357 return FALSE;
3358 }
3359 else if (h->Typ()==INTMAT_CMD)
3360 {
3361 res->data=(char *)singntl_HNF((intvec*)h->Data());
3362 return FALSE;
3363 }
3364 else if (h->Typ()==INTMAT_CMD)
3365 {
3366 res->data=(char *)singntl_HNF((intvec*)h->Data());
3367 return FALSE;
3368 }
3369 else
3370 {
3371 WerrorS("expected `system(\"HNF\",<matrix|intmat|bigintmat>)`");
3372 return TRUE;
3373 }
3374 }
3375 else return TRUE;
3376 }
3377 else
3378 /*================= probIrredTest ======================*/
3379 if (strcmp (sys_cmd, "probIrredTest") == 0)
3380 {
3381 if (h!=NULL && (h->Typ()== POLY_CMD) && ((h->next != NULL) && h->next->Typ() == STRING_CMD))
3382 {
3383 CanonicalForm F= convSingPFactoryP((poly)(h->Data()), currRing);
3384 char *s=(char *)h->next->Data();
3385 double error= atof (s);
3386 int irred= probIrredTest (F, error);
3387 res->rtyp= INT_CMD;
3388 res->data= (void*)(long)irred;
3389 return FALSE;
3390 }
3391 else return TRUE;
3392 }
3393 else
3394 #endif
3395 /*==================== mpz_t loader ======================*/
3396 if(strcmp(sys_cmd, "GNUmpLoad")==0)
3397 {
3398 if ((h != NULL) && (h->Typ() == STRING_CMD))
3399 {
3400 char* filename = (char*)h->Data();
3401 FILE* f = fopen(filename, "r");
3402 if (f == NULL)
3403 {
3404 WerrorS( "invalid file name (in paths use '/')");
3405 return FALSE;
3406 }
3407 mpz_t m; mpz_init(m);
3408 mpz_inp_str(m, f, 10);
3409 fclose(f);
3410 number n = n_InitMPZ(m, coeffs_BIGINT);
3411 res->rtyp = BIGINT_CMD;
3412 res->data = (void*)n;
3413 return FALSE;
3414 }
3415 else
3416 {
3417 WerrorS( "expected valid file name as a string");
3418 return TRUE;
3419 }
3420 }
3421 else
3422 /*==================== intvec matching ======================*/
3423 /* Given two non-empty intvecs, the call
3424 'system("intvecMatchingSegments", ivec, jvec);'
3425 computes all occurences of jvec in ivec, i.e., it returns
3426 a list of int indices k such that ivec[k..size(jvec)+k-1] = jvec.
3427 If no such k exists (e.g. when ivec is shorter than jvec), an
3428 intvec with the single entry 0 is being returned. */
3429 if(strcmp(sys_cmd, "intvecMatchingSegments")==0)
3430 {
3431 if ((h != NULL) && (h->Typ() == INTVEC_CMD) &&
3432 (h->next != NULL) && (h->next->Typ() == INTVEC_CMD) &&
3433 (h->next->next == NULL))
3434 {
3435 intvec* ivec = (intvec*)h->Data();
3436 intvec* jvec = (intvec*)h->next->Data();
3437 intvec* r = new intvec(1); (*r)[0] = 0;
3438 int validEntries = 0;
3439 for (int k = 0; k <= ivec->rows() - jvec->rows(); k++)
3440 {
3441 if (memcmp(&(*ivec)[k], &(*jvec)[0],
3442 sizeof(int) * jvec->rows()) == 0)
3443 {
3444 if (validEntries == 0)
3445 (*r)[0] = k + 1;
3446 else
3447 {
3448 r->resize(validEntries + 1);
3449 (*r)[validEntries] = k + 1;
3450 }
3451 validEntries++;
3452 }
3453 }
3454 res->rtyp = INTVEC_CMD;
3455 res->data = (void*)r;
3456 return FALSE;
3457 }
3458 else
3459 {
3460 WerrorS("expected two non-empty intvecs as arguments");
3461 return TRUE;
3462 }
3463 }
3464 else
3465 /* ================== intvecOverlap ======================= */
3466 /* Given two non-empty intvecs, the call
3467 'system("intvecOverlap", ivec, jvec);'
3468 computes the longest intvec kvec such that ivec ends with kvec
3469 and jvec starts with kvec. The length of this overlap is being
3470 returned. If there is no overlap at all, then 0 is being returned. */
3471 if(strcmp(sys_cmd, "intvecOverlap")==0)
3472 {
3473 if ((h != NULL) && (h->Typ() == INTVEC_CMD) &&
3474 (h->next != NULL) && (h->next->Typ() == INTVEC_CMD) &&
3475 (h->next->next == NULL))
3476 {
3477 intvec* ivec = (intvec*)h->Data();
3478 intvec* jvec = (intvec*)h->next->Data();
3479 int ir = ivec->rows(); int jr = jvec->rows();
3480 int r = jr; if (ir < jr) r = ir; /* r = min{ir, jr} */
3481 while ((r >= 1) && (memcmp(&(*ivec)[ir - r], &(*jvec)[0],
3482 sizeof(int) * r) != 0))
3483 r--;
3484 res->rtyp = INT_CMD;
3485 res->data = (void*)(long)r;
3486 return FALSE;
3487 }
3488 else
3489 {
3490 WerrorS("expected two non-empty intvecs as arguments");
3491 return TRUE;
3492 }
3493 }
3494 else
3495 /*==================== Hensel's lemma ======================*/
3496 if(strcmp(sys_cmd, "henselfactors")==0)
3497 {
3498 if ((h != NULL) && (h->Typ() == INT_CMD) &&
3499 (h->next != NULL) && (h->next->Typ() == INT_CMD) &&
3500 (h->next->next != NULL) && (h->next->next->Typ() == POLY_CMD) &&
3501 (h->next->next->next != NULL) &&
3502 (h->next->next->next->Typ() == POLY_CMD) &&
3503 (h->next->next->next->next != NULL) &&
3504 (h->next->next->next->next->Typ() == POLY_CMD) &&
3505 (h->next->next->next->next->next != NULL) &&
3506 (h->next->next->next->next->next->Typ() == INT_CMD) &&
3507 (h->next->next->next->next->next->next == NULL))
3508 {
3509 int xIndex = (int)(long)h->Data();
3510 int yIndex = (int)(long)h->next->Data();
3511 poly hh = (poly)h->next->next->Data();
3512 poly f0 = (poly)h->next->next->next->Data();
3513 poly g0 = (poly)h->next->next->next->next->Data();
3514 int d = (int)(long)h->next->next->next->next->next->Data();
3515 poly f; poly g;
3516 henselFactors(xIndex, yIndex, hh, f0, g0, d, f, g);
3518 L->Init(2);
3519 L->m[0].rtyp = POLY_CMD; L->m[0].data=(void*)f;
3520 L->m[1].rtyp = POLY_CMD; L->m[1].data=(void*)g;
3521 res->rtyp = LIST_CMD;
3522 res->data = (char *)L;
3523 return FALSE;
3524 }
3525 else
3526 {
3527 WerrorS( "expected argument list (int, int, poly, poly, poly, int)");
3528 return TRUE;
3529 }
3530 }
3531 else
3532 /*==================== Approx_Step =================*/
3533 #ifdef HAVE_PLURAL
3534 if (strcmp(sys_cmd, "astep") == 0)
3535 {
3536 ideal I;
3537 if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
3538 {
3539 I=(ideal)h->CopyD();
3540 res->rtyp=IDEAL_CMD;
3541 if (rIsPluralRing(currRing)) res->data=Approx_Step(I);
3542 else res->data=I;
3544 }
3545 else return TRUE;
3546 return FALSE;
3547 }
3548 else
3549 #endif
3550 /*==================== PrintMat =================*/
3551 #ifdef HAVE_PLURAL
3552 if (strcmp(sys_cmd, "PrintMat") == 0)
3553 {
3554 int a;
3555 int b;
3556 ring r;
3557 int metric;
3558 if (h!=NULL)
3559 {
3560 if (h->Typ()==INT_CMD)
3561 {
3562 a=(int)((long)(h->Data()));
3563 h=h->next;
3564 }
3565 else if (h->Typ()==INT_CMD)
3566 {
3567 b=(int)((long)(h->Data()));
3568 h=h->next;
3569 }
3570 else if (h->Typ()==RING_CMD)
3571 {
3572 r=(ring)h->Data();
3573 h=h->next;
3574 }
3575 else
3576 return TRUE;
3577 }
3578 else
3579 return TRUE;
3580 if ((h!=NULL) && (h->Typ()==INT_CMD))
3581 {
3582 metric=(int)((long)(h->Data()));
3583 }
3584 res->rtyp=MATRIX_CMD;
3585 if (rIsPluralRing(r)) res->data=nc_PrintMat(a,b,r,metric);
3586 else res->data=NULL;
3587 return FALSE;
3588 }
3589 else
3590 #endif
3591/* ============ NCUseExtensions ======================== */
3592 #ifdef HAVE_PLURAL
3593 if(strcmp(sys_cmd,"NCUseExtensions")==0)
3594 {
3595 if ((h!=NULL) && (h->Typ()==INT_CMD))
3596 res->data=(void *)(long)setNCExtensions( (int)((long)(h->Data())) );
3597 else
3598 res->data=(void *)(long)getNCExtensions();
3599 res->rtyp=INT_CMD;
3600 return FALSE;
3601 }
3602 else
3603 #endif
3604/* ============ NCGetType ======================== */
3605 #ifdef HAVE_PLURAL
3606 if(strcmp(sys_cmd,"NCGetType")==0)
3607 {
3608 res->rtyp=INT_CMD;
3609 if( rIsPluralRing(currRing) )
3610 res->data=(void *)(long)ncRingType(currRing);
3611 else
3612 res->data=(void *)(-1L);
3613 return FALSE;
3614 }
3615 else
3616 #endif
3617/* ============ ForceSCA ======================== */
3618 #ifdef HAVE_PLURAL
3619 if(strcmp(sys_cmd,"ForceSCA")==0)
3620 {
3621 if( !rIsPluralRing(currRing) )
3622 return TRUE;
3623 int b, e;
3624 if ((h!=NULL) && (h->Typ()==INT_CMD))
3625 {
3626 b = (int)((long)(h->Data()));
3627 h=h->next;
3628 }
3629 else return TRUE;
3630 if ((h!=NULL) && (h->Typ()==INT_CMD))
3631 {
3632 e = (int)((long)(h->Data()));
3633 }
3634 else return TRUE;
3635 if( !sca_Force(currRing, b, e) )
3636 return TRUE;
3637 return FALSE;
3638 }
3639 else
3640 #endif
3641/* ============ ForceNewNCMultiplication ======================== */
3642 #ifdef HAVE_PLURAL
3643 if(strcmp(sys_cmd,"ForceNewNCMultiplication")==0)
3644 {
3645 if( !rIsPluralRing(currRing) )
3646 return TRUE;
3647 if( !ncInitSpecialPairMultiplication(currRing) ) // No Plural!
3648 return TRUE;
3649 return FALSE;
3650 }
3651 else
3652 #endif
3653/* ============ ForceNewOldNCMultiplication ======================== */
3654 #ifdef HAVE_PLURAL
3655 if(strcmp(sys_cmd,"ForceNewOldNCMultiplication")==0)
3656 {
3657 if( !rIsPluralRing(currRing) )
3658 return TRUE;
3659 if( !ncInitSpecialPowersMultiplication(currRing) ) // Enable Formula for Plural (depends on swiches)!
3660 return TRUE;
3661 return FALSE;
3662 }
3663 else
3664 #endif
3665/*==================== test64 =================*/
3666 #if 0
3667 if(strcmp(sys_cmd,"test64")==0)
3668 {
3669 long l=8;int i;
3670 for(i=1;i<62;i++)
3671 {
3672 l=l<<1;
3673 number n=n_Init(l,coeffs_BIGINT);
3674 Print("%ld= ",l);n_Print(n,coeffs_BIGINT);
3678 PrintS(" F:");
3680 PrintLn();
3682 }
3683 Print("SIZEOF_LONG=%d\n",SIZEOF_LONG);
3684 return FALSE;
3685 }
3686 else
3687 #endif
3688/*==================== n_SwitchChinRem =================*/
3689 if(strcmp(sys_cmd,"cache_chinrem")==0)
3690 {
3692 Print("caching inverse in chines remainder:%d\n",n_SwitchChinRem);
3693 if ((h!=NULL)&&(h->Typ()==INT_CMD))
3694 n_SwitchChinRem=(int)(long)h->Data();
3695 return FALSE;
3696 }
3697 else
3698/*==================== LU for bigintmat =================*/
3699#ifdef SINGULAR_4_2
3700 if(strcmp(sys_cmd,"LU")==0)
3701 {
3702 if ((h!=NULL) && (h->Typ()==CMATRIX_CMD))
3703 {
3704 // get the argument:
3705 bigintmat *b=(bigintmat *)h->Data();
3706 // just for tests: simply transpose
3707 bigintmat *bb=b->transpose();
3708 // return the result:
3709 res->rtyp=CMATRIX_CMD;
3710 res->data=(char*)bb;
3711 return FALSE;
3712 }
3713 else
3714 {
3715 WerrorS("system(\"LU\",<cmatrix>) expected");
3716 return TRUE;
3717 }
3718 }
3719 else
3720#endif
3721/*==================== sort =================*/
3722 if(strcmp(sys_cmd,"sort")==0)
3723 {
3724 extern BOOLEAN jjSORTLIST(leftv,leftv);
3725 if (h->Typ()==LIST_CMD)
3726 return jjSORTLIST(res,h);
3727 else
3728 return TRUE;
3729 }
3730 else
3731/*==================== uniq =================*/
3732 if(strcmp(sys_cmd,"uniq")==0)
3733 {
3734 extern BOOLEAN jjUNIQLIST(leftv, leftv);
3735 if (h->Typ()==LIST_CMD)
3736 return jjUNIQLIST(res,h);
3737 else
3738 return TRUE;
3739 }
3740 else
3741/*==================== GF(p,n) ==================================*/
3742 if(strcmp(sys_cmd,"GF")==0)
3743 {
3744 const short t[]={3,INT_CMD,INT_CMD,STRING_CMD};
3745 if (iiCheckTypes(h,t,1))
3746 {
3747 int p=(int)(long)h->Data();
3748 int n=(int)(long)h->next->Data();
3749 char *v=(char*)h->next->next->CopyD();
3750 GFInfo param;
3751 param.GFChar = p;
3752 param.GFDegree = n;
3753 param.GFPar_name = v;
3754 coeffs cf= nInitChar(n_GF, &param);
3755 res->rtyp=CRING_CMD;
3756 res->data=cf;
3757 return FALSE;
3758 }
3759 else
3760 return TRUE;
3761 }
3762 else
3763/*==================== power* ==================================*/
3764 #if 0
3765 if(strcmp(sys_cmd,"power1")==0)
3766 {
3767 res->rtyp=POLY_CMD;
3768 poly f=(poly)h->CopyD();
3769 poly g=pPower(f,2000);
3770 res->data=(void *)g;
3771 return FALSE;
3772 }
3773 else
3774 if(strcmp(sys_cmd,"power2")==0)
3775 {
3776 res->rtyp=POLY_CMD;
3777 poly f=(poly)h->Data();
3778 poly g=pOne();
3779 for(int i=0;i<2000;i++)
3780 g=pMult(g,pCopy(f));
3781 res->data=(void *)g;
3782 return FALSE;
3783 }
3784 if(strcmp(sys_cmd,"power3")==0)
3785 {
3786 res->rtyp=POLY_CMD;
3787 poly f=(poly)h->Data();
3788 poly p2=pMult(pCopy(f),pCopy(f));
3789 poly p4=pMult(pCopy(p2),pCopy(p2));
3790 poly p8=pMult(pCopy(p4),pCopy(p4));
3791 poly p16=pMult(pCopy(p8),pCopy(p8));
3792 poly p32=pMult(pCopy(p16),pCopy(p16));
3793 poly p64=pMult(pCopy(p32),pCopy(p32));
3794 poly p128=pMult(pCopy(p64),pCopy(p64));
3795 poly p256=pMult(pCopy(p128),pCopy(p128));
3796 poly p512=pMult(pCopy(p256),pCopy(p256));
3797 poly p1024=pMult(pCopy(p512),pCopy(p512));
3798 poly p1536=pMult(p1024,p512);
3799 poly p1792=pMult(p1536,p256);
3800 poly p1920=pMult(p1792,p128);
3801 poly p1984=pMult(p1920,p64);
3802 poly p2000=pMult(p1984,p16);
3803 res->data=(void *)p2000;
3804 pDelete(&p2);
3805 pDelete(&p4);
3806 pDelete(&p8);
3807 //pDelete(&p16);
3808 pDelete(&p32);
3809 //pDelete(&p64);
3810 //pDelete(&p128);
3811 //pDelete(&p256);
3812 //pDelete(&p512);
3813 //pDelete(&p1024);
3814 //pDelete(&p1536);
3815 //pDelete(&p1792);
3816 //pDelete(&p1920);
3817 //pDelete(&p1984);
3818 return FALSE;
3819 }
3820 else
3821 #endif
3822/* ccluster --------------------------------------------------------------*/
3823#ifdef HAVE_CCLUSTER
3824 if(strcmp(sys_cmd,"ccluster")==0)
3825 {
3826 if ((currRing!=NULL)
3828 {
3831
3832// printf("test t : %d\n", h->Typ()==POLY_CMD);
3833// printf("test t : %d\n", h->next->Typ()==POLY_CMD);
3834 int pol_with_complex_coeffs=0;
3835 if (h->next->Typ()==POLY_CMD)
3836 pol_with_complex_coeffs=1;
3837
3838 if ( (pol_with_complex_coeffs==0 && iiCheckTypes(h,t,1))
3839 ||(pol_with_complex_coeffs==1 && iiCheckTypes(h,t2,1)) )
3840 {
3841 // convert first arg. to fmpq_poly_t
3842 fmpq_poly_t fre, fim;
3843 convSingPFlintP(fre,(poly)h->Data(),currRing); h=h->next;
3844 if (pol_with_complex_coeffs==1)
3845 { // convert second arg. to fmpq_poly_t
3846 convSingPFlintP(fim,(poly)h->Data(),currRing); h=h->next;
3847 }
3848 // convert box-center(re,im), box-size, epsilon
3849 fmpq_t center_re,center_im,boxsize,eps;
3850 convSingNFlintN(center_re,(number)h->Data(),currRing->cf); h=h->next;
3851 convSingNFlintN(center_im,(number)h->Data(),currRing->cf); h=h->next;
3852 convSingNFlintN(boxsize,(number)h->Data(),currRing->cf); h=h->next;
3853 convSingNFlintN(eps,(number)h->Data(),currRing->cf); h=h->next;
3854 // alloc arrays
3855 int n=fmpq_poly_length(fre);
3856 fmpq_t* re_part=(fmpq_t*)omAlloc(n*sizeof(fmpq_t));
3857 fmpq_t* im_part=(fmpq_t*)omAlloc(n*sizeof(fmpq_t));
3858 int *mult =(int*) omAlloc(n*sizeof(int));
3859 for(int i=0; i<n;i++)
3860 { fmpq_init(re_part[i]); fmpq_init(im_part[i]); }
3861 // call cccluster, adjust n
3862 int verbosity =0; //nothing is printed
3863 int strategy = 23; //default strategy
3864 int nn=0;
3865 long nb_threads = (long) feOptValue(FE_OPT_CPUS);
3866 strategy = strategy+(nb_threads<<6);
3867// printf("nb threads: %ld\n", nb_threads);
3868// printf("strategy: %ld\n", strategy);
3869 if (pol_with_complex_coeffs==0)
3870 nn=ccluster_interface_poly_real(re_part,im_part,mult,fre,center_re,center_im,boxsize,eps,strategy,verbosity);
3871 else
3872 nn=ccluster_interface_poly_real_imag(re_part,im_part,mult,fre,fim,center_re,center_im,boxsize,eps,strategy,verbosity);
3873 // convert to list
3875 l->Init(nn);
3876 for(int i=0; i<nn;i++)
3877 {
3879 l->m[i].rtyp=LIST_CMD;
3880 l->m[i].data=ll;
3881 ll->Init(3);
3882 ll->m[0].rtyp=NUMBER_CMD;
3883 ll->m[1].rtyp=NUMBER_CMD;
3884 ll->m[2].rtyp=INT_CMD;
3885 ll->m[0].data=convFlintNSingN(re_part[i],currRing->cf);
3886 ll->m[1].data=convFlintNSingN(im_part[i],currRing->cf);
3887 ll->m[2].data=(void *)(long)mult[i];
3888 }
3889 //clear re, im, mults, fre, fim
3890 for(int i=n-1;i>=0;i--) { fmpq_clear(re_part[i]); fmpq_clear(im_part[i]); }
3891 omFree(re_part);
3892 omFree(im_part);
3893 omFree(mult);
3894 fmpq_clear(center_re); fmpq_clear(center_im); fmpq_clear(boxsize); fmpq_clear(eps);
3895 fmpq_poly_clear(fre);
3896 if (pol_with_complex_coeffs==1) fmpq_poly_clear(fim);
3897 // result
3898 res->rtyp=LIST_CMD;
3899 res->data=l;
3900 return FALSE;
3901 }
3902 }
3903 return TRUE;
3904 }
3905 else
3906#endif
3907/* ====== maEvalAt ============================*/
3908 if(strcmp(sys_cmd,"evaluate")==0)
3909 {
3910 extern number maEvalAt(const poly p,const number* pt, const ring r);
3911 if (h->Typ()!=POLY_CMD)
3912 {
3913 WerrorS("expected system(\"evaluate\",<poly>,..)");
3914 return TRUE;
3915 }
3916 poly p=(poly)h->Data();
3917 number *pt=(number*)omAlloc(sizeof(number)*currRing->N);
3918 for(int i=0;i<currRing->N;i++)
3919 {
3920 h=h->next;
3921 if ((h==NULL)||(h->Typ()!=NUMBER_CMD))
3922 {
3923 WerrorS("system(\"evaluate\",<poly>,<number>..) - expect number");
3924 return TRUE;
3925 }
3926 pt[i]=(number)h->Data();
3927 }
3928 res->data=maEvalAt(p,pt,currRing);
3929 res->rtyp=NUMBER_CMD;
3930 return FALSE;
3931 }
3932 else
3933/* ====== DivRem ============================*/
3934 if(strcmp(sys_cmd,"DivRem")==0)
3935 {
3936 const short t1[]={2,POLY_CMD,POLY_CMD};
3937 if (iiCheckTypes(h,t1,1))
3938 {
3939 poly p=(poly)h->CopyD();
3940 poly q=(poly)h->next->CopyD();
3941 poly rest;
3942 res->data=p_DivRem(p,q,rest,currRing);
3943 res->rtyp=POLY_CMD;
3944 Print("rest:");pWrite(rest);
3945 return FALSE;
3946 }
3947 else
3948 {
3949 WerrorS("expected system(\"DivRem\",<poly>,<poly>)");
3950 return TRUE;
3951 }
3952 }
3953 else
3954/* ====== CoeffTerm ============================*/
3955 if(strcmp(sys_cmd,"CoeffTerm")==0)
3956 {
3957 const short t1[]={2,POLY_CMD,POLY_CMD};
3958 const short t2[]={2,VECTOR_CMD,VECTOR_CMD};
3959 const short t3[]={2,IDEAL_CMD,POLY_CMD};
3960 const short t4[]={2,MODUL_CMD,VECTOR_CMD};
3961 const short t5[]={2,VECTOR_CMD,POLY_CMD};
3962 const short t6[]={2,MODUL_CMD,POLY_CMD};
3963 const short t7[]={2,VECTOR_CMD,IDEAL_CMD};
3964 const short t8[]={2,VECTOR_CMD,MODUL_CMD};
3965 if (iiCheckTypes(h,t1,0)
3966 || iiCheckTypes(h,t2,0))
3967 {
3968 poly p=(poly)h->Data();
3969 poly q=(poly)h->next->Data();
3970 res->data=p_CoeffTerm(p,q,currRing);
3971 res->rtyp=NUMBER_CMD;
3972 return FALSE;
3973 }
3974 else if (iiCheckTypes(h,t3,0)
3975 || iiCheckTypes(h,t4,0))
3976 {
3977 ideal p=(ideal)h->Data();
3978 poly q=(poly)h->next->Data();
3979 res->data=id_CoeffTerm(p,q,currRing);
3980 res->rtyp=h->Typ();
3981 return FALSE;
3982 }
3983 else if (iiCheckTypes(h,t5,0))
3984 {
3985 poly p=(poly)h->Data();
3986 poly q=(poly)h->next->Data();
3987 res->data=p_CoeffTermV(p,q,currRing);
3988 res->rtyp=VECTOR_CMD;
3989 return FALSE;
3990 }
3991 else if (iiCheckTypes(h,t6,0))
3992 {
3993 ideal p=(ideal)h->Data();
3994 poly q=(poly)h->next->Data();
3995 res->data=id_CoeffTermV(p,q,currRing);
3996 res->rtyp=MODUL_CMD;
3997 return FALSE;
3998 }
3999 else if (iiCheckTypes(h,t7,0)) /* vector,ideal*/
4000 {
4001 poly p=(poly)h->Data();
4002 ideal q=(ideal)h->next->Data();
4004 res->rtyp=VECTOR_CMD;
4005 return FALSE;
4006 }
4007 else if (iiCheckTypes(h,t8,0)) /* vector,module*/
4008 {
4009 poly p=(poly)h->Data();
4010 ideal q=(ideal)h->next->Data();
4012 res->rtyp=VECTOR_CMD;
4013 return FALSE;
4014 }
4015 else
4016 {
4017 WerrorS("expected system(\"CoeffTerm\",<poly>/<vector>,<poly>/<vector>)" "\n or <ideal>/<module>,<poly>/<vector>");
4018 return TRUE;
4019 }
4020 }
4021 else
4022/*==================== Error =================*/
4023 Werror( "(extended) system(\"%s\",...) %s", sys_cmd, feNotImplemented );
4024 }
4025 return TRUE;
4026}
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:667
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:413
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
STATIC_VAR coordinates * points
BOOLEAN jjSORTLIST(leftv, leftv arg)
Definition: iparith.cc:10235
BOOLEAN jjUNIQLIST(leftv, leftv arg)
Definition: iparith.cc:10244
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:6572
ring rSubring(ring org_ring, sleftv *rv)
Definition: ipshell.cc:6018
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
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:1161
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:254
matrix mp_InitI(int r, int c, int v, const ring R)
make it a v * unit matrix
Definition: matpol.cc:129
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:188
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:290
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:5086
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)
#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:1536
@ 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 long cpu=1; //feOptValue(FE_OPT_CPUS);
318 #ifdef _SC_NPROCESSORS_ONLN
319 cpu=sysconf(_SC_NPROCESSORS_ONLN);
320 #elif defined(_SC_NPROCESSORS_CONF)
321 cpu=sysconf(_SC_NPROCESSORS_CONF);
322 #endif
323 res->data=(void *)cpu;
324 res->rtyp=INT_CMD;
325 return FALSE;
326 }
327 else
328/*==================== executable ==================================*/
329 if(strcmp(sys_cmd,"executable")==0)
330 {
331 if ((h!=NULL) && (h->Typ()==STRING_CMD))
332 {
333 char tbuf[MAXPATHLEN];
334 char *s=omFindExec((char*)h->Data(),tbuf);
335 if(s==NULL) s=(char*)"";
336 res->data=(void *)omStrDup(s);
337 res->rtyp=STRING_CMD;
338 return FALSE;
339 }
340 return TRUE;
341 }
342 else
343 /*==================== flatten =============================*/
344 if(strcmp(sys_cmd,"flatten")==0)
345 {
346 if ((h!=NULL) &&(h->Typ()==SMATRIX_CMD))
347 {
348 res->data=(char*)sm_Flatten((ideal)h->Data(),currRing);
349 res->rtyp=SMATRIX_CMD;
350 return FALSE;
351 }
352 else
353 WerrorS("smatrix expected");
354 }
355 else
356 /*==================== unflatten =============================*/
357 if(strcmp(sys_cmd,"unflatten")==0)
358 {
359 const short t1[]={2,SMATRIX_CMD,INT_CMD};
360 if (iiCheckTypes(h,t1,1))
361 {
362 res->data=(char*)sm_UnFlatten((ideal)h->Data(),(int)(long)h->next->Data(),currRing);
363 res->rtyp=SMATRIX_CMD;
364 return res->data==NULL;
365 }
366 else return TRUE;
367 }
368 else
369 /*==================== neworder =============================*/
370 if(strcmp(sys_cmd,"neworder")==0)
371 {
372 if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
373 {
374 res->rtyp=STRING_CMD;
375 res->data=(void *)singclap_neworder((ideal)h->Data(), currRing);
376 return FALSE;
377 }
378 else
379 WerrorS("ideal expected");
380 }
381 else
382/*===== nc_hilb ===============================================*/
383 // Hilbert series of non-commutative monomial algebras
384 if(strcmp(sys_cmd,"nc_hilb") == 0)
385 {
386 ideal i; int lV;
387 bool ig = FALSE;
388 bool mgrad = FALSE;
389 bool autop = FALSE;
390 int trunDegHs=0;
391 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
392 i = (ideal)h->Data();
393 else
394 {
395 WerrorS("nc_Hilb:ideal expected");
396 return TRUE;
397 }
398 h = h->next;
399 if((h != NULL)&&(h->Typ() == INT_CMD))
400 lV = (int)(long)h->Data();
401 else
402 {
403 WerrorS("nc_Hilb:int expected");
404 return TRUE;
405 }
406 h = h->next;
407 while(h != NULL)
408 {
409 if((int)(long)h->Data() == 1)
410 ig = TRUE;
411 else if((int)(long)h->Data() == 2)
412 mgrad = TRUE;
413 else if(h->Typ()==STRING_CMD)
414 autop = TRUE;
415 else if(h->Typ() == INT_CMD)
416 trunDegHs = (int)(long)h->Data();
417 h = h->next;
418 }
419 if(h != NULL)
420 {
421 WerrorS("nc_Hilb:int 1,2, total degree for the truncation, and a string for printing the details are expected");
422 return TRUE;
423 }
424
425 HilbertSeries_OrbitData(i, lV, ig, mgrad, autop, trunDegHs);
426 return(FALSE);
427 }
428 else
429/* ====== verify ============================*/
430 if(strcmp(sys_cmd,"verifyGB")==0)
431 {
432 if (rIsNCRing(currRing))
433 {
434 WerrorS("system(\"verifyGB\",<ideal>,..) expects a commutative ring");
435 return TRUE;
436 }
437 if (h->Typ()!=IDEAL_CMD)
438 {
439 WerrorS("expected system(\"verifyGB\",<ideal>,..)");
440 return TRUE;
441 }
442 ideal F=(ideal)h->Data();
443 if (h->next==NULL)
444 {
445 #ifdef HAVE_VSPACE
446 int cpus = (long) feOptValue(FE_OPT_CPUS);
447 if (cpus>1)
448 res->data=(char*)(long) kVerify2(F,currRing->qideal);
449 else
450 #endif
451 res->data=(char*)(long) kVerify1(F,currRing->qideal);
452 }
453 else return TRUE;
454 res->rtyp=INT_CMD;
455 return FALSE;
456 }
457 else
458/*===== rcolon ===============================================*/
459 if(strcmp(sys_cmd,"rcolon") == 0)
460 {
461 const short t1[]={3,IDEAL_CMD,POLY_CMD,INT_CMD};
462 if (iiCheckTypes(h,t1,1))
463 {
464 ideal i = (ideal)h->Data();
465 h = h->next;
466 poly w=(poly)h->Data();
467 h = h->next;
468 int lV = (int)(long)h->Data();
469 res->rtyp = IDEAL_CMD;
470 res->data = RightColonOperation(i, w, lV);
471 return(FALSE);
472 }
473 else
474 return TRUE;
475 }
476 else
477
478/*==================== sh ==================================*/
479 if(strcmp(sys_cmd,"sh")==0)
480 {
482 {
483 WerrorS("shell execution is disallowed in restricted mode");
484 return TRUE;
485 }
486 res->rtyp=INT_CMD;
487 if (h==NULL) res->data = (void *)(long) system("sh");
488 else if (h->Typ()==STRING_CMD)
489 res->data = (void*)(long) system((char*)(h->Data()));
490 else
491 WerrorS("string expected");
492 return FALSE;
493 }
494 else
495/*========reduce procedure like the global one but with jet bounds=======*/
496 if(strcmp(sys_cmd,"reduce_bound")==0)
497 {
498 poly p;
499 ideal pid=NULL;
500 const short t1[]={3,POLY_CMD,IDEAL_CMD,INT_CMD};
501 const short t2[]={3,IDEAL_CMD,IDEAL_CMD,INT_CMD};
502 const short t3[]={3,VECTOR_CMD,MODUL_CMD,INT_CMD};
503 const short t4[]={3,MODUL_CMD,MODUL_CMD,INT_CMD};
504 if ((iiCheckTypes(h,t1,0))||((iiCheckTypes(h,t3,0))))
505 {
506 p = (poly)h->CopyD();
507 }
508 else if ((iiCheckTypes(h,t2,0))||(iiCheckTypes(h,t4,1)))
509 {
510 pid = (ideal)h->CopyD();
511 }
512 else return TRUE;
513 //int htype;
514 res->rtyp= h->Typ(); /*htype*/
515 ideal q = (ideal)h->next->CopyD();
516 int bound = (int)(long)h->next->next->Data();
517 if (pid==NULL) /*(htype == POLY_CMD || htype == VECTOR_CMD)*/
518 res->data = (char *)kNFBound(q,currRing->qideal,p,bound);
519 else /*(htype == IDEAL_CMD || htype == MODUL_CMD)*/
520 res->data = (char *)kNFBound(q,currRing->qideal,pid,bound);
521 return FALSE;
522 }
523 else
524/*==================== uname ==================================*/
525 if(strcmp(sys_cmd,"uname")==0)
526 {
527 res->rtyp=STRING_CMD;
528 res->data = omStrDup(S_UNAME);
529 return FALSE;
530 }
531 else
532/*==================== with ==================================*/
533 if(strcmp(sys_cmd,"with")==0)
534 {
535 if (h==NULL)
536 {
537 res->rtyp=STRING_CMD;
538 res->data=(void *)versionString();
539 return FALSE;
540 }
541 else if (h->Typ()==STRING_CMD)
542 {
543 #define TEST_FOR(A) if(strcmp(s,A)==0) res->data=(void *)1; else
544 char *s=(char *)h->Data();
545 res->rtyp=INT_CMD;
546 #ifdef HAVE_DBM
547 TEST_FOR("DBM")
548 #endif
549 #ifdef HAVE_DLD
550 TEST_FOR("DLD")
551 #endif
552 //TEST_FOR("factory")
553 //TEST_FOR("libfac")
554 #ifdef HAVE_READLINE
555 TEST_FOR("readline")
556 #endif
557 #ifdef TEST_MAC_ORDER
558 TEST_FOR("MAC_ORDER")
559 #endif
560 // unconditional since 3-1-0-6
561 TEST_FOR("Namespaces")
562 #ifdef HAVE_DYNAMIC_LOADING
563 TEST_FOR("DynamicLoading")
564 #endif
565 #ifdef HAVE_EIGENVAL
566 TEST_FOR("eigenval")
567 #endif
568 #ifdef HAVE_GMS
569 TEST_FOR("gms")
570 #endif
571 #ifdef OM_NDEBUG
572 TEST_FOR("om_ndebug")
573 #endif
574 #ifdef SING_NDEBUG
575 TEST_FOR("ndebug")
576 #endif
577 {};
578 return FALSE;
579 #undef TEST_FOR
580 }
581 return TRUE;
582 }
583 else
584 /*==================== browsers ==================================*/
585 if (strcmp(sys_cmd,"browsers")==0)
586 {
587 res->rtyp = STRING_CMD;
588 StringSetS("");
590 res->data = StringEndS();
591 return FALSE;
592 }
593 else
594 /*==================== pid ==================================*/
595 if (strcmp(sys_cmd,"pid")==0)
596 {
597 res->rtyp=INT_CMD;
598 res->data=(void *)(long) getpid();
599 return FALSE;
600 }
601 else
602 /*==================== getenv ==================================*/
603 if (strcmp(sys_cmd,"getenv")==0)
604 {
605 if ((h!=NULL) && (h->Typ()==STRING_CMD))
606 {
607 res->rtyp=STRING_CMD;
608 const char *r=getenv((char *)h->Data());
609 if (r==NULL) r="";
610 res->data=(void *)omStrDup(r);
611 return FALSE;
612 }
613 else
614 {
615 WerrorS("string expected");
616 return TRUE;
617 }
618 }
619 else
620 /*==================== setenv ==================================*/
621 if (strcmp(sys_cmd,"setenv")==0)
622 {
623 #ifdef HAVE_SETENV
624 const short t[]={2,STRING_CMD,STRING_CMD};
625 if (iiCheckTypes(h,t,1))
626 {
627 res->rtyp=STRING_CMD;
628 setenv((char *)h->Data(), (char *)h->next->Data(), 1);
629 res->data=(void *)omStrDup((char *)h->next->Data());
631 return FALSE;
632 }
633 else
634 {
635 return TRUE;
636 }
637 #else
638 WerrorS("setenv not supported on this platform");
639 return TRUE;
640 #endif
641 }
642 else
643 /*==================== Singular ==================================*/
644 if (strcmp(sys_cmd, "Singular") == 0)
645 {
646 res->rtyp=STRING_CMD;
647 const char *r=feResource("Singular");
648 if (r == NULL) r="";
649 res->data = (void*) omStrDup( r );
650 return FALSE;
651 }
652 else
653 if (strcmp(sys_cmd, "SingularLib") == 0)
654 {
655 res->rtyp=STRING_CMD;
656 const char *r=feResource("SearchPath");
657 if (r == NULL) r="";
658 res->data = (void*) omStrDup( r );
659 return FALSE;
660 }
661 else
662 if (strcmp(sys_cmd, "SingularBin") == 0)
663 {
664 res->rtyp=STRING_CMD;
665 const char *r=feResource('r');
666 if (r == NULL) r="/usr/local";
667 int l=strlen(r);
668 /* where to find Singular's programs: */
669 #define SINGULAR_PROCS_DIR "/libexec/singular/MOD"
670 int ll=si_max((int)strlen(SINGULAR_PROCS_DIR),(int)strlen(LIBEXEC_DIR));
671 char *s=(char*)omAlloc(l+ll+2);
672 if ((strstr(r,".libs/..")==NULL) /*not installed Singular (libtool)*/
673 &&(strstr(r,"Singular/..")==NULL)) /*not installed Singular (static)*/
674 {
675 strcpy(s,r);
676 strcat(s,SINGULAR_PROCS_DIR);
677 if (access(s,X_OK)==0)
678 {
679 strcat(s,"/");
680 }
681 else
682 {
683 /*second try: LIBEXEC_DIR*/
684 strcpy(s,LIBEXEC_DIR);
685 if (access(s,X_OK)==0)
686 {
687 strcat(s,"/");
688 }
689 else
690 {
691 s[0]='\0';
692 }
693 }
694 }
695 else
696 {
697 const char *r=feResource('b');
698 if (r == NULL)
699 {
700 s[0]='\0';
701 }
702 else
703 {
704 strcpy(s,r);
705 strcat(s,"/");
706 }
707 }
708 res->data = (void*)s;
709 return FALSE;
710 }
711 else
712 /*==================== options ==================================*/
713 if (strstr(sys_cmd, "--") == sys_cmd)
714 {
715 if (strcmp(sys_cmd, "--") == 0)
716 {
718 return FALSE;
719 }
720 feOptIndex opt = feGetOptIndex(&sys_cmd[2]);
721 if (opt == FE_OPT_UNDEF)
722 {
723 Werror("Unknown option %s", sys_cmd);
724 WerrorS("Use 'system(\"--\");' for listing of available options");
725 return TRUE;
726 }
727 // for Untyped Options (help version),
728 // setting it just triggers action
729 if (feOptSpec[opt].type == feOptUntyped)
730 {
731 feSetOptValue(opt,0);
732 return FALSE;
733 }
734 if (h == NULL)
735 {
736 if (feOptSpec[opt].type == feOptString)
737 {
738 res->rtyp = STRING_CMD;
739 const char *r=(const char*)feOptSpec[opt].value;
740 if (r == NULL) r="";
741 res->data = omStrDup(r);
742 }
743 else
744 {
745 res->rtyp = INT_CMD;
746 res->data = feOptSpec[opt].value;
747 }
748 return FALSE;
749 }
750 if (h->Typ() != STRING_CMD &&
751 h->Typ() != INT_CMD)
752 {
753 WerrorS("Need string or int argument to set option value");
754 return TRUE;
755 }
756 const char* errormsg;
757 if (h->Typ() == INT_CMD)
758 {
759 if (feOptSpec[opt].type == feOptString)
760 {
761 Werror("Need string argument to set value of option %s", sys_cmd);
762 return TRUE;
763 }
764 errormsg = feSetOptValue(opt, (int)((long) h->Data()));
765 if (errormsg != NULL)
766 Werror("Option '--%s=%d' %s", sys_cmd, (int) ((long)h->Data()), errormsg);
767 }
768 else
769 {
770 errormsg = feSetOptValue(opt, (char*) h->Data());
771 if (errormsg != NULL)
772 Werror("Option '--%s=%s' %s", sys_cmd, (char*) h->Data(), errormsg);
773 }
774 if (errormsg != NULL) return TRUE;
775 return FALSE;
776 }
777 else
778 /*==================== HC ==================================*/
779 if (strcmp(sys_cmd,"HC")==0)
780 {
781 res->rtyp=INT_CMD;
782 res->data=(void *)(long) HCord;
783 return FALSE;
784 }
785 else
786 /*==================== random ==================================*/
787 if(strcmp(sys_cmd,"random")==0)
788 {
789 const short t[]={1,INT_CMD};
790 if (h!=NULL)
791 {
792 if (iiCheckTypes(h,t,1))
793 {
794 siRandomStart=(int)((long)h->Data());
797 return FALSE;
798 }
799 else
800 {
801 return TRUE;
802 }
803 }
804 res->rtyp=INT_CMD;
805 res->data=(void*)(long) siSeed;
806 return FALSE;
807 }
808 else
809 /*======================= demon_list =====================*/
810 if (strcmp(sys_cmd,"denom_list")==0)
811 {
812 res->rtyp=LIST_CMD;
813 extern lists get_denom_list();
814 res->data=(lists)get_denom_list();
815 return FALSE;
816 }
817 else
818 /*==================== complexNearZero ======================*/
819 if(strcmp(sys_cmd,"complexNearZero")==0)
820 {
821 const short t[]={2,NUMBER_CMD,INT_CMD};
822 if (iiCheckTypes(h,t,1))
823 {
825 {
826 WerrorS( "unsupported ground field!");
827 return TRUE;
828 }
829 else
830 {
831 res->rtyp=INT_CMD;
832 res->data=(void*)complexNearZero((gmp_complex*)h->Data(),
833 (int)((long)(h->next->Data())));
834 return FALSE;
835 }
836 }
837 else
838 {
839 return TRUE;
840 }
841 }
842 else
843 /*==================== getPrecDigits ======================*/
844 if(strcmp(sys_cmd,"getPrecDigits")==0)
845 {
846 if ( (currRing==NULL)
848 {
849 WerrorS( "unsupported ground field!");
850 return TRUE;
851 }
852 res->rtyp=INT_CMD;
853 res->data=(void*)(long)gmp_output_digits;
854 //if (gmp_output_digits!=getGMPFloatDigits())
855 //{ Print("%d, %d\n",getGMPFloatDigits(),gmp_output_digits);}
856 return FALSE;
857 }
858 else
859 /*==================== lduDecomp ======================*/
860 if(strcmp(sys_cmd, "lduDecomp")==0)
861 {
862 const short t[]={1,MATRIX_CMD};
863 if (iiCheckTypes(h,t,1))
864 {
865 matrix aMat = (matrix)h->Data();
866 matrix pMat; matrix lMat; matrix dMat; matrix uMat;
867 poly l; poly u; poly prodLU;
868 lduDecomp(aMat, pMat, lMat, dMat, uMat, l, u, prodLU);
870 L->Init(7);
871 L->m[0].rtyp = MATRIX_CMD; L->m[0].data=(void*)pMat;
872 L->m[1].rtyp = MATRIX_CMD; L->m[1].data=(void*)lMat;
873 L->m[2].rtyp = MATRIX_CMD; L->m[2].data=(void*)dMat;
874 L->m[3].rtyp = MATRIX_CMD; L->m[3].data=(void*)uMat;
875 L->m[4].rtyp = POLY_CMD; L->m[4].data=(void*)l;
876 L->m[5].rtyp = POLY_CMD; L->m[5].data=(void*)u;
877 L->m[6].rtyp = POLY_CMD; L->m[6].data=(void*)prodLU;
878 res->rtyp = LIST_CMD;
879 res->data = (char *)L;
880 return FALSE;
881 }
882 else
883 {
884 return TRUE;
885 }
886 }
887 else
888 /*==================== lduSolve ======================*/
889 if(strcmp(sys_cmd, "lduSolve")==0)
890 {
891 /* for solving a linear equation system A * x = b, via the
892 given LDU-decomposition of the matrix A;
893 There is one valid parametrisation:
894 1) exactly eight arguments P, L, D, U, l, u, lTimesU, b;
895 P, L, D, and U realise the LDU-decomposition of A, that is,
896 P * A = L * D^(-1) * U, and P, L, D, and U satisfy the
897 properties decribed in method 'luSolveViaLDUDecomp' in
898 linearAlgebra.h; see there;
899 l, u, and lTimesU are as described in the same location;
900 b is the right-hand side vector of the linear equation system;
901 The method will return a list of either 1 entry or three entries:
902 1) [0] if there is no solution to the system;
903 2) [1, x, H] if there is at least one solution;
904 x is any solution of the given linear system,
905 H is the matrix with column vectors spanning the homogeneous
906 solution space.
907 The method produces an error if matrix and vector sizes do not
908 fit. */
910 if (!iiCheckTypes(h,t,1))
911 {
912 return TRUE;
913 }
915 {
916 WerrorS("field required");
917 return TRUE;
918 }
919 matrix pMat = (matrix)h->Data();
920 matrix lMat = (matrix)h->next->Data();
921 matrix dMat = (matrix)h->next->next->Data();
922 matrix uMat = (matrix)h->next->next->next->Data();
923 poly l = (poly) h->next->next->next->next->Data();
924 poly u = (poly) h->next->next->next->next->next->Data();
925 poly lTimesU = (poly) h->next->next->next->next->next->next->Data();
926 matrix bVec = (matrix)h->next->next->next->next->next->next->next->Data();
927 matrix xVec; int solvable; matrix homogSolSpace;
928 if (pMat->rows() != pMat->cols())
929 {
930 Werror("first matrix (%d x %d) is not quadratic",
931 pMat->rows(), pMat->cols());
932 return TRUE;
933 }
934 if (lMat->rows() != lMat->cols())
935 {
936 Werror("second matrix (%d x %d) is not quadratic",
937 lMat->rows(), lMat->cols());
938 return TRUE;
939 }
940 if (dMat->rows() != dMat->cols())
941 {
942 Werror("third matrix (%d x %d) is not quadratic",
943 dMat->rows(), dMat->cols());
944 return TRUE;
945 }
946 if (dMat->cols() != uMat->rows())
947 {
948 Werror("third matrix (%d x %d) and fourth matrix (%d x %d) %s",
949 dMat->rows(), dMat->cols(), uMat->rows(), uMat->cols(),
950 "do not t");
951 return TRUE;
952 }
953 if (uMat->rows() != bVec->rows())
954 {
955 Werror("fourth matrix (%d x %d) and vector (%d x 1) do not fit",
956 uMat->rows(), uMat->cols(), bVec->rows());
957 return TRUE;
958 }
959 solvable = luSolveViaLDUDecomp(pMat, lMat, dMat, uMat, l, u, lTimesU,
960 bVec, xVec, homogSolSpace);
961
962 /* build the return structure; a list with either one or
963 three entries */
965 if (solvable)
966 {
967 ll->Init(3);
968 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
969 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)xVec;
970 ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)homogSolSpace;
971 }
972 else
973 {
974 ll->Init(1);
975 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
976 }
977 res->rtyp = LIST_CMD;
978 res->data=(char*)ll;
979 return FALSE;
980 }
981 else
982 /*==== countedref: reference and shared ====*/
983 if (strcmp(sys_cmd, "shared") == 0)
984 {
985 #ifndef SI_COUNTEDREF_AUTOLOAD
988 #endif
989 res->rtyp = NONE;
990 return FALSE;
991 }
992 else if (strcmp(sys_cmd, "reference") == 0)
993 {
994 #ifndef SI_COUNTEDREF_AUTOLOAD
997 #endif
998 res->rtyp = NONE;
999 return FALSE;
1000 }
1001 else
1002/*==================== semaphore =================*/
1003#ifdef HAVE_SIMPLEIPC
1004 if (strcmp(sys_cmd,"semaphore")==0)
1005 {
1006 if((h!=NULL) && (h->Typ()==STRING_CMD) && (h->next!=NULL) && (h->next->Typ()==INT_CMD))
1007 {
1008 int v=1;
1009 if ((h->next->next!=NULL)&& (h->next->next->Typ()==INT_CMD))
1010 v=(int)(long)h->next->next->Data();
1011 res->data=(char *)(long)simpleipc_cmd((char *)h->Data(),(int)(long)h->next->Data(),v);
1012 res->rtyp=INT_CMD;
1013 return FALSE;
1014 }
1015 else
1016 {
1017 WerrorS("Usage: system(\"semaphore\",<cmd>,int)");
1018 return TRUE;
1019 }
1020 }
1021 else
1022#endif
1023/*==================== reserved port =================*/
1024 if (strcmp(sys_cmd,"reserve")==0)
1025 {
1026 int ssiReservePort(int clients);
1027 const short t[]={1,INT_CMD};
1028 if (iiCheckTypes(h,t,1))
1029 {
1030 res->rtyp=INT_CMD;
1031 int p=ssiReservePort((int)(long)h->Data());
1032 res->data=(void*)(long)p;
1033 return (p==0);
1034 }
1035 return TRUE;
1036 }
1037 else
1038/*==================== reserved link =================*/
1039 if (strcmp(sys_cmd,"reservedLink")==0)
1040 {
1041 res->rtyp=LINK_CMD;
1043 res->data=(void*)p;
1044 return (p==NULL);
1045 }
1046 else
1047/*==================== install newstruct =================*/
1048 if (strcmp(sys_cmd,"install")==0)
1049 {
1050 const short t[]={4,STRING_CMD,STRING_CMD,PROC_CMD,INT_CMD};
1051 if (iiCheckTypes(h,t,1))
1052 {
1053 return newstruct_set_proc((char*)h->Data(),(char*)h->next->Data(),
1054 (int)(long)h->next->next->next->Data(),
1055 (procinfov)h->next->next->Data());
1056 }
1057 return TRUE;
1058 }
1059 else
1060/*==================== newstruct =================*/
1061 if (strcmp(sys_cmd,"newstruct")==0)
1062 {
1063 const short t[]={1,STRING_CMD};
1064 if (iiCheckTypes(h,t,1))
1065 {
1066 int id=0;
1067 char *n=(char*)h->Data();
1068 blackboxIsCmd(n,id);
1069 if (id>0)
1070 {
1071 blackbox *bb=getBlackboxStuff(id);
1072 if (BB_LIKE_LIST(bb))
1073 {
1074 newstruct_desc desc=(newstruct_desc)bb->data;
1075 newstructShow(desc);
1076 return FALSE;
1077 }
1078 else Werror("'%s' is not a newstruct",n);
1079 }
1080 else Werror("'%s' is not a blackbox object",n);
1081 }
1082 return TRUE;
1083 }
1084 else
1085/*==================== blackbox =================*/
1086 if (strcmp(sys_cmd,"blackbox")==0)
1087 {
1089 return FALSE;
1090 }
1091 else
1092 /*================= absBiFact ======================*/
1093 #if defined(HAVE_FLINT) || defined(HAVE_NTL)
1094 if (strcmp(sys_cmd, "absFact") == 0)
1095 {
1096 const short t[]={1,POLY_CMD};
1097 if (iiCheckTypes(h,t,1)
1098 && (currRing!=NULL)
1099 && (getCoeffType(currRing->cf)==n_transExt))
1100 {
1101 res->rtyp=LIST_CMD;
1102 intvec *v=NULL;
1103 ideal mipos= NULL;
1104 int n= 0;
1105 ideal f=singclap_absFactorize((poly)(h->Data()), mipos, &v, n, currRing);
1106 if (f==NULL) return TRUE;
1107 ivTest(v);
1109 l->Init(4);
1110 l->m[0].rtyp=IDEAL_CMD;
1111 l->m[0].data=(void *)f;
1112 l->m[1].rtyp=INTVEC_CMD;
1113 l->m[1].data=(void *)v;
1114 l->m[2].rtyp=IDEAL_CMD;
1115 l->m[2].data=(void*) mipos;
1116 l->m[3].rtyp=INT_CMD;
1117 l->m[3].data=(void*) (long) n;
1118 res->data=(void *)l;
1119 return FALSE;
1120 }
1121 else return TRUE;
1122 }
1123 else
1124 #endif
1125 /* =================== LLL via NTL ==============================*/
1126 #ifdef HAVE_NTL
1127 if (strcmp(sys_cmd, "LLL") == 0)
1128 {
1129 if (h!=NULL)
1130 {
1131 res->rtyp=h->Typ();
1132 if (h->Typ()==MATRIX_CMD)
1133 {
1134 res->data=(char *)singntl_LLL((matrix)h->Data(), currRing);
1135 return FALSE;
1136 }
1137 else if (h->Typ()==INTMAT_CMD)
1138 {
1139 res->data=(char *)singntl_LLL((intvec*)h->Data());
1140 return FALSE;
1141 }
1142 else return TRUE;
1143 }
1144 else return TRUE;
1145 }
1146 else
1147 #endif
1148 /* =================== LLL via Flint ==============================*/
1149 #ifdef HAVE_FLINT
1150 #if __FLINT_RELEASE >= 20500
1151 if (strcmp(sys_cmd, "LLL_Flint") == 0)
1152 {
1153 if (h!=NULL)
1154 {
1155 if(h->next == NULL)
1156 {
1157 res->rtyp=h->Typ();
1158 if (h->Typ()==BIGINTMAT_CMD)
1159 {
1160 res->data=(char *)singflint_LLL((bigintmat*)h->Data(), NULL);
1161 return FALSE;
1162 }
1163 else if (h->Typ()==INTMAT_CMD)
1164 {
1165 res->data=(char *)singflint_LLL((intvec*)h->Data(), NULL);
1166 return FALSE;
1167 }
1168 else return TRUE;
1169 }
1170 if(h->next->Typ()!= INT_CMD)
1171 {
1172 WerrorS("matrix,int or bigint,int expected");
1173 return TRUE;
1174 }
1175 if(h->next->Typ()== INT_CMD)
1176 {
1177 if(((int)((long)(h->next->Data())) != 0) && (int)((long)(h->next->Data()) != 1))
1178 {
1179 WerrorS("int is different from 0, 1");
1180 return TRUE;
1181 }
1182 res->rtyp=h->Typ();
1183 if((long)(h->next->Data()) == 0)
1184 {
1185 if (h->Typ()==BIGINTMAT_CMD)
1186 {
1187 res->data=(char *)singflint_LLL((bigintmat*)h->Data(), NULL);
1188 return FALSE;
1189 }
1190 else if (h->Typ()==INTMAT_CMD)
1191 {
1192 res->data=(char *)singflint_LLL((intvec*)h->Data(), NULL);
1193 return FALSE;
1194 }
1195 else return TRUE;
1196 }
1197 // This will give also the transformation matrix U s.t. res = U * m
1198 if((long)(h->next->Data()) == 1)
1199 {
1200 if (h->Typ()==BIGINTMAT_CMD)
1201 {
1202 bigintmat* m = (bigintmat*)h->Data();
1203 bigintmat* T = new bigintmat(m->rows(),m->rows(),m->basecoeffs());
1204 for(int i = 1; i<=m->rows(); i++)
1205 {
1206 n_Delete(&(BIMATELEM(*T,i,i)),T->basecoeffs());
1207 BIMATELEM(*T,i,i)=n_Init(1, T->basecoeffs());
1208 }
1209 m = singflint_LLL(m,T);
1211 L->Init(2);
1212 L->m[0].rtyp = BIGINTMAT_CMD; L->m[0].data = (void*)m;
1213 L->m[1].rtyp = BIGINTMAT_CMD; L->m[1].data = (void*)T;
1214 res->data=L;
1215 res->rtyp=LIST_CMD;
1216 return FALSE;
1217 }
1218 else if (h->Typ()==INTMAT_CMD)
1219 {
1220 intvec* m = (intvec*)h->Data();
1221 intvec* T = new intvec(m->rows(),m->rows(),(int)0);
1222 for(int i = 1; i<=m->rows(); i++)
1223 IMATELEM(*T,i,i)=1;
1224 m = singflint_LLL(m,T);
1226 L->Init(2);
1227 L->m[0].rtyp = INTMAT_CMD; L->m[0].data = (void*)m;
1228 L->m[1].rtyp = INTMAT_CMD; L->m[1].data = (void*)T;
1229 res->data=L;
1230 res->rtyp=LIST_CMD;
1231 return FALSE;
1232 }
1233 else return TRUE;
1234 }
1235 }
1236
1237 }
1238 else return TRUE;
1239 }
1240 else
1241 #endif
1242 #endif
1243/* ====== rref ============================*/
1244 #if defined(HAVE_FLINT) || defined(HAVE_NTL)
1245 if(strcmp(sys_cmd,"rref")==0)
1246 {
1247 const short t1[]={1,MATRIX_CMD};
1248 const short t2[]={1,SMATRIX_CMD};
1249 if (iiCheckTypes(h,t1,0))
1250 {
1251 matrix M=(matrix)h->Data();
1252 #if defined(HAVE_FLINT)
1253 res->data=(void*)singflint_rref(M,currRing);
1254 #elif defined(HAVE_NTL)
1255 res->data=(void*)singntl_rref(M,currRing);
1256 #endif
1257 res->rtyp=MATRIX_CMD;
1258 return FALSE;
1259 }
1260 else if (iiCheckTypes(h,t2,1))
1261 {
1262 ideal M=(ideal)h->Data();
1263 #if defined(HAVE_FLINT)
1264 res->data=(void*)singflint_rref(M,currRing);
1265 #elif defined(HAVE_NTL)
1266 res->data=(void*)singntl_rref(M,currRing);
1267 #endif
1268 res->rtyp=SMATRIX_CMD;
1269 return FALSE;
1270 }
1271 else
1272 {
1273 WerrorS("expected system(\"rref\",<matrix>/<smatrix>)");
1274 return TRUE;
1275 }
1276 }
1277 else
1278 #endif
1279 /*==================== pcv ==================================*/
1280 #ifdef HAVE_PCV
1281 if(strcmp(sys_cmd,"pcvLAddL")==0)
1282 {
1283 return pcvLAddL(res,h);
1284 }
1285 else
1286 if(strcmp(sys_cmd,"pcvPMulL")==0)
1287 {
1288 return pcvPMulL(res,h);
1289 }
1290 else
1291 if(strcmp(sys_cmd,"pcvMinDeg")==0)
1292 {
1293 return pcvMinDeg(res,h);
1294 }
1295 else
1296 if(strcmp(sys_cmd,"pcvP2CV")==0)
1297 {
1298 return pcvP2CV(res,h);
1299 }
1300 else
1301 if(strcmp(sys_cmd,"pcvCV2P")==0)
1302 {
1303 return pcvCV2P(res,h);
1304 }
1305 else
1306 if(strcmp(sys_cmd,"pcvDim")==0)
1307 {
1308 return pcvDim(res,h);
1309 }
1310 else
1311 if(strcmp(sys_cmd,"pcvBasis")==0)
1312 {
1313 return pcvBasis(res,h);
1314 }
1315 else
1316 #endif
1317 /*==================== hessenberg/eigenvalues ==================================*/
1318 #ifdef HAVE_EIGENVAL
1319 if(strcmp(sys_cmd,"hessenberg")==0)
1320 {
1321 return evHessenberg(res,h);
1322 }
1323 else
1324 #endif
1325 /*==================== eigenvalues ==================================*/
1326 #ifdef HAVE_EIGENVAL
1327 if(strcmp(sys_cmd,"eigenvals")==0)
1328 {
1329 return evEigenvals(res,h);
1330 }
1331 else
1332 #endif
1333 /*==================== rowelim ==================================*/
1334 #ifdef HAVE_EIGENVAL
1335 if(strcmp(sys_cmd,"rowelim")==0)
1336 {
1337 return evRowElim(res,h);
1338 }
1339 else
1340 #endif
1341 /*==================== rowcolswap ==================================*/
1342 #ifdef HAVE_EIGENVAL
1343 if(strcmp(sys_cmd,"rowcolswap")==0)
1344 {
1345 return evSwap(res,h);
1346 }
1347 else
1348 #endif
1349 /*==================== Gauss-Manin system ==================================*/
1350 #ifdef HAVE_GMS
1351 if(strcmp(sys_cmd,"gmsnf")==0)
1352 {
1353 return gmsNF(res,h);
1354 }
1355 else
1356 #endif
1357 /*==================== contributors =============================*/
1358 if(strcmp(sys_cmd,"contributors") == 0)
1359 {
1360 res->rtyp=STRING_CMD;
1361 res->data=(void *)omStrDup(
1362 "Olaf Bachmann, Michael Brickenstein, Hubert Grassmann, Kai Krueger, Victor Levandovskyy, Wolfgang Neumann, Thomas Nuessler, Wilfred Pohl, Jens Schmidt, Mathias Schulze, Thomas Siebert, Ruediger Stobbe, Moritz Wenk, Tim Wichmann");
1363 return FALSE;
1364 }
1365 else
1366 /*==================== spectrum =============================*/
1367 #ifdef HAVE_SPECTRUM
1368 if(strcmp(sys_cmd,"spectrum") == 0)
1369 {
1370 if ((h==NULL) || (h->Typ()!=POLY_CMD))
1371 {
1372 WerrorS("poly expected");
1373 return TRUE;
1374 }
1375 if (h->next==NULL)
1376 return spectrumProc(res,h);
1377 if (h->next->Typ()!=INT_CMD)
1378 {
1379 WerrorS("poly,int expected");
1380 return TRUE;
1381 }
1382 if(((long)h->next->Data())==1L)
1383 return spectrumfProc(res,h);
1384 return spectrumProc(res,h);
1385 }
1386 else
1387 /*==================== semic =============================*/
1388 if(strcmp(sys_cmd,"semic") == 0)
1389 {
1390 if ((h->next!=NULL)
1391 && (h->Typ()==LIST_CMD)
1392 && (h->next->Typ()==LIST_CMD))
1393 {
1394 if (h->next->next==NULL)
1395 return semicProc(res,h,h->next);
1396 else if (h->next->next->Typ()==INT_CMD)
1397 return semicProc3(res,h,h->next,h->next->next);
1398 }
1399 return TRUE;
1400 }
1401 else
1402 /*==================== spadd =============================*/
1403 if(strcmp(sys_cmd,"spadd") == 0)
1404 {
1405 const short t[]={2,LIST_CMD,LIST_CMD};
1406 if (iiCheckTypes(h,t,1))
1407 {
1408 return spaddProc(res,h,h->next);
1409 }
1410 return TRUE;
1411 }
1412 else
1413 /*==================== spmul =============================*/
1414 if(strcmp(sys_cmd,"spmul") == 0)
1415 {
1416 const short t[]={2,LIST_CMD,INT_CMD};
1417 if (iiCheckTypes(h,t,1))
1418 {
1419 return spmulProc(res,h,h->next);
1420 }
1421 return TRUE;
1422 }
1423 else
1424 #endif
1425/*==================== tensorModuleMult ========================= */
1426 #define HAVE_SHEAFCOH_TRICKS 1
1427
1428 #ifdef HAVE_SHEAFCOH_TRICKS
1429 if(strcmp(sys_cmd,"tensorModuleMult")==0)
1430 {
1431 const short t[]={2,INT_CMD,MODUL_CMD};
1432 // WarnS("tensorModuleMult!");
1433 if (iiCheckTypes(h,t,1))
1434 {
1435 int m = (int)( (long)h->Data() );
1436 ideal M = (ideal)h->next->Data();
1437 res->rtyp=MODUL_CMD;
1438 res->data=(void *)id_TensorModuleMult(m, M, currRing);
1439 return FALSE;
1440 }
1441 return TRUE;
1442 }
1443 else
1444 #endif
1445 /*==================== twostd =================*/
1446 #ifdef HAVE_PLURAL
1447 if (strcmp(sys_cmd, "twostd") == 0)
1448 {
1449 ideal I;
1450 if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
1451 {
1452 I=(ideal)h->CopyD();
1453 res->rtyp=IDEAL_CMD;
1454 if (rIsPluralRing(currRing)) res->data=twostd(I);
1455 else res->data=I;
1458 }
1459 else return TRUE;
1460 return FALSE;
1461 }
1462 else
1463 #endif
1464 /*==================== lie bracket =================*/
1465 #ifdef HAVE_PLURAL
1466 if (strcmp(sys_cmd, "bracket") == 0)
1467 {
1468 const short t[]={2,POLY_CMD,POLY_CMD};
1469 if (iiCheckTypes(h,t,1))
1470 {
1471 poly p=(poly)h->CopyD();
1472 h=h->next;
1473 poly q=(poly)h->Data();
1474 res->rtyp=POLY_CMD;
1476 return FALSE;
1477 }
1478 return TRUE;
1479 }
1480 else
1481 #endif
1482 /*==================== env ==================================*/
1483 #ifdef HAVE_PLURAL
1484 if (strcmp(sys_cmd, "env")==0)
1485 {
1486 if ((h!=NULL) && (h->Typ()==RING_CMD))
1487 {
1488 ring r = (ring)h->Data();
1489 res->data = rEnvelope(r);
1490 res->rtyp = RING_CMD;
1491 return FALSE;
1492 }
1493 else
1494 {
1495 WerrorS("`system(\"env\",<ring>)` expected");
1496 return TRUE;
1497 }
1498 }
1499 else
1500 #endif
1501/* ============ opp ======================== */
1502 #ifdef HAVE_PLURAL
1503 if (strcmp(sys_cmd, "opp")==0)
1504 {
1505 if ((h!=NULL) && (h->Typ()==RING_CMD))
1506 {
1507 ring r=(ring)h->Data();
1508 res->data=rOpposite(r);
1509 res->rtyp=RING_CMD;
1510 return FALSE;
1511 }
1512 else
1513 {
1514 WerrorS("`system(\"opp\",<ring>)` expected");
1515 return TRUE;
1516 }
1517 }
1518 else
1519 #endif
1520 /*==================== oppose ==================================*/
1521 #ifdef HAVE_PLURAL
1522 if (strcmp(sys_cmd, "oppose")==0)
1523 {
1524 if ((h!=NULL) && (h->Typ()==RING_CMD)
1525 && (h->next!= NULL))
1526 {
1527 ring Rop = (ring)h->Data();
1528 h = h->next;
1529 idhdl w;
1530 if ((w=Rop->idroot->get(h->Name(),myynest))!=NULL)
1531 {
1532 poly p = (poly)IDDATA(w);
1533 res->data = pOppose(Rop, p, currRing); // into CurrRing?
1534 res->rtyp = POLY_CMD;
1535 return FALSE;
1536 }
1537 }
1538 else
1539 {
1540 WerrorS("`system(\"oppose\",<ring>,<poly>)` expected");
1541 return TRUE;
1542 }
1543 }
1544 else
1545 #endif
1546 /*==================== walk stuff =================*/
1547 /*==================== walkNextWeight =================*/
1548 #ifdef HAVE_WALK
1549 #ifdef OWNW
1550 if (strcmp(sys_cmd, "walkNextWeight") == 0)
1551 {
1552 const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1553 if (!iiCheckTypes(h,t,1)) return TRUE;
1554 if (((intvec*) h->Data())->length() != currRing->N ||
1555 ((intvec*) h->next->Data())->length() != currRing->N)
1556 {
1557 Werror("system(\"walkNextWeight\" ...) intvecs not of length %d\n",
1558 currRing->N);
1559 return TRUE;
1560 }
1561 res->data = (void*) walkNextWeight(((intvec*) h->Data()),
1562 ((intvec*) h->next->Data()),
1563 (ideal) h->next->next->Data());
1564 if (res->data == NULL || res->data == (void*) 1L)
1565 {
1566 res->rtyp = INT_CMD;
1567 }
1568 else
1569 {
1570 res->rtyp = INTVEC_CMD;
1571 }
1572 return FALSE;
1573 }
1574 else
1575 #endif
1576 #endif
1577 /*==================== walkNextWeight =================*/
1578 #ifdef HAVE_WALK
1579 #ifdef OWNW
1580 if (strcmp(sys_cmd, "walkInitials") == 0)
1581 {
1582 if (h == NULL || h->Typ() != IDEAL_CMD)
1583 {
1584 WerrorS("system(\"walkInitials\", ideal) expected");
1585 return TRUE;
1586 }
1587 res->data = (void*) walkInitials((ideal) h->Data());
1588 res->rtyp = IDEAL_CMD;
1589 return FALSE;
1590 }
1591 else
1592 #endif
1593 #endif
1594 /*==================== walkAddIntVec =================*/
1595 #ifdef HAVE_WALK
1596 #ifdef WAIV
1597 if (strcmp(sys_cmd, "walkAddIntVec") == 0)
1598 {
1599 const short t[]={2,INTVEC_CMD,INTVEC_CMD};
1600 if (!iiCheckTypes(h,t,1)) return TRUE;
1601 intvec* arg1 = (intvec*) h->Data();
1602 intvec* arg2 = (intvec*) h->next->Data();
1603 res->data = (intvec*) walkAddIntVec(arg1, arg2);
1604 res->rtyp = INTVEC_CMD;
1605 return FALSE;
1606 }
1607 else
1608 #endif
1609 #endif
1610 /*==================== MwalkNextWeight =================*/
1611 #ifdef HAVE_WALK
1612 #ifdef MwaklNextWeight
1613 if (strcmp(sys_cmd, "MwalkNextWeight") == 0)
1614 {
1615 const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1616 if (!iiCheckTypes(h,t,1)) return TRUE;
1617 if (((intvec*) h->Data())->length() != currRing->N ||
1618 ((intvec*) h->next->Data())->length() != currRing->N)
1619 {
1620 Werror("system(\"MwalkNextWeight\" ...) intvecs not of length %d\n",
1621 currRing->N);
1622 return TRUE;
1623 }
1624 intvec* arg1 = (intvec*) h->Data();
1625 intvec* arg2 = (intvec*) h->next->Data();
1626 ideal arg3 = (ideal) h->next->next->Data();
1627 intvec* result = (intvec*) MwalkNextWeight(arg1, arg2, arg3);
1628 res->rtyp = INTVEC_CMD;
1629 res->data = result;
1630 return FALSE;
1631 }
1632 else
1633 #endif //MWalkNextWeight
1634 #endif
1635 /*==================== Mivdp =================*/
1636 #ifdef HAVE_WALK
1637 if(strcmp(sys_cmd, "Mivdp") == 0)
1638 {
1639 if (h == NULL || h->Typ() != INT_CMD)
1640 {
1641 WerrorS("system(\"Mivdp\", int) expected");
1642 return TRUE;
1643 }
1644 if ((int) ((long)(h->Data())) != currRing->N)
1645 {
1646 Werror("system(\"Mivdp\" ...) intvecs not of length %d\n",
1647 currRing->N);
1648 return TRUE;
1649 }
1650 int arg1 = (int) ((long)(h->Data()));
1651 intvec* result = (intvec*) Mivdp(arg1);
1652 res->rtyp = INTVEC_CMD;
1653 res->data = result;
1654 return FALSE;
1655 }
1656 else
1657 #endif
1658 /*==================== Mivlp =================*/
1659 #ifdef HAVE_WALK
1660 if(strcmp(sys_cmd, "Mivlp") == 0)
1661 {
1662 if (h == NULL || h->Typ() != INT_CMD)
1663 {
1664 WerrorS("system(\"Mivlp\", int) expected");
1665 return TRUE;
1666 }
1667 if ((int) ((long)(h->Data())) != currRing->N)
1668 {
1669 Werror("system(\"Mivlp\" ...) intvecs not of length %d\n",
1670 currRing->N);
1671 return TRUE;
1672 }
1673 int arg1 = (int) ((long)(h->Data()));
1674 intvec* result = (intvec*) Mivlp(arg1);
1675 res->rtyp = INTVEC_CMD;
1676 res->data = result;
1677 return FALSE;
1678 }
1679 else
1680 #endif
1681 /*==================== MpDiv =================*/
1682 #ifdef HAVE_WALK
1683 #ifdef MpDiv
1684 if(strcmp(sys_cmd, "MpDiv") == 0)
1685 {
1686 const short t[]={2,POLY_CMD,POLY_CMD};
1687 if (!iiCheckTypes(h,t,1)) return TRUE;
1688 poly arg1 = (poly) h->Data();
1689 poly arg2 = (poly) h->next->Data();
1690 poly result = MpDiv(arg1, arg2);
1691 res->rtyp = POLY_CMD;
1692 res->data = result;
1693 return FALSE;
1694 }
1695 else
1696 #endif
1697 #endif
1698 /*==================== MpMult =================*/
1699 #ifdef HAVE_WALK
1700 #ifdef MpMult
1701 if(strcmp(sys_cmd, "MpMult") == 0)
1702 {
1703 const short t[]={2,POLY_CMD,POLY_CMD};
1704 if (!iiCheckTypes(h,t,1)) return TRUE;
1705 poly arg1 = (poly) h->Data();
1706 poly arg2 = (poly) h->next->Data();
1707 poly result = MpMult(arg1, arg2);
1708 res->rtyp = POLY_CMD;
1709 res->data = result;
1710 return FALSE;
1711 }
1712 else
1713 #endif
1714 #endif
1715 /*==================== MivSame =================*/
1716 #ifdef HAVE_WALK
1717 if (strcmp(sys_cmd, "MivSame") == 0)
1718 {
1719 const short t[]={2,INTVEC_CMD,INTVEC_CMD};
1720 if (!iiCheckTypes(h,t,1)) return TRUE;
1721 /*
1722 if (((intvec*) h->Data())->length() != currRing->N ||
1723 ((intvec*) h->next->Data())->length() != currRing->N)
1724 {
1725 Werror("system(\"MivSame\" ...) intvecs not of length %d\n",
1726 currRing->N);
1727 return TRUE;
1728 }
1729 */
1730 intvec* arg1 = (intvec*) h->Data();
1731 intvec* arg2 = (intvec*) h->next->Data();
1732 /*
1733 poly result = (poly) MivSame(arg1, arg2);
1734 res->rtyp = POLY_CMD;
1735 res->data = (poly) result;
1736 */
1737 res->rtyp = INT_CMD;
1738 res->data = (void*)(long) MivSame(arg1, arg2);
1739 return FALSE;
1740 }
1741 else
1742 #endif
1743 /*==================== M3ivSame =================*/
1744 #ifdef HAVE_WALK
1745 if (strcmp(sys_cmd, "M3ivSame") == 0)
1746 {
1747 const short t[]={3,INTVEC_CMD,INTVEC_CMD,INTVEC_CMD};
1748 if (!iiCheckTypes(h,t,1)) return TRUE;
1749 /*
1750 if (((intvec*) h->Data())->length() != currRing->N ||
1751 ((intvec*) h->next->Data())->length() != currRing->N ||
1752 ((intvec*) h->next->next->Data())->length() != currRing->N )
1753 {
1754 Werror("system(\"M3ivSame\" ...) intvecs not of length %d\n",
1755 currRing->N);
1756 return TRUE;
1757 }
1758 */
1759 intvec* arg1 = (intvec*) h->Data();
1760 intvec* arg2 = (intvec*) h->next->Data();
1761 intvec* arg3 = (intvec*) h->next->next->Data();
1762 /*
1763 poly result = (poly) M3ivSame(arg1, arg2, arg3);
1764 res->rtyp = POLY_CMD;
1765 res->data = (poly) result;
1766 */
1767 res->rtyp = INT_CMD;
1768 res->data = (void*)(long) M3ivSame(arg1, arg2, arg3);
1769 return FALSE;
1770 }
1771 else
1772 #endif
1773 /*==================== MwalkInitialForm =================*/
1774 #ifdef HAVE_WALK
1775 if(strcmp(sys_cmd, "MwalkInitialForm") == 0)
1776 {
1777 const short t[]={2,IDEAL_CMD,INTVEC_CMD};
1778 if (!iiCheckTypes(h,t,1)) return TRUE;
1779 if(((intvec*) h->next->Data())->length() != currRing->N)
1780 {
1781 Werror("system \"MwalkInitialForm\"...) intvec not of length %d\n",
1782 currRing->N);
1783 return TRUE;
1784 }
1785 ideal id = (ideal) h->Data();
1786 intvec* int_w = (intvec*) h->next->Data();
1787 ideal result = (ideal) MwalkInitialForm(id, int_w);
1788 res->rtyp = IDEAL_CMD;
1789 res->data = result;
1790 return FALSE;
1791 }
1792 else
1793 #endif
1794 /*==================== MivMatrixOrder =================*/
1795 #ifdef HAVE_WALK
1796 /************** Perturbation walk **********/
1797 if(strcmp(sys_cmd, "MivMatrixOrder") == 0)
1798 {
1799 if(h==NULL || h->Typ() != INTVEC_CMD)
1800 {
1801 WerrorS("system(\"MivMatrixOrder\",intvec) expected");
1802 return TRUE;
1803 }
1804 intvec* arg1 = (intvec*) h->Data();
1805 intvec* result = MivMatrixOrder(arg1);
1806 res->rtyp = INTVEC_CMD;
1807 res->data = result;
1808 return FALSE;
1809 }
1810 else
1811 #endif
1812 /*==================== MivMatrixOrderdp =================*/
1813 #ifdef HAVE_WALK
1814 if(strcmp(sys_cmd, "MivMatrixOrderdp") == 0)
1815 {
1816 if(h==NULL || h->Typ() != INT_CMD)
1817 {
1818 WerrorS("system(\"MivMatrixOrderdp\",intvec) expected");
1819 return TRUE;
1820 }
1821 int arg1 = (int) ((long)(h->Data()));
1823 res->rtyp = INTVEC_CMD;
1824 res->data = result;
1825 return FALSE;
1826 }
1827 else
1828 #endif
1829 /*==================== MPertVectors =================*/
1830 #ifdef HAVE_WALK
1831 if(strcmp(sys_cmd, "MPertVectors") == 0)
1832 {
1833 const short t[]={3,IDEAL_CMD,INTVEC_CMD,INT_CMD};
1834 if (!iiCheckTypes(h,t,1)) return TRUE;
1835 ideal arg1 = (ideal) h->Data();
1836 intvec* arg2 = (intvec*) h->next->Data();
1837 int arg3 = (int) ((long)(h->next->next->Data()));
1838 intvec* result = (intvec*) MPertVectors(arg1, arg2, arg3);
1839 res->rtyp = INTVEC_CMD;
1840 res->data = result;
1841 return FALSE;
1842 }
1843 else
1844 #endif
1845 /*==================== MPertVectorslp =================*/
1846 #ifdef HAVE_WALK
1847 if(strcmp(sys_cmd, "MPertVectorslp") == 0)
1848 {
1849 const short t[]={3,IDEAL_CMD,INTVEC_CMD,INT_CMD};
1850 if (!iiCheckTypes(h,t,1)) return TRUE;
1851 ideal arg1 = (ideal) h->Data();
1852 intvec* arg2 = (intvec*) h->next->Data();
1853 int arg3 = (int) ((long)(h->next->next->Data()));
1854 intvec* result = (intvec*) MPertVectorslp(arg1, arg2, arg3);
1855 res->rtyp = INTVEC_CMD;
1856 res->data = result;
1857 return FALSE;
1858 }
1859 else
1860 #endif
1861 /************** fractal walk **********/
1862 #ifdef HAVE_WALK
1863 if(strcmp(sys_cmd, "Mfpertvector") == 0)
1864 {
1865 const short t[]={2,IDEAL_CMD,INTVEC_CMD};
1866 if (!iiCheckTypes(h,t,1)) return TRUE;
1867 ideal arg1 = (ideal) h->Data();
1868 intvec* arg2 = (intvec*) h->next->Data();
1869 intvec* result = Mfpertvector(arg1, arg2);
1870 res->rtyp = INTVEC_CMD;
1871 res->data = result;
1872 return FALSE;
1873 }
1874 else
1875 #endif
1876 /*==================== MivUnit =================*/
1877 #ifdef HAVE_WALK
1878 if(strcmp(sys_cmd, "MivUnit") == 0)
1879 {
1880 const short t[]={1,INT_CMD};
1881 if (!iiCheckTypes(h,t,1)) return TRUE;
1882 int arg1 = (int) ((long)(h->Data()));
1883 intvec* result = (intvec*) MivUnit(arg1);
1884 res->rtyp = INTVEC_CMD;
1885 res->data = result;
1886 return FALSE;
1887 }
1888 else
1889 #endif
1890 /*==================== MivWeightOrderlp =================*/
1891 #ifdef HAVE_WALK
1892 if(strcmp(sys_cmd, "MivWeightOrderlp") == 0)
1893 {
1894 const short t[]={1,INTVEC_CMD};
1895 if (!iiCheckTypes(h,t,1)) return TRUE;
1896 intvec* arg1 = (intvec*) h->Data();
1898 res->rtyp = INTVEC_CMD;
1899 res->data = result;
1900 return FALSE;
1901 }
1902 else
1903 #endif
1904 /*==================== MivWeightOrderdp =================*/
1905 #ifdef HAVE_WALK
1906 if(strcmp(sys_cmd, "MivWeightOrderdp") == 0)
1907 {
1908 if(h==NULL || h->Typ() != INTVEC_CMD)
1909 {
1910 WerrorS("system(\"MivWeightOrderdp\",intvec) expected");
1911 return TRUE;
1912 }
1913 intvec* arg1 = (intvec*) h->Data();
1914 //int arg2 = (int) h->next->Data();
1916 res->rtyp = INTVEC_CMD;
1917 res->data = result;
1918 return FALSE;
1919 }
1920 else
1921 #endif
1922 /*==================== MivMatrixOrderlp =================*/
1923 #ifdef HAVE_WALK
1924 if(strcmp(sys_cmd, "MivMatrixOrderlp") == 0)
1925 {
1926 if(h==NULL || h->Typ() != INT_CMD)
1927 {
1928 WerrorS("system(\"MivMatrixOrderlp\",int) expected");
1929 return TRUE;
1930 }
1931 int arg1 = (int) ((long)(h->Data()));
1933 res->rtyp = INTVEC_CMD;
1934 res->data = result;
1935 return FALSE;
1936 }
1937 else
1938 #endif
1939 /*==================== MkInterRedNextWeight =================*/
1940 #ifdef HAVE_WALK
1941 if (strcmp(sys_cmd, "MkInterRedNextWeight") == 0)
1942 {
1943 const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1944 if (!iiCheckTypes(h,t,1)) return TRUE;
1945 if (((intvec*) h->Data())->length() != currRing->N ||
1946 ((intvec*) h->next->Data())->length() != currRing->N)
1947 {
1948 Werror("system(\"MkInterRedNextWeight\" ...) intvecs not of length %d\n",
1949 currRing->N);
1950 return TRUE;
1951 }
1952 intvec* arg1 = (intvec*) h->Data();
1953 intvec* arg2 = (intvec*) h->next->Data();
1954 ideal arg3 = (ideal) h->next->next->Data();
1955 intvec* result = (intvec*) MkInterRedNextWeight(arg1, arg2, arg3);
1956 res->rtyp = INTVEC_CMD;
1957 res->data = result;
1958 return FALSE;
1959 }
1960 else
1961 #endif
1962 /*==================== MPertNextWeight =================*/
1963 #ifdef HAVE_WALK
1964 #ifdef MPertNextWeight
1965 if (strcmp(sys_cmd, "MPertNextWeight") == 0)
1966 {
1967 const short t[]={3,INTVEC_CMD,IDEAL_CMD,INT_CMD};
1968 if (!iiCheckTypes(h,t,1)) return TRUE;
1969 if (((intvec*) h->Data())->length() != currRing->N)
1970 {
1971 Werror("system(\"MPertNextWeight\" ...) intvecs not of length %d\n",
1972 currRing->N);
1973 return TRUE;
1974 }
1975 intvec* arg1 = (intvec*) h->Data();
1976 ideal arg2 = (ideal) h->next->Data();
1977 int arg3 = (int) h->next->next->Data();
1978 intvec* result = (intvec*) MPertNextWeight(arg1, arg2, arg3);
1979 res->rtyp = INTVEC_CMD;
1980 res->data = result;
1981 return FALSE;
1982 }
1983 else
1984 #endif //MPertNextWeight
1985 #endif
1986 /*==================== Mivperttarget =================*/
1987 #ifdef HAVE_WALK
1988 #ifdef Mivperttarget
1989 if (strcmp(sys_cmd, "Mivperttarget") == 0)
1990 {
1991 const short t[]={2,IDEAL_CMD,INT_CMD};
1992 if (!iiCheckTypes(h,t,1)) return TRUE;
1993 ideal arg1 = (ideal) h->Data();
1994 int arg2 = (int) h->next->Data();
1995 intvec* result = (intvec*) Mivperttarget(arg1, arg2);
1996 res->rtyp = INTVEC_CMD;
1997 res->data = result;
1998 return FALSE;
1999 }
2000 else
2001 #endif //Mivperttarget
2002 #endif
2003 /*==================== Mwalk =================*/
2004 #ifdef HAVE_WALK
2005 if (strcmp(sys_cmd, "Mwalk") == 0)
2006 {
2008 if (!iiCheckTypes(h,t,1)) return TRUE;
2009 if (((intvec*) h->next->Data())->length() != currRing->N &&
2010 ((intvec*) h->next->next->Data())->length() != currRing->N )
2011 {
2012 Werror("system(\"Mwalk\" ...) intvecs not of length %d\n",
2013 currRing->N);
2014 return TRUE;
2015 }
2016 ideal arg1 = (ideal) h->CopyD();
2017 intvec* arg2 = (intvec*) h->next->Data();
2018 intvec* arg3 = (intvec*) h->next->next->Data();
2019 ring arg4 = (ring) h->next->next->next->Data();
2020 int arg5 = (int) (long) h->next->next->next->next->Data();
2021 int arg6 = (int) (long) h->next->next->next->next->next->Data();
2022 ideal result = (ideal) Mwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2023 res->rtyp = IDEAL_CMD;
2024 res->data = result;
2025 return FALSE;
2026 }
2027 else
2028 #endif
2029 /*==================== Mpwalk =================*/
2030 #ifdef HAVE_WALK
2031 #ifdef MPWALK_ORIG
2032 if (strcmp(sys_cmd, "Mwalk") == 0)
2033 {
2034 const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,RING_CMD};
2035 if (!iiCheckTypes(h,t,1)) return TRUE;
2036 if ((((intvec*) h->next->Data())->length() != currRing->N &&
2037 ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
2038 (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
2039 ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N)))
2040 {
2041 Werror("system(\"Mwalk\" ...) intvecs not of length %d or %d\n",
2042 currRing->N,(currRing->N)*(currRing->N));
2043 return TRUE;
2044 }
2045 ideal arg1 = (ideal) h->Data();
2046 intvec* arg2 = (intvec*) h->next->Data();
2047 intvec* arg3 = (intvec*) h->next->next->Data();
2048 ring arg4 = (ring) h->next->next->next->Data();
2049 ideal result = (ideal) Mwalk(arg1, arg2, arg3,arg4);
2050 res->rtyp = IDEAL_CMD;
2051 res->data = result;
2052 return FALSE;
2053 }
2054 else
2055 #else
2056 if (strcmp(sys_cmd, "Mpwalk") == 0)
2057 {
2059 if (!iiCheckTypes(h,t,1)) return TRUE;
2060 if(((intvec*) h->next->next->next->Data())->length() != currRing->N &&
2061 ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
2062 {
2063 Werror("system(\"Mpwalk\" ...) intvecs not of length %d\n",currRing->N);
2064 return TRUE;
2065 }
2066 ideal arg1 = (ideal) h->Data();
2067 int arg2 = (int) (long) h->next->Data();
2068 int arg3 = (int) (long) h->next->next->Data();
2069 intvec* arg4 = (intvec*) h->next->next->next->Data();
2070 intvec* arg5 = (intvec*) h->next->next->next->next->Data();
2071 int arg6 = (int) (long) h->next->next->next->next->next->Data();
2072 int arg7 = (int) (long) h->next->next->next->next->next->next->Data();
2073 int arg8 = (int) (long) h->next->next->next->next->next->next->next->Data();
2074 ideal result = (ideal) Mpwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
2075 res->rtyp = IDEAL_CMD;
2076 res->data = result;
2077 return FALSE;
2078 }
2079 else
2080 #endif
2081 #endif
2082 /*==================== Mrwalk =================*/
2083 #ifdef HAVE_WALK
2084 if (strcmp(sys_cmd, "Mrwalk") == 0)
2085 {
2087 if (!iiCheckTypes(h,t,1)) return TRUE;
2088 if(((intvec*) h->next->Data())->length() != currRing->N &&
2089 ((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
2090 ((intvec*) h->next->next->Data())->length() != currRing->N &&
2091 ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) )
2092 {
2093 Werror("system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
2094 currRing->N,(currRing->N)*(currRing->N));
2095 return TRUE;
2096 }
2097 ideal arg1 = (ideal) h->Data();
2098 intvec* arg2 = (intvec*) h->next->Data();
2099 intvec* arg3 = (intvec*) h->next->next->Data();
2100 int arg4 = (int)(long) h->next->next->next->Data();
2101 int arg5 = (int)(long) h->next->next->next->next->Data();
2102 int arg6 = (int)(long) h->next->next->next->next->next->Data();
2103 int arg7 = (int)(long) h->next->next->next->next->next->next->Data();
2104 ideal result = (ideal) Mrwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
2105 res->rtyp = IDEAL_CMD;
2106 res->data = result;
2107 return FALSE;
2108 }
2109 else
2110 #endif
2111 /*==================== MAltwalk1 =================*/
2112 #ifdef HAVE_WALK
2113 if (strcmp(sys_cmd, "MAltwalk1") == 0)
2114 {
2115 const short t[]={5,IDEAL_CMD,INT_CMD,INT_CMD,INTVEC_CMD,INTVEC_CMD};
2116 if (!iiCheckTypes(h,t,1)) return TRUE;
2117 if (((intvec*) h->next->next->next->Data())->length() != currRing->N &&
2118 ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
2119 {
2120 Werror("system(\"MAltwalk1\" ...) intvecs not of length %d\n",
2121 currRing->N);
2122 return TRUE;
2123 }
2124 ideal arg1 = (ideal) h->Data();
2125 int arg2 = (int) ((long)(h->next->Data()));
2126 int arg3 = (int) ((long)(h->next->next->Data()));
2127 intvec* arg4 = (intvec*) h->next->next->next->Data();
2128 intvec* arg5 = (intvec*) h->next->next->next->next->Data();
2129 ideal result = (ideal) MAltwalk1(arg1, arg2, arg3, arg4, arg5);
2130 res->rtyp = IDEAL_CMD;
2131 res->data = result;
2132 return FALSE;
2133 }
2134 else
2135 #endif
2136 /*==================== MAltwalk1 =================*/
2137 #ifdef HAVE_WALK
2138 #ifdef MFWALK_ALT
2139 if (strcmp(sys_cmd, "Mfwalk_alt") == 0)
2140 {
2141 const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
2142 if (!iiCheckTypes(h,t,1)) return TRUE;
2143 if (((intvec*) h->next->Data())->length() != currRing->N &&
2144 ((intvec*) h->next->next->Data())->length() != currRing->N )
2145 {
2146 Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
2147 currRing->N);
2148 return TRUE;
2149 }
2150 ideal arg1 = (ideal) h->Data();
2151 intvec* arg2 = (intvec*) h->next->Data();
2152 intvec* arg3 = (intvec*) h->next->next->Data();
2153 int arg4 = (int) h->next->next->next->Data();
2154 ideal result = (ideal) Mfwalk_alt(arg1, arg2, arg3, arg4);
2155 res->rtyp = IDEAL_CMD;
2156 res->data = result;
2157 return FALSE;
2158 }
2159 else
2160 #endif
2161 #endif
2162 /*==================== Mfwalk =================*/
2163 #ifdef HAVE_WALK
2164 if (strcmp(sys_cmd, "Mfwalk") == 0)
2165 {
2166 const short t[]={5,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD};
2167 if (!iiCheckTypes(h,t,1)) return TRUE;
2168 if (((intvec*) h->next->Data())->length() != currRing->N &&
2169 ((intvec*) h->next->next->Data())->length() != currRing->N )
2170 {
2171 Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
2172 currRing->N);
2173 return TRUE;
2174 }
2175 ideal arg1 = (ideal) h->Data();
2176 intvec* arg2 = (intvec*) h->next->Data();
2177 intvec* arg3 = (intvec*) h->next->next->Data();
2178 int arg4 = (int)(long) h->next->next->next->Data();
2179 int arg5 = (int)(long) h->next->next->next->next->Data();
2180 ideal result = (ideal) Mfwalk(arg1, arg2, arg3, arg4, arg5);
2181 res->rtyp = IDEAL_CMD;
2182 res->data = result;
2183 return FALSE;
2184 }
2185 else
2186 #endif
2187 /*==================== Mfrwalk =================*/
2188 #ifdef HAVE_WALK
2189 if (strcmp(sys_cmd, "Mfrwalk") == 0)
2190 {
2192 if (!iiCheckTypes(h,t,1)) return TRUE;
2193/*
2194 if (((intvec*) h->next->Data())->length() != currRing->N &&
2195 ((intvec*) h->next->next->Data())->length() != currRing->N)
2196 {
2197 Werror("system(\"Mfrwalk\" ...) intvecs not of length %d\n",currRing->N);
2198 return TRUE;
2199 }
2200*/
2201 if((((intvec*) h->next->Data())->length() != currRing->N &&
2202 ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
2203 (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
2204 ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) ))
2205 {
2206 Werror("system(\"Mfrwalk\" ...) intvecs not of length %d or %d\n",
2207 currRing->N,(currRing->N)*(currRing->N));
2208 return TRUE;
2209 }
2210
2211 ideal arg1 = (ideal) h->Data();
2212 intvec* arg2 = (intvec*) h->next->Data();
2213 intvec* arg3 = (intvec*) h->next->next->Data();
2214 int arg4 = (int)(long) h->next->next->next->Data();
2215 int arg5 = (int)(long) h->next->next->next->next->Data();
2216 int arg6 = (int)(long) h->next->next->next->next->next->Data();
2217 ideal result = (ideal) Mfrwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2218 res->rtyp = IDEAL_CMD;
2219 res->data = result;
2220 return FALSE;
2221 }
2222 else
2223 /*==================== Mprwalk =================*/
2224 if (strcmp(sys_cmd, "Mprwalk") == 0)
2225 {
2227 if (!iiCheckTypes(h,t,1)) return TRUE;
2228 if((((intvec*) h->next->Data())->length() != currRing->N &&
2229 ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
2230 (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
2231 ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) ))
2232 {
2233 Werror("system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
2234 currRing->N,(currRing->N)*(currRing->N));
2235 return TRUE;
2236 }
2237 ideal arg1 = (ideal) h->Data();
2238 intvec* arg2 = (intvec*) h->next->Data();
2239 intvec* arg3 = (intvec*) h->next->next->Data();
2240 int arg4 = (int)(long) h->next->next->next->Data();
2241 int arg5 = (int)(long) h->next->next->next->next->Data();
2242 int arg6 = (int)(long) h->next->next->next->next->next->Data();
2243 int arg7 = (int)(long) h->next->next->next->next->next->next->Data();
2244 int arg8 = (int)(long) h->next->next->next->next->next->next->next->Data();
2245 int arg9 = (int)(long) h->next->next->next->next->next->next->next->next->Data();
2246 ideal result = (ideal) Mprwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
2247 res->rtyp = IDEAL_CMD;
2248 res->data = result;
2249 return FALSE;
2250 }
2251 else
2252 #endif
2253 /*==================== TranMImprovwalk =================*/
2254 #ifdef HAVE_WALK
2255 #ifdef TRAN_Orig
2256 if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
2257 {
2258 const short t[]={3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};
2259 if (!iiCheckTypes(h,t,1)) return TRUE;
2260 if (((intvec*) h->next->Data())->length() != currRing->N &&
2261 ((intvec*) h->next->next->Data())->length() != currRing->N )
2262 {
2263 Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2264 currRing->N);
2265 return TRUE;
2266 }
2267 ideal arg1 = (ideal) h->Data();
2268 intvec* arg2 = (intvec*) h->next->Data();
2269 intvec* arg3 = (intvec*) h->next->next->Data();
2270 ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3);
2271 res->rtyp = IDEAL_CMD;
2272 res->data = result;
2273 return FALSE;
2274 }
2275 else
2276 #endif
2277 #endif
2278 /*==================== MAltwalk2 =================*/
2279 #ifdef HAVE_WALK
2280 if (strcmp(sys_cmd, "MAltwalk2") == 0)
2281 {
2282 const short t[]={3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};
2283 if (!iiCheckTypes(h,t,1)) return TRUE;
2284 if (((intvec*) h->next->Data())->length() != currRing->N &&
2285 ((intvec*) h->next->next->Data())->length() != currRing->N )
2286 {
2287 Werror("system(\"MAltwalk2\" ...) intvecs not of length %d\n",
2288 currRing->N);
2289 return TRUE;
2290 }
2291 ideal arg1 = (ideal) h->Data();
2292 intvec* arg2 = (intvec*) h->next->Data();
2293 intvec* arg3 = (intvec*) h->next->next->Data();
2294 ideal result = (ideal) MAltwalk2(arg1, arg2, arg3);
2295 res->rtyp = IDEAL_CMD;
2296 res->data = result;
2297 return FALSE;
2298 }
2299 else
2300 #endif
2301 /*==================== MAltwalk2 =================*/
2302 #ifdef HAVE_WALK
2303 if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
2304 {
2305 const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
2306 if (!iiCheckTypes(h,t,1)) return TRUE;
2307 if (((intvec*) h->next->Data())->length() != currRing->N &&
2308 ((intvec*) h->next->next->Data())->length() != currRing->N )
2309 {
2310 Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2311 currRing->N);
2312 return TRUE;
2313 }
2314 ideal arg1 = (ideal) h->Data();
2315 intvec* arg2 = (intvec*) h->next->Data();
2316 intvec* arg3 = (intvec*) h->next->next->Data();
2317 int arg4 = (int) ((long)(h->next->next->next->Data()));
2318 ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3, arg4);
2319 res->rtyp = IDEAL_CMD;
2320 res->data = result;
2321 return FALSE;
2322 }
2323 else
2324 #endif
2325 /*==================== TranMrImprovwalk =================*/
2326 #if 0
2327 #ifdef HAVE_WALK
2328 if (strcmp(sys_cmd, "TranMrImprovwalk") == 0)
2329 {
2330 if (h == NULL || h->Typ() != IDEAL_CMD ||
2331 h->next == NULL || h->next->Typ() != INTVEC_CMD ||
2332 h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ||
2333 h->next->next->next == NULL || h->next->next->next->Typ() != INT_CMD ||
2334 h->next->next->next == NULL || h->next->next->next->next->Typ() != INT_CMD ||
2335 h->next->next->next == NULL || h->next->next->next->next->next->Typ() != INT_CMD)
2336 {
2337 WerrorS("system(\"TranMrImprovwalk\", ideal, intvec, intvec) expected");
2338 return TRUE;
2339 }
2340 if (((intvec*) h->next->Data())->length() != currRing->N &&
2341 ((intvec*) h->next->next->Data())->length() != currRing->N )
2342 {
2343 Werror("system(\"TranMrImprovwalk\" ...) intvecs not of length %d\n", currRing->N);
2344 return TRUE;
2345 }
2346 ideal arg1 = (ideal) h->Data();
2347 intvec* arg2 = (intvec*) h->next->Data();
2348 intvec* arg3 = (intvec*) h->next->next->Data();
2349 int arg4 = (int)(long) h->next->next->next->Data();
2350 int arg5 = (int)(long) h->next->next->next->next->Data();
2351 int arg6 = (int)(long) h->next->next->next->next->next->Data();
2352 ideal result = (ideal) TranMrImprovwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2353 res->rtyp = IDEAL_CMD;
2354 res->data = result;
2355 return FALSE;
2356 }
2357 else
2358 #endif
2359 #endif
2360 /*================= Extended system call ========================*/
2361 {
2362 #ifndef MAKE_DISTRIBUTION
2363 return(jjEXTENDED_SYSTEM(res, args));
2364 #else
2365 Werror( "system(\"%s\",...) %s", sys_cmd, feNotImplemented );
2366 #endif
2367 }
2368 } /* typ==string */
2369 return TRUE;
2370}
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:218
void printBlackboxTypes()
list all defined type (for debugging)
Definition: blackbox.cc:235
#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:1011
void * Data()
Definition: subexpr.cc:1154
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:2380
return result
Definition: facAbsBiFact.cc:75
feOptIndex
Definition: feOptGen.h:15
@ FE_OPT_UNDEF
Definition: feOptGen.h:15
void fePrintOptValues()
Definition: feOpt.cc:337
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:4428
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
Definition: ipshell.cc:4511
BOOLEAN spectrumfProc(leftv result, leftv first)
Definition: ipshell.cc:4184
BOOLEAN spmulProc(leftv result, leftv first, leftv second)
Definition: ipshell.cc:4470
BOOLEAN spectrumProc(leftv result, leftv first)
Definition: ipshell.cc:4133
BOOLEAN semicProc(leftv res, leftv u, leftv v)
Definition: ipshell.cc:4551
char * versionString()
Definition: misc_ip.cc:770
poly kNFBound(ideal F, ideal Q, poly p, int bound, int syzComp, int lazyReduce)
Definition: kstd1.cc:3238
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:3350
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:1946
ideal sm_Flatten(ideal a, const ring R)
Definition: matpol.cc:1926
#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:2291
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2841
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:5281
ring rEnvelope(ring R)
Definition: ring.cc:5671
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:934
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:486
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:231

◆ 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.