Changeset 4b6ab7 in git


Ignore:
Timestamp:
Apr 29, 2005, 6:11:12 PM (18 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
a6fd668c9df17ae48732553d170dcf4294339382
Parents:
6d7113d27870d87916efbd6084abc75fa74e64eb
Message:
*hannes: ringlist for reals


git-svn-id: file:///usr/local/Singular/svn/trunk@7954 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/ipshell.cc

    r6d7113 r4b6ab7  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ipshell.cc,v 1.105 2005-04-29 07:49:55 Singular Exp $ */
     4/* $Id: ipshell.cc,v 1.106 2005-04-29 16:11:12 Singular Exp $ */
    55/*
    66* ABSTRACT:
     
    15361536}
    15371537void rDecomposeC(leftv h,const ring R)
     1538/* field is R or C */
    15381539{
    15391540  lists L=(lists)omAlloc0Bin(slists_bin);
    1540   L->Init(4);
     1541  if (rField_is_long_C(R)) L->Init(3);
     1542  else                     L->Init(2);
    15411543  h->rtyp=LIST_CMD;
    15421544  h->data=(void *)L;
     
    15441546  // 1: list (var)
    15451547  // 2: list (ord)
    1546   // 3: qideal
    15471548  // ----------------------------------------
    15481549  // 0: char/ cf - ring
    15491550  L->m[0].rtyp=INT_CMD;
    1550   L->m[0].data=(void *)R->ch;
     1551  L->m[0].data=(void *)0;
    15511552  // ----------------------------------------
    1552   // 1: list (var)
     1553  // 1:
    15531554  lists LL=(lists)omAlloc0Bin(slists_bin);
    1554   LL->Init(1);
    1555     LL->m[0].rtyp=STRING_CMD;
    1556     LL->m[0].data=(void *)omStrDup(R->parameter[0]);
     1555  LL->Init(2);
     1556    LL->m[0].rtyp=INT_CMD;
     1557    LL->m[0].data=(void *)si_max(R->float_len,SHORT_REAL_LENGTH);
     1558    LL->m[1].rtyp=INT_CMD;
     1559    LL->m[1].data=(void *)si_max(R->float_len2,SHORT_REAL_LENGTH);
    15571560  L->m[1].rtyp=LIST_CMD;
    15581561  L->m[1].data=(void *)LL;
    15591562  // ----------------------------------------
    1560   // 2: list (ord)
    1561   LL=(lists)omAlloc0Bin(slists_bin);
    1562   LL->Init(1);
    1563   lists LLL;
    1564   {
    1565     intvec *iv;
    1566     int j;
    1567     LL->m[0].rtyp=LIST_CMD;
    1568     LLL=(lists)omAlloc0Bin(slists_bin);
    1569     LLL->Init(2);
    1570     LLL->m[0].rtyp=STRING_CMD;
    1571     LLL->m[0].data=(void *)omStrDup("lp");
    1572     {
    1573       iv=new intvec(1);
    1574       for(;j>=0; j--) (*iv)[0]=1;
    1575     }
    1576     LLL->m[1].rtyp=INTVEC_CMD;
    1577     LLL->m[1].data=(void *)iv;
    1578     LL->m[0].data=(void *)LLL;
    1579   }
    1580   L->m[2].rtyp=LIST_CMD;
    1581   L->m[2].data=(void *)LL;
    1582   // ----------------------------------------
    1583   // 3: qideal
    1584   L->m[3].rtyp=IDEAL_CMD;
    1585   {
    1586     ideal I=idInit(1,1);
    1587     L->m[3].data=(void *)I;
    1588     //I->m[0]=pOne();
    1589     //pSetCoeff(I->m[0],R->minpoly);
     1563  // 2: list (par)
     1564  if (rField_is_long_C(R))
     1565  {
     1566    L->m[2].rtyp=STRING_CMD;
     1567    L->m[2].data=(void *)omStrDup(R->parameter[0]);
    15901568  }
    15911569  // ----------------------------------------
     
    16171595  // 0: char/ cf - ring
    16181596  #if 1 /* TODO */
    1619   if (rIsExtension(r))
    1620   {
    1621     if (rField_is_long_C(r))
    1622       rDecomposeC(&(L->m[0]),r);
    1623     else
    1624       rDecomposeCF(&(L->m[0]),r->algring,r);
     1597  if (rField_is_numeric(r))
     1598  {
     1599    rDecomposeC(&(L->m[0]),r);
     1600  }
     1601  else if (rIsExtension(r))
     1602  {
     1603    rDecomposeCF(&(L->m[0]),r->algring,r);
    16251604    if (L->m[0].rtyp==0)
    16261605    {
     
    17131692}
    17141693
     1694void rComposeC(lists L, ring R)
     1695/* field is R or C */
     1696{
     1697  Print("in rComposeC\n");
     1698  // ----------------------------------------
     1699  // 0: char/ cf - ring
     1700  if ((L->m[0].rtyp!=INT_CMD) || (L->m[0].data!=(char *)0))
     1701    Werror("invald coeff. field description, expecting 0");
     1702    return;
     1703  R->ch=-1;
     1704  // ----------------------------------------
     1705  // 1:
     1706  if (L->m[1].rtyp!=LIST_CMD)
     1707    Werror("invald coeff. field description, expecting precision list");
     1708  lists LL=(lists)L->m[1].data;
     1709  int r1=(int)LL->m[0].data;
     1710  int r2=(int)LL->m[1].data;
     1711  if ((r1<=SHORT_REAL_LENGTH)
     1712  && (r2=SHORT_REAL_LENGTH))
     1713  {
     1714    R->float_len=0;
     1715    R->float_len2=0;
     1716  }
     1717  else
     1718  {
     1719    R->float_len=si_min(r1,32767);
     1720    R->float_len2=si_min(r2,32767);
     1721  }
     1722  // ----------------------------------------
     1723  // 2: list (par)
     1724  if (L->nr==2)
     1725  {
     1726    R->P=1;
     1727    if (L->m[2].rtyp!=STRING_CMD)
     1728    {
     1729      Werror("invald coeff. field description, expecting parameter name");
     1730      return;
     1731    }
     1732    R->parameter=(char**)omAlloc0(R->P*sizeof(char_ptr));
     1733    R->parameter[0]=omStrDup((char *)L->m[2].data);
     1734  }
     1735  // ----------------------------------------
     1736}
    17151737ring rCompose(const lists  L)
    17161738{
     
    17351757  else if (L->m[0].Typ()==LIST_CMD)
    17361758  {
    1737     R->algring=rCompose((lists)L->m[0].Data());
    1738     if (R->algring==NULL)
    1739     {
    1740       WerrorS("could not create rational function coefficient field");
    1741       goto rCompose_err;
    1742     }
    1743     if (R->algring->ch>0)
    1744        R->ch= -R->algring->ch;
     1759    lists LL=(lists)L->m[0].Data();
     1760    if (LL->nr<3)
     1761      rComposeC(LL,R); /* R, long_R, long_C */
    17451762    else
    1746        R->ch=1;
    1747     R->P=R->algring->N;
    1748     R->parameter=(char**)omAlloc0(R->P*sizeof(char_ptr));
    1749     int i;
    1750     for(i=R->P-1;i>=0;i--)
    1751       R->parameter[i]=omStrDup(R->algring->names[i]);
    1752     if (R->algring->qideal!=NULL)
    1753     {
    1754       R->minpoly=pGetCoeff(R->algring->qideal->m[0]);
     1763    {
     1764      R->algring=rCompose((lists)L->m[0].Data());
     1765      if (R->algring==NULL)
     1766      {
     1767        WerrorS("could not create rational function coefficient field");
     1768        goto rCompose_err;
     1769      }
     1770      if (R->algring->ch>0)
     1771         R->ch= -R->algring->ch;
     1772      else
     1773         R->ch=1;
     1774      R->P=R->algring->N;
     1775      R->parameter=(char**)omAlloc0(R->P*sizeof(char_ptr));
     1776      int i;
     1777      for(i=R->P-1;i>=0;i--)
     1778        R->parameter[i]=omStrDup(R->algring->names[i]);
     1779      if (R->algring->qideal!=NULL)
     1780      {
     1781        R->minpoly=pGetCoeff(R->algring->qideal->m[0]);
     1782      }
    17551783    }
    17561784  }
Note: See TracChangeset for help on using the changeset viewer.