Changeset 509ea41 in git for Singular/maps_ip.cc


Ignore:
Timestamp:
Apr 29, 2005, 6:04:36 PM (19 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
6d7113d27870d87916efbd6084abc75fa74e64eb
Parents:
a09c2a0d411d9ac83fb45653be9dc871cfb79373
Message:
*hannes: FAST_MAPS for subst


git-svn-id: file:///usr/local/Singular/svn/trunk@7952 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/maps_ip.cc

    ra09c2a0 r509ea41  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: maps_ip.cc,v 1.7 2005-04-18 15:10:06 Singular Exp $ */
     4/* $Id: maps_ip.cc,v 1.8 2005-04-29 16:04:36 Singular Exp $ */
    55/*
    66* ABSTRACT - the mapping of polynomials to other rings
     
    2323#include "prCopy.h"
    2424
     25// define this if you want to use the fast_map routine for mapping ideals
     26#define FAST_MAP
     27
     28#ifdef FAST_MAP
     29#include "fast_maps.h"
     30#endif
     31
     32
    2533/*2
    2634* maps the expression w to res,
     
    266274poly pSubstPoly(poly p, int var, poly image)
    267275{
     276  if (p==NULL) return NULL;
    268277#ifdef HAVE_PLURAL
    269278  if (rIsPluralRing(currRing))
     
    277286  theMap->m[var-1]=pCopy(image);
    278287
    279   leftv v=(leftv)omAlloc0Bin(sleftv_bin);
    280   sleftv tmpW;
    281   memset(&tmpW,0,sizeof(sleftv));
    282   tmpW.rtyp=POLY_CMD;
    283   tmpW.data=p;
    284288  poly res=NULL;
    285   if (maApplyFetch(MAP_CMD,theMap,v,&tmpW,currRing,NULL,NULL,0,nCopy))
    286   {
    287     WerrorS("map failed");
    288     v->data=NULL;
    289   }
    290   res=(poly)(v->data);
     289#ifdef FAST_MAP
     290  if (pGetComp(p)==0)
     291  {
     292    ideal src_id=idInit(1,1);
     293    src_id->m[0]=p;
     294    ideal res_id=fast_map(src_id,currRing,(ideal)theMap,currRing);
     295    res=res_id->m[0];
     296    res_id->m[0]=NULL; idDelete(&res_id);
     297    src_id->m[0]=NULL; idDelete(&src_id);
     298  }
     299  else
     300#endif
     301  {
     302    sleftv tmpW;
     303    memset(&tmpW,0,sizeof(sleftv));
     304    tmpW.rtyp=POLY_CMD;
     305    tmpW.data=p;
     306    leftv v=(leftv)omAlloc0Bin(sleftv_bin);
     307    if (maApplyFetch(MAP_CMD,theMap,v,&tmpW,currRing,NULL,NULL,0,nCopy))
     308    {
     309      WerrorS("map failed");
     310      v->data=NULL;
     311    }
     312    res=(poly)(v->data);
     313    omFreeBin((ADDRESS)v, sleftv_bin);
     314  }
    291315  idDelete((ideal *)(&theMap));
    292   omFreeBin((ADDRESS)v, sleftv_bin);
    293316  return res;
    294317}
Note: See TracChangeset for help on using the changeset viewer.