Changeset 85e36d in git


Ignore:
Timestamp:
Dec 7, 2000, 5:25:19 PM (23 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
Children:
4d688465cef2d21563e211d3a815944e412b94db
Parents:
a4f307a99ef35df8d18781c23cf3f7ad97cb4d4b
Message:
*hannes: nap-stuff


git-svn-id: file:///usr/local/Singular/svn/trunk@4837 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/longalg.h

    ra4f307a r85e36d  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: longalg.h,v 1.18 2000-12-07 15:21:07 Singular Exp $ */
     6/* $Id: longalg.h,v 1.19 2000-12-07 16:25:18 Singular Exp $ */
    77/*
    88* ABSTRACT:   algebraic numbers
     
    4040void naSetChar(int p, BOOLEAN complete, ring r);
    4141#define napAddExp(p,i,e)  ((p)->e[i-1]+=(e))
     42#define napLength(p)      (pLength((poly)p))
    4243#ifdef LDEBUG
    4344void    naDBDelete (number *p,char *f, int l);
     
    9091#define napVariables naNumbOfPar
    9192#define napNext(p) (p->ne)
     93#define napIter(p) ((p) = (p)->ne)
    9294#define napGetCoeff(p) (p->ko)
    93 #define napGetExp(p,i) (p->e[(i)-1])
     95#define napGetExp(p,i) ((p)->e[(i)-1])
     96#define napSetExp(p,i,ee) ((p)->e[(i)-1]=ee)
    9497#define napNew() ((alg)omAlloc0(napMonomSize))
    9598#define nanumber lnumber
  • Singular/mpsr_GetPoly.cc

    ra4f307a r85e36d  
    33****************************************/
    44
    5 /* $Id: mpsr_GetPoly.cc,v 1.30 2000-10-19 15:00:18 obachman Exp $ */
     5/* $Id: mpsr_GetPoly.cc,v 1.31 2000-12-07 16:25:19 Singular Exp $ */
    66
    77/***************************************************************
     
    252252    *x =  (number) omAlloc0Bin(rnumber_bin);
    253253    y = (number) *x;
    254 #if defined(LDEBUG) 
     254#if defined(LDEBUG)
    255255    y->debug = 123456;
    256256#endif
     
    277277      *x =  (number) omAlloc0Bin(rnumber_bin);
    278278      y = (number) *x;
    279 #if defined(LDEBUG) 
     279#if defined(LDEBUG)
    280280      y->debug = 123456;
    281281#endif
     
    301301 *
    302302 ***************************************************************/
    303 static inline mpsr_Status_t GetAlgPoly(MP_Link_pt link, alg *p)
     303static inline mpsr_Status_t GetAlgPoly(MP_Link_pt link, napoly *p)
    304304{
    305305  MP_Uint32_t j, nm;
    306306  int i;
    307   alg a;
    308 #if SIZEOF_INT == SIZEOF_PARAMETER
    309   Exponent_t *exp;
    310 #else
     307  napoly a;
    311308  int *exp;
    312 #endif
    313309
    314310  IMP_GetUint32(link, &nm);
     
    322318  *p = a;
    323319
    324   failr(GetAlgNumberNumber(link, &(a->ko)));
    325 #if SIZEOF_INT == SIZEOF_PARAMETER
    326   exp = &(a->e[0]);
    327   mp_failr(IMP_GetSint32Vector(link, (MP_Sint32_t **) &exp, naNumbOfPar));
    328 #else
     320  failr(GetAlgNumberNumber(link, &(napGetCoeff(a))));
    329321  mp_failr(IMP_GetSint32Vector(link, (MP_Sint32_t **) &gTa, naNumbOfPar));
    330322  for (i=0; i<naNumbOfPar; i++)
    331     a->e[i] = (PARAMETER_TYPE) gTa[i];
    332 #endif
     323    napSetExp(a,i+1,gTa[i]);
    333324
    334325  for (j=1; j<nm; j++)
    335326  {
    336     a->ne = napNew();
    337     a = a->ne;
    338     failr(GetAlgNumberNumber(link, &(a->ko)));
    339 #if SIZEOF_INT == SIZEOF_PARAMETER
    340     exp = &(a->e[0]);
    341     mp_failr(IMP_GetSint32Vector(link, (MP_Sint32_t **) &exp, naNumbOfPar));
    342 #else
    343   mp_failr(IMP_GetSint32Vector(link, (MP_Sint32_t **) &gTa, naNumbOfPar));
    344   for (i=0; i<naNumbOfPar; i++)
    345     a->e[i] = (PARAMETER_TYPE) gTa[i];
    346 #endif
    347   }
    348   a->ne = NULL;
     327    napNext(a) = napNew();
     328    napIter(a);
     329    failr(GetAlgNumberNumber(link, &(napGetCoeff(a))));
     330    mp_failr(IMP_GetSint32Vector(link, (MP_Sint32_t **) &gTa, naNumbOfPar));
     331    for (i=0; i<naNumbOfPar; i++)
     332      napSetExp(a,i+1,gTa[i]);
     333  }
     334  napNext(a) = NULL;
    349335
    350336  return mpsr_Success;
     
    10241010  return mpsr_Success;
    10251011}
    1026 
    10271012#endif
  • Singular/mpsr_PutPoly.cc

    ra4f307a r85e36d  
    33****************************************/
    44
    5 /* $Id: mpsr_PutPoly.cc,v 1.20 2000-09-18 09:19:22 obachman Exp $ */
     5/* $Id: mpsr_PutPoly.cc,v 1.21 2000-12-07 16:25:19 Singular Exp $ */
    66
    77/***************************************************************
     
    6767static mpsr_Status_t PutFloatNumber(MP_Link_pt link, number a);
    6868static mpsr_Status_t PutRationalNumber(MP_Link_pt link, number a);
    69 static mpsr_Status_t PutAlgPoly(MP_Link_pt link, alg a);
     69static mpsr_Status_t PutAlgPoly(MP_Link_pt link, napoly a);
    7070static mpsr_Status_t PutAlgNumber(MP_Link_pt link, number a);
    7171
     
    177177 *
    178178 ***************************************************************/
    179 inline MP_Uint32_t GetPlength(alg a)
    180 {
    181   MP_Uint32_t i = 0;
    182   while (a != NULL)
    183   {
    184     i++;
    185     a = a->ne;
    186   }
     179inline MP_Uint32_t GetPlength(napoly a)
     180{
     181  MP_Uint32_t i = napLength(a);
    187182  return i;
    188183}
     
    201196    mp_failr(IMP_PutUint32(link, 1));
    202197    mp_failr(IMP_PutUint32(link, GetPlength(b->z)));
    203     return PutAlgPoly(link, (alg) (b->z));
     198    return PutAlgPoly(link, b->z);
    204199  }
    205200  else
     
    208203    mp_failr(IMP_PutUint32(link, 2));
    209204    mp_failr(IMP_PutUint32(link, GetPlength(b->z)));
    210     failr(PutAlgPoly(link, (alg) (b->z)));
     205    failr(PutAlgPoly(link, b->z));
    211206    mp_failr(IMP_PutUint32(link, GetPlength(b->n)));
    212     return PutAlgPoly(link, (alg) (b->n));
     207    return PutAlgPoly(link, b->n);
    213208  }
    214209}
    215210
    216211// this is very similar to putting a Poly
    217 static mpsr_Status_t PutAlgPoly(MP_Link_pt link, alg a)
     212static mpsr_Status_t PutAlgPoly(MP_Link_pt link, napoly a)
    218213{
    219214  unsigned int i;
     
    223218    while (a != NULL)
    224219    {
    225       failr(PutAlgAlgNumber(link, a->ko));
    226 #if (SIZEOF_INT == SIZEOF_PARAMETER)
    227       mp_failr(IMP_PutSint32Vector(link, (MP_Sint32_t *) a->e, gNalgvars));
    228 #else
     220      failr(PutAlgAlgNumber(link, napGetCoeff(a)));
    229221      for (i=0; i<gNalgvars; i++)
    230         gTa[i] = a->e[i];
     222        gTa[i] = napGetExp(a,i+1);
    231223      mp_failr(IMP_PutSint32Vector(link, gTa, gNalgvars));
    232 #endif
    233       a = a->ne;
     224      napIter(a);
    234225    }
    235226  else
     
    237228    while (a != NULL)
    238229    {
    239       failr(PutAlgAlgNumber(link, a->ko));
    240       IMP_PutSint32(link, (MP_Sint32_t) a->e[0]);
    241       a = a->ne;
     230      failr(PutAlgAlgNumber(link, napGetCoeff(a)));
     231      IMP_PutSint32(link, (MP_Sint32_t) napGetExp(a,1));
     232      napIter(a);
    242233    }
    243234  }
Note: See TracChangeset for help on using the changeset viewer.