Changeset f45a05 in git for kernel/linear_algebra


Ignore:
Timestamp:
Mar 9, 2017, 3:39:05 PM (7 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
761d138c5d0b361d6a879874157b74198c2f4acb
Parents:
6d6c8d7133c387ddb4790a04d3358688ffbc6b3a
Message:
code cleanup for minor
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/linear_algebra/MinorInterface.cc

    r6d6c8d rf45a05  
    2020using namespace std;
    2121
    22 bool currRingIsOverIntegralDomain ()
    23 {
    24   if (rField_is_Ring_PtoM(currRing)) return false;
    25   if (rField_is_Ring_2toM(currRing)) return false;
    26   if (rField_is_Ring_ModN(currRing)) return false;
    27   return true;
     22static inline bool currRingIsOverIntegralDomain ()
     23{
     24  return rField_is_Domain(currRing);
    2825}
    2926
     
    263260  poly* myPolyMatrix = (poly*)(mat->m);
    264261  int length = rowCount * columnCount;
    265   poly* nfPolyMatrix = new poly[length];
    266262  ideal iii; /* the ideal to be filled and returned */
    267263
    268   /* copy all polynomials and reduce them w.r.t. iSB
    269      (if iSB is present, i.e., not the NULL pointer) */
    270   if (iSB != NULL)
    271   {
    272     for (int i = 0; i < length; i++)
    273     {
    274       nfPolyMatrix[i] = kNF(iSB, currRing->qideal,myPolyMatrix[i]);
    275     }
    276   }
    277   else
    278   {
    279     for (int i = 0; i < length; i++)
    280     {
    281       nfPolyMatrix[i] = pCopy(myPolyMatrix[i]);
    282     }
    283   }
    284 
    285264  if ((k == 0) && (strcmp(algorithm, "Bareiss") == 0)
    286       && (!rField_is_Ring_Z(currRing)) && (!allDifferent))
     265      && (!rField_is_Ring(currRing)) && (!allDifferent))
    287266  {
    288267    /* In this case, we call an optimized procedure, dating back to
     
    292271       - coefficients come from a field (i.e., the ring Z is not
    293272         allowed for this implementation). */
    294     iii = (iSB == 0 ? idMinors(mat, minorSize) : idMinors(mat, minorSize,
     273    iii = (iSB == NULL ? idMinors(mat, minorSize) : idMinors(mat, minorSize,
    295274                                                          iSB));
    296275  }
    297276  else
    298277  {
     278  /* copy all polynomials and reduce them w.r.t. iSB
     279     (if iSB is present, i.e., not the NULL pointer) */
     280
     281    poly* nfPolyMatrix = new poly[length];
     282    if (iSB != NULL)
     283    {
     284      for (int i = 0; i < length; i++)
     285      {
     286        nfPolyMatrix[i] = kNF(iSB, currRing->qideal,myPolyMatrix[i]);
     287      }
     288    }
     289    else
     290    {
     291      for (int i = 0; i < length; i++)
     292      {
     293        nfPolyMatrix[i] = pCopy(myPolyMatrix[i]);
     294      }
     295    }
    299296    iii = getMinorIdeal_Poly(nfPolyMatrix, rowCount, columnCount, minorSize,
    300297                             k, algorithm, iSB, allDifferent);
    301   }
    302 
    303   /* clean up */
    304   for (int j = 0; j < length; j++) pDelete(&nfPolyMatrix[j]);
    305   delete [] nfPolyMatrix;
     298
     299    /* clean up */
     300    for (int j = length-1; j>=0; j--) pDelete(&nfPolyMatrix[j]);
     301    delete [] nfPolyMatrix;
     302  }
    306303
    307304  return iii;
Note: See TracChangeset for help on using the changeset viewer.