Changeset b39bc1f in git


Ignore:
Timestamp:
Oct 18, 2004, 8:57:07 PM (20 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
bc36a0348925ea3732666805bd1ad0d87c9223e3
Parents:
a63c242b49717f7a64c2432c5f75c71fc335ebdf
Message:
*levandov: new commands oppose, opposite and envelope are available


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

Legend:

Unmodified
Added
Removed
  • kernel/gring.cc

    ra63c24 rb39bc1f  
    77 *  Author:  levandov (Viktor Levandovsky)
    88 *  Created: 8/00 - 11/00
    9  *  Version: $Id: gring.cc,v 1.15 2004-10-13 10:50:37 levandov Exp $
     9 *  Version: $Id: gring.cc,v 1.16 2004-10-18 18:57:06 levandov Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     
    23052305}
    23062306
    2307 poly p_Oppose(ring Rop, poly p)
    2308 {
    2309   /* TODO check Rop == rOpposite(currRing) */
    2310   /* the same basefield, same number of variables */
    2311 
     2307poly pOppose(ring Rop, poly p)
     2308  /* opposes a vector p from Rop to currRing */
     2309{
    23122310  /* the simplest case:*/
    2313   if (Rop==currRing) return pCopy(p); // ok
    2314   nMapFunc nMap=nSetMap(Rop);
     2311  if (  Rop == currRing )  return(pCopy(p));
     2312  /* check Rop == rOpposite(currRing) */
     2313  if ( !rIsLikeOpposite(currRing, Rop) )
     2314  {
     2315    WarnS("an opposite ring should be used");
     2316    return NULL;
     2317  }
     2318  /* nMapFunc nMap = nSetMap(Rop);*/
     2319  /* since we know that basefields coinside! */
    23152320  int *perm=(int *)omAlloc0((Rop->N+1)*sizeof(int));
    2316   /* we know perm exactly */
     2321  if (!p_IsConstantPoly(p, Rop))
     2322  {
     2323    /* we know perm exactly */
     2324    int i;
     2325    for(i=1; i<=Rop->N; i++)
     2326    {
     2327      perm[i] = Rop->N+1-i;
     2328    }
     2329  }
     2330  poly res = pPermPoly(p, perm, Rop, nCopy);
     2331  omFreeSize((ADDRESS)perm,(Rop->N+1)*sizeof(int));
     2332  return res;
     2333}
     2334
     2335ideal idOppose(ring Rop, ideal I)
     2336  /* opposes a module I from Rop to currRing */
     2337{
     2338  /* the simplest case:*/
     2339  if ( Rop == currRing ) return idCopy(I);
     2340  /* check Rop == rOpposite(currRing) */
     2341  if (!rIsLikeOpposite(currRing, Rop))
     2342  {
     2343    WarnS("an opposite ring should be used");
     2344    return NULL;
     2345  }
    23172346  int i;
    2318   for(i=1; i<=Rop->N; i++)
    2319   {
    2320     perm[i] = Rop->N+1-i;
    2321   }
    2322   /*  int *par_perm=NULL; */
    2323   poly res = pPermPoly(p, perm, Rop, nMap);
    2324   omFreeSize((ADDRESS)perm,(Rop->N+1)*sizeof(int));
    2325   //omFreeSize((ADDRESS)par_perm,rPar(r)*sizeof(int));
    2326   return res;
    2327 }
    2328 
    2329 
    2330 #endif
     2347  ideal idOp = idInit(I->ncols, I->rank);
     2348  for (i=0; i< (I->ncols)*(I->nrows); i++)
     2349  {
     2350    idOp->m[i] = pOppose(Rop,I->m[i]);
     2351  }
     2352  idTest(idOp);
     2353  return idOp;
     2354}
     2355
     2356BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate)
     2357  /* checks whether rings rBase and rCandidate */
     2358  /* could be opposite to each other */
     2359  /* returns TRUE if it is so */
     2360{
     2361  /* the same basefield */
     2362  int diagnose = TRUE;
     2363  ring save = currRing;
     2364  rChangeCurrRing(rBase);
     2365  nMapFunc nMap = nSetMap(rCandidate);
     2366  if (nMap != nCopy) diagnose = FALSE;
     2367  rChangeCurrRing(save);
     2368  /* same number of variables */
     2369  if (rBase->N != rCandidate->N) diagnose = FALSE;
     2370  /* nc and comm ring */
     2371  if ( rIsPluralRing(rBase) != rIsPluralRing(rCandidate) ) diagnose = FALSE;
     2372  /* TODO: varnames are e->E etc */
     2373  return diagnose;
     2374}
     2375
     2376#endif
  • kernel/gring.h

    ra63c24 rb39bc1f  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: gring.h,v 1.8 2004-08-27 12:20:02 Singular Exp $ */
     6/* $Id: gring.h,v 1.9 2004-10-18 18:57:06 levandov Exp $ */
    77/*
    88* ABSTRACT additional defines etc for --with-plural
     
    1919BOOLEAN nc_CallPlural(matrix CC, matrix DD, poly CN, poly DN, ring r);
    2020BOOLEAN nc_InitMultiplication(ring r);
     21BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate);
    2122
    2223ring nc_rCreateNCcomm(ring r);
     
    8485
    8586poly p_CopyEmbed(poly p, ring srcRing, int shift, int par_shift);
    86 poly p_Oppose(ring Rop, poly p);
     87poly pOppose(ring Rop, poly p);
     88ideal idOppose(ring Rop, ideal I);
    8789
    8890#else
  • kernel/ring.cc

    ra63c24 rb39bc1f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ring.cc,v 1.24 2004-10-15 17:40:30 Singular Exp $ */
     4/* $Id: ring.cc,v 1.25 2004-10-18 18:57:07 levandov Exp $ */
    55
    66/*
     
    35443544  /* creates an opposite algebra of R */
    35453545  /* that is R^opp, where f (*^opp) g = g*f  */
     3546  /* ignores the case of qring -> done in iparith.cc */
    35463547{
    35473548  ring save = currRing; 
    3548   ring    r = rCopy0(src);
     3549  ring    r = rCopy0(src,TRUE); /* TRUE for copy the qideal */
    35493550  // change vars v1..vN -> vN..v1
    35503551  int i;
     
    37993800  r->nc->IsSkewConstant =   src->nc->IsSkewConstant;
    38003801  omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int));
     3802  /* now oppose the qideal for qrings */
     3803//   if (r->qideal != NULL)
     3804//   {
     3805//     idDelete(&(r->qideal));
     3806//     r->qideal = idOppose(src, qideal);
     3807//   }
     3808//   rTest(r);
    38013809  rChangeCurrRing(save);
    38023810  }
     
    38113819  ring Ropp = rOpposite(R);
    38123820  ring Renv = NULL;
    3813   int stat = rSum(R, Ropp, Renv);
     3821  int stat = rSum(R, Ropp, Renv); /* should ignore qideals */
    38143822  if ( stat <=0 )
    38153823    WarnS("Error in rEnvelope at rSum");
     3824  /* now create the qideal for qrings */
     3825//   if (R->qideal != NULL)
     3826//   {
     3827//     ring save = currRing;
     3828//     rChangeCurrRing(Ropp);
     3829//     ideal Q = idCopy(R->qideal);
     3830//     ideal Qop = idOppose(R,Q);
     3831//     rChangeCurrRing(Renv);
     3832//     ideal Qenv = idInit(Q->ncols+Qop->ncols,1);
     3833//     int i;
     3834//     for (i=0; i<= Q->ncols; i++)
     3835//     {
     3836//       Qenv->m[i] = maIMap(R,Q->m[i]);
     3837//     }
     3838//     for (i=0; i<= Qop->ncols; i++)
     3839//     {
     3840//       Qenv->m[Q->ncols+i] = maIMap(Ropp,Qop->m[i]);
     3841//     }
     3842//     /* should we run twostd on the result? */
     3843//     Renv->qideal = Qenv;
     3844//     rChangeCurrRing(save);
     3845//   }
     3846  rTest(Renv);
    38163847  return Renv;
    38173848}
Note: See TracChangeset for help on using the changeset viewer.