Changeset aef5db in git


Ignore:
Timestamp:
Jun 29, 2018, 2:13:21 PM (6 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
96cd73ba8e350c13e7964b70073c3fec90b296c4
Parents:
13673122266edb13d76ff215c7d27bf6d7aa7ce3
Message:
add: system("unflatten",<smatrix>,<cols>)
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/extra.cc

    r1367312 raef5db  
    329329      else
    330330        WerrorS("smatrix expected");
     331    }
     332    else
     333  /*==================== unflatten =============================*/
     334    if(strcmp(sys_cmd,"unflatten")==0)
     335    {
     336      const short t1[]={2,SMATRIX_CMD,INT_CMD};
     337      if (iiCheckTypes(h,t1,1))
     338      {
     339        res->data=(char*)sm_UnFlatten((ideal)h->Data(),(int)(long)h->next->Data(),currRing);
     340        res->rtyp=SMATRIX_CMD;
     341        return res->data==NULL;
     342      }
     343      else return TRUE;
    331344    }
    332345    else
  • libpolys/polys/matpol.cc

    r1367312 raef5db  
    18431843  return res;
    18441844}
     1845
     1846ideal sm_UnFlatten(ideal a, int col, const ring R)
     1847{
     1848  if ((IDELEMS(a)!=1)
     1849  ||((a->rank % col)!=0))
     1850  {
     1851    Werror("wrong format: %d x %d for unflatten",(int)a->rank,IDELEMS(a));
     1852    return NULL;
     1853  }
     1854  int row=a->rank/col;
     1855  ideal res=idInit(col,row);
     1856  poly p=a->m[0];
     1857  while(p!=NULL)
     1858  {
     1859    poly h=p_Head(p,R);
     1860    int comp=p_GetComp(h,R);
     1861    int c=(comp-1)/row;
     1862    int r=comp%row; if (r==0) r=row;
     1863    p_SetComp(h,r,R); p_SetmComp(h,R);
     1864    res->m[c]=p_Add_q(res->m[c],h,R);
     1865    pIter(p);
     1866  }
     1867  return res;
     1868}
     1869
    18451870/*2
    18461871*returns the trace of matrix a
  • libpolys/polys/matpol.h

    r1367312 raef5db  
    9999ideal sm_Mult(ideal a, ideal b, const ring R);
    100100ideal sm_Flatten(ideal a, const ring R);
     101ideal sm_UnFlatten(ideal a, int col, const ring R);
    101102poly sm_Trace ( ideal a, const ring R);
    102103int sm_Compare(ideal a, ideal b, const ring R);
Note: See TracChangeset for help on using the changeset viewer.