@@ -167,94 +167,6 @@ static void mpSwapCol(matrix a, int pos, int lr, int lc)
167167 }
168168}
169169
170-
171- /*
172- /// entries of a are minors and go to result (only if not in R)
173- void mp_MinorToResult(ideal result, int &elems, matrix a, int r, int c,
174- ideal R, const ring R)
175- {
176- poly *q1;
177- int e=IDELEMS(result);
178- int i,j;
179-
180- if (R != NULL)
181- {
182- for (i=r-1;i>=0;i--)
183- {
184- q1 = &(a->m)[i*a->ncols];
185- for (j=c-1;j>=0;j--)
186- {
187- if (q1[j]!=NULL) q1[j] = kNF(R,currQuotient,q1[j]);
188- }
189- }
190- }
191- for (i=r-1;i>=0;i--)
192- {
193- q1 = &(a->m)[i*a->ncols];
194- for (j=c-1;j>=0;j--)
195- {
196- if (q1[j]!=NULL)
197- {
198- if (elems>=e)
199- {
200- if(e<SIZE_OF_SYSTEM_PAGE)
201- {
202- pEnlargeSet(&(result->m),e,e);
203- e += e;
204- }
205- else
206- {
207- pEnlargeSet(&(result->m),e,SIZE_OF_SYSTEM_PAGE);
208- e += SIZE_OF_SYSTEM_PAGE;
209- }
210- IDELEMS(result) =e;
211- }
212- result->m[elems] = q1[j];
213- q1[j] = NULL;
214- elems++;
215- }
216- }
217- }
218- }
219-
220- /// produces recursively the ideal of all arxar-minors of a
221- void mp_RecMin(int ar,ideal result,int &elems,matrix a,int lr,int lc,
222- poly barDiv, ideal R, const ring R)
223- {
224- int k;
225- int kr=lr-1,kc=lc-1;
226- matrix nextLevel=mpNew(kr,kc);
227-
228- loop
229- {
230- // --- look for an optimal row and bring it to last position ------------
231- if(mpPrepareRow(a,lr,lc)==0) break;
232- // --- now take all pivots from the last row ------------
233- k = lc;
234- loop
235- {
236- if(mpPreparePiv(a,lr,k)==0) break;
237- mpElimBar(a,nextLevel,barDiv,lr,k);
238- k--;
239- if (ar>1)
240- {
241- mpRecMin(ar-1,result,elems,nextLevel,kr,k,a->m[kr*a->ncols+k],R);
242- mpPartClean(nextLevel,kr,k);
243- }
244- else mpMinorToResult(result,elems,nextLevel,kr,k,R);
245- if (ar>k-1) break;
246- }
247- if (ar>=kr) break;
248- // --- now we have to take out the last row...------------
249- lr = kr;
250- kr--;
251- }
252- mpFinalClean(nextLevel);
253- }
254- */
255-
256-
257-
258170/*
259171* C++ classes for Bareiss algorithm
260172*/
@@ -319,47 +231,6 @@ class mp_permmatrix
319231
320232
321233
322- /* 2
323- *returns the determinant of the matrix m;
324- *uses Bareiss algorithm
325- */
326- poly mp_DetBareiss (matrix a, const ring R)
327- {
328- int s;
329- poly div, res;
330- if (MATROWS (a) != MATCOLS (a))
331- {
332- Werror (" det of %d x %d matrix" ,MATROWS (a),MATCOLS (a));
333- return NULL ;
334- }
335- matrix c = mp_Copy (a, R);
336- mp_permmatrix *Bareiss = new mp_permmatrix (c, R);
337- row_col_weight w (Bareiss->mpGetRdim (), Bareiss->mpGetCdim ());
338-
339- /* Bareiss */
340- div = NULL ;
341- while (Bareiss->mpPivotBareiss (&w))
342- {
343- Bareiss->mpElimBareiss (div);
344- div = Bareiss->mpGetElem (Bareiss->mpGetRdim (), Bareiss->mpGetCdim ());
345- }
346- Bareiss->mpRowReorder ();
347- Bareiss->mpColReorder ();
348- Bareiss->mpSaveArray ();
349- s = Bareiss->mpGetSign ();
350- delete Bareiss;
351-
352- /* result */
353- res = MATELEM (c,1 ,1 );
354- MATELEM (c,1 ,1 ) = NULL ;
355- id_Delete ((ideal *)&c, R);
356- if (s < 0 )
357- res = p_Neg (res, R);
358- return res;
359- }
360-
361-
362-
363234/* 2
364235*returns the determinant of the matrix m;
365236*uses Newtons formulea for symmetric functions
@@ -446,58 +317,6 @@ poly mp_Det (matrix m, const ring R)
446317 return result;
447318}
448319
449- /* 2
450- * compute all ar-minors of the matrix a
451- */
452- matrix mp_Wedge (matrix a, int ar, const ring R)
453- {
454- int i,j,k,l;
455- int *rowchoise,*colchoise;
456- BOOLEAN rowch,colch;
457- matrix result;
458- matrix tmp;
459- poly p;
460-
461- i = binom (a->nrows ,ar);
462- j = binom (a->ncols ,ar);
463-
464- rowchoise=(int *)omAlloc (ar*sizeof (int ));
465- colchoise=(int *)omAlloc (ar*sizeof (int ));
466- result =mpNew (i,j);
467- tmp=mpNew (ar,ar);
468- l = 1 ; /* k,l:the index in result*/
469- idInitChoise (ar,1 ,a->nrows ,&rowch,rowchoise);
470- while (!rowch)
471- {
472- k=1 ;
473- idInitChoise (ar,1 ,a->ncols ,&colch,colchoise);
474- while (!colch)
475- {
476- for (i=1 ; i<=ar; i++)
477- {
478- for (j=1 ; j<=ar; j++)
479- {
480- MATELEM (tmp,i,j) = MATELEM (a,rowchoise[i-1 ],colchoise[j-1 ]);
481- }
482- }
483- p = mp_DetBareiss (tmp, R);
484- if ((k+l) & 1 ) p=p_Neg (p, R);
485- MATELEM (result,l,k) = p;
486- k++;
487- idGetNextChoise (ar,a->ncols ,&colch,colchoise);
488- }
489- idGetNextChoise (ar,a->nrows ,&rowch,rowchoise);
490- l++;
491- }
492-
493- /* delete the matrix tmp*/
494- for (i=1 ; i<=ar; i++)
495- {
496- for (j=1 ; j<=ar; j++) MATELEM (tmp,i,j) = NULL ;
497- }
498- id_Delete ((ideal *) &tmp, R);
499- return (result);
500- }
501320
502321// /*2
503322// *homogenize all elements of matrix (not the matrix itself)
0 commit comments