Changeset f9fde8 in git for libpolys


Ignore:
Timestamp:
Jan 20, 2022, 3:19:54 PM (2 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
908d1f167af74acb9bca8213230d13d6c99501f5
Parents:
7be1d21a7379ce28be9574c8b6e13800001a7653
Message:
fix: system("rref")
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/flintconv.cc

    r7be1d2 rf9fde8  
    353353    {
    354354      poly h=MATELEM(m,i,j);
    355       if (h==NULL)
    356         nmod_mat_entry(M,i-1,j-1)=0;
    357       else
     355      if (h!=NULL)
    358356        nmod_mat_entry(M,i-1,j-1)=(long)pGetCoeff(h);
    359357    }
     
    380378  int c=m->cols();
    381379  int i,j;
    382   matrix M=mpNew(r,c);
     380  matrix M=NULL;
    383381  if (rField_is_Q(R))
    384382  {
    385383    fmpq_mat_t FLINTM;
    386384    fmpq_mat_init(FLINTM,r,c);
    387     number n=n_Init(0,R->cf);
     385    M=mpNew(r,c);
    388386    for(i=r;i>0;i--)
    389387    {
     
    401399      }
    402400    }
    403     n_Delete(&n,R->cf);
    404401    fmpq_mat_rref(FLINTM,FLINTM);
    405402    for(i=r;i>0;i--)
     
    407404      for(j=c;j>0;j--)
    408405      {
    409         n=convFlintNSingN(fmpq_mat_entry(FLINTM,i-1,j-1),R->cf);
     406        number n=convFlintNSingN(fmpq_mat_entry(FLINTM,i-1,j-1),R->cf);
    410407        MATELEM(M,i,j)=p_NSet(n,R);
    411408      }
     
    417414    nmod_mat_t FLINTM;
    418415    // convert matrix
    419     convSingMFlintNmod_mat(M,FLINTM,R);
     416    convSingMFlintNmod_mat(m,FLINTM,R);
    420417    // rank
    421418    long rk= nmod_mat_rref (FLINTM);
     
    456453    fmpq_mat_t FLINTM;
    457454    fmpq_mat_init(FLINTM,r,c);
    458     for(j=c;j>0;j--)
     455    for(j=c-1;j>=0;j--)
    459456    {
    460457      poly h=m->m[j];
     
    463460        i=p_GetComp(h,R);
    464461        if (p_Totaldegree(h,R)==0)
    465           convSingNFlintN(fmpq_mat_entry(FLINTM,i-1,j-1),p_GetCoeff(h,R),R->cf);
     462          convSingNFlintN(fmpq_mat_entry(FLINTM,i-1,j),p_GetCoeff(h,R),R->cf);
    466463        else
    467464        {
     
    475472    for(i=r;i>0;i--)
    476473    {
    477       for(j=c;j>0;j--)
    478       {
    479         number n=convFlintNSingN(fmpq_mat_entry(FLINTM,i-1,j-1),R->cf);
     474      for(j=c-1;j>=0;j--)
     475      {
     476        number n=convFlintNSingN(fmpq_mat_entry(FLINTM,i-1,j),R->cf);
    480477        if(!n_IsZero(n,R->cf))
    481478        {
     
    492489    nmod_mat_t FLINTM;
    493490    nmod_mat_init(FLINTM,r,c,rChar(R));
    494     for(j=c;j>0;j--)
     491    for(j=c-1;j>=0;j--)
    495492    {
    496493      poly h=m->m[j];
     
    499496        i=p_GetComp(h,R);
    500497        if (p_Totaldegree(h,R)==0)
    501           nmod_mat_entry(FLINTM,i-1,j-1)=(long)p_GetCoeff(h,R);
     498          nmod_mat_entry(FLINTM,i-1,j)=(long)p_GetCoeff(h,R);
    502499        else
    503500        {
     
    511508    for(i=r;i>0;i--)
    512509    {
    513       for(j=c;j>0;j--)
    514       {
    515         number n=n_Init(nmod_mat_entry(FLINTM,i-1,j-1),R->cf);
     510      for(j=c-1;j>=0;j--)
     511      {
     512        number n=n_Init(nmod_mat_entry(FLINTM,i-1,j),R->cf);
    516513        if(!n_IsZero(n,R->cf))
    517514        {
Note: See TracChangeset for help on using the changeset viewer.