Changeset 7164b40 in git


Ignore:
Timestamp:
Jan 19, 2002, 1:26:02 PM (22 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'spielwiese', 'd1b01e9d51ade4b46b745d3bada5c5f3696be3a8')
Children:
cb7578a9034f20d08a92cd05938a6eb9b7ce86ed
Parents:
a9256747eae039136ca8aa9de4dabf605eb86355
Message:
+ corrected maEggT


git-svn-id: file:///usr/local/Singular/svn/trunk@5733 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/fast_maps.cc

    ra92567 r7164b40  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 02/01
    9  *  Version: $Id: fast_maps.cc,v 1.5 2002-01-19 10:58:42 obachman Exp $
     9 *  Version: $Id: fast_maps.cc,v 1.6 2002-01-19 12:26:02 bricken Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     
    290290// return NULL if deg(ggt(m1, m2)) < 2
    291291// else return m = ggT(m1, m2) and q1, q2 such that m1 = q1*m m2 = q2*m
     292
    292293static poly maEggT(const poly m1, const poly m2, poly &q1, poly &q2,const ring r)
    293294{
     295
    294296  int i;
    295297  int dg = 0;
    296298  poly ggt = NULL;
    297   for (i=1; i<=r->N; i++)
    298   {
     299  q1 = p_Init(r);
     300  q2 = p_Init(r);
     301  ggt=p_Init(r);
     302
     303  for (i=1;i<=r->N;i++) {
    299304    Exponent_t e1 = p_GetExp(m1, i, r);
    300305    Exponent_t e2 = p_GetExp(m2, i, r);
    301     if (e1 > 0 && e2 > 0)
    302     {
     306    if (e1 > 0 && e2 > 0){
    303307      Exponent_t em = (e1 > e2 ? e2 : e1);
    304       if (dg < 2)
    305       {
    306         ggt = p_Init(r);
    307         q1 = p_Init(r);
    308         q2 = p_Init(r);
    309       }
    310308      dg += em;
    311309      p_SetExp(ggt, i, em, r);
     
    313311      p_SetExp(q2, i, e2 - em, r);
    314312    }
    315   }
    316   if (ggt != NULL)
     313    else {
     314      p_SetExp(q1, i, e1, r);
     315      p_SetExp(q2, i, e2, r);
     316    }
     317  }
     318  if (dg>1)
    317319  {
    318320    p_Setm(ggt, r);
    319321    p_Setm(q1, r);
    320322    p_Setm(q2, r);
     323
     324   
     325  }
     326  else {
     327    p_LmFree(ggt, r);
     328    p_LmFree(q1, r);
     329    p_LmFree(q2, r);
     330    ggt = NULL;
    321331  }
    322332  return ggt;
    323333}
     334
     335
    324336
    325337/*******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.