Changeset 692aed in git


Ignore:
Timestamp:
Sep 14, 2012, 5:23:35 PM (10 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
Children:
49660c91b075bf44c9cee29176507b1e9bc2e496
Parents:
4604b84fc397bca4fcd80a0d3b01bfdb7a7fdb76
git-author:
Martin Lee <martinlee84@web.de>2012-09-14 17:23:35+02:00
git-committer:
Martin Lee <martinlee84@web.de>2012-10-25 15:11:13+02:00
Message:
chg: added conversion of matrices to FLINT matrices
Location:
factory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • factory/FLINTconvert.cc

    r4604b84 r692aed  
    4242#include <flint/nmod_poly.h>
    4343#include <flint/fmpq_poly.h>
     44#include <flint/nmod_mat.h>
     45#include <flint/fmpz_mat.h>
    4446#ifdef __cplusplus
    4547}
     
    299301}
    300302
    301 #endif
    302 
    303 
     303void convertFacCFMatrix2Fmpz_mat_t (fmpz_mat_t M, CFMatrix &m)
     304{
     305  fmpz_mat_init (M, (long) m.rows(), (long) m.columns());
     306
     307  int i,j;
     308  for(i=m.rows();i>0;i--)
     309  {
     310    for(j=m.columns();j>0;j--)
     311    {
     312      convertCF2Fmpz (fmpz_mat_entry (M,i-1,j-1), m(i,j));
     313    }
     314  }
     315}
     316CFMatrix* convertFmpz_mat_t2FacCFMatrix(fmpz_mat_t m)
     317{
     318  CFMatrix *res=new CFMatrix(fmpz_mat_nrows (m),fmpz_mat_ncols (m));
     319  int i,j;
     320  for(i=res->rows();i>0;i--)
     321  {
     322    for(j=res->columns();j>0;j--)
     323    {
     324      (*res)(i,j)=convertFmpz2CF(fmpz_mat_entry (m,i-1,j-1));
     325    }
     326  }
     327  return res;
     328}
     329
     330void convertFacCFMatrix2nmod_mat_t (nmod_mat_t M, CFMatrix &m)
     331{
     332  nmod_mat_init (M, (long) m.rows(), (long) m.columns(), getCharacteristic());
     333
     334  bool save_sym_ff= isOn (SW_SYMMETRIC_FF);
     335  if (save_sym_ff) Off (SW_SYMMETRIC_FF);
     336  int i,j;
     337  for(i=m.rows();i>0;i--)
     338  {
     339    for(j=m.columns();j>0;j--)
     340    {
     341      if(!(m(i,j)).isImm()) printf("convertFacCFMatrix2FLINTmat_zz_p: not imm.\n");
     342      nmod_mat_entry (M,i-1,j-1)= (m(i,j)).intval();
     343    }
     344  }
     345  if (save_sym_ff) On (SW_SYMMETRIC_FF);
     346}
     347
     348CFMatrix* convertNmod_mat_t2FacCFMatrix(nmod_mat_t m)
     349{
     350  CFMatrix *res=new CFMatrix(nmod_mat_nrows (m), nmod_mat_ncols (m));
     351  int i,j;
     352  for(i=res->rows();i>0;i--)
     353  {
     354    for(j=res->columns();j>0;j--)
     355    {
     356      (*res)(i,j)=CanonicalForm((long) nmod_mat_entry (m, i-1, j-1));
     357    }
     358  }
     359  return res;
     360}
     361
     362#endif
     363
     364
  • factory/FLINTconvert.h

    r4604b84 r692aed  
    3333#include <flint/fmpq_poly.h>
    3434#include <flint/nmod_poly.h>
     35#include <flint/nmod_mat.h>
     36#include <flint/fmpz_mat.h>
    3537#ifdef __cplusplus
    3638}
     
    132134                             );
    133135
     136/// conversion of a factory matrix over Z to a fmpz_mat_t
     137void convertFacCFMatrix2Fmpz_mat_t (fmpz_mat_t M, ///<[in,out] fmpz_mat_t
     138                                    CFMatrix &m   ///<[in] matrix over Z
     139                                   );
     140
     141/// conversion of a FLINT matrix over Z to a factory matrix
     142CFMatrix* convertFmpz_mat_t2FacCFMatrix(fmpz_mat_t m ///<[in] fmpz_mat_t
     143                                       );
     144
     145/// conversion of a factory matrix over Z/p to a nmod_mat_t
     146void convertFacCFMatrix2nmod_mat_t (nmod_mat_t M, ///<[in,out] nmod_mat_t
     147                                    CFMatrix &m   ///<[in] matrix over Z/p
     148                                   );
     149
     150/// conversion of a FLINT matrix over Z/p to a factory matrix
     151CFMatrix* convertNmod_mat_t2FacCFMatrix(nmod_mat_t m ///<[in] nmod_mat_t
     152                                       );
     153
    134154#endif
    135155#endif
Note: See TracChangeset for help on using the changeset viewer.