Changeset a18fae in git
- Timestamp:
- Feb 27, 1998, 5:28:01 PM (26 years ago)
- Branches:
- (u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
- Children:
- 8520b7877eddd3c2fb9e800be697d25406a2e9fd
- Parents:
- 057e93cfb99481837b68f0a75ed85363fff714b6
- Location:
- Singular
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/febase.h
r057e93c ra18fae 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: febase.h,v 1. 6 1998-02-27 14:06:11Singular Exp $ */6 /* $Id: febase.h,v 1.7 1998-02-27 16:27:56 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT … … 47 47 enum feBufferTypes 48 48 { 49 BT_none = 0, // entry level 49 50 BT_break = 1, // while, for 50 BT_proc, // proc , script51 BT_proc, // proc 51 52 BT_example, // example 52 53 BT_file, // <"file" -
Singular/febase.inc
r057e93c ra18fae 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: febase.inc,v 1. 2 1998-02-27 14:06:11Singular Exp $ */4 /* $Id: febase.inc,v 1.3 1998-02-27 16:27:57 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: handling of 'voices' … … 345 345 346 346 /*2 347 * print prompt (si_echo or TRACE), set prompt_char 347 * set prompt_char 348 * only called with currentVoice->sw == BI_stdin 348 349 */ 349 350 static void feShowPrompt(void) 350 351 { 351 if ((traceit&TRACE_SHOW_LINE) 352 || (traceit&TRACE_SHOW_LINE1) 353 || (currentVoice->Typ() != BT_example)) 354 { 355 if ((si_echo > myynest) || (currentVoice->sw == BI_stdin) || (traceit&TRACE_SHOW_LINE) 356 || (traceit&TRACE_SHOW_LINE1)) 357 { 352 //if (currentVoice->sw == BI_stdin) 353 { 358 354 #ifdef HAVE_TCL 359 360 361 362 363 355 if (tclmode) 356 { 357 PrintTCL('P',(prompt_char=='>')? 0 : 1,NULL); 358 } 359 else 364 360 #endif 365 if ((BVERBOSE(V_PROMPT))&&(!feBatch)) 366 { 367 if (currentVoice->sw == BI_stdin) 368 { 369 fe_promptstr[0]=prompt_char; 361 if ((BVERBOSE(V_PROMPT))&&(!feBatch)) 362 { 363 fe_promptstr[0]=prompt_char; 370 364 #ifndef HAVE_READLINE 371 365 PrintS(fe_promptstr); 372 366 #endif 373 } 374 else 375 { 376 if (currentVoice->filename==NULL) 377 Print("(none) %3d%c ",yylineno,prompt_char); 378 else 379 Print("%s %3d%c ",currentVoice->filename,yylineno,prompt_char); 380 } 381 prompt_char = '.'; 382 mflush(); 383 } 367 } 368 mflush(); 384 369 #ifdef macintosh 385 370 cols = 0; 386 371 #endif 387 }388 372 } 389 373 } … … 394 378 static int fePrintEcho(char *anf) 395 379 { 380 prompt_char = '.'; 396 381 char *ss=strchr(anf,'\n'); 397 382 int len_s; … … 411 396 // handle echo: 412 397 if (((si_echo>myynest) 413 && (currentVoice->typ!=BT_break) 414 && (currentVoice->typ!=BT_execute) 415 && (strncmp(anf,";return();",10)!=0) 398 && (((currentVoice->typ==BT_proc) 399 && (strncmp(anf,";return();",10)!=0)) 400 || (currentVoice->typ==BT_example) 401 || (currentVoice->typ==BT_file) 402 || (currentVoice->typ==BT_none) 403 ) 416 404 ) 417 405 || (traceit&TRACE_SHOW_LINE) 418 406 || (traceit&TRACE_SHOW_LINE1)) 419 407 { 408 if (currentVoice->filename==NULL) 409 Print("(none) %3d%c ",yylineno,prompt_char); 410 else 411 Print("%s %3d%c ",currentVoice->filename,yylineno,prompt_char); 420 412 fwrite(anf,1,len_s,stdout); 421 413 mflush(); … … 454 446 strncpy(s,anf,len+2); 455 447 s[len+1]='\0'; 456 feShowPrompt();457 448 fePrintEcho(s); 458 449 FreeL((ADDRESS)s); … … 470 461 s[len+1]='\0'; 471 462 yylineno++; 472 feShowPrompt();473 463 fePrintEcho(s); 474 464 FreeL((ADDRESS)s); … … 489 479 NewRead: 490 480 yylineno++; 491 feShowPrompt();492 481 if (currentVoice->sw==BI_stdin) 482 { 483 feShowPrompt(); 493 484 s=fe_fgets_stdin(currentVoice->buffer+offset,(4096-sizeof(ADDRESS))-offset); 485 } 494 486 else if (currentVoice->sw==BI_file) 495 487 s=fgets(currentVoice->buffer+offset,(4096-sizeof(ADDRESS))-offset, -
Singular/ideals.cc
r057e93c ra18fae 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: ideals.cc,v 1. 19 1998-02-24 09:52:22 siebertExp $ */4 /* $Id: ideals.cc,v 1.20 1998-02-27 16:27:58 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT - all basic methods to manipulate ideals … … 2197 2197 } 2198 2198 2199 /*2 2200 * compute all ar-minors of the matrix a 2201 */ 2202 ideal idMinors(matrix a, int ar) 2203 { 2204 if(ar<=0) 2205 { 2206 Werror("%d-th minor ",ar); 2207 return NULL; 2208 } 2209 int i,j,k,size; 2210 int *rowchoise,*colchoise; 2211 BOOLEAN rowch,colch; 2212 ideal result; 2213 matrix tmp; 2214 poly p; 2215 2216 i = binom(a->rows(),ar); 2217 j = binom(a->cols(),ar); 2218 2219 rowchoise=(int *)Alloc(ar*sizeof(int)); 2220 colchoise=(int *)Alloc(ar*sizeof(int)); 2221 if ((i>512) || (j>512) || (i*j >512)) size=512; 2222 else size=i*j; 2223 result=idInit(size,1); 2224 tmp=mpNew(ar,ar); 2225 k = 0; /* the index in result*/ 2226 idInitChoise(ar,1,a->rows(),&rowch,rowchoise); 2227 while (!rowch) 2228 { 2229 idInitChoise(ar,1,a->cols(),&colch,colchoise); 2230 while (!colch) 2231 { 2232 for (i=1; i<=ar; i++) 2233 { 2234 for (j=1; j<=ar; j++) 2235 { 2236 MATELEM(tmp,i,j) = MATELEM(a,rowchoise[i-1],colchoise[j-1]); 2237 } 2238 } 2239 p = mpDet(tmp); 2240 if (p!=NULL) 2241 { 2242 if (k>=size) 2243 { 2244 pEnlargeSet(&result->m,size,32); 2245 size += 32; 2246 } 2247 result->m[k] = p; 2248 k++; 2249 } 2250 idGetNextChoise(ar,a->cols(),&colch,colchoise); 2251 } 2252 idGetNextChoise(ar,a->rows(),&rowch,rowchoise); 2253 } 2254 /*delete the matrix tmp*/ 2255 for (i=1; i<=ar; i++) 2256 { 2257 for (j=1; j<=ar; j++) MATELEM(tmp,i,j) = NULL; 2258 } 2259 idDelete((ideal*)&tmp); 2260 if (k==0) 2261 { 2262 k=1; 2263 result->m[0]=NULL; 2264 } 2265 Free((ADDRESS)rowchoise,ar*sizeof(int)); 2266 Free((ADDRESS)colchoise,ar*sizeof(int)); 2267 pEnlargeSet(&result->m,size,k-size); 2268 IDELEMS(result) = k; 2269 return (result); 2270 } 2271 2199 2272 /*3 2200 2273 * produces recursively the ideal of all arxar-minors of a 2201 2274 */ 2202 2275 static void idRecMin(matrix a,int ar,poly *barDiv,ideal result, 2203 int * nextPlace, int rowToChose=0)2276 int * nextPlace, intvec * pfRows, intvec * iv) 2204 2277 { 2205 2278 //Print("Level: %d\n",ar); … … 2211 2284 2212 2285 /*--- initializing temporary structures-------------------*/ 2213 int i,j,r =rowToChose,c,newi,newp,k;2286 int i,j,r,c,newi,newp,k; 2214 2287 poly p=NULL,pp; 2288 BOOLEAN justChosen=FALSE; 2215 2289 2216 2290 if (ar==0) … … 2230 2304 } 2231 2305 MATELEM(a,i,j) = NULL; 2306 //if ((*nextPlace==21) || (*nextPlace==37)) 2307 //{ 2308 // Print("Hier sind sie!\n"); 2309 //} 2310 //pWrite(p); 2232 2311 result->m[*nextPlace] = p; 2233 2312 (*nextPlace)++; … … 2235 2314 } 2236 2315 } 2237 idTest(result);2238 2316 idDelete((ideal*)&a); 2239 2317 return; … … 2243 2321 pp = pCopy(p); //we had to store barDiv for the remaining loops 2244 2322 matrix nextStep = mpOneStepBareiss(a,barDiv,&r,&c); 2245 //Print("next row is: %d, next col: %d\n",r,c); 2246 /*--- there is no pivot - the matrix is zero -------------*/ 2247 if (r*c==0) 2248 { 2249 idDelete((ideal*)&a); 2250 return; 2251 } 2323 /*--- we compute the row-index of the chosen row r -------*/ 2324 newi = 0; 2325 while ((newi<iv->length()) && ((*iv)[newi]!=0)) newi++; 2326 k = (*iv)[newi] = r; 2327 for (j=newi-1;j>0;j--) 2328 { 2329 if (k>=(*iv)[j]) k++; 2330 } 2331 newp = 0; 2332 while ((newp<pfRows->length()) && ((*pfRows)[newp]!=0)) 2333 { 2334 if ((*pfRows)[newp]==k) 2335 { 2336 justChosen = TRUE; 2337 //Print("just chosen\n"); 2338 break; 2339 } 2340 newp++; 2341 } 2342 if (!justChosen) (*pfRows)[newp] = k; 2343 //Print("Chosen: ");pfRows->show();PrintLn(); 2344 //Print("Deleted: ");iv->show();PrintLn(); 2252 2345 /*--- we read out the r-1 x c-1 matrix for the next step--*/ 2253 2346 if ((a->nrows-1)*(a->ncols-1)>0) … … 2264 2357 idDelete((ideal*)&nextStep); 2265 2358 /*--- we call the next Step------------------------------*/ 2266 idRecMin(next,ar-1,barDiv,result,nextPlace );2359 idRecMin(next,ar-1,barDiv,result,nextPlace,pfRows,iv); 2267 2360 next = NULL; 2268 2361 } 2269 2362 /*--- now we have to take out the r-th row...------------*/ 2270 if (((a->nrows)>1) && (rowToChose==0)) 2363 //Print("back for rows on Level: %d\n",ar); 2364 //Print("The actual row was %d\n",k); 2365 //Print("Chosen: ");pfRows->show();PrintLn(); 2366 //Print("Deleted: ");iv->show();PrintLn(); 2367 if (((a->nrows)>1) && (!justChosen)) 2271 2368 { 2272 2369 nextStep = mpNew(a->nrows-1,a->ncols); … … 2286 2383 } 2287 2384 /*--- and to perform the algorithm with the rest---------*/ 2288 idRecMin(nextStep,ar,&p,result,nextPlace );2385 idRecMin(nextStep,ar,&p,result,nextPlace,pfRows,iv); 2289 2386 nextStep = NULL; 2290 2387 } 2291 2388 /*--- now we have to take out the c-th col...------------*/ 2389 //Print("back for cols on Level: %d\n",ar); 2390 //Print("Chosen: ");pfRows->show();PrintLn(); 2391 //Print("Deleted: ");iv->show();PrintLn(); 2292 2392 if ((a->nrows)>1) 2293 2393 { … … 2309 2409 } 2310 2410 } 2411 idDelete((ideal*)&a); 2311 2412 /*--- and to perform the algorithm with the rest---------*/ 2312 idDelete((ideal*)&a);2313 idRecMin(nextStep,ar,&p,result,nextPlace, r);2413 (*iv)[newi] = 0; 2414 idRecMin(nextStep,ar,&p,result,nextPlace,pfRows,iv); 2314 2415 nextStep = NULL; 2315 2416 } 2316 2417 /*--- deleting temporary structures and returns----------*/ 2418 if (!justChosen) (*pfRows)[newp] = 0; 2317 2419 pDelete(barDiv); 2318 2420 pDelete(&p); … … 2325 2427 * the caller of idRecMin 2326 2428 */ 2327 ideal idMinors (matrix a, int ar)2429 ideal idMinors1(matrix a, int ar) 2328 2430 { 2329 2431 if((ar<=0) || (ar>min(a->ncols,a->nrows))) … … 2333 2435 } 2334 2436 int i=0; 2437 intvec * iv=new intvec(a->nrows+1); 2438 intvec * pv=new intvec(a->nrows+1); 2335 2439 poly barDiv=NULL; 2336 2440 ideal result=idInit(16,0); 2337 idTest(result); 2338 2339 idRecMin(mpCopy(a),ar-1,&barDiv,result,&i); 2441 2442 idRecMin(mpCopy(a),ar-1,&barDiv,result,&i,pv,iv); 2340 2443 idSkipZeroes(result); 2444 delete iv; 2445 delete pv; 2341 2446 return result; 2342 2447 } -
Singular/silink.cc
r057e93c ra18fae 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: silink.cc,v 1.1 4 1998-02-27 14:06:25Singular Exp $ */4 /* $Id: silink.cc,v 1.15 1998-02-27 16:28:01 Singular Exp $ */ 5 5 6 6 /* … … 703 703 if (status) 704 704 return TRUE; 705 706 int old_echo=si_echo; 707 si_echo=0; 708 705 709 status=yyparse(); 710 711 si_echo=old_echo; 706 712 707 713 if (status) -
Singular/tesths.cc
r057e93c ra18fae 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: tesths.cc,v 1.3 0 1998-02-27 14:06:26Singular Exp $ */4 /* $Id: tesths.cc,v 1.31 1998-02-27 16:28:01 Singular Exp $ */ 5 5 6 6 /* … … 148 148 si_echo = (int)(argv[1][i] - '0'); 149 149 } 150 else si_echo = 2;150 else si_echo = 1; 151 151 break; 152 152 case 'r': siRandomStart = 0;
Note: See TracChangeset
for help on using the changeset viewer.