Changeset cd5fefc in git


Ignore:
Timestamp:
Jul 3, 2012, 6:58:10 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
Children:
20409220dfe91ce9647c6b8d12e43f086961aa14
Parents:
ff7993e279b46dbac09bfb1762c976061c50eb24
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-07-03 18:58:10+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:45+02:00
Message:
new p_Tail and id_Tail (separated from a wrapper)
Location:
dyn_modules/syzextra
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • dyn_modules/syzextra/mod_main.cc

    rff7993 rcd5fefc  
    469469}
    470470
    471 
    472 
    473 
    474 
    475 
     471/// wrapper around p_Tail and id_Tail
    476472static BOOLEAN Tail(leftv res, leftv h)
    477473{
     
    480476  if( h == NULL )
    481477  {
    482     WarnS("Tail needs an argument...");
     478    WarnS("Tail needs a poly/vector/ideal/module argument...");
    483479    return TRUE;
    484480  }
     
    486482  assume( h != NULL );
    487483
     484  const ring r =  currRing;
     485
    488486  if( h->Typ() == POLY_CMD || h->Typ() == VECTOR_CMD)
    489487  {
    490     const poly p = (const poly)h->Data();
    491 
     488    res->data = p_Tail( (const poly)h->Data(), r );
    492489    res->rtyp = h->Typ();
    493 
    494     if( p == NULL)
    495       res->data = NULL;
    496     else
    497       res->data = p_Copy( pNext(p), currRing );
    498490
    499491    h = h->Next(); assume (h == NULL);
     
    504496  if( h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD)
    505497  {
    506     const ideal id = (const ideal)h->Data();
    507 
     498    res->data = id_Tail( (const ideal)h->Data(), r );     
    508499    res->rtyp = h->Typ();
    509 
    510     if( id == NULL)
    511       res->data = NULL;
    512     else
    513     {
    514       const ideal newid = idInit(IDELEMS(id),id->rank);
    515       for (int i=IDELEMS(id) - 1; i >= 0; i--)
    516         if( id->m[i] != NULL )
    517           newid->m[i] = p_Copy(pNext(id->m[i]), currRing);
    518         else
    519           newid->m[i] = NULL;
    520      
    521       newid->rank = id_RankFreeModule(newid, currRing);
    522      
    523       res->data = newid;
    524     }
    525500   
    526501    h = h->Next(); assume (h == NULL);
  • dyn_modules/syzextra/syzextra.cc

    rff7993 rcd5fefc  
    2828
    2929
     30poly p_Tail(const poly p, const ring r)
     31{
     32  if( p == NULL)
     33    return NULL;
     34  else
     35    return p_Copy( pNext(p), r );
     36}
     37
     38
     39ideal id_Tail(const ideal id, const ring r)
     40{
     41  if( id == NULL)
     42    return NULL;
     43
     44  const ideal newid = idInit(IDELEMS(id),id->rank);
     45 
     46  for (int i=IDELEMS(id) - 1; i >= 0; i--)
     47    newid->m[i] = p_Tail( id->m[i], r );
     48
     49  newid->rank = id_RankFreeModule(newid, currRing);
     50
     51  return newid; 
     52}
     53
    3054
    3155
  • dyn_modules/syzextra/syzextra.h

    rff7993 rcd5fefc  
    3434
    3535
     36/// return the tail of a given polynomial or vector
     37/// returns NULL if input is NULL, otherwise
     38/// the result is a new polynomial/vector in the ring r
     39poly p_Tail(const poly p, const ring r);
     40
     41
     42/// return the tail of a given ideal or module
     43/// returns NULL if input is NULL, otherwise
     44/// the result is a new ideal/module in the ring r
     45/// NOTE: the resulting rank is autocorrected
     46ideal id_Tail(const ideal id, const ring r);
     47
    3648
    3749
Note: See TracChangeset for help on using the changeset viewer.