Changeset 6b5dd2 in git


Ignore:
Timestamp:
Aug 13, 2004, 8:26:03 PM (20 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
eb234f15d6598ca0962dedbf1a9bb6b54a5e4b6d
Parents:
e5627dd3d72ab05802168acf771823493696b8ef
Message:
*levandov: new plural functions rOpposite and rEnvelope implemented


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

Legend:

Unmodified
Added
Removed
  • kernel/gring.cc

    re5627d r6b5dd2  
    77 *  Author:  levandov (Viktor Levandovsky)
    88 *  Created: 8/00 - 11/00
    9  *  Version: $Id: gring.cc,v 1.11 2004-07-29 14:58:00 Singular Exp $
     9 *  Version: $Id: gring.cc,v 1.12 2004-08-13 18:26:03 levandov Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     
    10271027    return(NULL);
    10281028  }
    1029   poly m=pOne();
     1029  poly m = pOne();
    10301030  p_ExpVectorDiff(m,p2,p1,r);
    10311031  //p_Setm(m,r);
     
    10341034#endif
    10351035  /* pSetComp(m,r)=0? */
    1036   poly N=nc_mm_Mult_p(m,p_Head(p1,r),r);
    1037   number C=n_Copy(p_GetCoeff(N,r),r);
    1038   number cF=n_Copy(p_GetCoeff(p2,r),r);
     1036  poly   N  = nc_mm_Mult_p(m, p_Head(p1,r), r);
     1037  number C  = n_Copy( p_GetCoeff(N,  r), r);
     1038  number cF = n_Copy( p_GetCoeff(p2, r),r);
    10391039  /* GCD stuff */
    1040   number cG = nGcd(C,cF,r);
    1041   if (!nEqual(cG,n_Init(1,r)))
    1042   {
    1043     cF = nDiv(cF,cG);
    1044     C  = nDiv(C,cG);
    1045   }
    1046   p2=p_Mult_nn(p2,C,r);
     1040  number cG = nGcd(C, cF, r);
     1041  if ( !nEqual(cG, n_Init(1,r) ) )
     1042  {
     1043    cF = nDiv(cF, cG);
     1044    C  = nDiv(C,  cG);
     1045  }
     1046  p2 = p_Mult_nn(p2, C, r);
    10471047  poly out = nc_mm_Mult_p(m, p_Copy(pNext(p1),r), r);
    1048   N=p_Add_q(N,out,r);
    1049   number MinusOne=n_Init(-1,r);
     1048  N = p_Add_q(N, out, r);
     1049  p_Test(p2,r);
     1050  p_Test(N,r);
     1051  number MinusOne = n_Init(-1,r);
    10501052  if (!n_Equal(cF,MinusOne,r))
    10511053  {
    1052     cF=n_Neg(cF,r);
    1053     N=p_Mult_nn(N,cF,r);
    1054   }
    1055   out=p_Add_q(p2,N,r);
    1056   if (out!=NULL) pContent(out);
     1054    cF = n_Neg(cF,r);
     1055    N  = p_Mult_nn(N, cF, r);
     1056    p_Test(N,r);
     1057  }
     1058  out = p_Add_q(p2,N,r);
     1059  p_Test(out,r);
     1060  if ( out!=NULL ) pContent(out);
    10571061  p_Delete(&m,r);
    10581062  n_Delete(&cF,r);
     
    22422246  matrix D = mpNew(r->N,r->N);
    22432247  int i,j;
    2244   number One=r->cf->nInit(1);
    22452248  for(i=1; i<r->N; i++)
    22462249  {
     
    22592262}
    22602263
    2261 poly p_CopyEmbed(poly p, ring srcRing, int shift)
    2262   /* for use with embeddings: srcRing is a sum of smaller rings */
     2264poly p_CopyEmbed(poly p, ring srcRing, int shift, int par_shift)
     2265  /* NOT USED ANYMORE: replaced by maFindPerm in ring.cc */
     2266  /* for use with embeddings: currRing is a sum of smaller rings */
     2267  /* and srcRing is one of such smaller rings */
    22632268  /* shift defines the position of a subring in srcRing */
     2269  /* par_shift defines the position of a subfield in basefield of CurrRing */
    22642270{
    22652271  if (currRing == srcRing)
     
    22692275  nMapFunc nMap=nSetMap(srcRing);
    22702276  poly q;
    2271   if ( nMap == nCopy)
    2272   {
    2273     q = prCopyR(p,srcRing);
    2274   }
    2275   else
     2277  //  if ( nMap == nCopy)
     2278  //  {
     2279  //    q = prCopyR(p,srcRing);
     2280  //  }
     2281  //  else
    22762282  {
    22772283    int *perm = (int *)omAlloc0((srcRing->N+1)*sizeof(int));
    2278     int *par_perm = NULL;
     2284    int *par_perm = (int *)omAlloc0((srcRing->P+1)*sizeof(int));
    22792285    //    int *par_perm = (int *)omAlloc0((srcRing->P+1)*sizeof(int));
    22802286    int i;
     
    22892295      return(0);
    22902296    }
    2291     for (i=1; i<=srcRing->N; i++)
    2292       perm[i]=shift+i;
     2297    for (i=1; i<= srcRing->N; i++)
     2298    {
     2299      perm[i] = shift+i;
     2300    }
    22932301    q = pPermPoly(p,perm,srcRing,nMap,par_perm,srcRing->P);
    22942302  }
  • kernel/ring.cc

    re5627d r6b5dd2  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ring.cc,v 1.17 2004-08-13 14:25:46 Singular Exp $ */
     4/* $Id: ring.cc,v 1.18 2004-08-13 18:26:02 levandov Exp $ */
    55
    66/*
     
    2828#include "gring.h"
    2929#include "matpol.h"
     30#include "maps.h"
    3031#endif
    3132
     
    11341135    ring old_ring = currRing;
    11351136    rChangeCurrRing(sum);
     1137/* find permutations of vars and pars */
     1138    int *perm1 = (int *)omAlloc0((R1->N+1)*sizeof(int));
     1139    int *par_perm1 = (int *)omAlloc0((R1->P+1)*sizeof(int));
     1140    int *perm2 = (int *)omAlloc0((R2->N+1)*sizeof(int));
     1141    int *par_perm2 = (int *)omAlloc0((R2->P+1)*sizeof(int));
     1142    //    maFindPerm(char **preim_names, int preim_n, char **preim_par, int preim_p,
     1143    //                char **names,       int n,       char **par,       int nop,
     1144    //                int * perm, int *par_perm, int ch);
     1145    maFindPerm(R1->names,  R1->N,  R1->parameter,  R1->P,
     1146               sum->names, sum->N, sum->parameter, sum->P,
     1147               perm1, par_perm1, sum->ch);
     1148    maFindPerm(R2->names,  R2->N,  R2->parameter,  R2->P,
     1149               sum->names, sum->N, sum->parameter, sum->P,
     1150               perm2, par_perm2, sum->ch);
     1151    nMapFunc nMap1 = nSetMap(R1);
     1152    nMapFunc nMap2 = nSetMap(R2);
    11361153    matrix C1 = R1->nc->C, C2 = R2->nc->C;
    11371154    matrix D1 = R1->nc->D, D2 = R2->nc->D;
     
    11391156    matrix C  = mpNew(l,l);
    11401157    matrix D  = mpNew(l,l);
     1158    int param_shift = 0;
    11411159    for (i=1; i<= R1->N + R2->N; i++)
    11421160    {
     
    11501168      for (j=i+1; j<=R1->N; j++)
    11511169      {
    1152         MATELEM(C,i,j) = p_CopyEmbed(MATELEM(C1,i,j),R1,0);
     1170        MATELEM(C,i,j) = pPermPoly(MATELEM(C1,i,j),perm1,R1,nMap1,par_perm1,R1->P);
     1171        MATELEM(D,i,j) = pPermPoly(MATELEM(D1,i,j),perm1,R1,nMap1,par_perm1,R1->P);
     1172        //      MATELEM(C,i,j) = p_CopyEmbed(MATELEM(C1,i,j),R1,0,param_shift);
    11531173          //prCopyR_NoSort(MATELEM(C1,i,j),R1,sum);
    11541174        //      MATELEM(D,i,j) = prCopyR(MATELEM(D1,i,j),R1,sum);
    1155         MATELEM(D,i,j) = p_CopyEmbed(MATELEM(D1,i,j),R1,0);
     1175        //      MATELEM(D,i,j) = p_CopyEmbed(MATELEM(D1,i,j),R1,0,param_shift);
     1176
    11561177      }
    11571178    }
     
    11621183        //      MATELEM(C,R1->N+i,R1->N+j) = prCopyR_NoSort(MATELEM(C2,i,j),R2,sum);
    11631184        //      MATELEM(D,R1->N+i,R1->N+j) = prCopyR(MATELEM(D2,i,j),R2,sum);
    1164         MATELEM(C,R1->N+i,R1->N+j) = p_CopyEmbed(MATELEM(C2,i,j),R2, R1->N);
    1165         MATELEM(D,R1->N+i,R1->N+j) = p_CopyEmbed(MATELEM(D2,i,j),R2, R1->N);
     1185        //      MATELEM(C,R1->N+i,R1->N+j) = p_CopyEmbed(MATELEM(C2,i,j),R2, R1->N,param_shift);
     1186        //      MATELEM(D,R1->N+i,R1->N+j) = p_CopyEmbed(MATELEM(D2,i,j),R2, R1->N,param_shift);
     1187
     1188        MATELEM(C,R1->N+i,R1->N+j) = pPermPoly(MATELEM(C2,i,j),perm2,R2,nMap2,par_perm2,R2->P);
     1189        MATELEM(D,R1->N+i,R1->N+j) = pPermPoly(MATELEM(D2,i,j),perm2,R2,nMap2,par_perm2,R2->P);
    11661190      }
    11671191    }
     
    34623486#include <ctype.h>
    34633487
    3464 ring rOpp(ring src)
    3465 {
     3488ring rOpposite(ring src)
     3489  /* creates an opposite algebra of R */
     3490  /* that is R^opp, where f (*^opp) g = g*f  */
     3491{
     3492  ring save=currRing; 
    34663493  ring r=rCopy(src);
    34673494  // change vars v1..vN -> vN..v1
     
    35293556      case ro_syzcomp:
    35303557      case ro_syz:
    3531          WerrorS("not implemented in rOpp");
     3558         WerrorS("not implemented in rOpposite");
    35323559         // should not happen
    35333560         break;
     
    35403567      case ro_none:
    35413568      default:
    3542        Werror("unknown typ in rOpp(%d)",r->typ[i].ord_typ);
     3569       Werror("unknown type in rOpposite(%d)",r->typ[i].ord_typ);
    35433570       break;
    35443571    }
    35453572  }
    35463573  // avoid printing changed stuff:
    3547   r->order[0]=ringorder_unspec;
    3548   r->block0[0]=1;
    3549   r->block1[0]=rVar(r);
    3550   r->order[1]=0;
    3551 #ifdef RDEBUG
    3552   rDebugPrint(r);
    3553 #endif
     3574//   r->order[0]=ringorder_unspec;
     3575//   r->block0[0]=1;
     3576//   r->block1[0]=rVar(r);
     3577//   r->order[1]=0;
     3578// #ifdef RDEBUG
     3579//   rDebugPrint(r);
     3580//#endif
     3581  /* now, we initialize a non-comm structure on it */
     3582  rComplete(r); /* dare we? */
     3583  //#ifdef HAVE_PLURAL
     3584  if (!rIsPluralRing(src))
     3585  {
     3586    return(r);
     3587  }
     3588  rChangeCurrRing(r); 
     3589  /* basic nc constructions  */
     3590  r->nc = (nc_struct *)omAlloc0(sizeof(nc_struct));
     3591  r->nc->ref = 1; /* in spite of Copy(src)? */
     3592  r->nc->basering = r;
     3593  r->nc->type =  src->nc->type;
     3594  int *perm = (int *)omAlloc0((r->N+1)*sizeof(int));
     3595  int *par_perm = NULL;
     3596  nMapFunc nMap = nSetMap(src);
     3597  int j;
     3598  int ni,nj;
     3599  for(i=1; i<=r->N; i++)
     3600  {
     3601    perm[i] = r->N+1-i;
     3602  }
     3603  matrix C = mpNew(r->N,r->N);
     3604  matrix D = mpNew(r->N,r->N);
     3605  for (i=1; i< r->N; i++)
     3606  {
     3607    for (j=i+1; j<=r->N; j++)
     3608    {
     3609      ni = r->N +1 - i;
     3610      nj = r->N +1 - j; /* i<j ==>   nj < ni */
     3611      MATELEM(C,nj,ni) = pPermPoly(MATELEM(src->nc->C,i,j),perm,src,nMap,par_perm,src->P);
     3612      MATELEM(D,nj,ni) = pPermPoly(MATELEM(src->nc->D,i,j),perm,src,nMap,par_perm,src->P);
     3613    }
     3614  }
     3615  r->nc->C = C;
     3616  r->nc->D = D;
     3617  if (nc_InitMultiplication(r))
     3618    WarnS("Error initializing multiplication!");
     3619  r->nc->IsSkewConstant =   src->nc->IsSkewConstant;
     3620  rChangeCurrRing(save);
    35543621  return r;
    35553622}
     3623
     3624ring rEnvelope(ring R)
     3625  /* creates an enveloping algebra of R */
     3626  /* that is R^e = R \tensor_K R^opp */
     3627{
     3628  ring Ropp = rOpposite(R);
     3629  ring Renv;
     3630  int stat = rSum(R, Ropp, Renv);
     3631  if (stat <=0)
     3632    WarnS("Error in rEnvelope at rSum");
     3633  return Renv;
     3634}
  • kernel/ring.h

    re5627d r6b5dd2  
    77* ABSTRACT - the interpreter related ring operations
    88*/
    9 /* $Id: ring.h,v 1.4 2004-08-09 14:44:30 Singular Exp $ */
     9/* $Id: ring.h,v 1.5 2004-08-13 18:26:03 levandov Exp $ */
    1010
    1111/* includes */
     
    2828void   rKill(ring r);
    2929ring   rCopy(ring r);
    30 ring   rOpp(ring r);
     30ring   rOpposite(ring r);
     31ring   rEnvelope(ring r);
    3132
    3233
Note: See TracChangeset for help on using the changeset viewer.