Changeset d914cf0 in git


Ignore:
Timestamp:
Aug 12, 2011, 7:25:13 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
77bb59200a4a6c29f96eb37fb6da3b221d283eba
Parents:
c10515350d72537c759f372977e1d69188eed976
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-08-12 19:25:13+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 13:24:02+01:00
Message:
ADD/FIX: maGetPreimage exposed by kernel/preimage.* now
Files:
1 added
5 edited
1 moved

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    rc10515 rd914cf0  
    3131#include <kernel/kstd1.h>
    3232#include <kernel/timer.h>
     33
     34#include <kernel/preimage.h>
     35
    3336#include <polys/monomials/ring.h>
    3437#include <Singular/subexpr.h>
  • kernel/makefile

    rc10515 rd914cf0  
    8383    tgb.cc tgbgauss.cc ringgb.cc f5data.cc f5lists.cc f5gb.cc \
    8484    f5c.cc ratgring.cc shiftgb.cc gfan.cc \
    85     linearAlgebra.cc nc.cc
     85    linearAlgebra.cc nc.cc preimage.cc
     86   
    8687CXXSOURCES2     = SingularBuilder.cpp
    8788
     
    115116        mmalloc.h \
    116117        semic.h \
    117         gfan.h
     118        gfan.h preimage.h
    118119
    119120DISTFILES=${SOURCES} ${HEADERS} ${ESOURCES} \
  • kernel/preimage.cc

    rc10515 rd914cf0  
    1 // ideal maGetPreimage(ring theImageRing, map theMap,ideal id);
     1#include "mod2.h"
     2
     3#include <omalloc/omalloc.h>
     4#include <misc/auxiliary.h>
     5#include <misc/options.h>
     6#include <misc/intvec.h>
     7
     8#include <polys/polys.h>
     9#include <polys/monomials/ring.h>
     10
     11
     12#include <kernel/febase.h>
     13#include <kernel/ideals.h>
     14#include <kernel/kstd1.h>
     15#include <kernel/khstd.h>
     16
     17#include <kernel/kutil.h>
     18
     19
     20#ifdef HAVE_PLURAL
     21#include <polys/nc/nc.h>
     22#endif
     23
     24/*2
     25*shifts the variables between minvar and maxvar of p  \in p_ring to the
     26*first maxvar-minvar+1 variables in the actual ring
     27*be carefull: there is no range check for the variables of p
     28*/
     29static poly pChangeSizeOfPoly(ring p_ring, poly p,int minvar,int maxvar, const ring dst_r)
     30{
     31  int i;
     32  poly result = NULL,resultWorkP;
     33  number n;
     34
     35  if (p==NULL) return result;
     36  else result = p_Init(dst_r);
     37  resultWorkP = result;
     38  while (p!=NULL)
     39  {
     40    for (i=minvar;i<=maxvar;i++)
     41      p_SetExp(resultWorkP,i-minvar+1,p_GetExp(p,i,p_ring),dst_r);
     42    p_SetComp(resultWorkP,p_GetComp(p,p_ring),dst_r);
     43    n=n_Copy(pGetCoeff(p),dst_r->cf);
     44    p_SetCoeff(resultWorkP,n,dst_r);
     45    p_Setm(resultWorkP,dst_r);
     46    pIter(p);
     47    if (p!=NULL)
     48    {
     49      pNext(resultWorkP) = p_Init(dst_r);
     50      pIter(resultWorkP);
     51    }
     52  }
     53  return result;
     54}
     55
     56
    257
    358/*2
     
    57112    {
    58113      p = p_SortMerge(
    59         pChangeSizeOfPoly(theImageRing,theMap->m[i],1,imagepvariables,tmpR),
    60         tmpR);
     114                      pChangeSizeOfPoly(theImageRing, theMap->m[i], 1, imagepvariables, tmpR),
     115                      tmpR);
    61116      p=p_Add_q(p,q,tmpR);
    62117    }
     
    70125  for (i=sourcering->N;i<sourcering->N+j0;i++)
    71126  {
    72     temp1->m[i] = p_SortMerge(pChangeSizeOfPoly(theImageRing,
    73                          id->m[i-sourcering->N],1,imagepvariables,tmpR),tmpR);
     127    temp1->m[i] = p_SortMerge(
     128                              pChangeSizeOfPoly(theImageRing, id->m[i-sourcering->N], 1, imagepvariables, tmpR),
     129                              tmpR);
    74130  }
    75131  for (i=sourcering->N+j0;i<sourcering->N+j;i++)
    76132  {
    77     temp1->m[i] = p_SortMerge(pChangeSizeOfPoly(theImageRing,
    78                               theImageRing->qideal->m[i-sourcering->N-j0],
    79                               1,imagepvariables,tmpR),tmpR);
     133    temp1->m[i] = p_SortMerge(
     134                              pChangeSizeOfPoly(theImageRing, theImageRing->qideal->m[i-sourcering->N-j0], 1, imagepvariables, tmpR),
     135                              tmpR);
    80136  }
    81137  // we ignore here homogenity - may be changed later:
     
    84140  for (i=0;i<IDELEMS(temp2);i++)
    85141  {
    86     if (pLowVar(temp2->m[i])<imagepvariables) p_Delete(&(temp2->m[i]),tmpR);
     142    if (p_LowVar(temp2->m[i], currRing)<imagepvariables) p_Delete(&(temp2->m[i]),tmpR);
    87143  }
    88144
     
    96152    if (p!=NULL)
    97153    {
    98       q = p_SortMerge(pChangeSizeOfPoly(tmpR, p,imagepvariables+1,N),sourcering);
     154      q = p_SortMerge(
     155                      pChangeSizeOfPoly(tmpR, p, imagepvariables+1, N, sourcering),
     156                      sourcering);
    99157      if (j>=IDELEMS(temp1))
    100158      {
  • kernel/test.cc

    rc10515 rd914cf0  
    149149// #include "PowerSeries.h" // Too old?
    150150
     151#include "preimage.h"
    151152
    152153#include "nc.h"
  • libpolys/polys/monomials/maps.cc

    rc10515 rd914cf0  
    159159  return result;
    160160}
    161 
    162 /*2
    163 *shifts the variables between minvar and maxvar of p  \in p_ring to the
    164 *first maxvar-minvar+1 variables in the actual ring
    165 *be carefull: there is no range check for the variables of p
    166 */
    167 static poly pChangeSizeOfPoly(ring p_ring, poly p,int minvar,int maxvar, const ring dst_r)
    168 {
    169   int i;
    170   poly result = NULL,resultWorkP;
    171   number n;
    172 
    173   if (p==NULL) return result;
    174   else result = p_Init(dst_r);
    175   resultWorkP = result;
    176   while (p!=NULL)
    177   {
    178     for (i=minvar;i<=maxvar;i++)
    179       p_SetExp(resultWorkP,i-minvar+1,p_GetExp(p,i,p_ring),dst_r);
    180     p_SetComp(resultWorkP,p_GetComp(p,p_ring),dst_r);
    181     n=n_Copy(pGetCoeff(p),dst_r->cf);
    182     p_SetCoeff(resultWorkP,n,dst_r);
    183     p_Setm(resultWorkP,dst_r);
    184     pIter(p);
    185     if (p!=NULL)
    186     {
    187       pNext(resultWorkP) = p_Init(dst_r);
    188       pIter(resultWorkP);
    189     }
    190   }
    191   return result;
    192 }
    193 
    194161
    195162void maFindPerm(char **preim_names, int preim_n, char **preim_par, int preim_p,
  • libpolys/polys/monomials/p_polys.h

    rc10515 rd914cf0  
    19201920
    19211921/*----------------------------------------------------*/
    1922 int   p_Var(poly mi,const ring r);
     1922int   p_Var(poly mi, const ring r);
    19231923/// the minimal index of used variables - 1
    1924 int   p_LowVar (poly p);
     1924int   p_LowVar (poly p, const ring r);
    19251925
    19261926/*----------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.