Changeset f45a05 in git


Ignore:
Timestamp:
Mar 9, 2017, 3:39:05 PM (7 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
761d138c5d0b361d6a879874157b74198c2f4acb
Parents:
6d6c8d7133c387ddb4790a04d3358688ffbc6b3a
Message:
code cleanup for minor
Files:
3 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;
  • libpolys/polys/linalg_from_matpol.cc

    r6d6c8d rf45a05  
    1414static void mp_SwapRow(matrix, int, int, int, const ring);
    1515static void mp_SwapCol(matrix, int, int, int, const ring);
    16 static void mp_ElimBar(matrix, matrix, poly, int, int, const ring);
    1716
    1817/*2
     
    915914  return d;
    916915}
    917 
    918 static void mp_ElimBar(matrix a0, matrix re, poly div, int lr, int lc, const ring R)
    919 {
    920   int r=lr-1, c=lc-1;
    921   poly *b = a0->m, *x = re->m;
    922   poly piv, elim, q1, q2, *ap, *a, *q;
    923   int i, j;
    924 
    925   ap = &b[r*a0->ncols];
    926   piv = ap[c];
    927   for(j=c-1; j>=0; j--)
    928     if (ap[j] != NULL) ap[j] = p_Neg(ap[j], R);
    929   for(i=r-1; i>=0; i--)
    930   {
    931     a = &b[i*a0->ncols];
    932     q = &x[i*re->ncols];
    933     if (a[c] != NULL)
    934     {
    935       elim = a[c];
    936       for (j=c-1; j>=0; j--)
    937       {
    938         q1 = NULL;
    939         if (a[j] != NULL)
    940         {
    941           q1 = SM_MULT(a[j], piv, div, R);
    942           if (ap[j] != NULL)
    943           {
    944             q2 = SM_MULT(ap[j], elim, div, R);
    945             q1 = p_Add_q(q1,q2, R);
    946           }
    947         }
    948         else if (ap[j] != NULL)
    949           q1 = SM_MULT(ap[j], elim, div, R);
    950         if (q1 != NULL)
    951         {
    952           if (div)
    953             SM_DIV(q1, div, R);
    954           q[j] = q1;
    955         }
    956       }
    957     }
    958     else
    959     {
    960       for (j=c-1; j>=0; j--)
    961       {
    962         if (a[j] != NULL)
    963         {
    964           q1 = SM_MULT(a[j], piv, div, R);
    965           if (div)
    966             SM_DIV(q1, div, R);
    967           q[j] = q1;
    968         }
    969       }
    970     }
    971   }
    972 }
    973 
  • libpolys/polys/matpol.cc

    r6d6c8d rf45a05  
    12171217  {
    12181218    res = (float)n_Size(pGetCoeff(p),r->cf);
    1219     for (i=rVar(r);i>0;i--)
     1219    for (i=r->N;i>0;i--)
    12201220    {
    12211221      if(p_GetExp(p,i,r)!=0)
Note: See TracChangeset for help on using the changeset viewer.