Changeset 67283e in git for Singular/extra.cc
- Timestamp:
- Jul 23, 2009, 11:14:52 AM (14 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 5dd5814a5a90f887c79c1fcffb83927e5fd0218b
- Parents:
- 4f14e517e43578d335a6caf15b4e150ccb9a6715
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/extra.cc
r4f14e5 r67283e 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: extra.cc,v 1.30 8 2009-07-20 12:01:13 motsakExp $ */4 /* $Id: extra.cc,v 1.309 2009-07-23 09:14:52 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: general interface to internals of Singular ("system" command) … … 720 720 return FALSE; 721 721 } 722 723 722 WerrorS("system(\"tensorModuleMult\", int, module) expected"); 724 723 return TRUE; … … 820 819 if ((h!=NULL) && (h->Typ()==IDEAL_CMD)) 821 820 { 822 823 824 825 826 821 I=(ideal)h->CopyD(); 822 res->rtyp=IDEAL_CMD; 823 if (rIsPluralRing(currRing)) res->data=Approx_Step(I); 824 else res->data=I; 825 setFlag(res,FLAG_STD); 827 826 } 828 827 else return TRUE; … … 852 851 } 853 852 else 854 853 return TRUE; 855 854 if ((h!=NULL) && (h->Typ()==INT_CMD)) 856 855 { … … 901 900 if(strcmp(sys_cmd,"NCUseExtensions")==0) 902 901 { 903 902 904 903 if ((h!=NULL) && (h->Typ()==INT_CMD)) 905 904 res->data=(void *)setNCExtensions( (int)((long)(h->Data())) ); 906 905 else 907 906 res->data=(void *)getNCExtensions(); 908 909 res->rtyp=INT_CMD; 910 return FALSE; 911 } 912 913 907 908 res->rtyp=INT_CMD; 909 return FALSE; 910 } 911 912 914 913 if(strcmp(sys_cmd,"NCGetType")==0) 915 914 { 916 915 res->rtyp=INT_CMD; 917 916 918 917 if( rIsPluralRing(currRing) ) 919 918 res->data=(void *)ncRingType(currRing); 920 919 else 921 920 res->data=(void *)(-1); 922 923 return FALSE; 924 } 925 926 921 922 return FALSE; 923 } 924 925 927 926 if(strcmp(sys_cmd,"ForceSCA")==0) 928 927 { … … 931 930 932 931 int b, e; 933 932 934 933 if ((h!=NULL) && (h->Typ()==INT_CMD)) 935 934 { 936 935 b = (int)((long)(h->Data())); 937 936 h=h->next; 938 } 937 } 939 938 else return TRUE; 940 939 941 940 if ((h!=NULL) && (h->Typ()==INT_CMD)) 942 941 { 943 942 e = (int)((long)(h->Data())); 944 } 943 } 945 944 else return TRUE; 946 945 … … 957 956 return TRUE; 958 957 959 if( !ncInitSpecialPairMultiplication(currRing) ) // No Plural! 958 if( !ncInitSpecialPairMultiplication(currRing) ) // No Plural! 960 959 return TRUE; 961 960 … … 976 975 977 976 978 977 979 978 /*==================== PLURAL =================*/ 980 979 /*==================== opp ==================================*/ … … 1044 1043 if ((h!=NULL) && (h->Typ()==IDEAL_CMD)) 1045 1044 { 1046 1047 1045 I=(ideal)h->CopyD(); 1046 h=h->next; 1048 1047 } 1049 1048 else return TRUE; 1050 1049 if ((h!=NULL) && (h->Typ()==INT_CMD)) 1051 1050 { 1052 1053 1051 uptodeg=(int)((long)(h->Data())); 1052 h=h->next; 1054 1053 } 1055 1054 else return TRUE; 1056 1055 if ((h!=NULL) && (h->Typ()==INT_CMD)) 1057 1056 { 1058 1059 1060 1061 1062 1063 1064 1065 1057 lVblock=(int)((long)(h->Data())); 1058 res->data = freegb(I,uptodeg,lVblock); 1059 if (res->data == NULL) 1060 { 1061 /* that is there were input errors */ 1062 res->data = I; 1063 } 1064 res->rtyp = IDEAL_CMD; 1066 1065 } 1067 1066 else return TRUE; … … 1923 1922 if ((h!=NULL) && (h->Typ()==STRING_CMD)) 1924 1923 { 1925 1926 1927 1924 const char *s=(const char *)h->Data(); 1925 if (strcmp(s,"posInT_EcartFDegpLength")==0) 1926 test_PosInT=posInT_EcartFDegpLength; 1928 1927 else if (strcmp(s,"posInT_FDegpLength")==0) 1929 1928 test_PosInT=posInT_FDegpLength; 1930 1929 else if (strcmp(s,"posInT_pLength")==0) 1931 1930 test_PosInT=posInT_pLength; 1932 1931 else if (strcmp(s,"posInT0")==0) 1933 1932 test_PosInT=posInT0; 1934 1933 else if (strcmp(s,"posInT1")==0) 1935 1934 test_PosInT=posInT1; 1936 1935 else if (strcmp(s,"posInT2")==0) 1937 1936 test_PosInT=posInT2; 1938 1937 else if (strcmp(s,"posInT11")==0) 1939 1938 test_PosInT=posInT11; 1940 1939 else if (strcmp(s,"posInT110")==0) 1941 1940 test_PosInT=posInT110; 1942 1941 else if (strcmp(s,"posInT13")==0) 1943 1942 test_PosInT=posInT13; 1944 1943 else if (strcmp(s,"posInT15")==0) 1945 1944 test_PosInT=posInT15; 1946 1945 else if (strcmp(s,"posInT17")==0) 1947 1946 test_PosInT=posInT17; 1948 1947 else if (strcmp(s,"posInT17_c")==0) 1949 1948 test_PosInT=posInT17_c; 1950 1949 else if (strcmp(s,"posInT19")==0) 1951 1950 test_PosInT=posInT19; 1952 1951 else Print("valid posInT:0,1,2,11,110,13,15,17,17_c,19,_EcartFDegpLength,_FDegpLength,_pLength,_EcartpLength\n"); 1953 1952 } … … 2059 2058 else 2060 2059 /*==================== poly debug ==================================*/ 2060 #ifdef RDEBUG 2061 2061 if(strcmp(sys_cmd,"p")==0) 2062 2062 { 2063 pDebugPrint((poly)h->Data()); 2064 return FALSE; 2065 } 2066 else 2067 #endif 2068 /*==================== ring debug ==================================*/ 2063 2069 #ifdef RDEBUG 2064 pDebugPrint((poly)h->Data());2065 #endif2066 return FALSE;2067 }2068 else2069 /*==================== ring debug ==================================*/2070 2070 if(strcmp(sys_cmd,"r")==0) 2071 2071 { 2072 #ifdef RDEBUG2073 2072 rDebugPrint((ring)h->Data()); 2074 #endif 2075 return FALSE;2076 } 2073 return FALSE; 2074 } 2075 #endif 2077 2076 /*==================== generic debug ==================================*/ 2077 #ifdef PDEBUG 2078 2078 if(strcmp(sys_cmd,"DebugPrint")==0) 2079 2079 { … … 2103 2103 2104 2104 return FALSE; 2105 } else 2105 } 2106 else 2107 #endif 2106 2108 /*==================== mtrack ==================================*/ 2107 2109 if(strcmp(sys_cmd,"mtrack")==0) … … 2160 2162 else 2161 2163 /*==================== backtrace ==================================*/ 2164 #ifndef OM_NDEBUG 2162 2165 if(strcmp(sys_cmd,"backtrace")==0) 2163 2166 { 2164 #ifndef OM_NDEBUG2165 2167 omPrintCurrentBackTrace(stdout); 2166 2168 return FALSE; 2167 #else 2168 WerrorS("btrack not supported without OM_TRACK"); 2169 return TRUE; 2170 #endif 2171 } 2172 else 2169 } 2170 else 2171 #endif 2173 2172 /*==================== naIdeal ==================================*/ 2174 2173 if(strcmp(sys_cmd,"naIdeal")==0) … … 2290 2289 else 2291 2290 #endif 2291 /*=======================gcd Testerei ================================*/ 2292 2292 #ifdef FACTORY_GCD_TEST 2293 /*=======================gcd Testerei ================================*/ 2294 if ( ! strcmp( sys_cmd, "setgcd" ) ) { 2295 if ( (h != NULL) && (h->Typ() == INT_CMD) ) { 2293 if ( ! strcmp( sys_cmd, "setgcd" ) ) 2294 { 2295 if ( (h != NULL) && (h->Typ() == INT_CMD) ) 2296 { 2296 2297 CFPrimitiveGcdUtil::setAlgorithm( (int)h->Data() ); 2297 2298 return FALSE; … … 2303 2304 2304 2305 #ifdef FACTORY_GCD_TIMING 2305 if ( ! strcmp( sys_cmd, "gcdtime" ) ) { 2306 if ( ! strcmp( sys_cmd, "gcdtime" ) ) 2307 { 2306 2308 TIMING_PRINT( contentTimer, "time used for content: " ); 2307 2309 TIMING_PRINT( algContentTimer, "time used for algContent: " ); … … 2316 2318 2317 2319 #ifdef FACTORY_GCD_STAT 2318 if ( ! strcmp( sys_cmd, "gcdstat" ) ) { 2320 if ( ! strcmp( sys_cmd, "gcdstat" ) ) 2321 { 2319 2322 printGcdTotal(); 2320 2323 printContTotal(); … … 2325 2328 else 2326 2329 #endif 2330 /*==================== lib ==================================*/ 2327 2331 #if !defined(HAVE_NS) 2328 /*==================== lib ==================================*/2329 2332 if(strcmp(sys_cmd,"LIB")==0) 2330 2333 { … … 2497 2500 } 2498 2501 else 2502 #endif 2499 2503 /*==================== sdb_edit =================*/ 2504 #ifdef HAVE_SDB 2500 2505 if (strcmp(sys_cmd, "sdb_edit") == 0) 2501 2506 { … … 2563 2568 else 2564 2569 #endif 2570 /*==================== DLL =================*/ 2565 2571 #ifdef ix86_Win 2566 2572 #ifdef HAVE_DL 2567 /*==================== DLL =================*/2568 2573 /* testing the DLL functionality under Win32 */ 2569 2574 if (strcmp(sys_cmd, "DLL") == 0) … … 2635 2640 } 2636 2641 else 2642 /*==================== Creating zero polynomials =================*/ 2637 2643 #ifdef HAVE_VANIDEAL 2638 /*==================== Creating zero polynomials =================*/2639 2644 if (strcmp(sys_cmd, "createG0")==0) 2640 2645 { … … 2661 2666 else 2662 2667 #endif 2668 /*==================== redNF_ring =================*/ 2663 2669 if (strcmp(sys_cmd, "redNF_ring")==0) 2664 2670 { … … 2673 2679 else 2674 2680 #endif 2681 /*==================== minor =================*/ 2675 2682 if (strcmp(sys_cmd, "minor")==0) 2676 2683 { … … 2700 2707 } 2701 2708 else 2709 /*==================== F5 Implementation =================*/ 2702 2710 #ifdef HAVE_F5 2703 /*==================== F5 Implementation =================*/2704 2711 if (strcmp(sys_cmd, "f5")==0) 2705 2712 { … … 2708 2715 WerrorS("ideal expected"); 2709 2716 return TRUE; 2710 } 2711 2717 } 2718 2712 2719 ring r = currRing; 2713 2720 ideal G = (ideal) h->Data(); … … 2726 2733 else 2727 2734 #endif 2735 /*==================== F5C Implementation =================*/ 2728 2736 #ifdef HAVE_F5C 2729 /*==================== F5C Implementation =================*/2730 2737 if (strcmp(sys_cmd, "f5c")==0) 2731 2738 { … … 2734 2741 WerrorS("ideal expected"); 2735 2742 return TRUE; 2736 } 2737 2743 } 2744 2738 2745 ring r = currRing; 2739 2746 ideal G = (ideal) h->Data(); … … 2744 2751 else 2745 2752 #endif 2753 /*==================== Testing groebner basis =================*/ 2746 2754 #ifdef HAVE_RINGS 2747 /*==================== Testing groebner basis =================*/2748 2755 if (strcmp(sys_cmd, "NF_ring")==0) 2749 2756 { … … 2779 2786 else 2780 2787 #endif 2788 /*==================== sca?AltVar ==================================*/ 2781 2789 #ifdef HAVE_PLURAL 2782 /*==================== sca?AltVar ==================================*/2783 2790 if ( (strcmp(sys_cmd, "AltVarStart") == 0) || (strcmp(sys_cmd, "AltVarEnd") == 0) ) 2784 2791 { … … 2807 2814 else 2808 2815 #endif 2816 /*==================== RatNF, noncomm rational coeffs =================*/ 2809 2817 #ifdef HAVE_PLURAL 2810 2818 #ifdef HAVE_RATGRING 2811 /*==================== RatNF, noncomm rational coeffs =================*/2812 2819 if (strcmp(sys_cmd, "intratNF") == 0) 2813 2820 { … … 2818 2825 if ((h!=NULL) && (h->Typ()==POLY_CMD)) 2819 2826 { 2820 2821 2822 //Print("poly is done\n");2827 p=(poly)h->CopyD(); 2828 h=h->next; 2829 // Print("poly is done\n"); 2823 2830 } 2824 2831 else return TRUE; 2825 2832 if ((h!=NULL) && (h->Typ()==IDEAL_CMD)) 2826 2833 { 2827 2828 2829 2830 //Print("ideal is done\n");2834 I=(ideal)h->CopyD(); 2835 q = I->m; 2836 h=h->next; 2837 // Print("ideal is done\n"); 2831 2838 } 2832 2839 else return TRUE; 2833 2840 if ((h!=NULL) && (h->Typ()==INT_CMD)) 2834 2841 { 2835 2836 //res->rtyp=INT_CMD;2837 //Print("int is done\n");2838 //res->rtyp=IDEAL_CMD;2839 2840 { 2841 2842 is=(int)((long)(h->Data())); 2843 // res->rtyp=INT_CMD; 2844 // Print("int is done\n"); 2845 // res->rtyp=IDEAL_CMD; 2846 if (rIsPluralRing(currRing)) 2847 { 2848 id = IDELEMS(I); 2842 2849 int *pl=(int*)omAlloc0(IDELEMS(I)*sizeof(int)); 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 // res->data = ncGCD(p,q,currRing); 2853 2854 else 2855 2856 2857 2858 2850 for(k=0; k < id; k++) 2851 { 2852 pl[k] = pLength(I->m[k]); 2853 } 2854 Print("starting redRat\n"); 2855 //res->data = (char *) 2856 redRat(&p, q, pl, (int)IDELEMS(I),is,currRing); 2857 res->data=p; 2858 res->rtyp=POLY_CMD; 2859 // res->data = ncGCD(p,q,currRing); 2860 } 2861 else 2862 { 2863 res->rtyp=POLY_CMD; 2864 res->data=p; 2865 } 2859 2866 } 2860 2867 else return TRUE; … … 2869 2876 if ((h!=NULL) && ( (h->Typ()==POLY_CMD) || (h->Typ()==VECTOR_CMD) ) ) 2870 2877 { 2871 2872 2873 2878 p=(poly)h->CopyD(); 2879 h=h->next; 2880 htype = h->Typ(); 2874 2881 } 2875 2882 else return TRUE; 2876 2883 if ((h!=NULL) && ( (h->Typ()==POLY_CMD) || (h->Typ()==VECTOR_CMD) ) ) 2877 2884 { 2878 2879 2885 q=(poly)h->CopyD(); 2886 h=h->next; 2880 2887 } 2881 2888 else return TRUE; 2882 2889 if ((h!=NULL) && (h->Typ()==INT_CMD)) 2883 2890 { 2884 2885 2886 //res->rtyp=IDEAL_CMD;2887 2888 { 2889 2890 // res->data = ncGCD(p,q,currRing); 2891 2892 2891 is=(int)((long)(h->Data())); 2892 res->rtyp=htype; 2893 // res->rtyp=IDEAL_CMD; 2894 if (rIsPluralRing(currRing)) 2895 { 2896 res->data = nc_rat_ReduceSpolyNew(q,p,is, currRing); 2897 // res->data = ncGCD(p,q,currRing); 2898 } 2899 else res->data=p; 2893 2900 } 2894 2901 else return TRUE; … … 2903 2910 if ((h!=NULL) && (h->Typ()==POLY_CMD)) 2904 2911 { 2905 2906 2912 p=(poly)h->CopyD(); 2913 h=h->next; 2907 2914 } 2908 2915 else return TRUE; 2909 2916 if ((h!=NULL) && (h->Typ()==POLY_CMD)) 2910 2917 { 2911 2912 2918 q=(poly)h->CopyD(); 2919 h=h->next; 2913 2920 } 2914 2921 else return TRUE; 2915 2922 if ((h!=NULL) && (h->Typ()==INT_CMD)) 2916 2923 { 2917 2918 2919 //res->rtyp=IDEAL_CMD;2920 2921 { 2922 2923 // res->data = ncGCD(p,q,currRing); 2924 2925 2924 is=(int)((long)(h->Data())); 2925 res->rtyp=POLY_CMD; 2926 // res->rtyp=IDEAL_CMD; 2927 if (rIsPluralRing(currRing)) 2928 { 2929 res->data = nc_rat_CreateSpoly(p,q,is,currRing); 2930 // res->data = ncGCD(p,q,currRing); 2931 } 2932 else res->data=p; 2926 2933 } 2927 2934 else return TRUE; … … 2937 2944 if ((h!=NULL) && (h->Typ()==POLY_CMD)) 2938 2945 { 2939 2940 2946 start=pIsPurePower((poly)h->Data()); 2947 h=h->next; 2941 2948 } 2942 2949 else return TRUE; 2943 2950 if ((h!=NULL) && (h->Typ()==POLY_CMD)) 2944 2951 { 2945 2946 2952 end=pIsPurePower((poly)h->Data()); 2953 h=h->next; 2947 2954 } 2948 2955 else return TRUE; … … 2960 2967 if ((h!=NULL) && (h->Typ()==POLY_CMD)) 2961 2968 { 2962 2963 2969 p=(poly)h->CopyD(); 2970 h=h->next; 2964 2971 } 2965 2972 else return TRUE; 2966 2973 if ((h!=NULL) && (h->Typ()==INT_CMD)) 2967 2974 { 2968 2969 2975 sh=(int)((long)(h->Data())); 2976 h=h->next; 2970 2977 } 2971 2978 else return TRUE; … … 2973 2980 if ((h!=NULL) && (h->Typ()==INT_CMD)) 2974 2981 { 2975 2976 2982 uptodeg=(int)((long)(h->Data())); 2983 h=h->next; 2977 2984 } 2978 2985 else return TRUE; 2979 2986 if ((h!=NULL) && (h->Typ()==INT_CMD)) 2980 2987 { 2981 2982 2983 2988 lVblock=(int)((long)(h->Data())); 2989 res->data = pLPshift(p,sh,uptodeg,lVblock); 2990 res->rtyp = POLY_CMD; 2984 2991 } 2985 2992 else return TRUE; … … 2996 3003 if ((h!=NULL) && (h->Typ()==POLY_CMD)) 2997 3004 { 2998 2999 3005 p=(poly)h->CopyD(); 3006 h=h->next; 3000 3007 } 3001 3008 else return TRUE; 3002 3009 if ((h!=NULL) && (h->Typ()==INT_CMD)) 3003 3010 { 3004 3005 3006 3011 lV=(int)((long)(h->Data())); 3012 res->rtyp = INT_CMD; 3013 res->data = (void*)pLastVblock(p, lV); 3007 3014 } 3008 3015 else return TRUE; … … 3017 3024 if ((h!=NULL) && (h->Typ()==POLY_CMD)) 3018 3025 { 3019 3020 3026 p=(poly)h->CopyD(); 3027 h=h->next; 3021 3028 } 3022 3029 else return TRUE; 3023 3030 if ((h!=NULL) && (h->Typ()==INT_CMD)) 3024 3031 { 3025 3026 3027 //res->data = p_mShrink(p, lV, currRing);3028 //kStrategy strat=new skStrategy;3029 //strat->tailRing = currRing;3030 3032 lV=(int)((long)(h->Data())); 3033 res->rtyp = POLY_CMD; 3034 // res->data = p_mShrink(p, lV, currRing); 3035 // kStrategy strat=new skStrategy; 3036 // strat->tailRing = currRing; 3037 res->data = p_Shrink(p, lV, currRing); 3031 3038 } 3032 3039 else return TRUE; … … 3256 3263 if (h!=NULL) 3257 3264 { 3258 3259 3260 3265 extern ring rSubring(ring r,leftv v); /* ipshell.cc*/ 3266 res->data=(char *)rSubring(currRing,h); 3267 res->rtyp=RING_CMD; 3261 3268 return res->data==NULL; 3262 3269 } … … 3323 3330 if (strcmp(sys_cmd,"Singular++")==0) 3324 3331 { 3325 // using namespace SINGULAR_NS; 3332 // using namespace SINGULAR_NS; 3326 3333 extern BOOLEAN Main(leftv res, leftv h); // FALSE = Ok, TRUE = Error! 3327 3334 return Main(res, h); … … 3337 3344 if (strcmp(sys_cmd,"gfan")==0) 3338 3345 { 3339 3340 { 3341 3342 3343 3346 if ((h==NULL) || (h!=NULL && h->Typ()!=IDEAL_CMD)) 3347 { 3348 Werror("system(\"gfan\"...) Ideal expected"); 3349 return TRUE; //Ooooops 3350 } 3344 3351 ideal I=((ideal)h->Data()); 3345 3352 res->rtyp=IDEAL_CMD; … … 3347 3354 //res->rtyp=LIST_CMD; 3348 3355 //res->data= ??? 3349 3350 return FALSE; //Everything went fine 3356 3357 return FALSE; //Everything went fine 3351 3358 } 3352 3359 else
Note: See TracChangeset
for help on using the changeset viewer.