Changeset 29d5f5 in git
- Timestamp:
- Oct 10, 2004, 12:30:36 PM (20 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- bb816a0c6c07bfea5755e3204da9de713b5ef949
- Parents:
- 2de2a9d3e8f79175378bf84769b7f049bae4b7e5
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/tgb.cc
r2de2a9d r29d5f5 520 520 P.p=h; /*p_Copy(h,c->r);*/ 521 521 P.FDeg=pFDeg(P.p,c->r); 522 522 523 if (!rField_is_Zp(c->r)){ 523 524 pCleardenom(P.p); 524 525 pContent(P.p); //is a duplicate call, but belongs here 525 }526 526 527 } 527 528 else 528 529 pNorm(P.p); 529 530 pNormalize(P.p); 530 531 531 532 c->strat->enterS(P,i,c->strat); … … 2336 2337 2337 2338 2338 tgb_sparse_matrix::tgb_sparse_matrix(int i, int j ){2339 tgb_sparse_matrix::tgb_sparse_matrix(int i, int j, ring rarg){ 2339 2340 mp=(mac_poly*) omalloc(i*sizeof (mac_poly));; 2340 2341 int z; … … 2347 2348 this->rows=i; 2348 2349 free_numbers=FALSE; 2350 r=rarg; 2349 2351 } 2350 2352 tgb_sparse_matrix::~tgb_sparse_matrix(){ … … 2503 2505 else 2504 2506 return FALSE; 2507 } 2508 void tgb_sparse_matrix::row_normalize(int row){ 2509 if (!rField_has_simple_inverse(r)) /* Z/p, GF(p,n), R, long R/C */ 2510 { 2511 mac_poly m=mp[row]; 2512 while (m!=NULL) 2513 { 2514 if (currRing==r) {nTest(m->coef);} 2515 n_Normalize(m->coef,r); 2516 m=m->next; 2517 } 2518 } 2505 2519 } 2506 2520 int tgb_sparse_matrix::non_zero_entries(int row){ … … 2567 2581 } 2568 2582 2569 void simple_gauss(tgb_sparse_matrix* mat ){2583 void simple_gauss(tgb_sparse_matrix* mat, calc_dat* c){ 2570 2584 int col, row; 2571 2585 int* row_cache=(int*) omalloc(mat->get_rows()*sizeof(int)); … … 2639 2653 2640 2654 found_in_row=row; 2655 BOOLEAN must_reduce=FALSE; 2641 2656 assume(pn<=mat->get_rows()); 2642 2657 for(i=row+1;i<=max_in_area;i++){ … … 2649 2664 col=first; 2650 2665 found_in_row=i; 2666 must_reduce=FALSE; 2667 } 2668 else { 2669 if(first==col) 2670 must_reduce=TRUE; 2651 2671 } 2652 2672 } … … 2674 2694 row_cache[found_in_row]=h; 2675 2695 2696 2697 2698 if(!must_reduce){ 2699 row++; 2700 continue; 2701 } 2676 2702 //reduction 2703 //must extract content and normalize here 2704 mat->row_normalize(row); 2677 2705 2678 2706 //for(i=row+1;i<pn;i++){ … … 2698 2726 mat->mult_row(i,n2); 2699 2727 mat->add_lambda_times_row(i,row,n1); 2728 nDelete(&n1); 2729 nDelete(&n2); 2700 2730 assume(mat->is_zero_entry(i,col)); 2701 2731 row_cache[i]=mat->min_col_not_zero_in_row(i); … … 2921 2951 } 2922 2952 static tgb_sparse_matrix* build_sparse_matrix(poly* p,int p_index,poly* done, int done_index, calc_dat* c){ 2923 tgb_sparse_matrix* t=new tgb_sparse_matrix(p_index,done_index );2953 tgb_sparse_matrix* t=new tgb_sparse_matrix(p_index,done_index,c->r); 2924 2954 int i, pos; 2925 2955 // Print("\n 0:%s\n",pString(done[done_index-1])); … … 3463 3493 // simple_gauss2(mat); 3464 3494 tgb_sparse_matrix* mat=build_sparse_matrix(p,p_index,done, done_index,c); 3465 simple_gauss(mat );3495 simple_gauss(mat,c); 3466 3496 m_size=mat->get_rows(); 3467 3497 m=(poly*) omalloc(m_size*sizeof(poly)); … … 4962 4992 r[rn].flatten(); 4963 4993 kBucketClear(r[rn].bucket,&red,&red_len); 4994 if (!rField_is_Zp(c->r)) 4995 { 4996 pContent(red); 4997 pCleardenom(red);//should be unnecessary 4998 4999 } 5000 pNormalize(red); 4964 5001 } 4965 5002 if (erg.to_reduce_u-erg.to_reduce_l>5){ -
Singular/tgb.h
r2de2a9d r29d5f5 136 136 class tgb_sparse_matrix{ 137 137 private: 138 ring r; 138 139 mac_poly* mp; 139 140 int columns; … … 144 145 friend poly free_row_to_poly(tgb_sparse_matrix* mat, int row, poly* monoms, int monom_index); 145 146 friend void init_with_mac_poly(tgb_sparse_matrix* mat, int row, mac_poly m); 146 tgb_sparse_matrix(int i, int j );147 tgb_sparse_matrix(int i, int j, ring rarg); 147 148 ~tgb_sparse_matrix(); 148 149 int get_rows(); 149 150 int get_columns(); 150 151 void print(); 152 void row_normalize(int row); 151 153 // void perm_rows(int i, int j); 152 154 void perm_rows(int i, int j){
Note: See TracChangeset
for help on using the changeset viewer.