Changeset 1de0ed in git


Ignore:
Timestamp:
Mar 30, 2000, 1:47:52 PM (24 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
119757281f1af0949ef91c82c7aa9f7f8a614c9b
Parents:
2d7f0fe3aa9857697ff4f1c260cf1dc43cd0c4f9
Message:
* hannes/krueger: fixes for ix86_linux_libc5


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

Legend:

Unmodified
Added
Removed
  • modules/modgen/makefile.cc

    r2d7f0f r1de0ed  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: makefile.cc,v 1.5 2000-03-30 06:35:44 krueger Exp $ */
     4/* $Id: makefile.cc,v 1.6 2000-03-30 11:47:48 Singular Exp $ */
    55/*
    66* ABSTRACT: lib parsing
     
    133133/*===  Machine depend Makefile creation                                ===*/
    134134/*========================================================================*/
    135 #ifdef ix86_Linux
     135#if defined(ix86_Linux) || defined(ix86_Linux_libc5)
    136136void build_compile_section(
    137137  FILE *fp,
  • modules/pcv/pcv/pcv.cc

    r2d7f0f r1de0ed  
    1 /*****************************************
    2 *  Computer Algebra System SINGULAR      *
    3 *****************************************/
    4 /* $Id: pcv.cc,v 1.2 1998-12-21 10:55:13 mschulze Exp $ */
    51/*
    6 * ABSTRACT: conversion between polys and coef vectors
    7 */
    8 
    9 #include "mod2.h"
    10 #include "tok.h"
    11 #include "ipid.h"
    12 #include "numbers.h"
    13 #include "polys.h"
    14 #include "lists.h"
    15 #include "febase.h"
     2 * This was automaticly generated by modgen
     3 * version 0.2
     4 * module pcv
     5 * Don't edit this file
     6 */
     7
     8
     9#line 10 "pcv.cc"
     10#include <stdlib.h>
     11#include <stdio.h>
     12#include <string.h>
     13#include <ctype.h>
     14
     15
     16#include <locals.h>
    1617#include "pcv.h"
    17 
    18 static int pcvDegBound;
    19 static int pcvTableSize;
    20 static int pcvIndexSize;
    21 static unsigned* pcvTable=NULL;
    22 static unsigned** pcvIndex=NULL;
    23 
    24 int pcvDeg(poly p)
    25 {
    26   int dp=0;
    27   for(int i=1;i<=pVariables;i++) dp+=pGetExp(p,i);
    28   return dp;
    29 }
    30 
    31 int pcvMinDeg(poly p)
    32 {
    33   if(!p) return 0;
    34   int md=pcvDeg(p);
    35   pIter(p);
    36   while(p)
     18#line 19 "pcv.cc"
     19
     20idhdl enter_id(char *name, char *value, idtyp t)
     21{
     22  idhdl h;
     23
     24  h=enterid(mstrdup(name),0, t, &IDROOT, TRUE/*FALSE*/);
     25  if(h!=NULL) {
     26     switch(t) {
     27         case STRING_CMD: IDSTRING(h) = mstrdup(value);break;
     28         case PACKAGE_CMD: break;
     29         case PROC_CMD: break;
     30     }
     31  } else
     32      Warn("Cannot create '%s'\n", name);
     33  return(h);
     34}
     35
     36#line 37 "pcv.cc"
     37
     38idhdl add_singular_proc(char *procname, int line,
     39                       long pos, long end, BOOLEAN pstatic)
     40{
     41  idhdl h;
     42  procinfov pi;
     43
     44  h = enter_id(procname, NULL, PROC_CMD);
     45  if(h == NULL) return NULL;
     46
     47  pi->procname = mstrdup(procname);
     48  pi->language = LANG_SINGULAR;
     49  pi->ref = 1;
     50  pi->is_static = pstatic;
     51  pi->data.s.proc_start = pos;
     52  pi->data.s.def_end    = pos;
     53  pi->data.s.help_start = 0L;
     54  pi->data.s.help_end   = 0L;
     55  pi->data.s.body_start = pos;
     56  pi->data.s.body_end   = end;
     57  pi->data.s.proc_end   = end;
     58  pi->data.s.example_start = 0L;
     59  pi->data.s.proc_lineno = line;
     60  pi->data.s.body_lineno = line;
     61  pi->data.s.example_lineno = 0;
     62  pi->data.s.body = NULL;
     63  pi->data.s.help_chksum = 0;
     64 
     65  return(h);
     66}
     67
     68void fill_help_package(idhdl pl);
     69void fill_example_package(idhdl pl);
     70
     71#line 2 "pcv.mod"
     72/*
     73 *  $Id: pcv.cc,v 1.3 2000-03-30 11:47:51 Singular Exp $
     74 *
     75 *  Test mod fuer modgen
     76 */
     77
     78#include <stdio.h>
     79#include "Pcv.h"
     80#line 11 "pcv.mod"
     81
     82
     83#line 84 "pcv.cc"
     84extern "C"
     85int mod_init(int(*iiAddCproc)())
     86{
     87  idhdl h;
     88  idhdl helphdl = enter_id("Help", NULL, PACKAGE_CMD);
     89  idhdl examplehdl = enter_id("Example", NULL, PACKAGE_CMD);
     90
     91 
     92   if( helphdl == NULL)
     93     Warn("Cannot create help-package\n");
     94   else fill_help_package(helphdl);
     95 
     96   if( examplehdl == NULL)
     97     Warn("Cannot create example-package\n");
     98   else fill_example_package(examplehdl);
     99#line 15 "pcv.mod"
     100  enter_id("version","$Id: pcv.cc,v 1.3 2000-03-30 11:47:51 Singular Exp $", STRING_CMD);
     101#line 25 "pcv.mod"
     102  enter_id("info","
     103LIBRARY: pcv.so  CONVERSION BETWEEN POLYS AND COEF VECTORS
     104AUTHOR:  Mathias Schulze, email: mschulze@mathematik.uni-kl.de
     105
     106 MinDeg(p);      min deg of monomials of poly p
     107 P2CV(l,d0,d1);  list of coef vectors from deg d0 to d1 of polys in list l
     108 CV2P(l,d0,d1);  list of polys with coef vectors from deg d0 to d1 in list l
     109 Dim(d0,d1);     number of monomials from deg d0 to d1
     110 Basis(d0,d1);   list of monomials from deg d0 to d1
     111", STRING_CMD);
     112
     113#line 31 "pcv.mod"
     114  iiAddCproc("pcv","MinDeg",FALSE, mod_MinDeg);
     115
     116#line 37 "pcv.mod"
     117  iiAddCproc("pcv","P2CV",FALSE, mod_P2CV);
     118
     119#line 51 "pcv.mod"
     120  iiAddCproc("pcv","CV2P",FALSE, mod_CV2P);
     121
     122#line 66 "pcv.mod"
     123  iiAddCproc("pcv","Dim",FALSE, mod_Dim);
     124
     125#line 81 "pcv.mod"
     126  iiAddCproc("pcv","Basis",FALSE, mod_Basis);
     127
     128  return 0;
     129}
     130
     131#line 132 "pcv.cc"
     132/* Help section */
     133void fill_help_package(idhdl pl) {
     134  namespaceroot->push(IDPACKAGE(pl), IDID(pl));
     135
     136#line 137 "pcv.cc"
     137  namespaceroot->pop();
     138}  /* End of Help section */
     139
     140/* Example section */
     141void fill_example_package(idhdl pl) {
     142  namespaceroot->push(IDPACKAGE(pl), IDID(pl));
     143
     144#line 145 "pcv.cc"
     145  namespaceroot->pop();
     146} /* End of Example section */
     147
     148#line 31 "pcv.mod"
     149BOOLEAN mod_MinDeg(leftv res, leftv h)
     150{
     151#line 31 "pcv.mod"
     152#line 153 "pcv.cc"
     153
     154#line 32 "pcv.mod"
     155#line 156 "pcv.cc"
     156  leftv v = h, v_save;
     157  int tok = NONE, index = 0;
     158  sleftv sp; leftv zp = &sp;
     159  poly p;
     160#line 32 "pcv.mod"
     161
     162
     163#line 33 "pcv.mod"
     164#line 165 "pcv.cc"
     165  if(v==NULL) goto mod_MinDeg_error;
     166  tok = v->Typ();
     167  if((index=iiTestConvert(tok, POLY_CMD))==0)
     168     goto mod_MinDeg_error;
     169  v_save = v->next;
     170  v->next = NULL;
     171  if(iiConvert(tok, POLY_CMD, index, v, zp))
     172     goto mod_MinDeg_error;
     173  v = v_save;
     174  p = (poly)zp->Data();
     175  if(v!=NULL) { tok = v->Typ(); goto mod_MinDeg_error; }
     176
     177#line 33 "pcv.mod"
     178
     179#line 34 "pcv.mod"
     180#line 181 "pcv.cc"
     181  res->rtyp = INT_CMD;
     182  res->data = (void *)pcvMinDeg(p);
     183  if(res->data != NULL) return FALSE;
     184  else return TRUE;
     185
     186
     187  mod_MinDeg_error:
     188    Werror("MinDeg(`%s`) is not supported", Tok2Cmdname(tok));
     189    Werror("expected MinDeg('poly')");
     190    return TRUE;
     191}
     192
     193#line 37 "pcv.mod"
     194BOOLEAN mod_P2CV(leftv res, leftv h)
     195{
     196#line 37 "pcv.mod"
     197#line 198 "pcv.cc"
     198
     199#line 38 "pcv.mod"
     200#line 201 "pcv.cc"
     201  leftv v = h, v_save;
     202  int tok = NONE, index = 0;
     203  sleftv spl; leftv zpl = &spl;
     204  lists pl;
     205  sleftv sd0; leftv zd0 = &sd0;
     206  int d0;
     207  sleftv sd1; leftv zd1 = &sd1;
     208  int d1;
     209#line 38 "pcv.mod"
     210
     211
     212
     213  /* check if current RingHandle is set */
     214  if(currRingHdl == NULL)
    37215  {
    38     int d=pcvDeg(p);
    39     if(d<md) md=d;
    40     pIter(p);
     216    WerrorS("no ring active");
     217    return TRUE;
    41218  }
    42   return md;
    43 }
    44 
    45 int pcvMaxDeg(poly p)
    46 {
    47   if(!p) return 0;
    48   int md=pcvDeg(p);
    49   pIter(p);
    50   while(p)
     219 
     220#line 47 "pcv.mod"
     221#line 222 "pcv.cc"
     222  if(v==NULL) goto mod_P2CV_error;
     223  tok = v->Typ();
     224  if((index=iiTestConvert(tok, LIST_CMD))==0)
     225     goto mod_P2CV_error;
     226  v_save = v->next;
     227  v->next = NULL;
     228  if(iiConvert(tok, LIST_CMD, index, v, zpl))
     229     goto mod_P2CV_error;
     230  v = v_save;
     231  pl = (lists)zpl->Data();
     232  if(v==NULL) goto mod_P2CV_error;
     233  tok = v->Typ();
     234  if((index=iiTestConvert(tok, INT_CMD))==0)
     235     goto mod_P2CV_error;
     236  v_save = v->next;
     237  v->next = NULL;
     238  if(iiConvert(tok, INT_CMD, index, v, zd0))
     239     goto mod_P2CV_error;
     240  v = v_save;
     241  d0 = (int)zd0->Data();
     242  if(v==NULL) goto mod_P2CV_error;
     243  tok = v->Typ();
     244  if((index=iiTestConvert(tok, INT_CMD))==0)
     245     goto mod_P2CV_error;
     246  v_save = v->next;
     247  v->next = NULL;
     248  if(iiConvert(tok, INT_CMD, index, v, zd1))
     249     goto mod_P2CV_error;
     250  v = v_save;
     251  d1 = (int)zd1->Data();
     252  if(v!=NULL) { tok = v->Typ(); goto mod_P2CV_error; }
     253
     254#line 47 "pcv.mod"
     255
     256#line 48 "pcv.mod"
     257#line 258 "pcv.cc"
     258  res->rtyp = LIST_CMD;
     259  res->data = (void *)pcvP2CV(pl, d0, d1);
     260  if(res->data != NULL) return FALSE;
     261  else return TRUE;
     262
     263
     264  mod_P2CV_error:
     265    Werror("P2CV(`%s`) is not supported", Tok2Cmdname(tok));
     266    Werror("expected P2CV('list','int','int')");
     267    return TRUE;
     268}
     269
     270#line 51 "pcv.mod"
     271BOOLEAN mod_CV2P(leftv res, leftv h)
     272{
     273#line 52 "pcv.mod"
     274#line 275 "pcv.cc"
     275
     276#line 53 "pcv.mod"
     277#line 278 "pcv.cc"
     278  leftv v = h, v_save;
     279  int tok = NONE, index = 0;
     280  sleftv spl; leftv zpl = &spl;
     281  lists pl;
     282  sleftv sd0; leftv zd0 = &sd0;
     283  int d0;
     284  sleftv sd1; leftv zd1 = &sd1;
     285  int d1;
     286#line 53 "pcv.mod"
     287
     288
     289
     290  /* check if current RingHandle is set */
     291  if(currRingHdl == NULL)
    51292  {
    52     int d=pcvDeg(p);
    53     if(d>md) md=d;
    54     pIter(p);
     293    WerrorS("no ring active");
     294    return TRUE;
    55295  }
    56   return md;
    57 }
    58 
    59 BOOLEAN pcvMinDeg(leftv res,leftv h)
    60 {
    61   if(h)
     296 
     297#line 62 "pcv.mod"
     298#line 299 "pcv.cc"
     299  if(v==NULL) goto mod_CV2P_error;
     300  tok = v->Typ();
     301  if((index=iiTestConvert(tok, LIST_CMD))==0)
     302     goto mod_CV2P_error;
     303  v_save = v->next;
     304  v->next = NULL;
     305  if(iiConvert(tok, LIST_CMD, index, v, zpl))
     306     goto mod_CV2P_error;
     307  v = v_save;
     308  pl = (lists)zpl->Data();
     309  if(v==NULL) goto mod_CV2P_error;
     310  tok = v->Typ();
     311  if((index=iiTestConvert(tok, INT_CMD))==0)
     312     goto mod_CV2P_error;
     313  v_save = v->next;
     314  v->next = NULL;
     315  if(iiConvert(tok, INT_CMD, index, v, zd0))
     316     goto mod_CV2P_error;
     317  v = v_save;
     318  d0 = (int)zd0->Data();
     319  if(v==NULL) goto mod_CV2P_error;
     320  tok = v->Typ();
     321  if((index=iiTestConvert(tok, INT_CMD))==0)
     322     goto mod_CV2P_error;
     323  v_save = v->next;
     324  v->next = NULL;
     325  if(iiConvert(tok, INT_CMD, index, v, zd1))
     326     goto mod_CV2P_error;
     327  v = v_save;
     328  d1 = (int)zd1->Data();
     329  if(v!=NULL) { tok = v->Typ(); goto mod_CV2P_error; }
     330
     331#line 62 "pcv.mod"
     332
     333#line 63 "pcv.mod"
     334#line 335 "pcv.cc"
     335  res->rtyp = LIST_CMD;
     336  res->data = (void *)pcvCV2P(pl, d0, d1);
     337  if(res->data != NULL) return FALSE;
     338  else return TRUE;
     339
     340
     341  mod_CV2P_error:
     342    Werror("CV2P(`%s`) is not supported", Tok2Cmdname(tok));
     343    Werror("expected CV2P('list','int','int')");
     344    return TRUE;
     345}
     346
     347#line 66 "pcv.mod"
     348BOOLEAN mod_Dim(leftv res, leftv h)
     349{
     350#line 67 "pcv.mod"
     351#line 352 "pcv.cc"
     352
     353#line 68 "pcv.mod"
     354#line 355 "pcv.cc"
     355  leftv v = h, v_save;
     356  int tok = NONE, index = 0;
     357  sleftv sd0; leftv zd0 = &sd0;
     358  int d0;
     359  sleftv sd1; leftv zd1 = &sd1;
     360  int d1;
     361#line 68 "pcv.mod"
     362
     363
     364
     365  /* check if current RingHandle is set */
     366  if(currRingHdl == NULL)
    62367  {
    63     if(h->Typ()==POLY_CMD)
    64     {
    65       res->rtyp=INT_CMD;
    66       res->data=(void*)pcvMinDeg((poly)h->Data());
    67       return FALSE;
    68     }
     368    WerrorS("no ring active");
     369    return TRUE;
    69370  }
    70   WerrorS("<poly> expected");
    71   return TRUE;
    72 }
    73 
    74 BOOLEAN pcvMaxDeg(leftv res,leftv h)
    75 {
    76   if(h)
     371 
     372#line 77 "pcv.mod"
     373#line 374 "pcv.cc"
     374  if(v==NULL) goto mod_Dim_error;
     375  tok = v->Typ();
     376  if((index=iiTestConvert(tok, INT_CMD))==0)
     377     goto mod_Dim_error;
     378  v_save = v->next;
     379  v->next = NULL;
     380  if(iiConvert(tok, INT_CMD, index, v, zd0))
     381     goto mod_Dim_error;
     382  v = v_save;
     383  d0 = (int)zd0->Data();
     384  if(v==NULL) goto mod_Dim_error;
     385  tok = v->Typ();
     386  if((index=iiTestConvert(tok, INT_CMD))==0)
     387     goto mod_Dim_error;
     388  v_save = v->next;
     389  v->next = NULL;
     390  if(iiConvert(tok, INT_CMD, index, v, zd1))
     391     goto mod_Dim_error;
     392  v = v_save;
     393  d1 = (int)zd1->Data();
     394  if(v!=NULL) { tok = v->Typ(); goto mod_Dim_error; }
     395
     396#line 77 "pcv.mod"
     397
     398#line 78 "pcv.mod"
     399#line 400 "pcv.cc"
     400  res->rtyp = INT_CMD;
     401  res->data = (void *)pcvDim(d0, d1);
     402  if(res->data != NULL) return FALSE;
     403  else return TRUE;
     404
     405
     406  mod_Dim_error:
     407    Werror("Dim(`%s`) is not supported", Tok2Cmdname(tok));
     408    Werror("expected Dim('int','int')");
     409    return TRUE;
     410}
     411
     412#line 81 "pcv.mod"
     413BOOLEAN mod_Basis(leftv res, leftv h)
     414{
     415#line 82 "pcv.mod"
     416#line 417 "pcv.cc"
     417
     418#line 83 "pcv.mod"
     419#line 420 "pcv.cc"
     420  leftv v = h, v_save;
     421  int tok = NONE, index = 0;
     422  sleftv sd0; leftv zd0 = &sd0;
     423  int d0;
     424  sleftv sd1; leftv zd1 = &sd1;
     425  int d1;
     426#line 83 "pcv.mod"
     427
     428
     429
     430  /* check if current RingHandle is set */
     431  if(currRingHdl == NULL)
    77432  {
    78     if(h->Typ()==POLY_CMD)
    79     {
    80       res->rtyp=INT_CMD;
    81       res->data=(void*)pcvMaxDeg((poly)h->Data());
    82       return FALSE;
    83     }
     433    WerrorS("no ring active");
     434    return TRUE;
    84435  }
    85   WerrorS("<poly> expected");
    86   return TRUE;
    87 }
    88 
    89 void pcvInit(int d)
    90 {
    91   if(d<0) d=0;
    92   pcvDegBound=d;
    93   pcvTableSize=pVariables*pcvDegBound*sizeof(unsigned);
    94   pcvTable=(unsigned*)Alloc0(pcvTableSize);
    95   pcvIndexSize=pVariables*sizeof(unsigned*);
    96   pcvIndex=(unsigned**)Alloc(pcvIndexSize);
    97   for(int i=0;i<pVariables;i++)
    98     pcvIndex[i]=pcvTable+i*pcvDegBound;
    99   for(int i=0;i<pcvDegBound;i++)
    100     pcvIndex[0][i]=i;
    101   for(int i=1;i<pVariables;i++)
    102   {
    103     unsigned x=0;
    104     for(int j=0;j<pcvDegBound;j++)
    105     {
    106       x+=pcvIndex[i-1][j];
    107       pcvIndex[i][j]=x;
    108     }
    109   }
    110 }
    111 
    112 void pcvClean()
    113 {
    114   if(pcvTable)
    115   {
    116     Free(pcvTable,pcvTableSize);
    117     pcvTable=NULL;
    118   }
    119   if(pcvIndex)
    120   {
    121     Free(pcvIndex,pcvIndexSize);
    122     pcvIndex=NULL;
    123   }
    124 }
    125 
    126 int pcvM2N(poly m)
    127 {
    128   unsigned n=0,d=0;
    129   for(int i=0;i<pVariables;i++)
    130   {
    131     d+=pGetExp(m,i+1);
    132     n+=pcvIndex[i][d];
    133   }
    134   return n+1;
    135 }
    136 
    137 poly pcvN2M(int n)
    138 {
    139   n--;
    140   poly m=pOne();
    141   int i,j,k;
    142   for(i=pVariables-1;i>=0;i--)
    143   {
    144     k=j;
    145     for(j=0;j<pcvDegBound&&pcvIndex[i][j]<=n;j++);
    146     j--;
    147     n-=pcvIndex[i][j];
    148     if(i<pVariables-1) pSetExp(m,i+2,k-j);
    149   }
    150   if(n==0)
    151   {
    152     pSetExp(m,1,j);
    153     pSetm(m);
    154     return m;
    155   }
    156   else
    157   {
    158     pDelete1(&m);
    159     return NULL;
    160   }
    161 }
    162 
    163 poly pcvP2CV(poly p,int d0,int d1)
    164 {
    165   poly cv=NULL;
    166   while(p)
    167   {
    168     int d=pcvDeg(p);
    169     if(d0<=d&&d<d1)
    170     {
    171       poly c=pOne();
    172       pSetComp(c,pcvM2N(p));
    173       pSetCoeff(c,nCopy(pGetCoeff(p)));
    174       cv=pAdd(cv,c);
    175     }
    176     pIter(p);
    177   }
    178   return cv;
    179 }
    180 
    181 poly pcvCV2P(poly cv,int d0,int d1)
    182 {
    183   poly p=NULL;
    184   while(cv)
    185   {
    186     poly m=pcvN2M(pGetComp(cv));
    187     if(m)
    188     {
    189       int d=pcvDeg(m);
    190       if(d0<=d&&d<d1)
    191       {
    192         pSetCoeff(m,nCopy(pGetCoeff(cv)));
    193         p=pAdd(p,m);
    194       }
    195     }
    196     pIter(cv);
    197   }
    198   return p;
    199 }
    200 
    201 lists pcvP2CV(lists pl,int d0,int d1)
    202 {
    203   lists cvl=(lists)Alloc(sizeof(slists));
    204   cvl->Init(pl->nr+1);
    205   pcvInit(d1);
    206   for(int i=pl->nr;i>=0;i--)
    207   {
    208     if(pl->m[i].rtyp==POLY_CMD)
    209     {
    210       cvl->m[i].rtyp=VECTOR_CMD;
    211       cvl->m[i].data=pcvP2CV((poly)pl->m[i].data,d0,d1);
    212     }
    213   }
    214   pcvClean();
    215   return cvl;
    216 }
    217 
    218 lists pcvCV2P(lists cvl,int d0,int d1)
    219 {
    220   lists pl=(lists)Alloc(sizeof(slists));
    221   pl->Init(cvl->nr+1);
    222   pcvInit(d1);
    223   for(int i=cvl->nr;i>=0;i--)
    224   {
    225     if(cvl->m[i].rtyp==VECTOR_CMD)
    226     {
    227       pl->m[i].rtyp=POLY_CMD;
    228       pl->m[i].data=pcvCV2P((poly)cvl->m[i].data,d0,d1);
    229     }
    230   }
    231   pcvClean();
    232   return pl;
    233 }
    234 
    235 BOOLEAN pcvP2CV(leftv res,leftv h)
    236 {
    237   if(currRingHdl)
    238   {
    239     if(h&&h->Typ()==LIST_CMD)
    240     {
    241       lists pl=(lists)h->Data();
    242       h=h->next;
    243       if(h&&h->Typ()==INT_CMD)
    244       {
    245         int d0=(int)h->Data();
    246         h=h->next;
    247         if(h&&h->Typ()==INT_CMD)
    248         {
    249           int d1=(int)h->Data();
    250           res->rtyp=LIST_CMD;
    251           res->data=pcvP2CV(pl,d0,d1);
    252           return FALSE;
    253         }
    254       }
    255     }
    256     WerrorS("<list>,<int>,<int> expected");
    257     return TRUE;
    258   }
    259   WerrorS("no ring active");
    260   return TRUE;
    261 }
    262 
    263 BOOLEAN pcvCV2P(leftv res,leftv h)
    264 {
    265   if(currRingHdl)
    266   {
    267     if(h&&h->Typ()==LIST_CMD)
    268     {
    269       lists pl=(lists)h->Data();
    270       h=h->next;
    271       if(h&&h->Typ()==INT_CMD)
    272       {
    273         int d0=(int)h->Data();
    274         h=h->next;
    275         if(h&&h->Typ()==INT_CMD)
    276         {
    277           int d1=(int)h->Data();
    278           res->rtyp=LIST_CMD;
    279           res->data=pcvCV2P(pl,d0,d1);
    280           return FALSE;
    281         }
    282       }
    283     }
    284     WerrorS("<list>,<int>,<int> expected");
    285     return TRUE;
    286   }
    287   WerrorS("no ring active");
    288   return TRUE;
    289 }
    290 
    291 int pcvDim(int d0,int d1)
    292 {
    293   if(d0<0) d0=0;
    294   if(d1<0) d1=0;
    295   pcvInit(d1+1);
    296   int d=pcvIndex[pVariables-1][d1]-pcvIndex[pVariables-1][d0];
    297   pcvClean();
    298   return d;
    299 }
    300 
    301 BOOLEAN pcvDim(leftv res,leftv h)
    302 {
    303   if(currRingHdl)
    304   {
    305     if(h&&h->Typ()==INT_CMD)
    306     {
    307       int d0=(int)h->Data();
    308       h=h->next;
    309       if(h&&h->Typ()==INT_CMD)
    310       {
    311         int d1=(int)h->Data();
    312         res->rtyp=INT_CMD;
    313         res->data=(void*)pcvDim(d0,d1);
    314         return FALSE;
    315       }
    316     }
    317     WerrorS("<int>,<int> expected");
    318     return TRUE;
    319   }
    320   WerrorS("no ring active");
    321   return TRUE;
    322 }
    323 
    324 int pcvBasis(lists b,int i,poly m,int d,int n)
    325 {
    326   if(n<pVariables)
    327   {
    328     for(int k=0,l=d;k<=l;k++,d--)
    329     {
    330       pSetExp(m,n,k);
    331       i=pcvBasis(b,i,m,d,n+1);
    332     }
    333   }
    334   else
    335   {
    336     pSetExp(m,n,d);
    337     pSetm(m);
    338     b->m[i].rtyp=POLY_CMD;
    339     b->m[i++].data=pCopy(m);
    340   }
    341   return i;
    342 }
    343 
    344 lists pcvBasis(int d0,int d1)
    345 {
    346   if(d0<0) d0=0;
    347   if(d1<0) d1=0;
    348   lists b=(lists)Alloc(sizeof(slists));
    349   b->Init(pcvDim(d0,d1));
    350   poly m=pOne();
    351   for(int d=d0,i=0;d<d1;d++)
    352     i=pcvBasis(b,i,m,d,1);
    353   pDelete1(&m);
    354   return b;
    355 }
    356 
    357 BOOLEAN pcvBasis(leftv res,leftv h)
    358 {
    359   if(currRingHdl)
    360   {
    361     if(h&&h->Typ()==INT_CMD)
    362     {
    363       int d0=(int)h->Data();
    364       h=h->next;
    365       if(h&&h->Typ()==INT_CMD)
    366       {
    367         int d1=(int)h->Data();
    368         res->rtyp=LIST_CMD;
    369         res->data=pcvBasis(d0,d1);
    370         return FALSE;
    371       }
    372     }
    373     WerrorS("<int>,<int> expected");
    374     return TRUE;
    375   }
    376   WerrorS("no ring active");
    377   return TRUE;
    378 }
     436 
     437#line 92 "pcv.mod"
     438#line 439 "pcv.cc"
     439  if(v==NULL) goto mod_Basis_error;
     440  tok = v->Typ();
     441  if((index=iiTestConvert(tok, INT_CMD))==0)
     442     goto mod_Basis_error;
     443  v_save = v->next;
     444  v->next = NULL;
     445  if(iiConvert(tok, INT_CMD, index, v, zd0))
     446     goto mod_Basis_error;
     447  v = v_save;
     448  d0 = (int)zd0->Data();
     449  if(v==NULL) goto mod_Basis_error;
     450  tok = v->Typ();
     451  if((index=iiTestConvert(tok, INT_CMD))==0)
     452     goto mod_Basis_error;
     453  v_save = v->next;
     454  v->next = NULL;
     455  if(iiConvert(tok, INT_CMD, index, v, zd1))
     456     goto mod_Basis_error;
     457  v = v_save;
     458  d1 = (int)zd1->Data();
     459  if(v!=NULL) { tok = v->Typ(); goto mod_Basis_error; }
     460
     461#line 92 "pcv.mod"
     462
     463#line 93 "pcv.mod"
     464#line 465 "pcv.cc"
     465  res->rtyp = LIST_CMD;
     466  res->data = (void *)pcvBasis(d0, d1);
     467  if(res->data != NULL) return FALSE;
     468  else return TRUE;
     469
     470
     471  mod_Basis_error:
     472    Werror("Basis(`%s`) is not supported", Tok2Cmdname(tok));
     473    Werror("expected Basis('int','int')");
     474    return TRUE;
     475}
     476
     477
     478#line 478 "pcv.cc"
  • modules/pcv/pcv/pcv.h

    r2d7f0f r1de0ed  
    1 /****************************************
    2 *  Computer Algebra System SINGULAR     *
    3 ****************************************/
    4 /* $Id: pcv.h,v 1.2 1998-12-21 10:55:17 mschulze Exp $ */
    51/*
    6 * ABSTRACT: conversion between polys and coef vectors
    7 */
     2 * This was automaticly generated by modgen
     3 * version 0.2
     4 * module pcv
     5 * Don't edit this file
     6 */
    87
    9 #ifndef PCV_H
    10 #define PCV_H
    118
    12 int pcvDeg(poly p);
    13 int pcvMinDeg(poly p);
    14 int pcvMaxDeg(poly p);
    15 BOOLEAN pcvMinDeg(leftv res,leftv h);
    16 BOOLEAN pcvMaxDeg(leftv res,leftv h);
    17 void pcvInit(int d);
    18 void pcvClean();
    19 poly pcvP2CV(poly p,int d0,int d1);
    20 poly pcvCV2P(poly cv,int d0,int d1);
    21 lists pcvP2CV(lists pl,int d0,int d1);
    22 lists pcvCV2P(lists cvl,int d0,int d1);
    23 BOOLEAN pcvP2CV(leftv res,leftv h);
    24 BOOLEAN pcvCV2P(leftv res,leftv h);
    25 int pcvDim(int d0,int d1);
    26 BOOLEAN pcvDim(leftv res,leftv h);
    27 int pcvBasis(lists b,int i,poly m,int d,int n);
    28 lists pcvBasis(int d0,int d1);
    29 BOOLEAN pcvBasis(leftv res,leftv h);
     9#line 113 "pcv.cc"
     10#include <stdlib.h>
     11#include <stdio.h>
     12#include <string.h>
     13#include <ctype.h>
    3014
    31 #endif
     15
     16#include <locals.h>
     17
     18BOOLEAN mod_MinDeg(leftv res, leftv h);
     19//int pcvMinDeg(poly p);
     20
     21BOOLEAN mod_P2CV(leftv res, leftv h);
     22//lists pcvP2CV(lists pl, int d0, int d1);
     23
     24BOOLEAN mod_CV2P(leftv res, leftv h);
     25//lists pcvCV2P(lists pl, int d0, int d1);
     26
     27BOOLEAN mod_Dim(leftv res, leftv h);
     28//int pcvDim(int d0, int d1);
     29
     30BOOLEAN mod_Basis(leftv res, leftv h);
     31//lists pcvBasis(int d0, int d1);
     32
Note: See TracChangeset for help on using the changeset viewer.