Changeset b78996 in git


Ignore:
Timestamp:
Apr 14, 2011, 3:34:10 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
a665ebdc0e6f023769cadc08a35bd0eb3f3ad935
Parents:
2f5936105b139a5635034b6eb233c5405b3e3e29
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-04-14 15:34:10+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:30:32+01:00
Message:
FIX: strting to fix sparse matrices (sparsmat.{h, cc})
Location:
libpolys/polys
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/matpol.cc

    r2f5936 rb78996  
    3030#include "monomials/ring.h"
    3131#include "monomials/p_polys.h"
    32 // #include <kernel/sparsmat.h>
    3332
    3433#include "coeffrings.h"
     
    365364  int       *qrow, *qcol;
    366365  poly      *Xarray;
    367   ring      _R;
     366  const ring      _R;
    368367 
    369368  void mpInitMat();
     
    10941093        if (ap[jj] != NULL)
    10951094        {
    1096           q2 = SM_MULT(ap[jj], elim, div);
     1095          q2 = SM_MULT(ap[jj], elim, div, _R);
    10971096          if (a[jj] != NULL)
    10981097          {
    1099             q1 = SM_MULT(a[jj], piv, div);
     1098            q1 = SM_MULT(a[jj], piv, div, _R);
    11001099            p_Delete(&a[jj], _R);
    11011100            q2 = p_Add_q(q2, q1, _R);
     
    11041103        else if (a[jj] != NULL)
    11051104        {
    1106           q2 = SM_MULT(a[jj], piv, div);
     1105          q2 = SM_MULT(a[jj], piv, div, _R);
    11071106        }
    11081107        if ((q2!=NULL) && div)
    1109           SM_DIV(q2, div);
     1108          SM_DIV(q2, div, _R);
    11101109        a[jj] = q2;
    11111110      }
     
    11191118        if (a[jj] != NULL)
    11201119        {
    1121           q2 = SM_MULT(a[jj], piv, div);
     1120          q2 = SM_MULT(a[jj], piv, div, _R);
    11221121          p_Delete(&a[jj], _R);
    11231122          if (div)
    1124             SM_DIV(q2, div);
     1123            SM_DIV(q2, div, _R);
    11251124          a[jj] = q2;
    11261125        }
     
    18391838        if (a[j] != NULL)
    18401839        {
    1841           q1 = SM_MULT(a[j], piv, div);
     1840          q1 = SM_MULT(a[j], piv, div, _R);
    18421841          if (ap[j] != NULL)
    18431842          {
    1844             q2 = SM_MULT(ap[j], elim, div);
     1843            q2 = SM_MULT(ap[j], elim, div, _R);
    18451844            q1 = p_Add_q(q1,q2, _R);
    18461845          }
    18471846        }
    18481847        else if (ap[j] != NULL)
    1849           q1 = SM_MULT(ap[j], elim, div);
     1848          q1 = SM_MULT(ap[j], elim, div, _R);
    18501849        if (q1 != NULL)
    18511850        {
    18521851          if (div)
    1853             SM_DIV(q1, div);
     1852            SM_DIV(q1, div, _R);
    18541853          q[j] = q1;
    18551854        }
     
    18621861        if (a[j] != NULL)
    18631862        {
    1864           q1 = SM_MULT(a[j], piv, div);
     1863          q1 = SM_MULT(a[j], piv, div, _R);
    18651864          if (div)
    1866             SM_DIV(q1, div);
     1865            SM_DIV(q1, div, _R);
    18671866          q[j] = q1;
    18681867        }
  • libpolys/polys/simpleideals.h

    r2f5936 rb78996  
    88* ABSTRACT - all basic methods to manipulate ideals
    99*/
     10#include <omalloc/omalloc.h>
    1011#include <polys/monomials/ring.h>
    11 #include <omalloc/omalloc.h>
    1212
    1313struct sip_sideal
  • libpolys/polys/sparsmat.cc

    r2f5936 rb78996  
    88*/
    99
    10 #include <kernel/mod2.h>
    11 #include <kernel/options.h>
    12 #include <kernel/febase.h>
    13 #include <kernel/intvec.h>
    14 #include <kernel/ring.h>
    15 #include <kernel/polys.h>
    16 #include <kernel/ideals.h>
    17 #include <kernel/numbers.h>
    18 #include <kernel/sparsmat.h>
    19 #include <kernel/prCopy.h>
    20 #include <kernel/p_Procs.h>
    21 #include <kernel/kbuckets.h>
    22 #include <kernel/p_Mult_q.h>
     10#include "config.h"
     11#include <misc/auxiliary.h>
     12
     13#include <omalloc/omalloc.h>
     14#include <misc/mylimits.h>
     15
     16#include <misc/options.h>
     17
     18#include <reporter/reporter.h>
     19#include <misc/intvec.h>
     20
     21#include <coeffs/numbers.h>
     22#include "coeffrings.h"
     23
     24#include "monomials/ring.h"
     25#include "monomials/p_polys.h"
     26
     27#include "simpleideals.h"
     28
     29
     30#include "sparsmat.h"
     31#include "prCopy.h"
     32
     33#include "templates/p_Procs.h"
     34
     35#include "kbuckets.h"
     36#include "operations/p_Mult_q.h"
    2337
    2438// define SM_NO_BUCKETS, if sparsemat stuff should not use buckets
     
    6781
    6882static poly pp_Mult_Coeff_mm_DivSelect_MultDiv(poly p, int &lp, poly m,
    69                                                poly a, poly b)
     83                                               poly a, poly b, const ring currRing)
    7084{
    7185  if (rOrd_is_Comp_dp(currRing) && currRing->ExpL_Size > 2)
     
    8397  {
    8498    p = pp_Mult_Coeff_mm_DivSelect(p, lp, m, currRing);
    85     smExpMultDiv(p, a, b);
     99    sm_ExpMultDiv(p, a, b, currRing);
    86100  }
    87101  return p;
    88102}
    89103
    90 static poly smSelectCopy_ExpMultDiv(poly p, poly m, poly a, poly b)
     104static poly sm_SelectCopy_ExpMultDiv(poly p, poly m, poly a, poly b, const ring currRing)
    91105{
    92106  int lp = 0;
    93   return pp_Mult_Coeff_mm_DivSelect_MultDiv(p, lp, m, a, b);
     107  return pp_Mult_Coeff_mm_DivSelect_MultDiv(p, lp, m, a, b, currRing);
    94108}
    95109
     
    133147  smpoly piv, oldpiv;  // pivot and previous pivot
    134148  smpoly dumm;         // allocated dummy
     149  const ring _R;
     150 
    135151  void smColToRow();
    136152  void smRowToCol();
     
    157173  void smNormalize();
    158174public:
    159   sparse_mat(ideal);
     175  sparse_mat(ideal, const ring);
    160176  ~sparse_mat();
    161177  int smGetSign() { return sign; }
     
    175191*/
    176192static void smMinSelect(long *, int, int);
    177 long smExpBound( ideal m, int di, int ra, int t)
     193
     194long sm_ExpBound( ideal m, int di, int ra, int t, const ring currRing)
    178195{
    179196  poly p;
     
    193210    while(p!=NULL)
    194211    {
    195       k = pGetComp(p)-1;
     212      k = p_GetComp(p, currRing)-1;
    196213      kr = r[k];
    197       for (j=pVariables;j>0;j--)
    198       {
    199         if(pGetExp(p,j)>kc)
    200           kc=pGetExp(p,j);
    201         if(pGetExp(p,j)>kr)
    202           kr=pGetExp(p,j);
     214      for (j=rVar(currRing);j>0;j--)
     215      {
     216        if(p_GetExp(p,j, currRing)>kc)
     217          kc=p_GetExp(p,j, currRing);
     218        if(p_GetExp(p,j, currRing)>kr)
     219          kr=p_GetExp(p,j, currRing);
    203220      }
    204221      r[k] = kr;
     
    244261
    245262/* ----------------- ops with rings ------------------ */
    246 ring smRingChange(ring *origR, long bound)
    247 {
    248   *origR =currRing;
     263ring sm_RingChange(const ring currRing, long bound)
     264{
     265//  *origR =currRing;
    249266  ring tmpR=rCopy0(currRing,FALSE,FALSE);
    250267  int *ord=(int*)omAlloc0(3*sizeof(int));
     
    268285  if ((*origR)->qideal!=NULL)
    269286  {
    270     tmpR->qideal= idrCopyR_NoSort((*origR)->qideal, (*origR), tmpR);
    271   }
    272   rChangeCurrRing(tmpR);
     287    tmpR->qideal= idrCopyR_NoSort((*origR)->qideal, currRing, tmpR);
     288  }
     289//  rChangeCurrRing(tmpR);
    273290  if (TEST_OPT_PROT)
    274291    Print("[%ld:%d]", (long) tmpR->bitmask, tmpR->ExpL_Size);
     
    276293}
    277294
    278 void smKillModifiedRing(ring r)
     295void sm_KillModifiedRing(ring r)
    279296{
    280297  if (r->qideal!=NULL) id_Delete(&(r->qideal),r);
  • libpolys/polys/sparsmat.h

    r2f5936 rb78996  
    1111
    1212
    13 poly smMult(poly, poly);
    14 void smPolyDiv(poly, poly);
    15 poly smMultDiv(poly, poly, const poly);
    16 void smSpecialPolyDiv(poly, poly);
     13poly sm_Mult(poly, poly, const ring);
     14void sm_PolyDiv(poly, poly, const ring);
     15poly sm_MultDiv(poly, poly, const poly, const ring);
     16void sm_SpecialPolyDiv(poly, poly, const ring);
    1717/* ----------------- macros ------------------ */
    1818/* #define OLD_DIV 1 */
    1919
    2020#ifdef OLD_DIV
    21 #define SM_MULT(A,B,C) smMult(A,B)
    22 #define SM_DIV smPolyDiv
     21#define SM_MULT(A,B,C, R) sm_Mult(A,B,R)
     22#define SM_DIV sm_PolyDiv
    2323#else
    24 #define SM_MULT smMultDiv
    25 #define SM_DIV smSpecialPolyDiv
     24#define SM_MULT sm_MultDiv
     25#define SM_DIV sm_SpecialPolyDiv
    2626#endif
    2727
    28 poly smCallDet(ideal I);
    29 void smCallBareiss(ideal smat, int x, int y, ideal & M, intvec ** iv);
    30 ideal smCallSolv(ideal I);
     28poly sm_CallDet(ideal I, const ring);
     29void sm_CallBareiss(ideal smat, int x, int y, ideal & M, intvec ** iv, const ring);
     30ideal sm_CallSolv(ideal I, const ring);
    3131
    32 ring smRingChange(ring *, long);
    33 void smKillModifiedRing(ring r);
    34 long smExpBound(ideal, int, int, int);
    35 BOOLEAN smCheckDet(ideal, int, BOOLEAN);
     32ring sm_RingChange(const ring, long);
     33void sm_KillModifiedRing(ring r);
     34long sm_ExpBound(ideal, int, int, int, const ring);
     35BOOLEAN sm_CheckDet(ideal, int, BOOLEAN, const ring);
    3636#endif
Note: See TracChangeset for help on using the changeset viewer.