Changeset 60763e in git


Ignore:
Timestamp:
Jun 10, 1999, 11:01:17 AM (25 years ago)
Author:
Wilfred Pohl <pohl@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
dfd346fefacb74ceabb45bd6bcb026bc23d9acf0
Parents:
28f2d302b56d434cf41693253b775ee4d0d1703d
Message:
bug fixes


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

Legend:

Unmodified
Added
Removed
  • Singular/sparsmat.cc

    r28f2d3 r60763e  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: sparsmat.cc,v 1.7 1999-06-04 13:06:28 pohl Exp $ */
     4/* $Id: sparsmat.cc,v 1.8 1999-06-10 09:01:17 pohl Exp $ */
    55
    66/*
     
    4444
    4545/* declare internal 'C' stuff */
    46 static void smDebug() { int k=0; }
    4746static void smExactPolyDiv(poly, poly);
    4847static BOOLEAN smIsScalar(const poly);
     
    8887  int crd;             // number of reduced columns (start: 0)
    8988  int tored;           // border for rows to reduce
     89  int inred;           // unreducable part
    9090  int rpiv, cpiv;      // position of the pivot
    9191  unsigned short *perm;// permutation of rows
     
    308308  }
    309309  sign = 1;
    310   act = ncols;
     310  inred = act = ncols;
    311311  crd = 0;
    312312  tored = nrows; // without border
     
    463463  if (act < y)
    464464  {
    465     if (act != 0)
    466     {
    467       this->smCopToRes();
    468     }
     465    this->smCopToRes();
    469466    return;
    470467  }
     
    499496    if (act < y)
    500497    {
    501       if (act != 0)
    502       {
    503         this->smCopToRes();
    504       }
    505       else
    506         tored = crd;
     498      this->smCopToRes();
    507499      return;
    508500    }
     
    525517  if (act < y)
    526518  {
    527     if (act != 0)
    528     {
    529       this->smCopToRes();
    530     }
     519    this->smCopToRes();
    531520    return;
    532521  }
     
    562551    if (act < y)
    563552    {
    564       if (act != 0)
    565       {
    566         this->smFinalMult();
    567         this->smCopToRes();
    568       }
    569       else
    570         tored = crd;
     553      this->smFinalMult();
     554      this->smCopToRes();
    571555      return;
    572556    }
     
    12571241    if (m_act[i]->pos > tored)
    12581242    {
    1259       m_res[crd] = m_act[i];
    1260       crd++;
     1243      m_res[inred] = m_act[i];
     1244      inred--;
    12611245      break;
    12621246    }
     
    12691253    if (m_act[i]->pos > tored)
    12701254    {
    1271       m_res[crd] = m_act[i];
    1272       crd++;
     1255      m_res[inred] = m_act[i];
     1256      inred--;
    12731257    }
    12741258    else
     
    12871271void sparse_mat::smCopToRes()
    12881272{
    1289   smpoly p, r, ap, a, h;
    1290   int c, i;
    1291 
    1292   if (act == 0) return;
    1293   if (act > 1)
    1294   {
    1295     Werror("Not implemented");
    1296   }
    1297   crd++;
    1298   c = crd;
    1299   p = m_res[c] = m_act[act];
    1300   do
    1301   {
    1302     r = m_row[p->pos];
    1303     m_row[p->pos] = NULL;
    1304     perm[c] = p->pos;
    1305     p->pos = c;
    1306     while (r != NULL)
    1307     {
    1308       ap = m_res[r->pos];
     1273  smpoly a,ap,r,h;
     1274  int i,j,k,l;
     1275
     1276  i = 0;
     1277  if (act)
     1278  {
     1279    a = m_act[act]; // init perm
     1280    do
     1281    {
     1282      i++;
     1283      perm[crd+i] = a->pos;
     1284      a = a->n;
     1285    } while (a != NULL);
     1286    for (j=act-1;j;j--) // load all positions of perm
     1287    {
     1288      a = m_act[j];
     1289      k = 1;
    13091290      loop
    13101291      {
    1311         a = ap->n;
    1312         if (a == NULL)
    1313         {
    1314           ap->n = h = r;
    1315           r = r->n;
    1316           h->n = a;
    1317           h->pos = c;
     1292        if (perm[crd+k] >= a->pos)
     1293        {
     1294          if (perm[crd+k] > a->pos)
     1295          {
     1296            for (l=i;l>=k;l--) perm[crd+l+1] = perm[crd+l];
     1297            perm[crd+k] = a->pos;
     1298            i++;
     1299          }
     1300          a = a->n;
     1301          if (a == NULL) break;
     1302        }
     1303        k++;
     1304        if (k > i)
     1305        {
     1306          do
     1307          {
     1308            i++;
     1309            perm[crd+i] = a->pos;
     1310            a = a->n;
     1311          } while (a != NULL);
    13181312          break;
    13191313        }
    1320         ap = a;
    1321       }
    1322     }
    1323     c++;
    1324     p = p->n;
    1325   } while (p != NULL);
    1326   for (i=1;i<=nrows;i++)
    1327   {
    1328     if(m_row[i] != NULL)
    1329     {
    1330       r = m_row[i];
    1331       m_row[i] = NULL;
     1314      }
     1315    }
     1316  }
     1317  tored = crd+i; // the number or permuted rows
     1318  for (j=act;j;j--) // renumber m_act
     1319  {
     1320    k = 1;
     1321    a = m_act[j];
     1322    do
     1323    {
     1324      if (perm[crd+k] == a->pos)
     1325      {
     1326        a->pos = crd+k;
     1327        a = a->n;
     1328      }
     1329      k++;
     1330    } while (a != NULL);
     1331  }
     1332  for(k=1;k<=i;k++) // clean this from m_row
     1333  {
     1334    j = perm[crd+k];
     1335    if (m_row[j] != NULL)
     1336    {
     1337      r = m_row[j];
     1338      m_row[j] = NULL;
    13321339      do
    13331340      {
     
    13381345          if (a == NULL)
    13391346          {
    1340             ap->n = h = r;
     1347            h = ap->n = r;
    13411348            r = r->n;
    1342             h->n = a;
    1343             h->pos = c;
     1349            h->n = NULL;
     1350            h->pos = crd+k;
    13441351            break;
    13451352          }
     
    13471354        }
    13481355      } while (r!=NULL);
    1349       c++;
    1350     }
    1351   }
    1352   tored = c-1;
     1356    }
     1357  }
     1358  while(act) // clean m_act
     1359  {
     1360    crd++;
     1361    m_res[crd] = m_act[act];
     1362    act--;
     1363  }
     1364  for (i=1;i<=nrows;i++) // take the rest of m_row
     1365  {
     1366    if(m_row[i] != NULL)
     1367    {
     1368      tored++;
     1369      r = m_row[i];
     1370      m_row[i] = NULL;
     1371      perm[tored] = i;
     1372      do
     1373      {
     1374        ap = m_res[r->pos];
     1375        loop
     1376        {
     1377          a = ap->n;
     1378          if (a == NULL)
     1379          {
     1380            h = ap->n = r;
     1381            r = r->n;
     1382            h->n = NULL;
     1383            h->pos = tored;
     1384            break;
     1385          }
     1386          ap = a;
     1387        }
     1388      } while (r!=NULL);
     1389    }
     1390  }
     1391  while (inred < ncols) // take unreducable
     1392  {
     1393    crd++;
     1394    inred++;
     1395    m_res[crd] = m_res[inred];
     1396  }
    13531397}
    13541398
Note: See TracChangeset for help on using the changeset viewer.