Changeset a3bc95e in git
- Timestamp:
- Oct 9, 2001, 6:36:27 PM (21 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 7497ef3773fc1afff892546445b1d82b1cf0fb05
- Parents:
- e58c4abd91b68d128331a23f3f9dd76dff924048
- Location:
- Singular
- Files:
-
- 92 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/clapconv.cc
re58c4a ra3bc95e 3 3 * Computer Algebra System SINGULAR * 4 4 ****************************************/ 5 // $Id: clapconv.cc,v 1.3 2 2000-12-08 17:26:22Singular Exp $5 // $Id: clapconv.cc,v 1.33 2001-10-09 16:35:56 Singular Exp $ 6 6 /* 7 7 * ABSTRACT: convert data between Singular and factory … … 210 210 { 211 211 number z=(number)omAllocBin(rnumber_bin); 212 #if defined(LDEBUG) 212 #if defined(LDEBUG) 213 213 z->debug=123456; 214 214 #endif … … 283 283 { 284 284 number z=(number)omAllocBin(rnumber_bin); 285 #if defined(LDEBUG) 285 #if defined(LDEBUG) 286 286 z->debug=123456; 287 287 #endif … … 581 581 { 582 582 number z=(number)omAllocBin(rnumber_bin); 583 #if defined(LDEBUG) 583 #if defined(LDEBUG) 584 584 z->debug=123456; 585 585 #endif -
Singular/cntrlc.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: cntrlc.cc,v 1.3 8 2001-08-27 14:46:50Singular Exp $ */4 /* $Id: cntrlc.cc,v 1.39 2001-10-09 16:35:56 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT - interupt handling … … 366 366 c = 'a'; 367 367 } 368 368 369 369 switch(c) 370 370 { … … 640 640 /* Under HPUX 9, system(...) returns -1 if SIGCHLD does not equal 641 641 SIG_DFL. However, if it stays at SIG_DFL we get zombie processes 642 for terminated childs generated by fork. Therefors some special treatment 642 for terminated childs generated by fork. Therefors some special treatment 643 643 is necessary */ 644 644 #ifdef HPUX_9 -
Singular/dError.h
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 9/00 9 * Version: $Id: dError.h,v 1. 5 2000-12-31 15:14:29 obachmanExp $9 * Version: $Id: dError.h,v 1.6 2001-10-09 16:35:56 Singular Exp $ 10 10 *******************************************************************/ 11 11 #ifndef DERROR_H … … 13 13 14 14 #ifdef __cplusplus 15 extern "C" 15 extern "C" 16 16 { 17 17 #endif -
Singular/distrib.h
re58c4a ra3bc95e 1 #undef MAKE_DISTRIBUTION 1 #undef MAKE_DISTRIBUTION -
Singular/emacs.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: emacs.cc,v 1.2 0 2001-08-27 14:46:56Singular Exp $ */4 /* $Id: emacs.cc,v 1.21 2001-10-09 16:35:57 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: Esingular main file … … 75 75 void fePrintReportBug(char* msg, char* file, int line) 76 76 { 77 error("YOU HAVE FOUND A BUG IN SINGULAR. 77 error("YOU HAVE FOUND A BUG IN SINGULAR. 78 78 Please, email the following output to singular@mathematik.uni-kl.de 79 Bug occured at %s:%d 80 Message: %s 79 Bug occured at %s:%d 80 Message: %s 81 81 Version: " S_UNAME S_VERSION1 " (%lu) " __DATE__ __TIME__, 82 82 file, line, msg, feVersionId); … … 100 100 int no_emacs_call = 0; 101 101 char cwd[MAXPATHLEN]; 102 102 103 103 // parse-cmdline options 104 104 105 105 feInitResources(argv[0]); 106 106 feResource('S'); 107 107 feResource('b'); 108 108 feResource('r'); 109 109 110 110 int optc, option_index; 111 112 while ((optc = fe_getopt_long(argc, argv, SHORT_OPTS_STRING, 111 112 while ((optc = fe_getopt_long(argc, argv, SHORT_OPTS_STRING, 113 113 feOptSpec, &option_index)) 114 114 != EOF) … … 119 119 feOptHelp(feArgv0); 120 120 exit(0); 121 121 122 122 case '?': 123 123 case ':': … … 134 134 emacs = fe_optarg; 135 135 break; 136 #else 136 #else 137 137 case FE_OPT_EMACS: 138 138 emacs = fe_optarg; 139 139 break; 140 140 141 141 case FE_OPT_EMACS_DIR: 142 142 emacs_dir = fe_optarg; 143 143 break; 144 144 145 145 case FE_OPT_EMACS_LOAD: 146 146 emacs_load = fe_optarg; 147 147 break; 148 #endif 148 #endif 149 149 case FE_OPT_SINGULAR: 150 150 singular = fe_optarg; … … 154 154 no_emacs_call = 1; 155 155 break; 156 156 157 157 default: 158 158 goto NEXT; 159 159 } 160 160 // delete options from option-list 161 if (fe_optind > 2 && *argv[fe_optind-1] != '-' && 161 if (fe_optind > 2 && *argv[fe_optind-1] != '-' && 162 162 fe_optarg != NULL && feOptSpec[option_index].has_arg) 163 163 { … … 181 181 if (emacs == NULL) 182 182 { 183 error( "Error: Can't find emacs xterm program. \n Expected it at %s or %s\n Specify alternative with --xterm=PROGRAM option,\n or set ESINGULAR_EMACS environment variable to the name of the program to use as xterm.\n", 183 error( "Error: Can't find emacs xterm program. \n Expected it at %s or %s\n Specify alternative with --xterm=PROGRAM option,\n or set ESINGULAR_EMACS environment variable to the name of the program to use as xterm.\n", 184 184 feResourceDefault('X')); 185 185 mainUsage(); 186 186 exit(1); 187 187 } 188 188 189 189 if (singular == NULL) singular = feResource("SingularXterm", 0); 190 190 if (singular == NULL) 191 191 { 192 error( "Error: Can't find singular executable.\n Expected it at %s\n Specify with --singular option,\n or set TSINGULAR_SINGULAR environment variable.\n", 192 error( "Error: Can't find singular executable.\n Expected it at %s\n Specify with --singular option,\n or set TSINGULAR_SINGULAR environment variable.\n", 193 193 feResourceDefault("SingularXterm")); 194 194 mainUsage(); … … 196 196 } 197 197 198 #ifdef WINNT 198 #ifdef WINNT 199 199 #define EXTRA_XTERM_ARGS "+vb -sl 2000 -fb Courier-bold-13 -tn linux -cr Red3" 200 200 #else … … 202 202 #endif 203 203 204 syscall = (char*) omAlloc(strlen(emacs) + 205 strlen(singular) + 204 syscall = (char*) omAlloc(strlen(emacs) + 205 strlen(singular) + 206 206 length + 300); 207 207 sprintf(syscall, "%s %s -e %s ", emacs, EXTRA_XTERM_ARGS, singular); … … 215 215 } 216 216 } 217 #else 217 #else 218 218 // make sure emacs, singular, emacs_dir, emacs_load are set 219 219 if (emacs == NULL) emacs = feResource("xemacs", 0); … … 221 221 if (emacs == NULL) 222 222 { 223 error( "Error: Can't find emacs or xemacs executable. \n Expected it at %s or %s\n Specify alternative with --emacs option,\n or set ESINGULAR_EMACS environment variable.\n", 223 error( "Error: Can't find emacs or xemacs executable. \n Expected it at %s or %s\n Specify alternative with --emacs option,\n or set ESINGULAR_EMACS environment variable.\n", 224 224 feResourceDefault("emacs"), feResourceDefault("xemacs")); 225 225 mainUsage(); 226 226 exit(1); 227 227 } 228 228 229 229 if (singular == NULL) singular = feResource("SingularEmacs", 0); 230 230 if (singular == NULL) 231 231 { 232 error( "Error: Can't find singular executable.\n Expected it at %s\n Specify with --singular option,\n or set ESINGULAR_SINGULAR environment variable.\n", 232 error( "Error: Can't find singular executable.\n Expected it at %s\n Specify with --singular option,\n or set ESINGULAR_SINGULAR environment variable.\n", 233 233 feResourceDefault("SingularEmacs")); 234 234 mainUsage(); 235 235 exit(1); 236 236 } 237 237 238 238 if (emacs_dir == NULL) emacs_dir = feResource("EmacsDir", 0); 239 239 if (emacs_dir == NULL) 240 240 { 241 error( "Error: Can't find emacs directory for Singular lisp files. \n Expected it at %s\n Specify with --emacs_dir option,\n or set ESINGULAR_EMACS_DIR environment variable.\n", 241 error( "Error: Can't find emacs directory for Singular lisp files. \n Expected it at %s\n Specify with --emacs_dir option,\n or set ESINGULAR_EMACS_DIR environment variable.\n", 242 242 feResourceDefault("EmacsDir")); 243 243 mainUsage(); … … 245 245 } 246 246 247 if (emacs_load == NULL) 247 if (emacs_load == NULL) 248 248 { 249 249 // look into env variable … … 268 268 if (emacs_load == NULL) 269 269 { 270 error( "Error: Can't find emacs load file for Singular mode. \n Expected it at %s\n Specify with --emacs_load option,\n or set ESINGULAR_EMACS_LOAD environment variable,\n or put file '.emacs-singular' in your home directory.\n", 271 feResourceDefault("EmacsLoad")); 270 error( "Error: Can't find emacs load file for Singular mode. \n Expected it at %s\n Specify with --emacs_load option,\n or set ESINGULAR_EMACS_LOAD environment variable,\n or put file '.emacs-singular' in your home directory.\n", 271 feResourceDefault("EmacsLoad")); 272 272 mainUsage(); 273 273 exit(1); … … 276 276 } 277 277 } 278 279 syscall = (char*) omAlloc(strlen(emacs) + 280 strlen(singular) + 281 strlen(emacs_dir) + 278 279 syscall = (char*) omAlloc(strlen(emacs) + 280 strlen(singular) + 281 strlen(emacs_dir) + 282 282 strlen(emacs_load) + 283 283 length + 300); … … 288 288 // append / at the end of cwd 289 289 if (cwd[strlen(cwd)-1] != '/') strcat(cwd, "/"); 290 291 // Note: option -no-init-file should be equivalent to -q. Anyhow, 290 291 // Note: option -no-init-file should be equivalent to -q. Anyhow, 292 292 // xemacs-20.4 sometimes crashed on startup when using -q. DonŽt know why. 293 293 sprintf(syscall, "%s %seval '(setq singular-emacs-home-directory \"%s\")' %sno-init-file %sl %s %seval '(singular-other \"%s\" \"%s\" (list ", 294 emacs, prefix, emacs_dir, prefix, prefix, emacs_load, prefix, 294 emacs, prefix, emacs_dir, prefix, prefix, emacs_load, prefix, 295 295 singular, cwd); 296 296 -
Singular/extra.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: extra.cc,v 1.16 8 2001-09-27 15:56:25Singular Exp $ */4 /* $Id: extra.cc,v 1.169 2001-10-09 16:35:57 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: general interface to internals of Singular ("system" command) … … 246 246 #ifdef HAVE_NAMESPACES 247 247 TEST_FOR("Namespaces"); 248 #endif 249 #ifdef HAVE_NS 250 TEST_FOR("namespaces"); 248 251 #endif 249 252 #ifdef HAVE_DYNAMIC_LOADING … … 1023 1026 { 1024 1027 #ifdef HAVE_NS 1025 idhdl hh=basePack->idroot; 1026 while (hh!=NULL) 1027 { 1028 if (IDDATA(hh)==(void *)currRing) PrintS("(R)"); 1029 else if (IDDATA(hh)==(void *)currPack) PrintS("(P)"); 1030 else PrintS(" "); 1031 Print("::%s, typ %s level %d\n", 1032 IDID(hh),Tok2Cmdname(IDTYP(hh)),IDLEV(hh)); 1033 hh=IDNEXT(hh); 1034 } 1035 hh=basePack->idroot; 1036 while (hh!=NULL) 1037 { 1038 if (IDDATA(hh)==(void *)basePack) 1039 Print("(T)::%s, typ %s level %d\n", 1040 IDID(hh),Tok2Cmdname(IDTYP(hh)),IDLEV(hh)); 1041 else 1042 if ((IDTYP(hh)==RING_CMD) 1043 || (IDTYP(hh)==QRING_CMD) 1044 || (IDTYP(hh)==PACKAGE_CMD)) 1045 { 1046 idhdl h2=IDRING(hh)->idroot; 1047 while (h2!=NULL) 1048 { 1049 if (IDDATA(h2)==(void *)currRing) PrintS("(R)"); 1050 else if (IDDATA(h2)==(void *)currPack) PrintS("(P)"); 1051 else PrintS(" "); 1052 Print("%s::%s, typ %s level %d\n", 1053 IDID(hh),IDID(h2),Tok2Cmdname(IDTYP(h2)),IDLEV(h2)); 1054 h2=IDNEXT(h2); 1055 } 1056 } 1057 hh=IDNEXT(hh); 1058 } 1059 #else 1028 listall(); 1029 #else 1060 1030 idhdl hh=IDROOT; 1061 1031 while (hh!=NULL) -
Singular/feOpt.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: feOpt.cc,v 1.1 8 2001-09-19 09:49:37Singular Exp $ */4 /* $Id: feOpt.cc,v 1.19 2001-10-09 16:35:58 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: Implementation of option buisness … … 67 67 {"xterm", required_argument, LONG_OPTION_RETURN, 68 68 "XTERM", "Use XTERM as terminal program to run Singular", feOptString, 0, 0}, 69 #endif 69 #endif 70 70 71 71 {"singular", required_argument, LONG_OPTION_RETURN, … … 184 184 #elif defined(TSINGULAR) 185 185 fd = fopen("feOptTS.inc", "w"); 186 #else 186 #else 187 187 fd = fopen("feOpt.inc", "w"); 188 188 #endif … … 375 375 else 376 376 sdb_flags = 0; 377 #endif 377 #endif 378 378 return NULL; 379 379 -
Singular/feOpt.h
re58c4a ra3bc95e 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: feOpt.h,v 1. 6 2000-05-05 18:40:28 obachmanExp $ */6 /* $Id: feOpt.h,v 1.7 2001-10-09 16:35:58 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT: Declarations for working with Options … … 12 12 13 13 extern const char SHORT_OPTS_STRING[]; 14 #define LONG_OPTION_RETURN 13 14 #define LONG_OPTION_RETURN 13 15 15 16 16 /* specifies format of options */ … … 37 37 38 38 void* feGetOptValue(feOptIndex opt); 39 39 40 40 41 41 #ifdef __cplusplus … … 48 48 inline int feOptValue(feOptIndex opt, char** val) 49 49 { 50 if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type == feOptString) 50 if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type == feOptString) 51 51 { 52 52 *val = (char*) feOptSpec[(int)opt].value; … … 58 58 inline int feOptValue(feOptIndex opt, int* val) 59 59 { 60 if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type != feOptString) 60 if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type != feOptString) 61 61 { 62 62 *val = (int) feOptSpec[(int)opt].value; … … 66 66 return FALSE; 67 67 } 68 68 69 69 // maps name to otions 70 70 feOptIndex feGetOptIndex(const char* name); -
Singular/fegetopt.h
re58c4a ra3bc95e 15 15 along with this program; if not, write to the Free Software 16 16 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 17 /* 18 obachman 9/99: adapted to Singular by 17 /* 18 obachman 9/99: adapted to Singular by 19 19 * adding prefix fe_ to global variables 20 * extended fe_option structure 20 * extended fe_option structure 21 21 */ 22 22 … … 91 91 const char* help; // (short) help string 92 92 feOptType type; // type of argument, if has_arg > 0 93 void* value; // (default) value of option 93 void* value; // (default) value of option 94 94 int set; // only relevant for strings: 0 if not set, 1 if set 95 95 }; -
Singular/fehelp.cc
re58c4a ra3bc95e 601 601 yylplex(str, libnamebuf, &lib_style, IDROOT, FALSE, GET_INFO); 602 602 #else /* HAVE_NAMESPACES */ 603 #ifdef HAVE_NS 604 yylplex(str, libnamebuf, &lib_style, IDROOT, FALSE, GET_INFO); 605 #else /* HAVE_NS */ 603 606 yylplex(str, libnamebuf, &lib_style, GET_INFO); 607 #endif /* HAVE_NS */ 604 608 #endif /* HAVE_NAMESPACES */ 605 609 reinit_yylp(); -
Singular/fglm.cc
re58c4a ra3bc95e 1 1 // emacs edit mode for this file is -*- C++ -*- 2 // $Id: fglm.cc,v 1.2 5 2001-01-12 13:47:09 Singular Exp $2 // $Id: fglm.cc,v 1.26 2001-10-09 16:35:59 Singular Exp $ 3 3 4 4 /**************************************** … … 147 147 else 148 148 pperm= NULL; 149 maFindPerm( sring->names, nvar, sring->parameter, npar, 150 dring->names, nvar, dring->parameter, npar, vperm, pperm, 149 maFindPerm( sring->names, nvar, sring->parameter, npar, 150 dring->names, nvar, dring->parameter, npar, vperm, pperm, 151 151 dring->ch); 152 152 for ( k= nvar; (k > 0) && (state == FglmOk); k-- ) … … 187 187 // check if dring->qideal is contained in sring->qideal: 188 188 int * dsvperm = (int *)omAlloc0( (nvar+1)*sizeof( int ) ); 189 maFindPerm( dring->names, nvar, NULL, 0, sring->names, nvar, NULL, 0, 189 maFindPerm( dring->names, nvar, NULL, 0, sring->names, nvar, NULL, 0, 190 190 dsvperm, NULL, sring->ch); 191 191 nMap=nSetMap(dring); … … 341 341 else if ( pIsConstant( quot ) ) state= FglmPolyIsOne; 342 342 } 343 343 344 344 if ( state == FglmOk ) { 345 345 assumeStdFlag( first ); -
Singular/fglmhom.cc
re58c4a ra3bc95e 1 1 // emacs edit mode for this file is -*- C++ -*- 2 // $Id: fglmhom.cc,v 1.1 7 2000-09-18 09:18:58 obachmanExp $2 // $Id: fglmhom.cc,v 1.18 2001-10-09 16:35:59 Singular Exp $ 3 3 4 4 /**************************************** … … 68 68 } 69 69 #ifndef HAVE_EXPLICIT_CONSTR 70 void initialize( poly m, int b, BOOLEAN ind ) 70 void initialize( poly m, int b, BOOLEAN ind ) 71 71 { 72 72 basis = b; … … 75 75 mon.sm = NULL; 76 76 } 77 void initialize( const homogElem h ) 77 void initialize( const homogElem h ) 78 78 { 79 79 basis = h.basis; … … 166 166 #ifdef HAVE_EXPLICIT_CONSTR 167 167 // Expand array using Singulars ReAlloc function 168 dat->monlist= 169 (homogElem * )omReallocSize( dat->monlist, 170 (dat->monlistmax)*sizeof( homogElem ), 168 dat->monlist= 169 (homogElem * )omReallocSize( dat->monlist, 170 (dat->monlistmax)*sizeof( homogElem ), 171 171 (dat->monlistmax+dat->monlistblock) * sizeof( homogElem ) ); 172 172 for ( k= dat->monlistmax; k < (dat->monlistmax+dat->monlistblock); k++ ) … … 177 177 homogElem * tempelem = new homogElem[ newsize ]; 178 178 // Copy old elements 179 for ( k= dat->monlistmax - 1; k >= 0; k-- ) 179 for ( k= dat->monlistmax - 1; k >= 0; k-- ) 180 180 tempelem[k].initialize( dat->monlist[k] ); 181 181 delete [] homogElem; … … 363 363 // Map the sourceHeads to the destRing 364 364 int * vperm = (int *)omAlloc( (sourceRing->N + 1)*sizeof(int) ); 365 maFindPerm( sourceRing->names, sourceRing->N, NULL, 0, currRing->names, 365 maFindPerm( sourceRing->names, sourceRing->N, NULL, 0, currRing->names, 366 366 currRing->N, NULL, 0, vperm, NULL, currRing->ch); 367 367 //nSetMap( sourceRing->ch, sourceRing->parameter, sourceRing->P, sourceRing->minpoly ); -
Singular/fglmzero.cc
re58c4a ra3bc95e 1 1 // emacs edit mode for this file is -*- C++ -*- 2 // $Id: fglmzero.cc,v 1.3 3 2001-01-09 15:40:06Singular Exp $2 // $Id: fglmzero.cc,v 1.34 2001-10-09 16:36:00 Singular Exp $ 3 3 4 4 /**************************************** … … 661 661 // STICKYPROT("Calculating vector rep\n"); 662 662 v = data.getVectorRep( p ); 663 // if ( v.isZero() ) 663 // if ( v.isZero() ) 664 664 // STICKYPROT("vectorrep is 0\n"); 665 665 return ( data.state() ); … … 1020 1020 initv = iv; 1021 1021 } 1022 1022 1023 1023 poly one = pOne(); 1024 1024 data.updateCandidates( one, initv ); -
Singular/gnumpc.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: gnumpc.cc,v 1.2 0 2001-03-22 19:10:59Singular Exp $ */4 /* $Id: gnumpc.cc,v 1.21 2001-10-09 16:36:00 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: computations with GMP complex floating-point numbers … … 322 322 gmp_complex* n = new gmp_complex(((gmp_complex*)a)->real()); 323 323 return (number)n; 324 } 325 324 } 325 326 326 number ngcImPart(number a) 327 327 { … … 329 329 gmp_complex* n = new gmp_complex(((gmp_complex*)a)->imag()); 330 330 return (number)n; 331 } 332 331 } 332 333 333 /*2 334 334 * za >= 0 ? -
Singular/gnumpc.h
re58c4a ra3bc95e 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: gnumpc.h,v 1.1 0 2001-03-22 19:11:00 Singular Exp $ */6 /* $Id: gnumpc.h,v 1.11 2001-10-09 16:36:00 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT: computations with GMP floating-point numbers … … 48 48 // folded-file: t *** 49 49 // compile-command: "make installg" *** 50 // End: *** 50 // End: *** -
Singular/gr_kstd2.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: gr_kstd2.cc,v 1. 2 2001-08-27 14:47:00Singular Exp $ */4 /* $Id: gr_kstd2.cc,v 1.3 2001-10-09 16:36:01 Singular Exp $ */ 5 5 /* $Log: not supported by cvs2svn $ 6 /* Revision 1.2 2001/08/27 14:47:00 Singular 7 /* *hannes: merge-2-0-2 8 /* 6 9 /* Revision 1.1.2.2 2001/08/16 13:17:29 Singular 7 10 /* * hannes: removed rcsid … … 580 583 pLmFree((*h).lcm); 581 584 (*h).lcm=NULL; 582 } 585 } 583 586 (*h).p = NULL; 584 587 return 0; -
Singular/grammar.y
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: grammar.y,v 1.9 3 2001-09-25 16:07:26Singular Exp $ */4 /* $Id: grammar.y,v 1.94 2001-10-09 16:36:01 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: SINGULAR shell grammatik … … 1133 1133 #ifdef HAVE_NS 1134 1134 #else 1135 Print("%s::%s;\n", (char *)$4.Name(),$2.Name()); 1135 Print("%s::%s;\n", (char *)$4.Name(),$2.Name()); 1136 1136 #endif /* HAVE_NS */ 1137 1137 #endif /* HAVE_NAMESPACES */ … … 1430 1430 idhdl h=(idhdl)$2.data; 1431 1431 if ($2.e!=NULL) h=rFindHdl((ring)$2.Data(),NULL, NULL); 1432 //Print("setring %s lev %d (ptr:%x)\n",IDID(h),IDLEV(h),IDRING(h)); 1432 1433 if ($1==KEEPRING_CMD) 1433 1434 { … … 1461 1462 if (BVERBOSE(V_REDEFINE)) 1462 1463 Warn("redefining %s",IDID(p)); 1463 killhdl (old,&root);1464 killhdl2(old,&root); 1464 1465 } 1465 1466 IDLEV(p)=prevlev; … … 1467 1468 p=IDNEXT(p); 1468 1469 } 1470 IDRING(h)->idroot=root; 1469 1471 //} 1470 1472 } 1471 1473 #ifdef USE_IILOCALRING 1472 1474 iiLocalRing[myynest-1]=IDRING(h); 1473 #e lse1475 #endif 1474 1476 procstack->currRing=IDRING(h); 1475 1477 procstack->currRingHdl=h; 1476 #endif1477 1478 } 1478 1479 else -
Singular/gring.cc
re58c4a ra3bc95e 7 7 * Author: levandov (Viktor Levandovsky) 8 8 * Created: 8/00 - 11/00 9 * Version: $Id: gring.cc,v 1. 9 2001-02-28 11:54:49 levandovExp $9 * Version: $Id: gring.cc,v 1.10 2001-10-09 16:36:02 Singular Exp $ 10 10 *******************************************************************/ 11 11 #include "mod2.h" … … 81 81 Exponent_t expP=0; 82 82 Exponent_t expOut=0; 83 83 84 84 while (p!=NULL) 85 85 { … … 87 87 p_Test(v,r); 88 88 p_Test(p,r); 89 89 90 90 expP=p_GetComp(v,r); 91 91 if (expP==0) … … 98 98 { 99 99 expOut=expM; 100 } 100 } 101 101 } 102 102 else … … 113 113 } 114 114 } 115 115 116 116 p_GetExpV(v,P,r); 117 117 cP=p_GetCoeff(v,r); … … 155 155 Exponent_t expP=0; 156 156 Exponent_t expOut=0; 157 157 158 158 while (p!=NULL) 159 159 { … … 161 161 p_Test(v,r); 162 162 p_Test(p,r); 163 163 164 164 expP=p_GetComp(v,r); 165 165 if (expP==0) … … 172 172 { 173 173 expOut=expM; 174 } 174 } 175 175 } 176 176 else … … 186 186 } 187 187 } 188 188 189 189 p_GetExpV(v,P,r); 190 190 cP=p_GetCoeff(v,r); … … 222 222 F[0]=0; 223 223 G[0]=0; 224 224 225 225 iF=r->N; 226 226 while ((F[iF]==0)&&(iF>=1)) iF--; /* last exp_num of F */ … … 237 237 { 238 238 F[i]=F[i]+G[i]; 239 } 239 } 240 240 p_SetExpV(out,F,r); 241 241 p_Setm(out,r); … … 248 248 // g is univariate monomial 249 249 { 250 // if (ri->nc->type==nc_skew) -- postpone to TU 250 // if (ri->nc->type==nc_skew) -- postpone to TU 251 251 out=nc_mm_Mult_uu(F,jG,G[jG],r); 252 252 freeT(F,r->N); … … 254 254 return(out); 255 255 } 256 256 257 257 number n1=n_Init(1,r); 258 258 Exponent_t *Prv=(Exponent_t *)omAlloc0(ExpSize); … … 331 331 p_Setm(Pn,r); 332 332 p_Test(Pn,r); 333 333 334 334 // if (pNext(D)==0) 335 335 // is D a monomial? could be postponed higher … … 339 339 // else 340 340 // { 341 Rout=nc_p_Mult_mm(D,Pn,r); 341 Rout=nc_p_Mult_mm(D,Pn,r); 342 342 // } 343 343 } … … 347 347 D=NULL; 348 348 } 349 349 350 350 if (Rout!=NULL) 351 351 { … … 395 395 int i; 396 396 number num=NULL; 397 397 398 398 int iF=r->N; 399 399 while ((F[iF]==0)&&(iF>0)) iF-- ; /* last exponent_num of F */ … … 426 426 return(out); 427 427 } 428 428 429 429 Exponent_t *Prv=(Exponent_t*)omAlloc0((r->N+1)*sizeof(Exponent_t)); 430 430 Exponent_t *Nxt=(Exponent_t*)omAlloc0((r->N+1)*sizeof(Exponent_t)); … … 518 518 kk=lF[cnt+1]; 519 519 On[kk]=F[kk]; 520 520 521 521 Pn=pOne(); 522 522 p_SetExpV(Pn,On,r); … … 562 562 /* leadterm and Prv-part with coef 1 */ 563 563 // U[0]=exp; 564 564 565 565 // U[jG]=U[jG]+bG; /* make leadterm */ 566 566 // ??????????? we have done it already :-0 … … 587 587 } 588 588 589 //----------pMultUU--------- 589 //----------pMultUU--------- 590 590 poly nc_uu_Mult_ww (int i, int a, int j, int b, const ring r) 591 591 { 592 592 poly out=NULL; 593 593 number tmp_number=NULL; 594 595 //Now check zero exeptions, commutativity and should we do something at all? 594 595 //Now check zero exeptions, commutativity and should we do something at all? 596 596 out=pOne(); 597 597 p_SetExp(out,j,b,r); … … 600 600 p_Setm(out,r); 601 601 if ((a==0)||(b==0)||(i<=j)) return(out);//zero exeptions and usual case 602 602 603 603 if (MATELEM(r->nc->COM,j,i)!=NULL) 604 604 //commutative or quasicommutative case … … 607 607 { 608 608 return(out); 609 } 609 } 610 610 else 611 611 { … … 629 629 return (out); 630 630 } 631 632 // poly C=MATELEM(r->nc->C,j,i); 633 // number c=p_GetCoeff(C,r); //coeff 631 632 // poly C=MATELEM(r->nc->C,j,i); 633 // number c=p_GetCoeff(C,r); //coeff 634 634 // p_Delete(&C,r); 635 635 636 636 int newcMTsize=0; 637 637 int k,m; 638 638 p_Delete(&out,r);//Shura thinks it is nesessary 639 639 640 640 641 641 if (a>=b) {newcMTsize=a;} else {newcMTsize=b;} 642 642 if (newcMTsize>cMTsize) … … 644 644 newcMTsize = newcMTsize+cMTsize; 645 645 matrix tmp = mpNew(newcMTsize,newcMTsize); 646 646 647 647 for (k=1;k<r->N;k++) 648 648 { … … 662 662 poly x=pOne();p_SetExp(x,j,1,r);p_Setm(x,r);//var(j); 663 663 poly y=pOne();p_SetExp(y,i,1,r);p_Setm(y,r);//var(i); for convenience 664 664 665 665 poly t=NULL; 666 666 /* ------------ Main Cycles ----------------------------*/ … … 679 679 t=NULL; 680 680 } 681 681 682 682 for (m=2;m<=b;m++) 683 683 { … … 762 762 int i=0; 763 763 int nv=r->N; 764 764 765 765 Exponent_t *A1=(Exponent_t *)omAlloc0((r->N+1)*sizeof(Exponent_t)); 766 766 Exponent_t *A2=(Exponent_t *)omAlloc0((r->N+1)*sizeof(Exponent_t)); -
Singular/gring.h
re58c4a ra3bc95e 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: gring.h,v 1. 7 2001-02-28 11:54:49 levandovExp $ */6 /* $Id: gring.h,v 1.8 2001-10-09 16:36:02 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT additional defines etc for --with-plural … … 20 20 // other routines we need in addition : 21 21 poly nc_mm_Mult_p(const poly m, poly p, const ring r); 22 poly nc_mm_Mult_nn (Exponent_t *F, Exponent_t *G, const ring r); 22 poly nc_mm_Mult_nn (Exponent_t *F, Exponent_t *G, const ring r); 23 23 poly nc_mm_Mult_uu (Exponent_t *F,int jG,int bG, const ring r); 24 24 poly nc_uu_Mult_ww (int i, int a, int j, int b, const ring r); -
Singular/ideals.h
re58c4a ra3bc95e 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: ideals.h,v 1.3 4 2001-03-05 16:41:48 mschulzeExp $ */6 /* $Id: ideals.h,v 1.35 2001-10-09 16:36:02 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT - all basic methods to manipulate ideals … … 60 60 61 61 long idRankFreeModule(ideal m, ring lmRing, ring tailRing); 62 inline long idRankFreeModule(ideal m, ring r = currRing) 62 inline long idRankFreeModule(ideal m, ring r = currRing) 63 63 {return idRankFreeModule(m, r, r);} 64 64 -
Singular/intvec.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: intvec.cc,v 1.2 3 2001-01-31 18:04:51Singular Exp $ */4 /* $Id: intvec.cc,v 1.24 2001-10-09 16:36:03 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: class intvec: lists/vectors of integers … … 323 323 324 324 /*2 325 *computes a triangular matrix 325 *computes a triangular matrix 326 326 */ 327 327 //void ivTriangMat(intvec * imat) … … 332 332 // i *= imat->cols(); 333 333 // for(j=k;j>=i;j--) 334 // (*imat)[j] = 0; 334 // (*imat)[j] = 0; 335 335 //} 336 336 … … 353 353 static void ivContent(intvec *); 354 354 static int ivL1Norm(intvec *); 355 static int ivCondNumber(intvec *, int); 355 static int ivCondNumber(intvec *, int); 356 356 357 357 /* Triangulierung in intmat.cc */ … … 697 697 for(k=w->rows()-1;k>=0;k--) 698 698 (*res)[k] = (*w)[k]; 699 } 699 } 700 700 } 701 701 -
Singular/iparith.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: iparith.cc,v 1.26 7 2001-09-25 16:07:26Singular Exp $ */4 /* $Id: iparith.cc,v 1.268 2001-10-09 16:36:03 Singular Exp $ */ 5 5 6 6 /* … … 763 763 case PACKAGE_CMD: 764 764 packhdl = (idhdl)u->data; 765 if((!IDPACKAGE(packhdl)->loaded) 765 if((!IDPACKAGE(packhdl)->loaded) 766 766 && (IDPACKAGE(packhdl)->language > LANG_TOP)) 767 767 { … … 1458 1458 leftv sl = iiMake_proc((idhdl)u->data,u,v); 1459 1459 #else /* HAVE_NAMESPACES */ 1460 #ifdef HAVE_NS 1461 leftv sl; 1462 if (u->req_packhdl==currPack) 1463 sl = iiMake_proc((idhdl)u->data,NULL,v); 1464 else 1465 sl = iiMake_proc((idhdl)u->data,u->req_packhdl,v); 1466 #else /* HAVE_NS */ 1460 1467 leftv sl = iiMake_proc((idhdl)u->data,v); 1468 #endif /* HAVE_NS */ 1461 1469 #endif /* HAVE_NAMESPACES */ 1462 1470 if (sl==NULL) … … 2559 2567 leftv sl = iiMake_proc((idhdl) u->data,u,NULL); 2560 2568 #else /* HAVE_NAMESPACES */ 2569 #ifdef HAVE_NS 2570 leftv sl = iiMake_proc((idhdl) u->data,u->req_packhdl,NULL); 2571 #else /* HAVE_NS */ 2561 2572 leftv sl = iiMake_proc((idhdl) u->data,NULL); 2573 #endif /* HAVE_NS */ 2562 2574 #endif /* HAVE_NAMESPACES */ 2563 2575 if (sl==NULL) -
Singular/ipid.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: ipid.cc,v 1.5 3 2001-09-25 16:07:27Singular Exp $ */4 /* $Id: ipid.cc,v 1.54 2001-10-09 16:36:04 Singular Exp $ */ 5 5 6 6 /* … … 46 46 #ifdef HAVE_NS 47 47 idhdl currPackHdl = NULL; 48 idhdl basePackHdl = NULL; 48 49 package currPack =NULL; 49 50 package basePack =NULL; … … 350 351 else if ((IDTYP(h) == t)||(t==DEF_CMD)) 351 352 { 353 if ((IDTYP(h)==PACKAGE_CMD) 354 && (strcmp(s,"Top")==0)) 355 { 356 goto errlabel; 357 } 352 358 if (BVERBOSE(V_REDEFINE)) 353 359 #ifdef KAI … … 357 363 #endif 358 364 #ifdef HAVE_NAMESPACES 359 if(t==PACKAGE_CMD && strcmp(s,"Top")==0) {360 Warn("identifier `%s` in use",s);361 return(h);362 }363 #endif /* HAVE_NAMESPACES */ 364 if (s==IDID(h)) 365 366 killhdl (h,root);365 if(t==PACKAGE_CMD && strcmp(s,"Top")==0) 366 { 367 Warn("identifier `%s` in use",s); 368 return(h); 369 } 370 #endif /* HAVE_NAMESPACES */ 371 if (s==IDID(h)) IDID(h)=NULL; 372 killhdl2(h,root); 367 373 } 368 374 else … … 375 381 { 376 382 if (IDLEV(h)!=lev) 377 {378 383 s=omStrDup(s); 379 }380 384 else if ((IDTYP(h) == t)||(t==DEF_CMD)) 381 385 { … … 386 390 Warn("redefining %s **",s); 387 391 #endif 388 IDID(h)=NULL;389 killhdl (h,&IDROOT);392 if (s==IDID(h)) IDID(h)=NULL; 393 killhdl2(h,&IDROOT); 390 394 } 391 395 else 392 {393 396 goto errlabel; 394 }395 397 } 396 398 } … … 423 425 #endif 424 426 IDID(h)=NULL; 425 killhdl (h,&currRing->idroot);427 killhdl2(h,&currRing->idroot); 426 428 } 427 429 else … … 431 433 } 432 434 } 433 return *root = (*root)->set(s, lev, t, init); 435 *root = (*root)->set(s, lev, t, init); 436 checkall(); 437 return *root; 434 438 435 439 errlabel: … … 452 456 if (h!=NULL) 453 457 { 454 killhdl (h,&(currRing->idroot));458 killhdl2(h,&(currRing->idroot)); 455 459 return; 456 460 } … … 459 463 return; 460 464 } 461 killhdl (h,ih);465 killhdl2(h,ih); 462 466 } 463 467 else … … 469 473 int t=IDTYP(h); 470 474 if ((BEGIN_RING<t) && (t<END_RING) && (t!=QRING_CMD)) 471 killhdl (h,&currRing->idroot);475 killhdl2(h,&currRing->idroot); 472 476 else 473 477 { … … 475 479 if(t==PACKAGE_CMD) 476 480 { 477 killhdl (h,&NSROOT(namespaceroot->root));481 killhdl2(h,&NSROOT(namespaceroot->root)); 478 482 } 479 483 else 480 484 #endif /* HAVE_NAMESPACES */ 485 #ifdef HAVE_NS 486 if(t==PACKAGE_CMD) 487 { 488 killhdl2(h,&(basePack->idroot)); 489 } 490 else 491 { 492 idhdl s=currPack->idroot; 493 while ((s!=h) && (s!=NULL)) s=s->next; 494 if (s!=NULL) 495 killhdl2(h,&(currPack->idroot)); 496 else if (basePack!=currPack) 497 { 498 idhdl s=basePack->idroot; 499 while ((s!=h) && (s!=NULL)) s=s->next; 500 if (s!=NULL) 501 killhdl2(h,&(basePack->idroot)); 502 else 503 killhdl2(h,&(currRing->idroot)); 504 } 505 } 506 #else /* HAVE_NS */ 481 507 { 482 508 idhdl s=IDROOT; 483 509 while ((s!=h) && (s!=NULL)) s=s->next; 484 if (s==NULL) killhdl(h,&currRing->idroot); 485 else killhdl(h,&IDROOT); 486 } 487 } 488 } 489 490 void killhdl(idhdl h, idhdl * ih) 510 if (s==NULL) killhdl2(h,&(currRing->idroot)); 511 else killhdl2(h,&IDROOT); 512 } 513 #endif /* HAVE_NAMESPACES */ 514 } 515 } 516 517 void killhdl2(idhdl h, idhdl * ih) 491 518 { 492 519 //printf("kill %s, id %x, typ %d lev: %d\n",IDID(h),(int)IDID(h),IDTYP(h),IDLEV(h)); … … 501 528 } 502 529 // ring / qring -------------------------------------------------------- 530 if ((IDTYP(h) == PACKAGE_CMD) && (strcmp(IDID(h),"Top")==0)) 531 { 532 WarnS("can not kill `Top`"); 533 return; 534 } 503 535 if ((IDTYP(h) == RING_CMD) || (IDTYP(h) == QRING_CMD)) 504 536 { … … 533 565 { 534 566 temp = IDNEXT(hdh); 535 killhdl (hdh,&(IDRING(h)->idroot));567 killhdl2(hdh,&(IDRING(h)->idroot)); 536 568 hdh = temp; 537 569 } 538 killhdl (*hd,hd);570 killhdl2(*hd,hd); 539 571 } 540 572 // reset currRing ? … … 581 613 } 582 614 #endif /* HAVE_NAMESPACES */ 615 #ifdef HAVE_NS 616 // package ------------------------------------------------------------- 617 else if (IDTYP(h) == PACKAGE_CMD) 618 { 619 // any objects defined for this package ? 620 if ((IDPACKAGE(h)->ref<=0) && (IDPACKAGE(h)->idroot!=NULL)) 621 { 622 if (currPack==IDPACKAGE(h)) 623 { 624 currPack=basePack; 625 currPackHdl=NULL; 626 } 627 idhdl * hd = &IDRING(h)->idroot; 628 idhdl hdh = IDNEXT(*hd); 629 idhdl temp; 630 while (hdh!=NULL) 631 { 632 temp = IDNEXT(hdh); 633 killhdl2(hdh,&(IDPACKAGE(h)->idroot)); 634 hdh = temp; 635 } 636 killhdl2(*hd,hd); 637 } 638 paKill(IDPACKAGE(h)); 639 if (currPackHdl==h) currPackHdl=packFindHdl(currPack); 640 } 641 #endif /* HAVE_NS */ 583 642 // poly / vector ------------------------------------------------------- 584 643 else if ((IDTYP(h) == POLY_CMD) || (IDTYP(h) == VECTOR_CMD)) … … 644 703 // general ------------------------------------------------------------- 645 704 // now dechain it and delete idrec 646 #ifdef KAI _705 #ifdef KAI 647 706 if(h->next != NULL) 648 707 Print("=======>%s(%x) -> %s<====\n", IDID(h), IDID(h), IDID(h->next)); … … 657 716 { 658 717 // h is at the beginning of the list 659 *ih = IDNEXT( *ih);718 *ih = IDNEXT(h) /* ==*ih */; 660 719 } 661 720 else … … 778 837 * move 'tomove' from root1 list to root2 list 779 838 */ 780 static voidipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)839 static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2) 781 840 { 782 841 idhdl h; … … 784 843 h=root2; 785 844 while ((h!=NULL) && (h!=tomove)) h=IDNEXT(h); 786 if (h!=NULL) return ;845 if (h!=NULL) return FALSE; /*okay */ 787 846 /* search predecessor of h in root1, remove 'tomove' */ 788 847 h=root1; … … 794 853 { 795 854 while ((h!=NULL) && (IDNEXT(h)!=tomove)) h=IDNEXT(h); 796 if (h==NULL) return ; /* not in the list root1 -> do nothing */855 if (h==NULL) return TRUE; /* not in the list root1 -> do nothing */ 797 856 IDNEXT(h)=IDNEXT(tomove); 798 857 } … … 800 859 IDNEXT(tomove)=root2; 801 860 root2=tomove; 861 return FALSE; 802 862 } 803 863 … … 806 866 if ((currRing!=NULL)&&(tomove!=NULL)) 807 867 { 808 if (((QRING_CMD!=IDTYP(tomove)) && (BEGIN_RING<IDTYP(tomove)) && (IDTYP(tomove)<END_RING))868 if (((QRING_CMD!=IDTYP(tomove)) && RingDependend(IDTYP(tomove))) 809 869 || ((IDTYP(tomove)==LIST_CMD) && (lRingDependend(IDLIST(tomove))))) 810 870 { 811 871 /*move 'tomove' to ring id's*/ 872 #ifdef HAVE_NS 873 if (ipSwapId(tomove,IDROOT,currRing->idroot)) 874 ipSwapId(tomove,basePack->idroot,currRing->idroot); 875 #else 812 876 ipSwapId(tomove,IDROOT,currRing->idroot); 877 #endif 813 878 } 814 879 else … … 917 982 (IDTYP(hdh)==PACKAGE_CMD && IDPACKAGE(hdh)->language==LANG_TOP && 918 983 IDPACKAGE(hdh)->ref>0 )) 919 killhdl (hdh,&(pack->idroot));984 killhdl2(hdh,&(pack->idroot)); 920 985 hdh = temp; 921 986 } … … 1001 1066 #endif 1002 1067 1003 void proclevel::push(ring r, idhdl R,char *n) 1004 { 1068 void proclevel::push(char *n) 1069 { 1070 //Print("push %s\n",n); 1005 1071 proclevel *p=(proclevel*)omAlloc0(sizeof(proclevel)); 1006 p->currRing= r;1007 p->currRingHdl= R;1072 p->currRing=::currRing; 1073 p->currRingHdl=::currRingHdl; 1008 1074 p->name=n; 1009 1075 #ifdef HAVE_NS … … 1013 1079 p->next=this; 1014 1080 procstack=p; 1015 } 1016 void proclevel::pop(ring &r, idhdl &R) 1017 { 1018 r=this->currRing; 1081 } 1082 void proclevel::pop() 1083 { 1084 //Print("pop %s\n",name); 1085 if (currRing!=::currRing) PrintS("currRing wrong\n");; 1086 ::currRing=this->currRing; 1019 1087 //if (r==NULL) Print("set ring to NULL at lev %d(%s)\n",myynest,name); 1020 R=this->currRingHdl; 1088 ::currRingHdl=this->currRingHdl; 1089 if((::currRingHdl==NULL)||(IDRING(::currRingHdl)!=(::currRing))) 1090 ::currRingHdl=rFindHdl(::currRing,NULL,NULL); 1021 1091 #ifdef HAVE_NS 1092 //Print("restore pack=%s,1.obj=%s\n",IDID(currPackHdl),IDID(currPack->idroot)); 1022 1093 ::currPackHdl=this->currPackHdl; 1023 1094 ::currPack=this->currPack; … … 1143 1214 } 1144 1215 #endif /* HAVE_NAMESPACES */ 1216 1217 #ifdef HAVE_NS 1218 idhdl packFindHdl(package r) 1219 { 1220 idhdl h=basePack->idroot; 1221 while (h!=NULL) 1222 { 1223 if ((IDTYP(h)==PACKAGE_CMD) 1224 && (IDPACKAGE(h)==r)) 1225 return h; 1226 h=IDNEXT(h); 1227 } 1228 return NULL; 1229 } 1230 #endif -
Singular/ipid.h
re58c4a ra3bc95e 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: ipid.h,v 1.3 0 2001-09-25 16:07:28Singular Exp $ */6 /* $Id: ipid.h,v 1.31 2001-10-09 16:36:05 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT: identfier handling … … 35 35 pack->ref++; 36 36 return pack; 37 } 38 39 inline void paKill(package pack) 40 { 41 pack->ref--; 37 42 } 38 43 … … 110 115 char * name; 111 116 proclevel() { memset(this,0,sizeof(*this)); } 112 void push( ring,idhdl,char *);113 void pop( ring &, idhdl &);114 }; 117 void push(char *); 118 void pop(); 119 }; 115 120 extern proclevel *procstack; 116 121 … … 149 154 #ifdef HAVE_NS 150 155 extern idhdl currPackHdl; 156 extern idhdl basePackHdl; 151 157 extern package currPack; 152 158 extern package basePack; … … 165 171 void killid(char * a, idhdl * i); 166 172 void killhdl(idhdl h); 167 void killhdl (idhdl h, idhdl * ih);173 void killhdl2(idhdl h, idhdl * ih); 168 174 lists ipNameList(idhdl root); 169 175 void ipMoveId(idhdl h); 170 176 BOOLEAN checkPackage(package pack); 177 #ifdef HAVE_NS 178 idhdl packFindHdl(package r); 179 #endif 171 180 172 181 #define FLAG_STD 0 -
Singular/iplib.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: iplib.cc,v 1.9 1 2001-09-27 13:13:03Singular Exp $ */4 /* $Id: iplib.cc,v 1.92 2001-10-09 16:36:05 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: interpreter: LIB and help … … 62 62 63 63 #ifndef HAVE_NAMESPACES 64 #ifndef HAVE_NS 64 65 char *p; 65 66 … … 69 70 70 71 return TRUE; 72 #else 73 char *plib = iiConvName(lib); 74 hl = basePack->idroot->get(plib,0); 75 if((hl==NULL) ||(IDTYP(hl)!=PACKAGE_CMD)) 76 { 77 omFree(plib); 78 return FALSE; 79 } 80 omFree(plib); 81 return (strcmp(lib,IDPACKAGE(hl)->libname)==0); 82 #endif 71 83 #else 72 84 char *plib = iiConvName(lib); … … 316 328 myynest++; 317 329 err=yyparse(); 330 checkall(); 318 331 if (sLastPrinted.rtyp!=0) 319 332 { … … 322 335 //Print("kill locals for %s (level %d)\n",IDID(pn),myynest); 323 336 killlocals(myynest); 337 checkall(); 324 338 //Print("end kill locals for %s (%d)\n",IDID(pn),myynest); 325 339 myynest--; … … 331 345 332 346 #ifdef USE_IILOCALRING 333 ring *iiLocalRing 334 #ifdef TEST 335 =NULL 336 #endif 337 ; 338 #endif 339 sleftv *iiRETURNEXPR 340 #ifdef TEST 341 =NULL 342 #endif 343 ; 347 ring *iiLocalRing; 348 #endif 349 sleftv *iiRETURNEXPR; 344 350 int iiRETURNEXPR_len=0; 345 351 … … 347 353 static void iiShowLevRings() 348 354 { 355 int i; 349 356 #ifdef USE_IILOCALRING 350 int i;351 357 for (i=1;i<=myynest;i++) 352 358 { … … 357 363 } 358 364 #endif 359 { 360 proclevel * nshdl; 361 for(nshdl=procstack; nshdl != NULL; nshdl = nshdl->next) 362 { 363 if (nshdl->currRing==NULL) PrintS("NULL"); 364 else Print("%d",nshdl->currRing); 365 PrintLn(); 366 } 367 } 365 #ifdef HAVE_NS 366 i=myynest; 367 proclevel *p=procstack; 368 while (p!=NULL) 369 { 370 Print("lev %d:",i); 371 if (p->currRingHdl==NULL) PrintS("NULL"); 372 else Print("%s",IDID(p->currRingHdl)); 373 PrintLn(); 374 p=p->next; 375 } 376 #endif 368 377 if (currRing==NULL) PrintS("curr:NULL\n"); 369 378 else Print ("curr:%x\n",currRing); … … 390 399 sleftv * iiMake_proc(idhdl pn, sleftv* slpn, sleftv* sl) 391 400 #else /* HAVE_NAMESPACES */ 401 #ifdef HAVE_NS 402 sleftv * iiMake_proc(idhdl pn, package pack, sleftv* sl) 403 #else /* HAVE_NS */ 392 404 sleftv * iiMake_proc(idhdl pn, sleftv* sl) 405 #endif /* HAVE_NS */ 393 406 #endif /* HAVE_NAMESPACES */ 394 407 { … … 422 435 //printf("iiMake_proc: staying in TOP-LEVEL\n"); 423 436 } 424 procstack->push(currRing,currRingHdl,pi->procname);425 437 #else /* HAVE_NAMESPACES */ 426 438 omFree((ADDRESS)plib); … … 431 443 return NULL; 432 444 } 433 procstack->push(currRing,currRingHdl,pi->procname);434 445 #endif /* HAVE_NAMESPACES */ 435 446 iiCheckNest(); … … 438 449 #endif 439 450 iiRETURNEXPR[myynest+1].Init(); 451 procstack->push(pi->procname); 440 452 if ((traceit&TRACE_SHOW_PROC) 441 453 || (pi->trace_flag&TRACE_SHOW_PROC)) … … 455 467 456 468 case LANG_SINGULAR: 469 #ifdef HAVE_NS 470 if ((pi->pack!=NULL)&&(currPack!=pi->pack)) 471 { 472 currPack=pi->pack; 473 currPackHdl=packFindHdl(currPack); 474 //Print("set pack=%s\n",IDID(currPackHdl)); 475 } 476 else if ((pack!=NULL)&&(currPack!=pack)) 477 { 478 currPack=pack; 479 currPackHdl=packFindHdl(currPack); 480 } 481 #endif 457 482 err=iiPStart(pn,sl); 458 483 break; … … 507 532 } 508 533 #else /* USE_IILOCALRING */ 534 if (procstack->currRing != currRing) 535 { 536 //if (procstack->currRingHdl!=NULL) 537 //Print("procstack:%s,",IDID(procstack->currRingHdl)); 538 //if (currRingHdl!=NULL) 539 //Print(" curr:%s\n",IDID(currRingHdl)); 540 //Print("pr:%x, curr: %x\n",procstack->currRing,currRing); 541 if (((iiRETURNEXPR[myynest+1].Typ()>BEGIN_RING) 542 && (iiRETURNEXPR[myynest+1].Typ()<END_RING)) 543 || ((iiRETURNEXPR[myynest+1].Typ()==LIST_CMD) 544 && (lRingDependend((lists)iiRETURNEXPR[myynest+1].Data())))) 545 { 546 //idhdl hn; 547 char *n; 548 char *o; 549 if (procstack->currRing!=NULL) 550 { 551 //PrintS("reset ring\n"); 552 procstack->currRingHdl=rFindHdl(procstack->currRing,NULL, NULL); 553 if (procstack->currRingHdl==NULL) 554 procstack->currRingHdl= 555 rFindHdl(procstack->currRing,NULL,procstack->currPack->idroot); 556 if (procstack->currRingHdl==NULL) 557 procstack->currRingHdl= 558 rFindHdl(procstack->currRing,NULL,basePack->idroot); 559 o=IDID(procstack->currRingHdl); 560 currRing=procstack->currRing; 561 currRingHdl=procstack->currRingHdl; 562 } 563 else o="none"; 564 if (currRing!=NULL) n=IDID(currRingHdl); 565 else n="none"; 566 if (currRing==NULL) 567 { 568 Werror("ring change during procedure call: %s -> %s",o,n); 569 iiRETURNEXPR[myynest+1].CleanUp(); 570 err=TRUE; 571 } 572 } 573 if (procstack->currRingHdl!=NULL) 574 { 575 rSetHdl(procstack->currRingHdl); 576 } 577 else 578 { currRingHdl=NULL; currRing=NULL; } 579 } 580 #endif /* USE_IILOCALRING */ 581 #ifdef HAVE_NAMESPACES 509 582 if (NS_LRING != currRing) 510 583 { … … 546 619 { currRingHdl=NULL; currRing=NULL; } 547 620 } 548 #endif /* USE_IILOCALRING*/621 #endif /* HAVE_NAMESPACES */ 549 622 if (iiCurrArgs!=NULL) 550 623 { … … 554 627 iiCurrArgs=NULL; 555 628 } 556 procstack->pop( currRing,currRingHdl);629 procstack->pop(); 557 630 if (err) 558 631 return NULL; … … 581 654 if(ns != NULL) namespaceroot->push(IDPACKAGE(ns), IDID(ns), myynest+1); 582 655 else namespaceroot->push(namespaceroot->root->pack, "Top", myynest+1); 583 procstack->push( currRing,currRingHdl,example);656 procstack->push(example); 584 657 #else /* HAVE_NAMESPACES */ 585 procstack->push( currRing,currRingHdl,example);658 procstack->push(example); 586 659 #endif /* HAVE_NAMESPACES */ 587 660 #ifdef USE_IILOCALRING … … 623 696 } 624 697 #else /* USE_IILOCALRING */ 698 #endif /* USE_IILOCALRING */ 625 699 if (NS_LRING != currRing) 626 700 { … … 638 712 } 639 713 } 640 #endif /* USE_IILOCALRING */641 procstack->pop( currRing,currRingHdl);714 //#endif /* USE_IILOCALRING */ 715 procstack->pop(); 642 716 return err; 643 717 } … … 770 844 idhdl pl; 771 845 #else 846 #ifdef HAVE_NS 847 idhdl pl; 848 #endif 772 849 idhdl hl; 773 850 #endif /* HAVE_NAMESPACES */ … … 778 855 char *plib = iiConvName(newlib); 779 856 #endif /* HAVE_NAMESPACES */ 857 #ifdef HAVE_NS 858 char *plib = iiConvName(newlib); 859 #endif 780 860 FILE * fp = feFopen( newlib, "r", libnamebuf, tellerror ); 781 861 if (fp==NULL) … … 873 953 LoadResult = iiLoadLIB(fp, libnamebuf, newlib, pl, autoexport, tellerror); 874 954 #else /* HAVE_NAMESPACES */ 955 #ifdef HAVE_NS 956 pl = basePack->idroot->get(plib,0); 957 if (pl==NULL) 958 { 959 pl = enterid( omStrDup(plib),0, PACKAGE_CMD, 960 &(basePack->idroot), TRUE ); 961 IDPACKAGE(pl)->language = LANG_SINGULAR; 962 IDPACKAGE(pl)->libname=omStrDup(newlib); 963 } 964 else 965 { 966 if(IDTYP(pl)!=PACKAGE_CMD) 967 { 968 Warn("not of typ package."); 969 fclose(fp); 970 return TRUE; 971 } 972 } 973 LoadResult = iiLoadLIB(fp, libnamebuf, newlib, pl, TRUE, tellerror); 974 #else /* HAVE_NS */ 875 975 LoadResult = iiLoadLIB(fp, libnamebuf, newlib, NULL, FALSE, tellerror); 876 #endif /* HAVE_NAMESPACES */ 976 #endif /* HAVE_NS */ 977 #endif /* HAVE_NAMESPACES */ 978 979 omFree((ADDRESS)newlib); 877 980 878 981 #ifdef HAVE_NAMESPACES 879 982 if(!LoadResult) IDPACKAGE(pl)->loaded = TRUE; 880 983 namespaceroot->pop(); 881 #endif /* HAVE_NAMESPACES */882 883 omFree((ADDRESS)newlib);884 #ifdef HAVE_NAMESPACES885 984 omFree((ADDRESS)plib); 886 #endif /* HAVE_LIBPARSER */ 985 #endif /* HAVE_NAMESPACES */ 986 #ifdef HAVE_NS 987 if(!LoadResult) IDPACKAGE(pl)->loaded = TRUE; 988 omFree((ADDRESS)plib); 989 #endif /* HAVE_NS */ 990 887 991 return LoadResult; 888 992 } … … 939 1043 yylplex(newlib, libnamebuf, &lib_style, pl, autoexport); 940 1044 #else /* HAVE_NAMESPACES */ 1045 #ifdef HAVE_NS 1046 yylplex(newlib, libnamebuf, &lib_style, pl, autoexport); 1047 #else 941 1048 yylplex(newlib, libnamebuf, &lib_style); 1049 #endif /* HAVE_NS */ 942 1050 #endif /* HAVE_NAMESPACES */ 943 1051 if(yylp_errno) … … 1032 1140 pi->language = LANG_SINGULAR; 1033 1141 pi->ref = 1; 1142 pi->pack = NULL; 1034 1143 pi->is_static = pstatic; 1035 1144 pi->data.s.proc_start = pos; -
Singular/ipshell.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: ipshell.cc,v 1.6 7 2001-09-27 13:13:03Singular Exp $ */4 /* $Id: ipshell.cc,v 1.68 2001-10-09 16:36:06 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: … … 244 244 { 245 245 idhdl nexth = IDNEXT(h); 246 killhdl (h,localhdl);246 killhdl2(h,localhdl); 247 247 h = nexth; 248 248 //PrintS("kill\n"); … … 259 259 void killlocals(int v) 260 260 { 261 #ifndef HAVE_NS 261 262 killlocals0(v,&IDROOT); 263 #else 264 killlocals0(v,&(currPack->idroot)); 265 if (currPack!=basePack) 266 { 267 //PrintS("killlocals in Top\n"); 268 killlocals0(v,&(basePack->idroot)); 269 } 270 #endif 262 271 263 272 if ((iiRETURNEXPR_len > myynest) … … 270 279 271 280 idhdl sh=currRingHdl; 281 ring sr=currRing; 272 282 BOOLEAN changed=FALSE; 273 283 #ifndef HAVE_NAMESPACES 284 #ifdef HAVE_NS 285 idhdl h = currPack->idroot; 286 #else 274 287 idhdl h = IDROOT; 275 288 #endif 289 290 // Print("killlocals in %s\n",IDID(currPackHdl)); 276 291 while (h!=NULL) 277 292 { … … 279 294 && (IDRING(h)->idroot!=NULL)) 280 295 { 281 if ( h!=currRingHdl) {changed=TRUE;rSetHdl(h);}296 if (IDRING(h)!=currRing) {changed=TRUE;rSetHdl(h);} 282 297 killlocals0(v,&(IDRING(h)->idroot)); 283 298 } 284 299 h = IDNEXT(h); 285 300 } 301 #ifdef HAVE_NS 302 if (currPack!=basePack) 303 { 304 //PrintS("killlocals in Top\n"); 305 h=basePack->idroot; 306 while (h!=NULL) 307 { 308 if (((IDTYP(h)==QRING_CMD) || (IDTYP(h) == RING_CMD)) 309 && (IDRING(h)->idroot!=NULL)) 310 { 311 //Print("go to %s\n",IDID(h)); 312 if (IDRING(h)!=currRing) {changed=TRUE;rSetHdl(h);} 313 killlocals0(v,&(IDRING(h)->idroot)); 314 } 315 h = IDNEXT(h); 316 } 317 } 318 #endif 286 319 #else 287 320 idhdl h = NSROOT(namespaceroot->root); … … 322 355 currRingHdl=NULL; 323 356 if (sh!=NULL) rSetHdl(sh); 357 else if (sr!=NULL) 358 { 359 sh=rFindHdl(sr,NULL,NULL); 360 rSetHdl(sh); 361 } 324 362 } 325 363 326 364 if (myynest<=1) iiNoKeepRing=TRUE; 365 //Print("end killlocals >= %d\n",v); 366 //listall(); 327 367 } 328 368 … … 613 653 #else 614 654 r=IDROOT->get(theMap->preimage,myynest); 655 #ifdef HAVE_NS 656 if ((currPack!=basePack) 657 &&((r==NULL) || ((r->typ != RING_CMD) && (r->typ != QRING_CMD)))) 658 r=basePack->idroot->get(theMap->preimage,myynest); 659 #endif /* HAVE_NS */ 615 660 #endif /* HAVE_NAMESPACES */ 616 661 if ((r!=NULL) && ((r->typ == RING_CMD) || (r->typ== QRING_CMD))) … … 887 932 #endif /* HAVE_NAMESPACES */ 888 933 { 934 if (name->rtyp==IDHDL) { id=omStrDup(id); } 889 935 sy->data = (char *)enterid(id,lev,t,root,init_b); 890 936 } … … 959 1005 if (iiLocalRing[0]==IDRING(h)) iiLocalRing[0]=NULL; 960 1006 #else 1007 #endif 961 1008 proclevel *p=procstack; 962 1009 while (p->next!=NULL) p=p->next; … … 966 1013 p->currRingHdl=NULL; 967 1014 } 968 #endif969 killhdl (h,root);1015 //#endif 1016 killhdl2(h,root); 970 1017 } 971 1018 else … … 1094 1141 BOOLEAN iiExport (leftv v, int toLev) 1095 1142 { 1143 checkall(); 1096 1144 BOOLEAN nok=FALSE; 1097 1145 leftv r=v; … … 1114 1162 } 1115 1163 r->CleanUp(); 1164 checkall(); 1116 1165 return nok; 1117 1166 } … … 1142 1191 Warn("redefining %s",IDID(old)); 1143 1192 } 1144 killhdl (old,&root);1193 killhdl2(old,&root); 1145 1194 } 1146 1195 else … … 1165 1214 BOOLEAN iiExport (leftv v, int toLev, idhdl root) 1166 1215 { 1216 checkall(); 1167 1217 BOOLEAN nok=FALSE; 1168 1218 leftv rv=v; … … 1186 1236 Warn("redefining %s",IDID(old)); 1187 1237 } 1188 killhdl (old,&root);1238 killhdl2(old,&root); 1189 1239 } 1190 1240 else … … 1203 1253 } 1204 1254 rv->CleanUp(); 1255 checkall(); 1205 1256 return nok; 1206 1257 } -
Singular/ipshell.h
re58c4a ra3bc95e 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: ipshell.h,v 1.2 5 2001-09-25 16:07:29Singular Exp $ */6 /* $Id: ipshell.h,v 1.26 2001-10-09 16:36:06 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT … … 171 171 sleftv * iiMake_proc(idhdl pn, sleftv* slpn, sleftv* sl); 172 172 #else /* HAVE_NAMESPACES */ 173 #ifdef HAVE_NS 174 sleftv * iiMake_proc(idhdl pn, package pack, sleftv* sl); 175 #else /* HAVE_NS */ 173 176 sleftv * iiMake_proc(idhdl pn, sleftv* sl); 177 #endif /* HAVE_NS */ 174 178 #endif /* HAVE_NAMESPACES */ 175 179 // from misc.cc: … … 180 184 /* ================================================================== */ 181 185 void singular_example(char *str); 186 187 #ifdef HAVE_NS 188 void listall(); 189 void checkall(); 190 #endif 182 191 #endif 183 192 -
Singular/kbuckets.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kbuckets.cc,v 1.2 3 2000-12-31 15:14:32 obachmanExp $ */4 /* $Id: kbuckets.cc,v 1.24 2001-10-09 16:36:06 Singular Exp $ */ 5 5 6 6 #include "mod2.h" … … 121 121 *bucket_pt = NULL; 122 122 } 123 123 124 124 125 125 void kBucketDeleteAndDestroy(kBucket_pt *bucket_pt) … … 190 190 assume(length <= 0 || length == pLength(lm)); 191 191 assume(kBucketIsCleared(bucket)); 192 192 193 193 if (lm == NULL) return; 194 194 … … 322 322 /// 323 323 /// For changing the ring of the Bpoly to new_tailBin 324 /// 324 /// 325 325 void kBucketShallowCopyDelete(kBucket_pt bucket, 326 326 ring new_tailRing, omBin new_tailBin, … … 329 329 #ifndef HAVE_PSEUDO_BUCKETS 330 330 int i; 331 331 332 332 kBucketCanonicalize(bucket); 333 333 for (i=0; i<= bucket->buckets_used; i++) 334 334 if (bucket->buckets[i] != NULL) 335 bucket->buckets[i] = p_shallow_copy_delete(bucket->buckets[i], 335 bucket->buckets[i] = p_shallow_copy_delete(bucket->buckets[i], 336 336 bucket->bucket_ring, 337 337 new_tailRing, … … 385 385 else 386 386 l1 = *l; 387 387 388 388 kBucketMergeLm(bucket); 389 389 kbTest(bucket); … … 442 442 { 443 443 p1 = p_Minus_mm_Mult_qq(bucket->buckets[i], m, p1, 444 bucket->buckets_length[i], l1, 444 bucket->buckets_length[i], l1, 445 445 spNoether, r); 446 446 l1 = bucket->buckets_length[i]; … … 462 462 pSetCoeff0(m, nNeg(pGetCoeff(m))); 463 463 } 464 464 465 465 while (bucket->buckets[i] != NULL) 466 466 { … … 526 526 p1 = r->p_Procs->pp_Mult_mm(p1, m, r, last); 527 527 } 528 528 529 529 while (bucket->buckets[i] != NULL) 530 530 { -
Singular/kbuckets.h
re58c4a ra3bc95e 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: kbuckets.h,v 1.1 4 2000-12-31 15:14:32 obachmanExp $ */6 /* $Id: kbuckets.h,v 1.15 2001-10-09 16:36:07 Singular Exp $ */ 7 7 #include "structs.h" 8 8 #include "p_Procs.h" … … 121 121 // first, do ExtractLarger 122 122 // then add q 123 inline poly 123 inline poly 124 124 kBucket_ExtractLarger_Add_q(kBucket_pt bucket, poly append, poly q, int *lq) 125 125 { … … 147 147 /// 148 148 /// For changing the ring of the Bpoly to new_tailBin 149 /// 150 void kBucketShallowCopyDelete(kBucket_pt bucket, 149 /// 150 void kBucketShallowCopyDelete(kBucket_pt bucket, 151 151 ring new_tailRing, omBin new_tailBin, 152 152 pShallowCopyDeleteProc p_shallow_copy_delete); … … 155 155 /// 156 156 /// Tests 157 /// 158 /// 159 #ifdef KDEBUG 157 /// 158 /// 159 #ifdef KDEBUG 160 160 BOOLEAN kbTest(kBucket_pt bucket); 161 161 #else … … 169 169 170 170 // define this if length of bucket polys are 2, 4, 8, etc 171 // instead of 4, 16, 64 ... -- 171 // instead of 4, 16, 64 ... -- 172 172 // this seems to be less efficient, both, in theory and in practice 173 // #define BUCKET_TWO_BASE 173 // #define BUCKET_TWO_BASE 174 174 #ifdef BUCKET_TWO_BASE 175 175 #define MAX_BUCKET 28 -
Singular/kspoly.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kspoly.cc,v 1.2 4 2001-01-09 15:40:09Singular Exp $ */4 /* $Id: kspoly.cc,v 1.25 2001-10-09 16:36:07 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT - Routines for Spoly creation and reductions … … 26 26 * Reduces PR with PW 27 27 * Assumes PR != NULL, PW != NULL, Lm(PR) divides Lm(PW) 28 * 28 * 29 29 ***************************************************************/ 30 30 int ksReducePoly(LObject* PR, … … 48 48 kTest_L(PR); 49 49 kTest_T(PW); 50 50 51 51 poly p1 = PR->GetLmTailRing(); 52 52 poly p2 = PW->GetLmTailRing(); … … 56 56 p_CheckPolyRing(p2, tailRing); 57 57 58 pAssume1(p2 != NULL && p1 != NULL && 58 pAssume1(p2 != NULL && p1 != NULL && 59 59 p_DivisibleBy(p2, p1, tailRing)); 60 60 61 61 pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) || 62 (p_GetComp(p2, tailRing) == 0 && 62 (p_GetComp(p2, tailRing) == 0 && 63 63 p_MaxComp(pNext(p2),tailRing) == 0)); 64 64 … … 71 71 72 72 p_ExpVectorSub(lm, p2, tailRing); 73 73 74 74 if (tailRing != currRing) 75 75 { … … 98 98 int ct = ksCheckCoeff(&an, &bn); 99 99 p_SetCoeff(lm, bn,tailRing); 100 if ((ct == 0) || (ct == 2)) 100 if ((ct == 0) || (ct == 2)) 101 101 PR->Tail_Mult_nn(an); 102 102 if (coef != NULL) *coef = an; … … 107 107 if (coef != NULL) *coef = n_Init(1, tailRing); 108 108 } 109 110 111 // and finally, 109 110 111 // and finally, 112 112 PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether); 113 113 PR->LmDeleteAndIter(); … … 124 124 * 125 125 * Creates S-Poly of p1 and p2 126 * 126 * 127 127 * 128 128 ***************************************************************/ 129 void ksCreateSpoly(LObject* Pair, poly spNoether, 130 int use_buckets, ring tailRing, 129 void ksCreateSpoly(LObject* Pair, poly spNoether, 130 int use_buckets, ring tailRing, 131 131 poly m1, poly m2, TObject** R) 132 132 { … … 139 139 poly last; 140 140 Pair->tailRing = tailRing; 141 141 142 142 assume(p1 != NULL); 143 143 assume(p2 != NULL); … … 149 149 150 150 int l1=0, l2=0; 151 151 152 152 if (p_GetComp(p1, currRing)!=p_GetComp(p2, currRing)) 153 153 { … … 168 168 if (m1 == NULL) 169 169 k_GetLeadTerms(p1, p2, currRing, m1, m2, tailRing); 170 170 171 171 pSetCoeff0(m1, lc2); 172 172 pSetCoeff0(m2, lc1); // and now, m1 * LT(p1) == m2 * LT(p2) … … 177 177 l2 = (R[Pair->i_r2])->GetpLength() - 1; 178 178 } 179 179 180 180 // get m2 * a2 181 181 if (spNoether != NULL) … … 191 191 // get m2*a2 - m1*a1 192 192 Pair->Tail_Minus_mm_Mult_qq(m1, a1, l1, spNoether); 193 193 194 194 // Clean-up time 195 195 Pair->LmDeleteAndIter(); 196 196 p_LmDelete(m1, tailRing); 197 197 198 198 if (co != 0) 199 199 { … … 215 215 poly Lp = PR->GetLmCurrRing(); 216 216 poly Save = PW->GetLmCurrRing(); 217 217 218 218 kTest_L(PR); 219 219 kTest_T(PW); 220 220 pAssume(pIsMonomOf(Lp, Current)); 221 221 222 222 assume(Lp != NULL && Current != NULL && pNext(Current) != NULL); 223 223 assume(PR->bucket == NULL); … … 228 228 pAssume(!pHaveCommonMonoms(Red.p, With.p)); 229 229 ret = ksReducePoly(&Red, &With, spNoether, &coef); 230 230 231 231 if (!ret) 232 232 { … … 245 245 } 246 246 247 if (Lp == Save) 247 if (Lp == Save) 248 248 With.Delete(); 249 249 return ret; … … 253 253 * 254 254 * Auxillary Routines 255 * 256 * 255 * 256 * 257 257 ***************************************************************/ 258 258 … … 464 464 } 465 465 } 466 467 468 469 470 471 472 -
Singular/libparse.h
re58c4a ra3bc95e 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: libparse.h,v 1.1 2 2000-04-27 10:07:08 obachmanExp $ */6 /* $Id: libparse.h,v 1.13 2001-10-09 16:36:07 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT: lib parsing … … 16 16 procinfo *iiInitSingularProcinfo(procinfov pi, char *libname, 17 17 char *procname, int line, long pos, 18 18 BOOLEAN pstatic = FALSE); 19 19 #ifdef HAVE_NAMESPACES 20 20 int yylplex(char *libname, char *libfile, lib_style_types *lib_style, 21 21 idhdl pl, BOOLEAN autoexport=FALSE, lp_modes=LOAD_LIB); 22 22 #else /* HAVE_NAMESPACES */ 23 #ifdef HAVE_NS 23 24 int yylplex(char *libname, char *libfile, lib_style_types *lib_style, 24 lp_modes=LOAD_LIB); 25 idhdl pl, BOOLEAN autoexport=FALSE, lp_modes=LOAD_LIB); 26 #else 27 int yylplex(char *libname, char *libfile, lib_style_types *lib_style, 28 lp_modes=LOAD_LIB); 29 #endif /* HAVE_NS */ 25 30 #endif /* HAVE_NAMESPACES */ 26 31 -
Singular/libparse.l
re58c4a ra3bc95e 3 3 * Computer Algebra System SINGULAR * 4 4 ****************************************/ 5 /* $Id: libparse.l,v 1.4 7 2001-09-25 16:07:29Singular Exp $ */5 /* $Id: libparse.l,v 1.48 2001-10-09 16:36:08 Singular Exp $ */ 6 6 #include <stdio.h> 7 7 #include <string.h> … … 34 34 #ifdef HAVE_NAMESPACES 35 35 void copy_string(lp_modes mode, idhdl pl); 36 extern void piCleanUp(procinfov pi);37 36 #else /* HAVE_NAMESPACES */ 38 37 void copy_string(lp_modes mode); 39 38 #endif /* HAVE_NAMESPACES */ 39 extern void piCleanUp(procinfov pi); 40 40 void make_version(char *p, int what); 41 41 … … 119 119 extern namehdl namespaceroot; 120 120 #endif /* HAVE_NAMESPACES */ 121 #ifdef HAVE_NS 122 idhdl h_top; 123 #endif 121 124 #define pi IDPROC(h0) 122 125 extern "C" … … 180 183 idhdl pl, BOOLEAN autoexport, lp_modes mode) 181 184 #else /* HAVE_NAMESPACES */ 185 #ifdef HAVE_NS 186 #define YY_DECL int yylex(char *newlib, char *libfile, \ 187 lib_style_types *lib_style, \ 188 idhdl pl, BOOLEAN autoexport, lp_modes mode) 189 #else 182 190 #define YY_DECL int yylex(char *newlib, char *libfile, \ 183 191 lib_style_types *lib_style, \ 184 192 lp_modes mode) 193 #endif /* HAVE_NS */ 185 194 #endif /* HAVE_NAMESPACES */ 186 195 … … 341 350 if( mode == LOAD_LIB) 342 351 { 343 344 345 346 347 348 349 350 351 352 352 #ifdef HAVE_NAMESPACES 353 h0 = enterid( omStrDup(proc), 0 /*myynest*/, PROC_CMD, 354 &IDPACKAGE(pl)->idroot, TRUE); 355 if(!p_static && autoexport) 356 { 357 namespaceroot->push( NSPACK(namespaceroot->root) ,""); 358 h_top = enterid( omStrDup(proc), myynest, PROC_CMD, 359 &NSROOT(namespaceroot->root), FALSE ); 360 namespaceroot->pop(); 361 } 353 362 #else /* HAVE_NAMESPACES */ 363 #ifdef HAVE_NS 364 h0 = enterid( omStrDup(proc), 0 /*myynest*/, PROC_CMD, 365 &(IDPACKAGE(pl)->idroot), TRUE); 366 if(!p_static && autoexport) 367 { 368 h_top = enterid( omStrDup(proc), 0 /*myynest*/, PROC_CMD, 369 &(basePack->idroot), FALSE ); 370 } 371 #else 354 372 h0 = enterid( omStrDup(proc), 0 /*myynest*/, PROC_CMD, 355 373 &IDROOT, TRUE ); 374 #endif /* HAVE_NS */ 356 375 #endif /* HAVE_NAMESPACES */ 357 376 /* omCheckAddr(IDID(h0)); */ … … 368 387 } 369 388 #endif /* HAVE_NAMESPACES */ 389 #ifdef HAVE_NS 390 if (!p_static && h_top != NULL && autoexport) 391 { 392 if(IDPROC(h_top)!=NULL) piCleanUp((procinfo *)IDPROC(h_top)); 393 IDPROC(h_top)=IDPROC(h0); 394 IDPROC(h_top)->ref++; 395 } 396 IDPROC(h0)->pack=IDPACKAGE(pl); 397 #endif /* HAVE_NS */ 370 398 if (BVERBOSE(V_LOAD_PROC)) 371 399 Warn( " proc '%s' registered", proc ); -
Singular/lists.h
re58c4a ra3bc95e 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: lists.h,v 1.1 5 2001-08-27 14:47:08 Singular Exp $ */6 /* $Id: lists.h,v 1.16 2001-10-09 16:36:08 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT: handling of the list type … … 13 13 #include "tok.h" 14 14 15 #ifdef MDEBUG 16 #define INLINE_THIS 15 #ifdef MDEBUG 16 #define INLINE_THIS 17 17 #else 18 18 #define INLINE_THIS inline -
Singular/misc.cc
re58c4a ra3bc95e 631 631 #endif 632 632 #ifdef HAVE_NAMESPACES 633 StringAppendS("Namespaces,"); 634 #endif 635 #ifdef HAVE_NS 633 636 StringAppendS("namespaces,"); 634 637 #endif … … 679 682 } 680 683 681 684 #ifdef HAVE_NS 685 void listall() 686 { 687 idhdl hh=basePack->idroot; 688 PrintS("====== Top ==============\n"); 689 while (hh!=NULL) 690 { 691 if (IDDATA(hh)==NULL) PrintS("(N)"); 692 else if (IDDATA(hh)==(void *)currRing) PrintS("(R)"); 693 else if (IDDATA(hh)==(void *)currPack) PrintS("(P)"); 694 else PrintS(" "); 695 Print("::%s, typ %s level %d", 696 IDID(hh),Tok2Cmdname(IDTYP(hh)),IDLEV(hh)); 697 if ((IDTYP(hh)==RING_CMD) 698 || (IDTYP(hh)==QRING_CMD)) 699 Print(" ref: %d\n",IDRING(hh)->ref); 700 else 701 PrintLn(); 702 hh=IDNEXT(hh); 703 } 704 hh=basePack->idroot; 705 while (hh!=NULL) 706 { 707 if (IDDATA(hh)==(void *)basePack) 708 Print("(T)::%s, typ %s level %d\n", 709 IDID(hh),Tok2Cmdname(IDTYP(hh)),IDLEV(hh)); 710 else 711 if ((IDTYP(hh)==RING_CMD) 712 || (IDTYP(hh)==QRING_CMD) 713 || (IDTYP(hh)==PACKAGE_CMD)) 714 { 715 Print("====== %s ==============\n",IDID(hh)); 716 idhdl h2=IDRING(hh)->idroot; 717 while (h2!=NULL) 718 { 719 if (IDDATA(h2)==NULL) PrintS("(N)"); 720 else if (IDDATA(h2)==(void *)currRing) PrintS("(R)"); 721 else if (IDDATA(h2)==(void *)currPack) PrintS("(P)"); 722 else PrintS(" "); 723 Print("%s::%s, typ %s level %d\n", 724 IDID(hh),IDID(h2),Tok2Cmdname(IDTYP(h2)),IDLEV(h2)); 725 h2=IDNEXT(h2); 726 } 727 } 728 hh=IDNEXT(hh); 729 } 730 Print("currRing:%x, currPack:%x,basePack:%x\n",currRing,currPack,basePack); 731 } 732 void checkall() 733 { 734 idhdl hh=basePack->idroot; 735 while (hh!=NULL) 736 { 737 omCheckAddr(hh); 738 omCheckAddr(IDID(hh)); 739 if (RingDependend(IDTYP(hh))) Print("%s typ %d in Top\n",IDID(hh),IDTYP(hh)); 740 hh=IDNEXT(hh); 741 } 742 hh=basePack->idroot; 743 while (hh!=NULL) 744 { 745 if (IDTYP(hh)==PACKAGE_CMD) 746 { 747 idhdl h2=IDPACKAGE(hh)->idroot; 748 while (h2!=NULL) 749 { 750 omCheckAddr(h2); 751 omCheckAddr(IDID(h2)); 752 if (RingDependend(IDTYP(h2))) Print("%s typ %d in %s\n",IDID(h2),IDTYP(h2),IDID(hh)); 753 h2=IDNEXT(h2); 754 } 755 } 756 hh=IDNEXT(hh); 757 } 758 } 759 #endif -
Singular/mmalloc.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: mmalloc.cc,v 1. 4 2001-02-01 21:19:54 obachmanExp $ */4 /* $Id: mmalloc.cc,v 1.5 2001-10-09 16:36:09 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: standard version of C++-memory management alloc func … … 12 12 #include <omalloc.h> 13 13 14 /* We define those, so that our values of 14 /* We define those, so that our values of 15 15 OM_TRACK and OM_CHECK are used */ 16 16 void* operator new ( size_t size ) -
Singular/mmalloc.h
re58c4a ra3bc95e 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: mmalloc.h,v 1. 2 2000-08-14 16:05:43 obachmanExp $ */6 /* $Id: mmalloc.h,v 1.3 2001-10-09 16:36:09 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT: declaration of routines for memory stuff … … 16 16 17 17 #ifdef __cplusplus 18 extern "C" 18 extern "C" 19 19 { 20 20 #endif -
Singular/modulop.h
re58c4a ra3bc95e 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: modulop.h,v 1.1 5 2001-01-09 15:40:11Singular Exp $ */6 /* $Id: modulop.h,v 1.16 2001-10-09 16:36:09 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT: numbers modulo p (<=32003) … … 53 53 inline number npMultM(number a, number b) 54 54 { 55 return (number) 55 return (number) 56 56 ((((unsigned long) a)*((unsigned long) b)) % ((unsigned long) npPrimeM)); 57 57 } -
Singular/mpr_complex.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: mpr_complex.cc,v 1.3 1 2001-08-27 14:47:13Singular Exp $ */4 /* $Id: mpr_complex.cc,v 1.32 2001-10-09 16:36:10 Singular Exp $ */ 5 5 6 6 /* … … 50 50 * the size of mantissa consists of two parts: 51 51 * the "output" part a and the "rest" part b. 52 * According to the GMP-precision digits is 52 * According to the GMP-precision digits is 53 53 * recomputed to bits (basis 2). 54 54 * Two numbers a, b are equal if … … 86 86 *c_in = '0'; 87 87 strcpy(&(c_in[1]), in); 88 88 89 89 mpf_set_str( t, c_in, 10 ); 90 90 omFreeSize((void*)c_in, len); … … 233 233 bool operator >= ( const gmp_float & a, const gmp_float & b ) 234 234 { 235 if (a.t == b.t) 236 return true; 235 if (a.t == b.t) 236 return true; 237 237 return mpf_cmp( a.t, b.t ) >= 0; 238 238 } 239 239 bool operator <= ( const gmp_float & a, const gmp_float & b ) 240 240 { 241 if (a.t == b.t) 242 return true; 241 if (a.t == b.t) 242 return true; 243 243 return mpf_cmp( a.t, b.t ) <= 0; 244 244 } … … 365 365 gmp_float r; 366 366 367 switch (k) 367 switch (k) 368 368 { 369 369 case QTOF: … … 665 665 out=(char*)omAlloc( len ); 666 666 memset(out,0,len); 667 if ( !c.real().isZero() ) 667 if ( !c.real().isZero() ) 668 668 sprintf(out,"(%s%s%s)",in_real,c.imag().sign()>=0?"+I*":"-I*",in_imag); 669 669 else … … 673 673 omFree( (ADDRESS) in_imag ); 674 674 } 675 else 675 else 676 676 { 677 677 out= floatToStr( c.real(), oprec ); -
Singular/mpr_complex.h
re58c4a ra3bc95e 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: mpr_complex.h,v 1.1 7 2001-08-27 14:47:14Singular Exp $ */6 /* $Id: mpr_complex.h,v 1.18 2001-10-09 16:36:10 Singular Exp $ */ 7 7 8 8 /* … … 100 100 inline const mpf_t *mpfp() const; 101 101 inline mpf_t *_mpfp(); 102 102 103 103 inline operator double(); 104 104 inline operator double() const; … … 177 177 } 178 178 179 inline mpf_t *gmp_float::_mpfp() 179 inline mpf_t *gmp_float::_mpfp() 180 180 { 181 181 return &t; -
Singular/mpr_inout.h
re58c4a ra3bc95e 5 5 ****************************************/ 6 6 7 /* $Id: mpr_inout.h,v 1. 6 1999-12-02 23:03:51 wenkExp $ */7 /* $Id: mpr_inout.h,v 1.7 2001-10-09 16:36:10 Singular Exp $ */ 8 8 9 9 /* … … 49 49 50 50 /** 51 * COMPUTE: polynomial p with values given by v at points p1,..,pN derived 51 * COMPUTE: polynomial p with values given by v at points p1,..,pN derived 52 52 * from p; more precisely: consider p as point in K^n and v as N elements in K, 53 53 * let p1,..,pN be the points in K^n obtained by evaluating all monomials 54 * of degree 0,1,...,N at p in lexicographical order, then the procedure 54 * of degree 0,1,...,N at p in lexicographical order, then the procedure 55 55 * computes the polynomial f satisfying f(pi) = v[i] 56 56 * RETURN: polynomial f of degree d -
Singular/mpr_numeric.h
re58c4a ra3bc95e 5 5 ****************************************/ 6 6 7 /* $Id: mpr_numeric.h,v 1. 5 1999-12-02 23:03:52 wenkExp $ */7 /* $Id: mpr_numeric.h,v 1.6 2001-10-09 16:36:11 Singular Exp $ */ 8 8 9 9 /* … … 18 18 19 19 // define polish mode when finding roots 20 #define PM_NONE 0 20 #define PM_NONE 0 21 21 #define PM_POLISH 1 22 22 #define PM_CORRUPT 2 … … 176 176 { 177 177 public: 178 178 179 179 int m; // number of constraints, make sure m == m1 + m2 + m3 !! 180 180 int n; // # of independent variables 181 181 int m1,m2,m3; // constraints <=, >= and == 182 int icase; // == 0: finite solution found; 182 int icase; // == 0: finite solution found; 183 183 // == +1 objective funtion unbound; == -1: no solution 184 int *izrov,*iposv; 184 int *izrov,*iposv; 185 185 186 186 mprfloat **LiPM; // the matrix (of size [m+2, n+1]) 187 187 188 /** #rows should be >= m+2, #cols >= n+1 188 /** #rows should be >= m+2, #cols >= n+1 189 189 */ 190 190 simplex( int rows, int cols ); -
Singular/mpsr_Get.cc
re58c4a ra3bc95e 3 3 ****************************************/ 4 4 5 /* $Id: mpsr_Get.cc,v 1.3 7 2001-09-25 15:45:43Singular Exp $ */5 /* $Id: mpsr_Get.cc,v 1.38 2001-10-09 16:36:11 Singular Exp $ */ 6 6 /*************************************************************** 7 7 * … … 173 173 { 174 174 number n = (number) omAllocBin(rnumber_bin); 175 #if defined(LDEBUG) 175 #if defined(LDEBUG) 176 176 n->debug=123456; 177 177 #endif … … 214 214 { 215 215 poly p; 216 216 217 217 pos = mpsr_rDefault(0, name, mlv->r); 218 218 mpsr_SetCurrRing(mlv->r, TRUE); -
Singular/mpsr_sl.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 12/00 9 * Version: $Id: mpsr_sl.cc,v 1. 3 2001-09-19 09:49:37Singular Exp $9 * Version: $Id: mpsr_sl.cc,v 1.4 2001-10-09 16:36:11 Singular Exp $ 10 10 *******************************************************************/ 11 11 … … 404 404 #ifdef HPUX_9 405 405 signal(SIGCHLD, (void (*)(int))SIG_DFL); 406 #endif 406 #endif 407 407 if ((strcmp(l->mode, "launch") == 0 || strcmp(l->mode, "fork") == 0) && 408 408 (MP_GetLinkStatus((MP_Link_pt)l->data,MP_LinkReadyWriting) == MP_TRUE)) … … 411 411 #ifdef HPUX_9 412 412 signal(SIGCHLD, (void (*)(int))SIG_IGN); 413 #endif 413 #endif 414 414 SI_LINK_SET_CLOSE_P(l); 415 415 return FALSE; -
Singular/omSingularConfig.h
re58c4a ra3bc95e 1 1 /******************************************************************* 2 2 * File: omSingularConfig.h 3 * Purpose: declaration of External Config stuff for omalloc 4 * This file is inlcuded by omDefaultConfig.h, i.e., at the the time 5 * the omalloc library is built. Any changes to the default config 6 * of omalloc should be done here (and, of course, you need to 3 * Purpose: declaration of External Config stuff for omalloc 4 * This file is inlcuded by omDefaultConfig.h, i.e., at the the time 5 * the omalloc library is built. Any changes to the default config 6 * of omalloc should be done here (and, of course, you need to 7 7 * rebuilt the library). 8 8 * Author: obachman@mathematik.uni-kl.de (Olaf Bachmann) 9 9 * Created: 8/00 10 * Version: $Id: omSingularConfig.h,v 1. 3 2000-12-18 15:44:42 obachmanExp $10 * Version: $Id: omSingularConfig.h,v 1.4 2001-10-09 16:36:12 Singular Exp $ 11 11 *******************************************************************/ 12 12 #ifndef OM_SINGULAR_CONFIG_H … … 14 14 15 15 #ifdef __cplusplus 16 extern "C" 16 extern "C" 17 17 { 18 18 #endif 19 19 20 20 #include <stdlib.h> 21 21 #include <stdio.h> … … 35 35 36 36 /* number of bytes for difference to report: every 1 MByte */ 37 #define SING_REPORT_THRESHOLD 1000*1024 37 #define SING_REPORT_THRESHOLD 1000*1024 38 38 #define OM_SINGULAR_HOOK \ 39 39 do \ -
Singular/pInline1.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: pInline1.cc,v 1. 3 2000-10-30 13:40:21 obachmanExp $9 * Version: $Id: pInline1.cc,v 1.4 2001-10-09 16:36:12 Singular Exp $ 10 10 *******************************************************************/ 11 11 #ifndef PINLINE1_CC … … 22 22 23 23 #undef NO_INLINE1 24 #define NO_INLINE1 24 #define NO_INLINE1 25 25 26 26 #endif // PDEBUG -
Singular/pShallowCopyDelete.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: pShallowCopyDelete.cc,v 1. 3 2000-10-26 16:31:37 obachmanExp $9 * Version: $Id: pShallowCopyDelete.cc,v 1.4 2001-10-09 16:36:12 Singular Exp $ 10 10 *******************************************************************/ 11 11 #include "mod2.h" … … 27 27 int N = d_r->N; 28 28 int i; 29 29 30 30 31 31 while (s_p != NULL) … … 33 33 d_p->next = p_Init(d_r, d_bin); 34 34 pIter(d_p); 35 35 36 36 pSetCoeff0(d_p, pGetCoeff(s_p)); 37 37 for (i=1; i<= N; i++) … … 41 41 p_SetComp(d_p, p_GetComp(s_p, s_r), d_r); 42 42 p_Setm(d_p, d_r); 43 43 44 44 s_p = p_LmFreeAndNext(s_p, s_r); 45 45 } … … 53 53 return pShallowCopyDelete_General; 54 54 } 55 56 57 58 59 -
Singular/pShallowCopyDelete.h
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: pShallowCopyDelete.h,v 1. 1 2000-10-23 16:32:27 obachmanExp $9 * Version: $Id: pShallowCopyDelete.h,v 1.2 2001-10-09 16:36:12 Singular Exp $ 10 10 *******************************************************************/ 11 11 12 12 // returns a poly from dest_r which is a ShallowCopy of s_p from source_r 13 typedef poly (*pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, 13 typedef poly (*pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, 14 14 omBin dest_bin); 15 15 pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring source_r, ring dest_r); -
Singular/p_Add_q__T.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: p_Add_q__T.cc,v 1. 2 2001-08-27 14:47:21Singular Exp $9 * Version: $Id: p_Add_q__T.cc,v 1.3 2001-10-09 16:36:13 Singular Exp $ 10 10 *******************************************************************/ 11 11 12 12 /*************************************************************** 13 13 * 14 * Returns: p + q, 14 * Returns: p + q, 15 15 * Shorter, where Shorter == Length(p) + Length(q) - Length(p+q); 16 16 * Destroys: p, q 17 * 17 * 18 18 ***************************************************************/ 19 19 LINKAGE poly p_Add_q(poly p, poly q, int &Shorter, const ring r) … … 24 24 int l = pLength(p) + pLength(q); 25 25 #endif 26 26 27 27 // test for trivial cases 28 28 Shorter = 0; 29 29 if (q == NULL) return p; 30 30 if (p == NULL) return q; 31 31 32 32 number t, n1, n2; 33 33 int shorter = 0; … … 47 47 n_Delete(&n2, r); 48 48 q = p_LmFreeAndNext(q, r); 49 49 50 50 if (n_IsZero(t, r)) 51 51 { … … 64 64 if (q==NULL) { pNext(a) = p; goto Finish;} 65 65 goto Top; 66 66 67 67 Greater: 68 68 a = pNext(a) = p; … … 70 70 if (p==NULL) { pNext(a) = q; goto Finish;} 71 71 goto Top; 72 72 73 73 Smaller: 74 74 a = pNext(a) = q; … … 76 76 if (q==NULL) { pNext(a) = p; goto Finish;} 77 77 goto Top; 78 78 79 79 80 80 Finish: … … 84 84 #if PDEBUG > 0 85 85 pAssume1(l - pLength(pNext(&rp)) == Shorter); 86 #endif 86 #endif 87 87 return pNext(&rp); 88 88 } -
Singular/p_Copy__T.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: p_Copy__T.cc,v 1. 2 2001-08-27 14:47:22Singular Exp $9 * Version: $Id: p_Copy__T.cc,v 1.3 2001-10-09 16:36:13 Singular Exp $ 10 10 *******************************************************************/ 11 11 … … 18 18 omBin bin = r->PolyBin; 19 19 poly h; 20 20 21 21 DECLARE_LENGTH(const unsigned long length = r->ExpL_Size); 22 22 -
Singular/p_Delete__T.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: p_Delete__T.cc,v 1. 2 2001-08-27 14:47:23 Singular Exp $9 * Version: $Id: p_Delete__T.cc,v 1.3 2001-10-09 16:36:13 Singular Exp $ 10 10 *******************************************************************/ 11 11 … … 13 13 { 14 14 poly p = *pp; 15 15 16 16 while (p != NULL) 17 17 { -
Singular/p_MemCmp.h
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: p_MemCmp.h,v 1. 2 2000-12-31 15:14:37 obachmanExp $9 * Version: $Id: p_MemCmp.h,v 1.3 2001-10-09 16:36:13 Singular Exp $ 10 10 *******************************************************************/ 11 11 #ifndef P_MEM_CMP_H … … 13 13 14 14 /*************************************************************** 15 * 15 * 16 16 * auxiallary macros 17 * 17 * 18 18 *******************************************************************/ 19 19 #define _p_MemCmp_Declare(s1, s2) \ … … 63 63 } \ 64 64 while (0) 65 66 /*************************************************************** 67 * 65 66 /*************************************************************** 67 * 68 68 * Pomog 69 * 69 * 70 70 *******************************************************************/ 71 71 #define p_MemCmp_LengthOne_OrdPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 144 144 145 145 /*************************************************************** 146 * 146 * 147 147 * Nomog 148 * 148 * 149 149 *******************************************************************/ 150 150 #define p_MemCmp_LengthOne_OrdNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 168 168 169 169 /*************************************************************** 170 * 170 * 171 171 * PomogZero 172 * 172 * 173 173 *******************************************************************/ 174 174 #define p_MemCmp_LengthTwo_OrdPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 190 190 191 191 /*************************************************************** 192 * 192 * 193 193 * NomogZero 194 * 194 * 195 195 *******************************************************************/ 196 196 #define p_MemCmp_LengthTwo_OrdNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 212 212 213 213 /*************************************************************** 214 * 214 * 215 215 * NegPomog 216 * 216 * 217 217 *******************************************************************/ 218 218 #define p_MemCmp_LengthTwo_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 250 250 251 251 /*************************************************************** 252 * 252 * 253 253 * PomogNeg 254 * 254 * 255 255 *******************************************************************/ 256 256 #define p_MemCmp_LengthTwo_OrdPomogNeg(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 288 288 289 289 /*************************************************************** 290 * 290 * 291 291 * PosNomog 292 * 292 * 293 293 *******************************************************************/ 294 294 #define p_MemCmp_LengthThree_OrdPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 306 306 #define p_MemCmp_LengthGeneral_OrdPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \ 307 307 p_MemCmp_LengthGeneral_OrdNegPomog(s1, s2, length, ordsgn, actionE, actionS, actionG) 308 309 /*************************************************************** 310 * 308 309 /*************************************************************** 310 * 311 311 * NomogPos 312 * 312 * 313 313 *******************************************************************/ 314 314 #define p_MemCmp_LengthThree_OrdNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 329 329 330 330 /*************************************************************** 331 * 331 * 332 332 * PomogNegZero 333 * 333 * 334 334 *******************************************************************/ 335 335 #define p_MemCmp_LengthThree_OrdPomogNegZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 349 349 350 350 /*************************************************************** 351 * 351 * 352 352 * NegPomogZero 353 * 353 * 354 354 *******************************************************************/ 355 355 #define p_MemCmp_LengthThree_OrdNegPomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 369 369 370 370 /*************************************************************** 371 * 371 * 372 372 * NomogPosZero 373 * 373 * 374 374 *******************************************************************/ 375 375 #define p_MemCmp_LengthFour_OrdNomogPosZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 387 387 388 388 /*************************************************************** 389 * 389 * 390 390 * PosNomogZero 391 * 391 * 392 392 *******************************************************************/ 393 393 #define p_MemCmp_LengthFour_OrdPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 405 405 406 406 /*************************************************************** 407 * 408 * PosPosNomog 409 * 407 * 408 * PosPosNomog 409 * 410 410 *******************************************************************/ 411 411 #define p_MemCmp_LengthThree_OrdPosPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 446 446 447 447 /*************************************************************** 448 * 449 * NegPosNomog 450 * 448 * 449 * NegPosNomog 450 * 451 451 *******************************************************************/ 452 452 #define p_MemCmp_LengthThree_OrdNegPosNomog(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 488 488 489 489 /*************************************************************** 490 * 491 * PosNomogPos 492 * 490 * 491 * PosNomogPos 492 * 493 493 *******************************************************************/ 494 494 #define p_MemCmp_LengthThree_OrdPosNomogPos(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 530 530 531 531 /*************************************************************** 532 * 532 * 533 533 * PosPosNomogZero 534 * 534 * 535 535 *******************************************************************/ 536 536 #define p_MemCmp_LengthFour_OrdPosPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 548 548 549 549 /*************************************************************** 550 * 550 * 551 551 * PosNomogPosZero 552 * 552 * 553 553 *******************************************************************/ 554 554 #define p_MemCmp_LengthFour_OrdPosNomogPosZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 566 566 567 567 /*************************************************************** 568 * 568 * 569 569 * NegPosNomogZero 570 * 570 * 571 571 *******************************************************************/ 572 572 #define p_MemCmp_LengthFour_OrdNegPosNomogZero(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 585 585 586 586 /*************************************************************** 587 * 587 * 588 588 * OrdGeneral 589 * 589 * 590 590 *******************************************************************/ 591 591 #define _p_MemCmp_OrdGeneral_Declare(s1, s2) \ … … 608 608 actionG; \ 609 609 } \ 610 while (0) 610 while (0) 611 611 612 612 #define _p_MemCmp_OrdGeneral(i, actionE) \ … … 618 618 if (_v1 == _v2) actionE; \ 619 619 } \ 620 while(0) 620 while(0) 621 621 622 622 #define _p_MemCmp_LengthTwo_OrdGeneral(actionE) \ … … 714 714 715 715 /*************************************************************** 716 * 716 * 717 717 * Last but not least LengthGeneral_OrdGeneral 718 * 718 * 719 719 *******************************************************************/ 720 720 #define p_MemCmp_LengthGeneral_OrdGeneral(s1, s2, length, ordsgn, actionE, actionG, actionS) \ … … 766 766 767 767 /*************************************************************** 768 * 768 * 769 769 * Bitmask 770 * 770 * 771 771 *******************************************************************/ 772 772 #define _p_MemCmp_Bitmask_Declare(s1, s2, bitmask) \ … … 813 813 } \ 814 814 while (0) 815 815 816 816 #define _p_MemCmp_Bitmask_LengthTwo(actionS) \ 817 817 do \ -
Singular/p_Merge_q__T.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: p_Merge_q__T.cc,v 1. 2 2001-08-27 14:47:24 Singular Exp $9 * Version: $Id: p_Merge_q__T.cc,v 1.3 2001-10-09 16:36:14 Singular Exp $ 10 10 *******************************************************************/ 11 11 … … 14 14 * Returns: p merged with q 15 15 * Destroys: p, q 16 * 16 * 17 17 ***************************************************************/ 18 18 LINKAGE poly p_Merge_q(poly p, poly q, const ring r) … … 24 24 int l = pLength(p) + pLength(q); 25 25 #endif 26 26 27 27 spolyrec rp; 28 28 poly a = &rp; … … 37 37 dReportError("Equal monomials in p_Merge_q"); 38 38 return NULL; 39 39 40 40 Greater: 41 41 a = pNext(a) = p; … … 43 43 if (p==NULL) { pNext(a) = q; goto Finish;} 44 44 goto Top; 45 45 46 46 Smaller: 47 47 a = pNext(a) = q; … … 49 49 if (q==NULL) { pNext(a) = p; goto Finish;} 50 50 goto Top; 51 51 52 52 Finish: 53 53 … … 55 55 #if PDEBUG > 0 56 56 pAssume1(l - pLength(pNext(&rp)) == 0); 57 #endif 57 #endif 58 58 return pNext(&rp); 59 59 } -
Singular/p_Minus_mm_Mult_qq__T.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: p_Minus_mm_Mult_qq__T.cc,v 1. 2 2001-08-27 14:47:25Singular Exp $9 * Version: $Id: p_Minus_mm_Mult_qq__T.cc,v 1.3 2001-10-09 16:36:14 Singular Exp $ 10 10 *******************************************************************/ 11 11 … … 16 16 * Destroys: p 17 17 * Const: m, q 18 * 18 * 19 19 ***************************************************************/ 20 20 LINKAGE poly p_Minus_mm_Mult_qq(poly p, poly m, poly q, int& Shorter, const poly spNoether, const ring r, poly &last) … … 31 31 // we are done if q == NULL || m == NULL 32 32 if (q == NULL || m == NULL) return p; 33 33 34 34 spolyrec rp; 35 35 poly a = &rp, // collects the result … … 50 50 const unsigned long* m_e = m->exp; 51 51 omBin bin = r->PolyBin; 52 52 53 53 if (p == NULL) goto Finish; // return tneg*q if (p == NULL) 54 54 55 55 pAssume(p_GetComp(q, r) == 0 || p_GetComp(m, r) == 0); 56 56 … … 60 60 p_MemSum(qm->exp, q->exp, m_e, length); 61 61 p_MemAddAdjust(qm, r); 62 63 CmpTop: 62 63 CmpTop: 64 64 // compare qm = m*q and p w.r.t. monomial ordering 65 65 p_MemCmp(qm->exp, p->exp, length, ordsgn, goto Equal, goto Greater, goto Smaller ); 66 66 67 67 Equal: // qm equals p 68 68 tb = n_Mult(pGetCoeff(q), tm, r); … … 78 78 } 79 79 else 80 { // coeffs are equal, so their difference is 0: 80 { // coeffs are equal, so their difference is 0: 81 81 shorter += 2; 82 82 n_Delete(&tc, r); … … 88 88 // no, so update qm 89 89 goto SumTop; 90 90 91 91 92 92 Greater: … … 97 97 { 98 98 qm = NULL; 99 goto Finish; 99 goto Finish; 100 100 } 101 // construct new qm 101 // construct new qm 102 102 goto AllocTop; 103 104 Smaller: 103 104 Smaller: 105 105 a = pNext(a) = p;// append p to result and advance p 106 106 pIter(p); 107 107 if (p == NULL) goto Finish; 108 108 goto CmpTop; 109 109 110 110 111 111 Finish: // q or p is NULL: Clean-up time … … 129 129 pSetCoeff0(m, tm); 130 130 } 131 131 132 132 n_Delete(&tneg, r); 133 133 if (qm != NULL) p_FreeBinAddr(qm, r); … … 135 135 p_Test(pNext(&rp), r); 136 136 return pNext(&rp); 137 } 137 } -
Singular/p_Mult_mm__T.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: p_Mult_mm__T.cc,v 1. 2 2001-08-27 14:47:25 Singular Exp $9 * Version: $Id: p_Mult_mm__T.cc,v 1.3 2001-10-09 16:36:15 Singular Exp $ 10 10 *******************************************************************/ 11 11 … … 14 14 * Returns: p*m 15 15 * Const: m 16 * Destroys: p 16 * Destroys: p 17 17 * 18 18 ***************************************************************/ -
Singular/p_Mult_nn__T.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: p_Mult_nn__T.cc,v 1. 2 2001-08-27 14:47:26Singular Exp $9 * Version: $Id: p_Mult_nn__T.cc,v 1.3 2001-10-09 16:36:15 Singular Exp $ 10 10 *******************************************************************/ 11 11 … … 21 21 pAssume(!n_IsZero(n,r)); 22 22 p_Test(p, r); 23 23 24 24 poly q = p; 25 25 while (p != NULL) -
Singular/p_Mult_q.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: p_Mult_q.cc,v 1. 7 2000-12-31 15:14:38 obachmanExp $9 * Version: $Id: p_Mult_q.cc,v 1.8 2001-10-09 16:36:15 Singular Exp $ 10 10 *******************************************************************/ 11 11 #include "mod2.h" … … 13 13 /*************************************************************** 14 14 * 15 * Returns: p * q, 15 * Returns: p * q, 16 16 * Destroys: if !copy then p, q 17 17 * Assumes: pLength(p) >= 2 pLength(q) >=2 … … 27 27 { 28 28 int l = 0; 29 29 30 30 do 31 31 { … … 62 62 } 63 63 64 65 static poly _p_Mult_q_Bucket(poly p, const int lp, 66 poly q, const int lq, 64 65 static poly _p_Mult_q_Bucket(poly p, const int lp, 66 poly q, const int lq, 67 67 const int copy, const ring r) 68 68 { … … 80 80 poly rn = pNext(res); // pNext(rr) 81 81 number n, n1; 82 82 83 83 kBucket_pt bucket = kBucketCreate(r); 84 84 85 85 // initialize bucket 86 86 kBucketInit(bucket, pNext(rn), lp - 2); … … 91 91 if (rn == NULL) goto Smaller; 92 92 p_LmCmpAction(rn, qn, r, goto Equal, goto Greater, goto Smaller); 93 93 94 94 Greater: 95 95 // rn > qn, so iter … … 98 98 pIter(rn); 99 99 goto Top; 100 100 101 101 // rn < qn, append qn to rr, and compute next Lm(qq)*pp 102 102 Smaller: … … 117 117 pNext(rr) = kBucketExtractLm(bucket); 118 118 } 119 119 120 120 pIter(qq); 121 121 if (qq == NULL) goto Finish; 122 122 rn = pNext(rr); 123 123 goto Top; 124 124 125 125 Equal: 126 126 n1 = pGetCoeff(rn); … … 141 141 qn = p_LmFreeAndNext(qn, r); 142 142 goto Work; 143 143 144 144 Finish: 145 145 assume(rr != NULL && pNext(rr) != NULL); 146 146 pNext(pNext(rr)) = kBucketClear(bucket); 147 147 kBucketDestroy(&bucket); 148 148 149 149 if (!copy) 150 150 { … … 171 171 poly rn = pNext(res); // pNext(rr) 172 172 number n, n1; 173 173 174 174 // now the main loop 175 175 Top: 176 176 if (rn == NULL) goto Smaller; 177 177 p_LmCmpAction(rn, qn, r, goto Equal, goto Greater, goto Smaller); 178 178 179 179 Greater: 180 180 // rn > qn, so iter … … 182 182 pIter(rn); 183 183 goto Top; 184 184 185 185 // rn < qn, append qn to rr, and compute next Lm(qq)*pp 186 186 Smaller: … … 195 195 pNext(rr) = p_Plus_mm_Mult_qq(rn, qq, pp, r); 196 196 } 197 197 198 198 pIter(qq); 199 199 if (qq == NULL) goto Finish; 200 200 rn = pNext(rr); 201 201 goto Top; 202 202 203 203 Equal: 204 204 n1 = pGetCoeff(rn); … … 219 219 qn = p_LmFreeAndNext(qn, r); 220 220 goto Work; 221 221 222 222 Finish: 223 223 if (!copy) … … 235 235 int lp, lq, l; 236 236 poly pt; 237 237 238 238 pqLength(p, q, lp, lq, MIN_LENGTH_BUCKET); 239 239 240 240 if (lp < lq) 241 241 { -
Singular/p_Mult_q.h
re58c4a ra3bc95e 4 4 /*************************************************************** 5 5 * File: p_Mult_q.h 6 * Purpose: declaration of some auxillary routines for 6 * Purpose: declaration of some auxillary routines for 7 7 * p_Mult_q 8 8 * Author: obachman (Olaf Bachmann) 9 9 * Created: 8/00 10 * Version: $Id: p_Mult_q.h,v 1. 1 2000-12-31 15:14:39 obachmanExp $10 * Version: $Id: p_Mult_q.h,v 1.2 2001-10-09 16:36:15 Singular Exp $ 11 11 *******************************************************************/ 12 12 #include "mod2.h" -
Singular/p_Procs.h
re58c4a ra3bc95e 8 8 * Author: obachman (Olaf Bachmann) 9 9 * Created: 8/00 10 * Version: $Id: p_Procs.h,v 1.1 3 2001-08-27 14:47:28Singular Exp $10 * Version: $Id: p_Procs.h,v 1.14 2001-10-09 16:36:16 Singular Exp $ 11 11 *******************************************************************/ 12 12 #ifndef P_PROCS_H … … 21 21 typedef poly (*pp_Mult_nn_Proc_Ptr)(poly p, const number n, const ring r); 22 22 typedef poly (*p_Mult_mm_Proc_Ptr)(poly p, const poly m, const ring r); 23 typedef poly (*pp_Mult_mm_Proc_Ptr)(poly p, const poly m, 24 const ring r, 23 typedef poly (*pp_Mult_mm_Proc_Ptr)(poly p, const poly m, 24 const ring r, 25 25 poly &last); 26 typedef poly (*pp_Mult_mm_Noether_Proc_Ptr)(poly p, const poly m, 26 typedef poly (*pp_Mult_mm_Noether_Proc_Ptr)(poly p, const poly m, 27 27 const poly spNoether, int &ll, 28 28 const ring r, poly &last); 29 29 typedef poly (*p_Add_q_Proc_Ptr)(poly p, poly q, int & shorter, const ring r); 30 typedef poly (*p_Minus_mm_Mult_qq_Proc_Ptr)(poly p, poly m, poly q, 30 typedef poly (*p_Minus_mm_Mult_qq_Proc_Ptr)(poly p, poly m, poly q, 31 31 int &shorter, const poly spNoether, 32 32 const ring r, poly &last); … … 59 59 } pProcs_s; 60 60 61 61 62 62 void p_ProcsSet(ring r, p_Procs_s* p_Procs); 63 63 #ifdef RDEBUG 64 void p_Debug_GetSpecNames(const ring r, char* &field, char* &length, 64 void p_Debug_GetSpecNames(const ring r, char* &field, char* &length, 65 65 char* &ord); 66 66 void p_Debug_GetProcNames(const ring r, p_Procs_s* p_Procs); -
Singular/p_Procs_Dynamic.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 12/00 9 * Version: $Id: p_Procs_Dynamic.cc,v 1. 4 2001-01-30 12:19:24Singular Exp $9 * Version: $Id: p_Procs_Dynamic.cc,v 1.5 2001-10-09 16:36:16 Singular Exp $ 10 10 *******************************************************************/ 11 11 #include "mod2.h" … … 58 58 { 59 59 const char* module = p_ProcField_2_Module(proc, field); 60 61 if (strcmp(module, "FieldIndep") == 0) 60 61 if (strcmp(module, "FieldIndep") == 0) 62 62 return p_ProcInitHandle(&p_procs_handle_FieldIndep, module); 63 else if (strcmp(module, "FieldZp") == 0) 63 else if (strcmp(module, "FieldZp") == 0) 64 64 return p_ProcInitHandle(&p_procs_handle_FieldZp, module); 65 else if (strcmp(module, "FieldQ") == 0) 65 else if (strcmp(module, "FieldQ") == 0) 66 66 return p_ProcInitHandle(&p_procs_handle_FieldQ, module); 67 else if (strcmp(module, "FieldGeneral") == 0) 67 else if (strcmp(module, "FieldGeneral") == 0) 68 68 return p_ProcInitHandle(&p_procs_handle_FieldGeneral, module); 69 69 else … … 74 74 } 75 75 76 76 77 77 #define InitSetProcs(f, l, o) ((void)0) 78 78 … … 81 81 switch(proc) 82 82 { 83 case p_Copy_Proc: 83 case p_Copy_Proc: 84 84 return (void *)p_Copy__FieldGeneral_LengthGeneral_OrdGeneral; 85 case p_Delete_Proc: 85 case p_Delete_Proc: 86 86 return (void *)p_Delete__FieldGeneral_LengthGeneral_OrdGeneral; 87 case p_ShallowCopyDelete_Proc: 87 case p_ShallowCopyDelete_Proc: 88 88 return (void *)p_ShallowCopyDelete__FieldGeneral_LengthGeneral_OrdGeneral; 89 case p_Mult_nn_Proc: 89 case p_Mult_nn_Proc: 90 90 return (void *)p_Mult_nn__FieldGeneral_LengthGeneral_OrdGeneral; 91 case pp_Mult_nn_Proc: 91 case pp_Mult_nn_Proc: 92 92 return (void *)pp_Mult_nn__FieldGeneral_LengthGeneral_OrdGeneral; 93 case pp_Mult_mm_Proc: 93 case pp_Mult_mm_Proc: 94 94 return (void *)pp_Mult_mm__FieldGeneral_LengthGeneral_OrdGeneral; 95 case pp_Mult_mm_Noether_Proc: 95 case pp_Mult_mm_Noether_Proc: 96 96 return (void *)pp_Mult_mm_Noether__FieldGeneral_LengthGeneral_OrdGeneral; 97 case p_Mult_mm_Proc: 97 case p_Mult_mm_Proc: 98 98 return (void *)p_Mult_mm__FieldGeneral_LengthGeneral_OrdGeneral; 99 case p_Add_q_Proc: 99 case p_Add_q_Proc: 100 100 return (void *)p_Add_q__FieldGeneral_LengthGeneral_OrdGeneral; 101 case p_Minus_mm_Mult_qq_Proc: 101 case p_Minus_mm_Mult_qq_Proc: 102 102 return (void *)p_Minus_mm_Mult_qq__FieldGeneral_LengthGeneral_OrdGeneral; 103 case p_Neg_Proc: 103 case p_Neg_Proc: 104 104 return (void *)p_Neg__FieldGeneral_LengthGeneral_OrdGeneral; 105 case pp_Mult_Coeff_mm_DivSelect_Proc: 105 case pp_Mult_Coeff_mm_DivSelect_Proc: 106 106 return (void *)pp_Mult_Coeff_mm_DivSelect__FieldGeneral_LengthGeneral_OrdGeneral; 107 case pp_Mult_Coeff_mm_DivSelectMult_Proc: 107 case pp_Mult_Coeff_mm_DivSelectMult_Proc: 108 108 return (void *)pp_Mult_Coeff_mm_DivSelectMult__FieldGeneral_LengthGeneral_OrdGeneral; 109 case p_Merge_q_Proc: 109 case p_Merge_q_Proc: 110 110 return (void *)p_Merge_q__FieldGeneral_LengthGeneral_OrdGeneral; 111 case p_kBucketSetLm_Proc: 111 case p_kBucketSetLm_Proc: 112 112 return (void *)p_kBucketSetLm__FieldGeneral_LengthGeneral_OrdGeneral; 113 113 case p_Unknown_Proc: … … 125 125 switch(proc) 126 126 { 127 case p_Copy_Proc: 127 case p_Copy_Proc: 128 128 return "p_Copy__FieldGeneral_LengthGeneral_OrdGeneral"; 129 case p_Delete_Proc: 129 case p_Delete_Proc: 130 130 return "p_Delete__FieldGeneral_LengthGeneral_OrdGeneral"; 131 case p_ShallowCopyDelete_Proc: 131 case p_ShallowCopyDelete_Proc: 132 132 return "p_ShallowCopyDelete__FieldGeneral_LengthGeneral_OrdGeneral"; 133 case p_Mult_nn_Proc: 133 case p_Mult_nn_Proc: 134 134 return "p_Mult_nn__FieldGeneral_LengthGeneral_OrdGeneral"; 135 case pp_Mult_nn_Proc: 135 case pp_Mult_nn_Proc: 136 136 return "pp_Mult_nn__FieldGeneral_LengthGeneral_OrdGeneral"; 137 case pp_Mult_mm_Proc: 137 case pp_Mult_mm_Proc: 138 138 return "pp_Mult_mm__FieldGeneral_LengthGeneral_OrdGeneral"; 139 case pp_Mult_mm_Noether_Proc: 139 case pp_Mult_mm_Noether_Proc: 140 140 return "pp_Mult_mm_Noether__FieldGeneral_LengthGeneral_OrdGeneral"; 141 case p_Mult_mm_Proc: 141 case p_Mult_mm_Proc: 142 142 return "p_Mult_mm__FieldGeneral_LengthGeneral_OrdGeneral"; 143 case p_Add_q_Proc: 143 case p_Add_q_Proc: 144 144 return "p_Add_q__FieldGeneral_LengthGeneral_OrdGeneral"; 145 case p_Minus_mm_Mult_qq_Proc: 145 case p_Minus_mm_Mult_qq_Proc: 146 146 return "p_Minus_mm_Mult_qq__FieldGeneral_LengthGeneral_OrdGeneral"; 147 case p_Neg_Proc: 147 case p_Neg_Proc: 148 148 return "p_Neg__FieldGeneral_LengthGeneral_OrdGeneral"; 149 case pp_Mult_Coeff_mm_DivSelect_Proc: 149 case pp_Mult_Coeff_mm_DivSelect_Proc: 150 150 return "pp_Mult_Coeff_mm_DivSelect__FieldGeneral_LengthGeneral_OrdGeneral"; 151 case pp_Mult_Coeff_mm_DivSelectMult_Proc: 151 case pp_Mult_Coeff_mm_DivSelectMult_Proc: 152 152 return "pp_Mult_Coeff_mm_DivSelectMult__FieldGeneral_LengthGeneral_OrdGeneral"; 153 case p_Merge_q_Proc: 153 case p_Merge_q_Proc: 154 154 return "p_Merge_q__FieldGeneral_LengthGeneral_OrdGeneral"; 155 case p_kBucketSetLm_Proc: 155 case p_kBucketSetLm_Proc: 156 156 return "p_kBucketSetLm__FieldGeneral_LengthGeneral_OrdGeneral"; 157 157 case p_Unknown_Proc: … … 163 163 164 164 165 static void* GetDynamicProc(const char* proc_s, p_Proc proc, 165 static void* GetDynamicProc(const char* proc_s, p_Proc proc, 166 166 p_Field field, p_Length length, p_Ord ord 167 167 #ifdef RDEBUG … … 172 172 void* proc_ptr = NULL; 173 173 char proc_name[MAX_PROCNAME_LEN]; 174 sprintf(proc_name, "%s__%s_%s_%s", proc_s, 175 p_FieldEnum_2_String(field), 176 p_LengthEnum_2_String(length), 174 sprintf(proc_name, "%s__%s_%s_%s", proc_s, 175 p_FieldEnum_2_String(field), 176 p_LengthEnum_2_String(length), 177 177 p_OrdEnum_2_String(ord)); 178 178 // first, try to get the proc from the kernel … … 187 187 #ifdef RDEBUG 188 188 sprintf(proc_name, GetGeneralProcName(proc)); 189 #endif 189 #endif 190 190 } 191 191 } … … 200 200 return proc_ptr; 201 201 } 202 202 203 203 204 204 #define DoReallySetProc(what, field, length, ord) \ … … 221 221 #endif 222 222 223 223 224 224 #include "p_Procs_Set.h" 225 225 -
Singular/p_Procs_Impl.h
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 12/00 9 * Version: $Id: p_Procs_Impl.h,v 1. 5 2000-12-31 15:54:46 obachmanExp $9 * Version: $Id: p_Procs_Impl.h,v 1.6 2001-10-09 16:36:16 Singular Exp $ 10 10 *******************************************************************/ 11 11 #ifndef P_PROCS_IMPL_H … … 13 13 14 14 /*************************************************************** 15 * 15 * 16 16 * Configurations 17 * 17 * 18 18 *******************************************************************/ 19 19 20 20 /*************************************************************** 21 21 Here is how it works: 22 At run-time, SetProcs is used to choose the appropriate PolyProcs 22 At run-time, SetProcs is used to choose the appropriate PolyProcs 23 23 based on the ring properies. 24 At generate-time, SetProcs is used to generate all 24 At generate-time, SetProcs is used to generate all 25 25 possible PolyProcs. 26 Which PolyProcs are generated/used can be controled by values of 26 Which PolyProcs are generated/used can be controled by values of 27 27 HAVE_FAST_P_PROCS, HAVE_FAST_LENGTH, HAVE_FAST_ORD, and FAST_FIELD 28 28 29 29 At generate-time, the file p_Procs.inc is generated, 30 30 which provides implementations of the p_Procs, based on … … 32 32 macros. 33 33 34 At run-time, a fast proc is set/choosen if found/generated, else 34 At run-time, a fast proc is set/choosen if found/generated, else 35 35 a general proc is set/choosen. 36 36 *******************************************************************/ … … 52 52 // 2 -- plus special cases for FieldQ 53 53 // nothing else is implemented, yet 54 #ifndef HAVE_FAST_FIELD 54 #ifndef HAVE_FAST_FIELD 55 55 #define HAVE_FAST_FIELD 0 56 56 #endif … … 62 62 // 3 -- special cases for length <= 4 63 63 // 4 -- special cases for length <= 8 64 #ifndef HAVE_FAST_LENGTH 64 #ifndef HAVE_FAST_LENGTH 65 65 #define HAVE_FAST_LENGTH 0 66 66 #endif … … 72 72 // 3 -- special ords for with n_min <= 3 73 73 // 4 -- special for all ords 74 #ifndef HAVE_FAST_ORD 74 #ifndef HAVE_FAST_ORD 75 75 #define HAVE_FAST_ORD 0 76 76 #endif 77 77 78 78 // Define HAVE_FAST_ZERO_ORD to: 79 // 0 -- no zero ords are considered 79 // 0 -- no zero ords are considered 80 80 // 1 -- only ZeroOrds for OrdPosNomogPosZero, OrdNomogPosZero, OrdPomogNegZero 81 81 // 2 -- ZeroOrds for all 82 #ifndef HAVE_FAST_ZERO_ORD 82 #ifndef HAVE_FAST_ZERO_ORD 83 83 #define HAVE_FAST_ZERO_ORD 0 84 84 #endif … … 94 94 95 95 /*************************************************************** 96 * 96 * 97 97 * Definitions of our fields, lengths, ords, procs we work with 98 * 98 * 99 99 *******************************************************************/ 100 100 … … 106 106 { 107 107 FieldGeneral = 0, 108 FieldZp, 108 FieldZp, 109 109 FieldQ, 110 110 FieldR, … … 121 121 { 122 122 LengthGeneral = 0, // n >= 1 123 LengthEight, // n == 8 123 LengthEight, // n == 8 124 124 LengthSeven, 125 125 LengthSix, … … 131 131 LengthUnknown 132 132 }; 133 typedef enum p_Ord 134 { 135 OrdGeneral = 0, 136 // ordsgn 133 typedef enum p_Ord 134 { 135 OrdGeneral = 0, 136 // ordsgn 137 137 // 0 1 i n-1 n n_min Example 138 138 OrdPomog, // + + + + + 1 (lp,C) … … 199 199 { 200 200 case FieldGeneral: return "FieldGeneral"; 201 case FieldZp: return "FieldZp"; 201 case FieldZp: return "FieldZp"; 202 202 case FieldQ: return "FieldQ"; 203 203 case FieldR: return "FieldR"; … … 218 218 switch(length) 219 219 { 220 case LengthGeneral: return "LengthGeneral"; 221 case LengthEight: return "LengthEight"; 220 case LengthGeneral: return "LengthGeneral"; 221 case LengthEight: return "LengthEight"; 222 222 case LengthSeven: return "LengthSeven"; 223 223 case LengthSix: return "LengthSix"; … … 236 236 switch(ord) 237 237 { 238 case OrdGeneral: return "OrdGeneral"; 239 case OrdPomog: return "OrdPomog"; 240 case OrdNomog: return "OrdNomog"; 241 case OrdNegPomog: return "OrdNegPomog"; 242 case OrdPomogNeg: return "OrdPomogNeg"; 243 case OrdPosNomog: return "OrdPosNomog"; 244 case OrdNomogPos: return "OrdNomogPos"; 245 case OrdPosPosNomog: return "OrdPosPosNomog"; 246 case OrdPosNomogPos: return "OrdPosNomogPos"; 247 case OrdNegPosNomog: return "OrdNegPosNomog"; 238 case OrdGeneral: return "OrdGeneral"; 239 case OrdPomog: return "OrdPomog"; 240 case OrdNomog: return "OrdNomog"; 241 case OrdNegPomog: return "OrdNegPomog"; 242 case OrdPomogNeg: return "OrdPomogNeg"; 243 case OrdPosNomog: return "OrdPosNomog"; 244 case OrdNomogPos: return "OrdNomogPos"; 245 case OrdPosPosNomog: return "OrdPosPosNomog"; 246 case OrdPosNomogPos: return "OrdPosNomogPos"; 247 case OrdNegPosNomog: return "OrdNegPosNomog"; 248 248 #ifdef HAVE_LENGTH_DIFF 249 case OrdNegPomogZero: return "OrdNegPomogZero"; 250 case OrdPomogNegZero: return "OrdPomogNegZero"; 251 case OrdPomogZero: return "OrdPomogZero"; 252 case OrdNomogZero: return "OrdNomogZero"; 253 case OrdNomogPosZero: return "OrdNomogPosZero"; 254 case OrdPosNomogZero: return "OrdPosNomogZero"; 249 case OrdNegPomogZero: return "OrdNegPomogZero"; 250 case OrdPomogNegZero: return "OrdPomogNegZero"; 251 case OrdPomogZero: return "OrdPomogZero"; 252 case OrdNomogZero: return "OrdNomogZero"; 253 case OrdNomogPosZero: return "OrdNomogPosZero"; 254 case OrdPosNomogZero: return "OrdPosNomogZero"; 255 255 case OrdPosPosNomogZero: return "OrdPosPosNomogZero"; 256 256 case OrdPosNomogPosZero: return "OrdPosNomogPosZero"; … … 304 304 case p_Merge_q_Proc: 305 305 return 1; 306 306 307 307 default: 308 308 return 0; … … 318 318 case p_Neg_Proc: 319 319 return 0; 320 320 321 321 default: 322 322 return 1; 323 323 } 324 324 } 325 325 326 326 // returns string specifying the module into which the p_Proc 327 327 // should go … … 338 338 339 339 /*************************************************************** 340 * 341 * 340 * 341 * 342 342 * Deal with OrdZero 343 * 343 * 344 344 *******************************************************************/ 345 345 #ifdef HAVE_LENGTH_DIFF … … 365 365 case OrdPosPosNomogZero: return OrdPosPosNomog; 366 366 case OrdNegPosNomogZero: return OrdNegPosNomog; 367 default: 367 default: 368 368 if (strict) return OrdGeneral; 369 369 else if (ord == OrdPomogNegZero) return OrdPomogNeg; … … 384 384 385 385 /*************************************************************** 386 * 387 * Filters which are applied to field/length/ord, before a proc is 386 * 387 * Filters which are applied to field/length/ord, before a proc is 388 388 * choosen 389 * 389 * 390 390 *******************************************************************/ 391 391 #ifdef p_Procs_Static 392 static inline void StaticKernelFilter(p_Field &field, p_Length &length, 392 static inline void StaticKernelFilter(p_Field &field, p_Length &length, 393 393 p_Ord &ord, const p_Proc proc) 394 394 { … … 407 407 { 408 408 if (HAVE_FAST_P_PROCS >= 5) return; 409 409 410 410 if (HAVE_FAST_P_PROCS < 3 && field == FieldQ) 411 411 field = FieldGeneral; 412 412 413 413 if ((HAVE_FAST_P_PROCS == 0) || 414 414 (HAVE_FAST_P_PROCS <= 4 && field != FieldZp && field != FieldQ && … … 420 420 return; 421 421 } 422 if (HAVE_FAST_P_PROCS == 1 || 422 if (HAVE_FAST_P_PROCS == 1 || 423 423 (HAVE_FAST_P_PROCS == 4 && field != FieldZp && proc != p_Merge_q_Proc)) 424 424 ord = OrdGeneral; … … 427 427 static inline void FastFieldFilter(p_Field &field) 428 428 { 429 if (HAVE_FAST_FIELD <= 0 || 429 if (HAVE_FAST_FIELD <= 0 || 430 430 (HAVE_FAST_FIELD == 1 && field != FieldZp) || 431 431 (field != FieldZp && field != FieldQ)) 432 432 field = FieldGeneral; 433 433 } 434 434 435 435 static inline void FastLengthFilter(p_Length &length) 436 436 { … … 457 457 if (IsZeroOrd(ord)) 458 458 { 459 if ((HAVE_FAST_ZERO_ORD == 1 && (ord != OrdPosNomogPosZero && 460 ord != OrdNomogPosZero && 459 if ((HAVE_FAST_ZERO_ORD == 1 && (ord != OrdPosNomogPosZero && 460 ord != OrdNomogPosZero && 461 461 ord != OrdPomogNegZero)) || 462 462 (HAVE_FAST_ZERO_ORD <= 0)) … … 484 484 } 485 485 486 static inline void pp_Mult_mm_Noether_Filter(p_Field &field, 486 static inline void pp_Mult_mm_Noether_Filter(p_Field &field, 487 487 p_Length &length, p_Ord &ord) 488 488 { 489 if (ord == OrdPomog 489 if (ord == OrdPomog 490 490 || ord == OrdPomogZero 491 || (ord == OrdPomogNeg && length > LengthTwo) 491 || (ord == OrdPomogNeg && length > LengthTwo) 492 492 #ifdef HAVE_LENGTH_DIFF 493 493 || (ord == OrdPomogZero) … … 502 502 } 503 503 } 504 505 static inline void FastProcFilter(p_Proc proc, p_Field &field, 504 505 static inline void FastProcFilter(p_Proc proc, p_Field &field, 506 506 p_Length &length, p_Ord &ord) 507 507 { … … 512 512 p_Add_q__Filter(length, ord); 513 513 break; 514 514 515 515 case p_Copy_Proc: 516 516 case p_Delete_Proc: 517 517 NCopy__Filter(field); 518 518 break; 519 519 520 520 case pp_Mult_mm_Noether_Proc: 521 521 pp_Mult_mm_Noether_Filter(field, length, ord); … … 531 531 } 532 532 break; 533 533 534 534 default: break; 535 535 } … … 554 554 ord > ORD_MAX_N_3) // i.e. OrdNomogPosZero and below 555 555 return 0; 556 556 557 557 if (length >= LengthTwo && // i.e. 1 or 2 558 558 ord > ORD_MAX_N_2) // i.e. PosNomog and below 559 559 return 0; 560 560 561 if (length == LengthOne && 561 if (length == LengthOne && 562 562 ord > ORD_MAX_N_1) // i.e. PosPomogZero and below 563 563 return 0; … … 569 569 } 570 570 571 571 572 572 static inline int index(p_Length length, p_Ord ord) 573 573 { … … 593 593 case p_Neg_Proc: 594 594 return field; 595 595 596 596 case p_ShallowCopyDelete_Proc: 597 597 return length; 598 598 599 599 case p_Copy_Proc: 600 600 case pp_Mult_mm_Proc: … … 610 610 case p_kBucketSetLm_Proc: 611 611 return index(field, length, ord); 612 612 613 613 case p_Merge_q_Proc: 614 614 return index(length, ord); 615 615 616 616 default: 617 617 assume(0); … … 623 623 624 624 /*************************************************************** 625 * 626 * Macros for setting procs -- these are used for 625 * 626 * Macros for setting procs -- these are used for 627 627 * generation and setting 628 628 * … … 639 639 } \ 640 640 while (0) \ 641 641 642 642 #define SetProcs(field, length, ord) \ 643 643 do \ -
Singular/p_Procs_Static.h
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 12/00 9 * Version: $Id: p_Procs_Static.h,v 1. 3 2000-12-20 17:18:53 obachmanExp $9 * Version: $Id: p_Procs_Static.h,v 1.4 2001-10-09 16:36:16 Singular Exp $ 10 10 *******************************************************************/ 11 11 … … 46 46 47 47 // Set HAVE_FAST_ZERO_ORD to: 48 // 0 -- no zero ords are considered 48 // 0 -- no zero ords are considered 49 49 // 1 -- only ZeroOrds for OrdPosNomogPosZero, OrdNomogPosZero, OrdPomogNegZero 50 50 // 2 -- ZeroOrds for all -
Singular/p_ShallowCopyDelete__T.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: p_ShallowCopyDelete__T.cc,v 1. 2 2001-08-27 14:47:29Singular Exp $9 * Version: $Id: p_ShallowCopyDelete__T.cc,v 1.3 2001-10-09 16:36:17 Singular Exp $ 10 10 *******************************************************************/ 11 11 … … 13 13 * 14 14 * Destroys: p 15 * Assumes: Monoms of p are from 16 * Returns: 15 * Assumes: Monoms of p are from 16 * Returns: 17 17 ***************************************************************/ 18 18 LINKAGE poly p_ShallowCopyDelete(poly s_p, const ring r, omBin d_bin) … … 22 22 unsigned long* s_e; 23 23 poly h; 24 24 25 25 DECLARE_LENGTH(const unsigned long length = r->ExpL_Size); 26 26 -
Singular/p_polys.h
re58c4a ra3bc95e 4 4 /*************************************************************** 5 5 * File: p_Polys.h 6 * Purpose: declaration of poly stuf which are independent of 6 * Purpose: declaration of poly stuf which are independent of 7 7 * currRing 8 8 * Author: obachman (Olaf Bachmann) 9 9 * Created: 9/00 10 * Version: $Id: p_polys.h,v 1. 19 2000-12-31 15:14:40 obachmanExp $10 * Version: $Id: p_polys.h,v 1.20 2001-10-09 16:36:17 Singular Exp $ 11 11 *******************************************************************/ 12 12 #ifndef P_POLYS_H … … 24 24 - debugging only if PDEBUG >= 2 25 25 - normally inlined, unless PDEBUG >= 2 || NO_INLINE2 26 Level 1: operations on monomials with time proportional to length 26 Level 1: operations on monomials with time proportional to length 27 27 - implemented in: pInline1.h 28 28 - debugging only if PDEBUG >= 1 29 - normally inlined, unless PDEBUG >= 1 || NO_INLINE1 29 - normally inlined, unless PDEBUG >= 1 || NO_INLINE1 30 30 Level 0: short operations on polynomials with time proportional to 31 31 length of poly … … 35 35 #define DO_PINLINE0 36 36 #include "pInline0.h" 37 Misc : operations on polynomials which do not fit in any of the 37 Misc : operations on polynomials which do not fit in any of the 38 38 above categories 39 39 - implemented in: polys*.cc … … 66 66 PINLINE2 number p_SetCoeff(poly p, number n, ring r); 67 67 68 // get Order 68 // get Order 69 69 PINLINE2 Order_t p_GetOrder(poly p, ring r); 70 70 // don't use this … … 92 92 /*************************************************************** 93 93 * 94 * Allocation/Initalization/Deletion 94 * Allocation/Initalization/Deletion 95 95 * except for pDeleteLm and pHead, all polys must be != NULL 96 96 * … … 158 158 PINLINE2 int p_Cmp(poly p1, poly p2, ring r); 159 159 160 161 /*************************************************************** 162 * 163 * Divisiblity tests, args must be != NULL, except for 160 161 /*************************************************************** 162 * 163 * Divisiblity tests, args must be != NULL, except for 164 164 * pDivisbleBy 165 165 * … … 169 169 PINLINE1 BOOLEAN p_LmDivisibleByNoComp(poly a, poly b, ring r); 170 170 unsigned long p_GetShortExpVector(poly a, ring r); 171 PINLINE1 BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, 171 PINLINE1 BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, 172 172 poly b, unsigned long not_sev_b, ring r); 173 173 … … 183 183 ***************************************************************/ 184 184 // test if the monomial is a constant as a vector component 185 // i.e., test if all exponents are zero 185 // i.e., test if all exponents are zero 186 186 PINLINE1 BOOLEAN p_LmIsConstantComp(const poly p, const ring r); 187 187 PINLINE1 BOOLEAN p_LmIsConstant(const poly p, const ring r); … … 282 282 // like p_Minus_mm_Mult_qq, except that if lp == pLength(lp) lq == pLength(lq) 283 283 // then lp == pLength(p -m*q) 284 PINLINE2 poly p_Minus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq, 284 PINLINE2 poly p_Minus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq, 285 285 poly spNoether, const ring r); 286 286 // returns p + m*q destroys p, const: q, m … … 288 288 289 289 // returns p + m*q destroys p, const: q, m 290 PINLINE2 poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq, 290 PINLINE2 poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq, 291 291 const ring r); 292 292 … … 402 402 // check if Lm(p) is from ring r 403 403 BOOLEAN p_LmCheckIsFromRing(poly p, ring r); 404 // check if Lm(p) != NULL, r != NULL and initialized && Lm(p) is from r 404 // check if Lm(p) != NULL, r != NULL and initialized && Lm(p) is from r 405 405 BOOLEAN p_LmCheckPolyRing(poly p, ring r); 406 406 // check if all monoms of p are from ring r -
Singular/pcv.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: pcv.cc,v 1.3 2 2001-02-13 13:10:38Singular Exp $ */4 /* $Id: pcv.cc,v 1.33 2001-10-09 16:36:17 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: conversion between polys and coef vectors … … 154 154 { 155 155 res->rtyp=INT_CMD; 156 res->data=(void*)pcvMinDeg((matrix)h->Data()); 156 res->data=(void*)pcvMinDeg((matrix)h->Data()); 157 157 return FALSE; 158 158 } -
Singular/polys.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: polys.cc,v 1.7 7 2001-09-25 16:07:31Singular Exp $ */4 /* $Id: polys.cc,v 1.78 2001-10-09 16:36:18 Singular Exp $ */ 5 5 6 6 /* … … 71 71 pFDeg = new_FDeg; 72 72 currRing->pFDeg = new_FDeg; 73 73 74 74 if (new_lDeg == NULL) 75 75 new_lDeg = currRing->pLDegOrig; … … 80 80 81 81 82 // restores pFDeg and pLDeg: 82 // restores pFDeg and pLDeg: 83 83 extern void pRestoreDegProcs(pFDegProc old_FDeg, pLDegProc old_lDeg) 84 84 { -
Singular/pp_Mult_Coeff_mm_DivSelectMult__T.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: pp_Mult_Coeff_mm_DivSelectMult__T.cc,v 1. 2 2001-08-27 14:47:33Singular Exp $9 * Version: $Id: pp_Mult_Coeff_mm_DivSelectMult__T.cc,v 1.3 2001-10-09 16:36:18 Singular Exp $ 10 10 *******************************************************************/ 11 11 … … 14 14 * Returns: p*Coeff(m)*a/b for such monomials pm of p, for which 15 15 * m is divisble by pm, shorter == #of monomials left out 16 * Assumes: m, a, b are monomials, ordering is (c, dp), 16 * Assumes: m, a, b are monomials, ordering is (c, dp), 17 17 * (p*a) is divisble by b for all monimials in question 18 18 * Const: p, m, a, b … … 40 40 unsigned long* ab_e = &(ab->exp[0]); 41 41 42 p_MemDiff(ab_e, ((unsigned long*) &(a->exp[0])), ((unsigned long*) &(b->exp[0])), 42 p_MemDiff(ab_e, ((unsigned long*) &(a->exp[0])), ((unsigned long*) &(b->exp[0])), 43 43 length); 44 44 45 45 int Shorter = 0; 46 46 poly q = &rp; … … 50 50 p_MemCmp_Bitmask_2(m_e, &(p->exp[2]), bitmask, length_2, 51 51 goto Divisible, goto NotDivisible); 52 52 53 53 NotDivisible: 54 54 pAssume(!p_LmDivisibleByNoComp(m, p, r)); 55 55 Shorter++; 56 56 goto Iter; 57 57 58 58 Divisible: 59 59 pAssume(p_LmDivisibleByNoComp(m, p, r)); -
Singular/pp_Mult_Coeff_mm_DivSelect__T.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: pp_Mult_Coeff_mm_DivSelect__T.cc,v 1. 2 2001-08-27 14:47:34Singular Exp $9 * Version: $Id: pp_Mult_Coeff_mm_DivSelect__T.cc,v 1.3 2001-10-09 16:36:19 Singular Exp $ 10 10 *******************************************************************/ 11 11 … … 17 17 * 18 18 ***************************************************************/ 19 LINKAGE poly pp_Mult_Coeff_mm_DivSelect(poly p, const poly m, int &shorter, 19 LINKAGE poly pp_Mult_Coeff_mm_DivSelect(poly p, const poly m, int &shorter, 20 20 const ring r) 21 21 { -
Singular/pp_Mult_mm_Noether__T.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: pp_Mult_mm_Noether__T.cc,v 1. 2 2001-08-27 14:47:35Singular Exp $9 * Version: $Id: pp_Mult_mm_Noether__T.cc,v 1.3 2001-10-09 16:36:19 Singular Exp $ 10 10 *******************************************************************/ 11 11 … … 23 23 p_LmTest(m, ri); 24 24 assume(spNoether != NULL); 25 if (p == NULL) 25 if (p == NULL) 26 26 { 27 27 ll = 0; … … 40 40 pAssume1(p_GetComp(m, ri) == 0 || p_MaxComp(p, ri) == 0); 41 41 int l = 0; 42 42 43 43 do 44 44 { … … 48 48 49 49 p_MemCmp(r->exp, spNoether_exp, length, ordsgn, goto Continue, goto Continue, goto Break); 50 50 51 51 Break: 52 52 p_FreeBinAddr(r, ri); … … 64 64 else 65 65 ll = pLength(p); 66 67 if (q != &rp) 66 67 if (q != &rp) 68 68 last = q; 69 69 pNext(q) = NULL; -
Singular/pp_Mult_mm__T.cc
re58c4a ra3bc95e 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: pp_Mult_mm__T.cc,v 1. 2 2001-08-27 14:47:35Singular Exp $9 * Version: $Id: pp_Mult_mm__T.cc,v 1.3 2001-10-09 16:36:19 Singular Exp $ 10 10 *******************************************************************/ 11 11 … … 20 20 p_Test(p, ri); 21 21 p_LmTest(m, ri); 22 if (p == NULL) 22 if (p == NULL) 23 23 { 24 24 last = NULL; -
Singular/prCopy.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: prCopy.cc,v 1.1 1 2000-12-31 15:14:43 obachmanExp $ */4 /* $Id: prCopy.cc,v 1.12 2001-10-09 16:36:19 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT - implementation of functions for Copy/Move/Delete for Polys … … 16 16 #include "sbuckets.h" 17 17 18 static inline void 18 static inline void 19 19 prCopyEvector(poly dest, ring dest_r, poly src, ring src_r,int max) 20 20 { … … 41 41 { 42 42 poly res; 43 43 44 44 if (rField_has_simple_Alloc(currRing)) 45 45 res = pr_Copy_REqual_NSimple_NoSort(p, currRing, currRing); … … 92 92 else 93 93 res = pr_Move_NoREqual_NoNSimple_NoSort(p, src_r, currRing); 94 pTest(res); 95 return res; 96 } 97 94 pTest(res); 95 return res; 96 } 97 98 98 ///////////////////////////////////////////////////////////////////////// 99 99 // prHead … … 114 114 { 115 115 prCopyProc_t prproc; 116 if (rField_has_simple_Alloc(currRing)) 116 if (rField_has_simple_Alloc(currRing)) 117 117 prproc = pr_Copy_NoREqual_NSimple_NoSort; 118 118 else 119 prproc = pr_Copy_NoREqual_NoNSimple_NoSort; 120 119 prproc = pr_Copy_NoREqual_NoNSimple_NoSort; 120 121 121 return prHeadR(p, src_r, prproc); 122 122 } … … 124 124 ///////////////////////////////////////////////////////////////////////// 125 125 // idrCopy 126 static inline ideal 126 static inline ideal 127 127 idrCopy(ideal id, ring src_r, ring dest_r, prCopyProc_t prproc) 128 128 { … … 131 131 ideal res = idInit(IDELEMS(id), id->rank); 132 132 int i; 133 133 134 134 for (i=IDELEMS(id)-1; i>=0; i--) 135 135 { … … 145 145 ideal res; 146 146 prCopyProc_t prproc; 147 if (rField_has_simple_Alloc(currRing)) 147 if (rField_has_simple_Alloc(currRing)) 148 148 prproc = pr_Copy_REqual_NSimple_NoSort; 149 149 else … … 157 157 ideal res; 158 158 prCopyProc_t prproc; 159 if (rField_has_simple_Alloc(currRing)) 159 if (rField_has_simple_Alloc(currRing)) 160 160 prproc = pr_Copy_NoREqual_NSimple_Sort; 161 161 else … … 164 164 return res; 165 165 } 166 166 167 167 ideal idrCopyR_NoSort(ideal id, ring src_r) 168 168 { 169 169 ideal res; 170 170 prCopyProc_t prproc; 171 if (rField_has_simple_Alloc(currRing)) 171 if (rField_has_simple_Alloc(currRing)) 172 172 prproc = pr_Copy_NoREqual_NSimple_NoSort; 173 173 else … … 176 176 return res; 177 177 } 178 178 179 179 ///////////////////////////////////////////////////////////////////////// 180 180 // idrMove 181 static inline ideal 181 static inline ideal 182 182 idrMove(ideal &id, ring src_r, ring dest_r, prCopyProc_t prproc) 183 183 { 184 184 if (id == NULL) return NULL; 185 185 ideal res = id; 186 186 187 187 int i; 188 188 for (i=IDELEMS(id)-1; i>=0; i--) … … 196 196 prCopyProc_t prproc; 197 197 ideal res; 198 199 if (rField_has_simple_Alloc(currRing)) 198 199 if (rField_has_simple_Alloc(currRing)) 200 200 prproc = pr_Move_NoREqual_NSimple_Sort; 201 201 else … … 204 204 return res; 205 205 } 206 206 207 207 ideal idrMoveR_NoSort(ideal &id, ring src_r) 208 208 { 209 209 prCopyProc_t prproc; 210 210 ideal res; 211 212 if (rField_has_simple_Alloc(currRing)) 211 212 if (rField_has_simple_Alloc(currRing)) 213 213 prproc = pr_Move_NoREqual_NSimple_NoSort; 214 214 else -
Singular/prCopyMacros.h
re58c4a ra3bc95e 32 32 #undef PR_NDELETE 33 33 #undef PR_NUMBER_SIMPLE_NAME 34 #if PR_NUMBER_SIMPLE > 0 34 #if PR_NUMBER_SIMPLE > 0 35 35 #define PR_NCOPY(n, r) n 36 36 #define PR_NDELETE(n, r) ((void)0) -
Singular/prCopyTemplate.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: prCopyTemplate.cc,v 1. 5 2000-12-07 15:42:30 obachmanExp $ */4 /* $Id: prCopyTemplate.cc,v 1.6 2001-10-09 16:36:20 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT - templates for pr routines … … 8 8 9 9 10 static poly PR_NAME 10 static poly PR_NAME 11 11 (poly &src, ring r_src, ring r_dest) 12 12 { … … 14 14 poly dest = &dest_s; 15 15 poly tmp; 16 PR_INIT_EVECTOR_COPY(r_src, r_dest); 16 PR_INIT_EVECTOR_COPY(r_src, r_dest); 17 17 18 18 while (src != NULL) … … 32 32 return dest; 33 33 } 34 35 -
Singular/ring.h
re58c4a ra3bc95e 7 7 * ABSTRACT - the interpreter related ring operations 8 8 */ 9 /* $Id: ring.h,v 1.6 6 2001-05-22 13:20:00 Singular Exp $ */9 /* $Id: ring.h,v 1.67 2001-10-09 16:36:20 Singular Exp $ */ 10 10 11 11 /* includes */ … … 235 235 rOrderType_t rGetOrderType(ring r); 236 236 /* returns TRUE if var(i) belongs to p-block */ 237 BOOLEAN rIsPolyVar(int i, ring r = currRing); 237 BOOLEAN rIsPolyVar(int i, ring r = currRing); 238 238 239 239 inline BOOLEAN rOrd_is_Comp_dp(ring r) 240 240 { 241 241 return ((r->order[0] == ringorder_c || r->order[0] == ringorder_C) && 242 r->order[1] == ringorder_dp && 242 r->order[1] == ringorder_dp && 243 243 r->order[2] == 0); 244 244 } -
Singular/run.h
re58c4a ra3bc95e 23 23 #ifdef B19 24 24 #define CYGWIN_ATTACH_HANDLE_TO_FD(a) cygwin32_attach_handle_to_fd a 25 #define CYGWIN_CONV_TO_FULL_POSIX_PATH(a) cygwin32_conv_to_full_posix_path a 25 #define CYGWIN_CONV_TO_FULL_POSIX_PATH(a) cygwin32_conv_to_full_posix_path a 26 26 #define CYGWIN_CONV_TO_FULL_WIN32_PATH(a) cygwin32_conv_to_full_win32_path a 27 27 #define CYGWIN_CONV_TO_POSIX_PATH(a) cygwin32_conv_to_posix_path a … … 39 39 #else 40 40 #define CYGWIN_ATTACH_HANDLE_TO_FD(a) cygwin_attach_handle_to_fd a 41 #define CYGWIN_CONV_TO_FULL_POSIX_PATH(a) cygwin_conv_to_full_posix_path a 41 #define CYGWIN_CONV_TO_FULL_POSIX_PATH(a) cygwin_conv_to_full_posix_path a 42 42 #define CYGWIN_CONV_TO_FULL_WIN32_PATH(a) cygwin_conv_to_full_win32_path a 43 43 #define CYGWIN_CONV_TO_POSIX_PATH(a) cygwin_conv_to_posix_path a … … 91 91 int fileExists(char* fullname, const char* path, const char* name); 92 92 int endsWith(const char* s1, const char* s2); 93 int fileExistsMulti(char* fullname, const char* path, 93 int fileExistsMulti(char* fullname, const char* path, 94 94 const char* name_noext, const char* exts[], 95 95 const int extcnt); -
Singular/sbuckets.cc
re58c4a ra3bc95e 4 4 /*************************************************************** 5 5 * File: sbuckets.cc 6 * Purpose: implementation of routines for sorting polys using 6 * Purpose: implementation of routines for sorting polys using 7 7 * a bucket sort 8 8 * Author: obachman (Olaf Bachmann) 9 9 * Created: 9/00 10 * Version: $Id: sbuckets.cc,v 1. 1 2000-12-31 15:17:47 obachmanExp $10 * Version: $Id: sbuckets.cc,v 1.2 2001-10-09 16:36:21 Singular Exp $ 11 11 *******************************************************************/ 12 12 #include "sbuckets.h" … … 56 56 } 57 57 while (1); 58 58 59 59 return j; 60 60 } 61 61 62 62 ////////////////////////////////////////////////////////////////////////// 63 63 // Creation/Destruction of buckets … … 96 96 assume(LOG2(length) == i); 97 97 } 98 98 99 99 bucket->buckets[i].p = p; 100 100 bucket->buckets[i].length = length; 101 101 if (i > bucket->max_bucket) bucket->max_bucket = i; 102 102 } 103 103 104 104 void sBucket_Merge_p(sBucket_pt bucket, poly p, int length) 105 105 { 106 106 assume(bucket != NULL); 107 107 assume(length <= 0 || length == pLength(p)); 108 108 109 109 if (p == NULL) return; 110 110 if (length <= 0) length = pLength(p); 111 111 112 112 int i = LOG2(length); 113 113 114 114 while (bucket->buckets[i].p != NULL) 115 115 { … … 121 121 assume(LOG2(length) == i); 122 122 } 123 123 124 124 bucket->buckets[i].p = p; 125 125 bucket->buckets[i].length = length; … … 131 131 assume(bucket != NULL); 132 132 assume(length <= 0 || length == pLength(p)); 133 133 134 134 if (p == NULL) return; 135 135 if (length <= 0) length = pLength(p); 136 136 137 137 int i = LOG2(length); 138 138 139 139 while (bucket->buckets[i].p != NULL) 140 140 { 141 p = p_Add_q(p, bucket->buckets[i].p, length, bucket->buckets[i].length, 141 p = p_Add_q(p, bucket->buckets[i].p, length, bucket->buckets[i].length, 142 142 bucket->bucket_ring); 143 143 bucket->buckets[i].p = NULL; … … 145 145 i = LOG2(length); 146 146 } 147 147 148 148 bucket->buckets[i].p = p; 149 149 bucket->buckets[i].length = length; … … 158 158 int lr = 0; 159 159 int i = 0; 160 160 161 161 while (bucket->buckets[i].p == NULL) 162 162 { … … 170 170 bucket->buckets[i].length = 0; 171 171 i++; 172 172 173 173 while (i <= bucket->max_bucket) 174 174 { … … 182 182 i++; 183 183 } 184 184 185 185 done: 186 186 *p = pr; … … 196 196 int lr = 0; 197 197 int i = 0; 198 198 199 199 while (bucket->buckets[i].p == NULL) 200 200 { … … 208 208 bucket->buckets[i].length = 0; 209 209 i++; 210 210 211 211 while (i <= bucket->max_bucket) 212 212 { 213 213 if (bucket->buckets[i].p != NULL) 214 214 { 215 pr = p_Add_q(pr, bucket->buckets[i].p, lr, bucket->buckets[i].length, 215 pr = p_Add_q(pr, bucket->buckets[i].p, lr, bucket->buckets[i].length, 216 216 bucket->bucket_ring); 217 217 bucket->buckets[i].p = NULL; … … 220 220 i++; 221 221 } 222 222 223 223 done: 224 224 *p = pr; … … 236 236 int l_in = pLength(p); 237 237 #endif 238 238 239 239 if (p == NULL || pNext(p) == NULL) return p; 240 240 241 241 sBucket_pt bucket = sBucketCreate(r); 242 242 poly pn = pNext(p); 243 243 244 244 do 245 245 { … … 251 251 } 252 252 while (1); 253 253 254 254 int l_dummy; 255 255 sBucketClearMerge(bucket, &pn, &l_dummy); … … 273 273 int l_in = pLength(p); 274 274 #endif 275 275 276 276 if (p == NULL || pNext(p) == NULL) return p; 277 277 278 278 sBucket_pt bucket = sBucketCreate(r); 279 279 poly pn = pNext(p); 280 280 281 281 do 282 282 { … … 288 288 } 289 289 while (1); 290 290 291 291 int l_dummy; 292 292 sBucketClearAdd(bucket, &pn, &l_dummy); … … 300 300 return pn; 301 301 } 302 303 304 305 306 307 -
Singular/sbuckets.h
re58c4a ra3bc95e 4 4 /*************************************************************** 5 5 * File: sbuckets.h 6 * Purpose: declaration of routines for sorting and adding up polys using 6 * Purpose: declaration of routines for sorting and adding up polys using 7 7 * a bucket sort 8 8 * Note: If you need to extract the leading momonial of a bucket, … … 10 10 * Author: obachman (Olaf Bachmann) 11 11 * Created: 9/00 12 * Version: $Id: sbuckets.h,v 1. 1 2000-12-31 15:17:47 obachmanExp $12 * Version: $Id: sbuckets.h,v 1.2 2001-10-09 16:36:21 Singular Exp $ 13 13 *******************************************************************/ 14 14 #ifndef S_BUCKETS_H -
Singular/scanner.l
re58c4a ra3bc95e 3 3 * Computer Algebra System SINGULAR * 4 4 ****************************************/ 5 /* $Id: scanner.l,v 1. 29 2000-09-18 09:19:32 obachmanExp $ */5 /* $Id: scanner.l,v 1.30 2001-10-09 16:36:21 Singular Exp $ */ 6 6 #include <stdio.h> 7 7 #include <string.h> … … 47 47 #undef malloc 48 48 #define malloc my_malloc 49 #undef realloc 49 #undef realloc 50 50 #define realloc my_realloc 51 51 #undef free -
Singular/silink.cc
re58c4a ra3bc95e 2 2 * Computer Algebra System SINGULAR * 3 3 ***************************