Changeset 70be3a in git for Singular


Ignore:
Timestamp:
May 19, 2015, 12:42:20 PM (9 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
9492956fc07a12208a84a518c1334fd7c747e283
Parents:
530df5694d913482bbc03f7ebe601e4ee58dfc0a
Message:
Singular_4_1: assign int/number -> cnumber
Location:
Singular
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Singular/ipassign.cc

    r530df5 r70be3a  
    458458  }
    459459  jiAssignAttr(res,a);
     460  return FALSE;
     461}
     462static BOOLEAN jiA_NUMBER2_I(leftv res, leftv a, Subexpr e)
     463{
     464  if (e==NULL)
     465  {
     466    if (res->data!=NULL)
     467    {
     468      number2 nn=(number2)res->data;
     469      number2 n=n2Init((long)a->Data(),nn->cf);
     470      n2Delete(nn);
     471      res->data=(void *)n;
     472    }
     473    else
     474    {
     475      WerrorS("no (c)ring avialable for conversion from int");
     476      return TRUE;
     477    }
     478  }
     479  else
     480  {
     481    int i=e->start-1;
     482    if (i<0)
     483    {
     484      Werror("index[%d] must be positive",i+1);
     485      return TRUE;
     486    }
     487    bigintmat *iv=(bigintmat *)res->data;
     488    if (e->next==NULL)
     489    {
     490      WerrorS("only one index given");
     491      return TRUE;
     492    }
     493    else
     494    {
     495      int c=e->next->start;
     496      if ((i>=iv->rows())||(c<1)||(c>iv->cols()))
     497      {
     498        Werror("wrong range [%d,%d] in cmatrix %s(%d,%d)",i+1,c,res->Name(),iv->rows(),iv->cols());
     499        return TRUE;
     500      }
     501      else
     502      {
     503        n_Delete((number *)&BIMATELEM(*iv,i+1,c),iv->basecoeffs());
     504        BIMATELEM(*iv,i+1,c) = n_Init((long)a->Data(),iv->basecoeffs());
     505      }
     506    }
     507  }
     508  return FALSE;
     509}
     510static BOOLEAN jiA_NUMBER2_N(leftv res, leftv a, Subexpr e)
     511{
     512  if (e==NULL)
     513  {
     514    if (res->data!=NULL)
     515    {
     516      number2 nn=(number2)res->data;
     517      if (currRing->cf==nn->cf)
     518      {
     519        number2 n=(number2)omAlloc(sizeof(*n));
     520        n->cf=currRing->cf; n->cf++;
     521        n->n=(number)a->CopyD(NUMBER_CMD);
     522        n2Delete(nn);
     523        res->data=(void *)n;
     524      }
     525      else
     526      {
     527        WerrorS("different base");
     528        return TRUE;
     529      }
     530    }
     531    else
     532    {
     533      WerrorS("no (c)ring avialable for conversion from number");
     534      return TRUE;
     535    }
     536  }
     537  else
     538  {
     539    int i=e->start-1;
     540    if (i<0)
     541    {
     542      Werror("index[%d] must be positive",i+1);
     543      return TRUE;
     544    }
     545    bigintmat *iv=(bigintmat *)res->data;
     546    if (e->next==NULL)
     547    {
     548      WerrorS("only one index given");
     549      return TRUE;
     550    }
     551    else
     552    {
     553      int c=e->next->start;
     554      if ((i>=iv->rows())||(c<1)||(c>iv->cols()))
     555      {
     556        Werror("wrong range [%d,%d] in cmatrix %s(%d,%d)",i+1,c,res->Name(),iv->rows(),iv->cols());
     557        return TRUE;
     558      }
     559      else if (iv->basecoeffs()==currRing->cf)
     560      {
     561        n_Delete((number *)&BIMATELEM(*iv,i+1,c),iv->basecoeffs());
     562        BIMATELEM(*iv,i+1,c) = (number)(a->CopyD(NUMBER_CMD));
     563      }
     564      else
     565      {
     566        WerrorS("different base");
     567        return TRUE;
     568      }
     569    }
     570  }
    460571  return FALSE;
    461572}
     
    19082019        if (module_assign)
    19092020        {
    1910           rk=0;
     2021          rk=0;
    19112022          mtyp=MODUL_CMD;
    19122023          etyp=VECTOR_CMD;
    19132024        }
    1914         else
    1915           rk=1;
     2025        else
     2026          rk=1;
    19162027      }
    19172028
  • Singular/table.h

    r530df5 r70be3a  
    12211221,{D(jiA_BIGINTMAT),CMATRIX_CMD,    CMATRIX_CMD}
    12221222,{D(jiA_NUMBER2),  CNUMBER_CMD,    CNUMBER_CMD }
     1223,{D(jiA_NUMBER2_I),CNUMBER_CMD,    INT_CMD }
     1224,{D(jiA_NUMBER2_N),CNUMBER_CMD,    NUMBER_CMD }
    12231225,{D(jiA_CRING),    CRING_CMD,      CRING_CMD }
    12241226#endif
Note: See TracChangeset for help on using the changeset viewer.