Changeset 0e4337 in git


Ignore:
Timestamp:
Feb 26, 2001, 4:08:45 PM (23 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
af847a2a8b7e01d923f5ef3edef35d4921a47299
Parents:
d88b030aab30132964e13441edf50d4075a99fb2
Message:
plural multiplication routines


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

Legend:

Unmodified
Added
Removed
  • Singular/extra.cc

    rd88b03 r0e4337  
    22*  Computer Algebra System SINGULAR      *
    33*****************************************/
    4 /* $Id: extra.cc,v 1.162 2001-02-22 19:12:57 levandov Exp $ */
     4/* $Id: extra.cc,v 1.163 2001-02-26 15:08:42 levandov Exp $ */
    55/*
    66* ABSTRACT: general interface to internals of Singular ("system" command)
     
    6969
    7070#ifdef HAVE_PLURAL
     71#include "ring.h"
    7172#include "gring.h"
    7273#endif
     
    11801181      matrix C;
    11811182      matrix D;
    1182 
     1183      matrix COM;
    11831184      if ((h!=NULL) && (h->Typ()==MATRIX_CMD))
    11841185      {
     
    11951196      {
    11961197        currRing->nc=(nc_struct *)omAlloc0(sizeof(nc_struct));
    1197         currRing->nc->MT=(matrix *)omAlloc0(pVariables*(pVariables-1)/2*sizeof(matrix));
    1198         currRing->nc->MTsize=(int *)omAlloc0(pVariables*(pVariables-1)/2*sizeof(int));
     1198        currRing->nc->MT=(matrix *)omAlloc0(currRing->N*(currRing->N-1)/2*sizeof(matrix));
     1199        currRing->nc->MTsize=(int *)omAlloc0(currRing->N*(currRing->N-1)/2*sizeof(int));
    11991200      }
    12001201      else
    12011202      {
    12021203        WarnS("redefining algebra structure");
    1203       }
     1204      }     
    12041205      currRing->nc->type=nc_general;
    12051206      currRing->nc->C=C;
    12061207      currRing->nc->D=D;
    1207       {
    1208         int i,j;
    1209         poly p;
    1210         short DefMTsize=7;
    1211         int nv=pVariables;
    1212         for(i=1;i<nv;i++)
    1213         {
    1214           for(j=i+1;j<=nv;j++)
    1215           {
    1216             currRing->nc->MTsize[UPMATELEM(i,j,curring->N)]=DefMTsize; /* default sizes */
    1217             currRing->nc->MT[UPMATELEM(i,j,curring->N)]=mpNew(DefMTsize,DefMTsize);
     1208      COM=mpCopy(currRing->nc->C);
     1209      int i,j;
     1210      poly p;
     1211      short DefMTsize=7;
     1212      int nv=currRing->N;
     1213      for(i=1;i<nv;i++)
     1214      {
     1215        for(j=i+1;j<=nv;j++)
     1216        {
     1217          if (MATELEM(D,i,j)==NULL)
     1218          {
     1219            currRing->nc->MTsize[UPMATELEM(i,j,currRing->N)]=0;
     1220          }
     1221          else
     1222          {
     1223            MATELEM(COM,i,j)=NULL;
     1224            currRing->nc->MTsize[UPMATELEM(i,j,currRing->N)]=DefMTsize; /* default sizes */
     1225            currRing->nc->MT[UPMATELEM(i,j,currRing->N)]=mpNew(DefMTsize,DefMTsize);
    12181226            p=pOne();
    12191227            pSetCoeff(p,nCopy(pGetCoeff(MATELEM(currRing->nc->C,i,j))));
     
    12221230            pSetm(p);
    12231231            p=pAdd(p,pCopy(MATELEM(currRing->nc->D,i,j)));
    1224             MATELEM(currRing->nc->MT[UPMATELEM(i,j,curring->N)],1,1)=p;
    1225             /* set MT[i,j,1,1] to c_i_j*x_i*x_j + D_i_j */
     1232            MATELEM(currRing->nc->MT[UPMATELEM(i,j,currRing->N)],1,1)=p;
    12261233          }
    1227         }
    1228       }
    1229       // set p_Procs:
    1230 //      currRing->p_Procs->pp_Mult_mm =nc_pp_Mult_mm;
    1231 //      currRing->p_Procs->p_Mult_mm =nc_p_Mult_mm;
    1232 //      currRing->p_Procs->p_Minus_mm_Mult_qq =nc_p_Minus_mm_Mult_qq;
    1233 
     1234         
     1235          /* set MT[i,j,1,1] to c_i_j*x_i*x_j + D_i_j */
     1236        }
     1237      }
     1238     
     1239      currRing->nc->COM=COM;
    12341240      return FALSE;
    12351241    }
  • Singular/gring.cc

    rd88b03 r0e4337  
    77 *  Author:  levandov (Viktor Levandovsky)
    88 *  Created: 8/00 - 11/00
    9  *  Version: $Id: gring.cc,v 1.7 2001-02-23 16:44:13 levandov Exp $
     9 *  Version: $Id: gring.cc,v 1.8 2001-02-26 15:08:43 levandov Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     12#ifdef HAVE_PLURAL
    1213#include "gring.h"
    13 #ifdef HAVE_PLURAL
     14#include "febase.h"
     15#include "ring.h"
     16#include "polys.h"
     17#include "numbers.h"
     18#include "ideals.h"
     19#include "matpol.h"
     20
    1421
    1522//global nc_macros :
     
    3946  /* destroy p,q */
    4047{
    41   poly res=0;
    42   poly ghost;
     48  poly res=NULL;
     49  poly ghost=NULL;
    4350  while (q!=NULL)
    4451    {
    4552      res=p_Add_q(res,nc_pp_Mult_mm(p,p_Head(q,r),r,ghost),r);
    46       p_LmDeleteAndNext(q,r);
     53      q=p_LmDeleteAndNext(q,r);
    4754    }
    4855  p_Delete(&p,r);
     
    117124    out = p_Add_q(out,v,r);
    118125    //    p_DeleteLm(&p,r);
    119     p_LmDeleteAndNext(p,r);
     126    p=p_LmDeleteAndNext(p,r);
    120127  }
    121128  freeT(P,r->N);
     
    586593  number tmp_number=NULL;
    587594 
    588 // first check wether the polynom is alredy computed
     595//Now check zero exeptions, commutativity and should we do something at all? 
     596  out=pOne();
     597  p_SetExp(out,j,b,r);
     598  p_SetExp(out,i,a,r);
     599  if (i==j) p_SetExp(out,j,a+b,r);
     600  p_Setm(out,r);
     601  if ((a==0)||(b==0)||(i<=j)) return(out);//zero exeptions and usual case
     602 
     603  if (MATELEM(r->nc->COM,j,i)!=NULL)
     604//commutative or quasicommutative case
     605  {
     606    if (r->cf->nIsOne(p_GetCoeff(MATELEM(r->nc->COM,j,i),r))) //commutative case
     607    {
     608      return(out);
     609    }     
     610    else
     611    {
     612      tmp_number=p_GetCoeff(MATELEM(r->nc->COM,j,i),r); //quasicommutative case
     613      nPower(tmp_number,a*b,&tmp_number);
     614      p_SetCoeff(out,tmp_number,r);
     615      return(out);
     616    }
     617  }// end commutative or quasicommutative case
     618
     619  //we are here if  i>j and variables do not commute or quasicommute
     620  //in fact, now a>=1 and b>=1; and j<i
     621  // now check wether the polynom is alredy computed
    589622  int vik = UPMATELEM(j,i,r->N);
    590623  matrix cMT=r->nc->MT[vik];
     
    593626  if (((a<cMTsize)&&(b<cMTsize))&&(MATELEM(cMT,a,b)!=NULL))
    594627  {
    595      out=p_Copy(MATELEM(cMT,a,b),r);
    596      return (out);
    597   }
    598 
    599 //Now check zero exeptions, commutativity and should we do something at all? 
    600       out=pOne();
    601       p_SetExp(out,j,b,r);
    602       p_SetExp(out,i,a,r);
    603       if (i==j) p_SetExp(out,j,a+b,r);
    604       p_Setm(out,r);
    605       if ((a==0)||(b==0)||(i<=j)) return(out);//zero exeptions and usual case
    606      
    607       if (p_GetCoeff(r->nc->COM[UPMATELEM(i,j,r->N)],r)!=0) //commutative or quasicommutative case
    608       {
    609         if (p_GetCoeff(r->nc->COM[UPMATELEM(i,j,r->N)],r)!=n_Init(1,r)) //commutative case
    610         {
    611           return(out);
    612         }     
    613         else
    614         {
    615           tmp_number=p_GetCoeff(r->nc->COM[UPMATELEM(i,j,r->N)],r); //quasicommutative case
    616           nPower(tmp_number,a*b,&tmp_number);
    617           p_SetCoeff(out,tmp_number,r);
    618           return(out);
    619         }
    620       }// end commutative or quasicommutative case
    621 
    622 //we are here if  i>j and variables do not commute or quasicommute
    623 //in fact, now a>=1 and b>=1; and j<i
    624 
     628    out=p_Copy(MATELEM(cMT,a,b),r);
     629    return (out);
     630  }
     631 
    625632//  poly C=MATELEM(r->nc->C,j,i);               
    626633//  number c=p_GetCoeff(C,r); //coeff           
     
    628635     
    629636  int newcMTsize=0;
    630  
     637  int k,m;
    631638  p_Delete(&out,r);//Shura thinks it is nesessary
     639
    632640 
    633641  if (a>=b) {newcMTsize=a;} else {newcMTsize=b;}
     
    636644     newcMTsize = newcMTsize+cMTsize;
    637645     matrix tmp = mpNew(newcMTsize,newcMTsize);
    638      int k,m;
    639646     
    640647     for (k=1;k<r->N;k++)
  • Singular/gring.h

    rd88b03 r0e4337  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: gring.h,v 1.5 2001-02-23 16:28:24 levandov Exp $ */
     6/* $Id: gring.h,v 1.6 2001-02-26 15:08:44 levandov Exp $ */
    77/*
    88* ABSTRACT additional defines etc for --with-plural
     
    1111#include "mod2.h"
    1212#ifdef HAVE_PLURAL
    13 #include "polys.h" // do we need it really?
    14 #include "numbers.h"
    15 #include "matpol.h"
    16 /* #include "p_Procs.h" */
    17 #include "ideals.h"
     13#include "structs.h"
    1814
    1915#define UPMATELEM(i,j,nVar) ( (nVar * ((i)-1) - ((i) * ((i)-1))/2 + (j)-1)-(i) )
     
    2723poly nc_mm_Mult_uu (Exponent_t *F,int jG,int bG, const ring r);
    2824poly nc_uu_Mult_ww (int i, int a, int j, int b, const ring r);
     25poly _nc_p_Mult_q(poly p, poly q, const int copy, const ring r);
    2926
    3027#endif /* HAVE_PLURAL */
  • Singular/pInline2.h

    rd88b03 r0e4337  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: pInline2.h,v 1.26 2001-02-23 16:28:24 levandov Exp $
     9 *  Version: $Id: pInline2.h,v 1.27 2001-02-26 15:08:44 levandov Exp $
    1010 *******************************************************************/
    1111#ifndef PINLINE2_H
     
    2626#ifdef HAVE_PLURAL
    2727#include "gring.h"
     28#include "ring.h"
    2829#endif
    2930
  • Singular/structs.h

    rd88b03 r0e4337  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: structs.h,v 1.57 2001-02-20 09:45:43 Singular Exp $ */
     6/* $Id: structs.h,v 1.58 2001-02-26 15:08:45 levandov Exp $ */
    77/*
    88* ABSTRACT
     
    353353  matrix D;
    354354  matrix *MT;
     355  matrix COM;
    355356  int *MTsize;
    356357};
Note: See TracChangeset for help on using the changeset viewer.