Changeset 8421b8 in git


Ignore:
Timestamp:
Nov 24, 2006, 10:53:01 AM (17 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
3705d5c995e721d82fb6dad60d586e998ed821ca
Parents:
33c36dbf5e1e3c1f88f492f3ff653ecb9f38a11c
Message:
*hannes: idReadOutUnits: memory leak fixed, optimized


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

Legend:

Unmodified
Added
Removed
  • kernel/ideals.cc

    r33c36d r8421b8  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ideals.cc,v 1.22 2006-11-17 17:58:10 Singular Exp $ */
     4/* $Id: ideals.cc,v 1.23 2006-11-24 09:53:01 Singular Exp $ */
    55/*
    66* ABSTRACT - all basic methods to manipulate ideals
     
    34863486{
    34873487  if (idIs0(arg)) return -1;
    3488   int i=0,j,rk_arg=idRankFreeModule(arg),generator=-1;
    3489   intvec * componentIsUsed =new intvec(rk_arg+1);
     3488  int i=0,j, generator=-1;
     3489  int rk_arg=arg->rank; //idRankFreeModule(arg);
     3490  int * componentIsUsed =(int *)omAlloc((rk_arg+1)*sizeof(int));
    34903491  poly p,q;
    34913492
    3492   while ((i<IDELEMS(arg)) && (generator<0))
    3493   {
    3494     for (j=rk_arg;j>=0;j--)
    3495       (*componentIsUsed)[j]=0;
     3493  while ((generator<0) && (i<IDELEMS(arg)))
     3494  {
     3495    memset(componentIsUsed,0,(rk_arg+1)*sizeof(int));
    34963496    p = arg->m[i];
    34973497    while (p!=NULL)
    34983498    {
    34993499      j = pGetComp(p);
    3500       if ((*componentIsUsed)[j]==0)
     3500      if (componentIsUsed[j]==0)
    35013501      {
    35023502        if (pLmIsConstantComp(p))
    35033503        {
    35043504          generator = i;
    3505           (*componentIsUsed)[j] = 1;
     3505          componentIsUsed[j] = 1;
    35063506        }
    35073507        else
    35083508        {
    3509           (*componentIsUsed)[j] = -1;
     3509          componentIsUsed[j] = -1;
    35103510        }
    35113511      }
    3512       else if ((*componentIsUsed)[j]>0)
    3513       {
    3514         ((*componentIsUsed)[j])++;
     3512      else if (componentIsUsed[j]>0)
     3513      {
     3514        (componentIsUsed[j])++;
    35153515      }
    35163516      pIter(p);
     
    35223522  for (j=0;j<=rk_arg;j++)
    35233523  {
    3524     if ((*componentIsUsed)[j]>0)
    3525     {
    3526       if ((*comp==-1) || ((*componentIsUsed)[j]<i))
     3524    if (componentIsUsed[j]>0)
     3525    {
     3526      if ((*comp==-1) || (componentIsUsed[j]<i))
    35273527      {
    35283528        *comp = j;
    3529         i= (*componentIsUsed)[j];
    3530       }
    3531     }
    3532   }
     3529        i= componentIsUsed[j];
     3530      }
     3531    }
     3532  }
     3533  omFree(componentIsUsed);
    35333534  return generator;
    35343535}
     
    35673568
    35683569  if (!inPlace) res = idCopy(arg);
     3570  res->rank=si_max(res->rank,idRankFreeModule(res));
     3571
    35693572  loop
    35703573  {
Note: See TracChangeset for help on using the changeset viewer.