Changeset 273a2f in git
- Timestamp:
- Dec 2, 2021, 3:56:49 PM (2 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 18bb792edcc6d3f65af0111f93ed61118123ffd1
- Parents:
- c31a71c38969321615ad9607978783ca23b0edbb
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2021-12-02 15:56:49+01:00
- git-committer:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2021-12-02 15:59:38+01:00
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/extra.cc
rc31a71 r273a2f 3918 3918 } 3919 3919 else 3920 /* ====== fq_nmod_mat_rref ============================*/ 3921 #ifdef HAVE_FLINT 3922 if(strcmp(sys_cmd,"fq_nmod_mat_rref")==0) 3923 { 3924 const short t1[]={1,MATRIX_CMD}; 3925 if (iiCheckTypes(h,t1,1)) 3926 { 3927 matrix M=(matrix)h->Data(); 3928 fq_nmod_ctx_t ctx; 3929 fmpz_t p; 3930 convSingIFlintI(p,rChar(currRing)); 3931 fq_nmod_ctx_init(ctx,p,1,"t"); 3932 fq_nmod_mat_t FLINTM; 3933 // convert matrix 3934 convSingMFlintFq_nmod_mat(M,FLINTM,ctx,currRing); 3935 // rank 3936 long rk= fq_nmod_mat_rref (FLINTM,ctx); 3937 res->data=(void*)convFlintFq_nmod_matSingM(FLINTM,ctx,currRing); 3938 // clean up 3939 fq_nmod_mat_clear (FLINTM,ctx); 3940 fq_nmod_ctx_clear(ctx); 3941 fmpz_clear(p); 3942 res->rtyp=MATRIX_CMD; 3943 Print("rank:%ld\n",rk); 3944 return FALSE; 3945 } 3946 else 3947 { 3948 WerrorS("expected system(\"fq_nmod_mat_rref\",<matrix>)"); 3949 return TRUE; 3950 } 3951 } 3952 else 3953 #endif 3920 3954 /*==================== Error =================*/ 3921 3955 Werror( "(extended) system(\"%s\",...) %s", sys_cmd, feNotImplemented ); -
libpolys/polys/flintconv.cc
rc31a71 r273a2f 14 14 #ifdef HAVE_FLINT 15 15 #if __FLINT_RELEASE >= 20500 16 16 17 #include "coeffs/coeffs.h" 17 18 #include "coeffs/longrat.h" … … 281 282 } 282 283 284 void convSingPFlintnmod_poly_t(nmod_poly_t result, const poly p, const ring r) 285 { 286 // assume univariate 287 nmod_poly_init2 (result,rChar(r),p_Deg(p,r)); 288 poly h=p; 289 while(h!=NULL) 290 { 291 nmod_poly_set_coeff_ui(result,p_GetExp(h,1,r),n_Int(pGetCoeff(h),r->cf)); 292 pIter(h); 293 } 294 } 295 296 void convSingMFlintFq_nmod_mat(matrix m, fq_nmod_mat_t M, const fq_nmod_ctx_t fq_con, const ring r) 297 { 298 fq_nmod_mat_init (M, (long)MATROWS(m), (long) MATCOLS(m), fq_con); 299 int i,j; 300 for(i=MATROWS(m);i>0;i--) 301 { 302 for(j=MATCOLS(m);j>0;j--) 303 { 304 convSingPFlintnmod_poly_t (M->rows[i-1]+j-1, MATELEM(m,i,j),r); 305 } 306 } 307 } 308 309 poly convFlintFq_nmodSingP(const fq_nmod_t Fp, const fq_nmod_ctx_t ctx, const ring r) 310 { 311 poly p=NULL; 312 poly h; 313 for (int i= 0; i < nmod_poly_length (Fp); i++) 314 { 315 ulong coeff= nmod_poly_get_coeff_ui (Fp, i); 316 if (coeff != 0) 317 h=p_NSet(n_Init(coeff,r->cf),r); 318 p_SetExp(h,1,i,r); 319 p_Setm(h,r); 320 p=p_Add_q(p,h,r); 321 } 322 return p; 323 } 324 325 matrix convFlintFq_nmod_matSingM(fq_nmod_mat_t m, const fq_nmod_ctx_t fq_con, const ring r) 326 { 327 matrix M=mpNew(fq_nmod_mat_nrows (m, fq_con),fq_nmod_mat_ncols (m, fq_con)); 328 int i,j; 329 for(i=MATROWS(M);i>0;i--) 330 { 331 for(j=MATCOLS(M);j>0;j--) 332 { 333 MATELEM(M,i,j)=convFlintFq_nmodSingP(fq_nmod_mat_entry (m, i-1, j-1), 334 fq_con, r); 335 } 336 } 337 return M; 338 } 339 283 340 bigintmat* singflint_LLL(bigintmat* m, bigintmat* T) 284 341 { -
libpolys/polys/flintconv.h
rc31a71 r273a2f 37 37 #if __FLINT_RELEASE >= 20500 38 38 #include <flint/fmpz_lll.h> 39 #include <flint/fq.h> 40 #include <flint/fq_poly.h> 41 #include <flint/fq_nmod.h> 42 #include <flint/fq_nmod_poly.h> 43 #include <flint/fq_nmod_mat.h> 39 44 #endif 40 45 … … 57 62 bigintmat* singflint_LLL(bigintmat* A, bigintmat* T); 58 63 intvec* singflint_LLL(intvec* A, intvec* T); 64 65 #if __FLINT_RELEASE >= 20500 66 void convSingPFlintnmod_poly_t(nmod_poly_t result, const poly p, const ring r); 67 void convSingMFlintFq_nmod_mat(matrix m, fq_nmod_mat_t M, const fq_nmod_ctx_t fq_con, const ring r); 68 poly convFlintFq_nmodSingP(const fq_nmod_t Fp, const fq_nmod_ctx_t ctx, const ring r); 69 matrix convFlintFq_nmod_matSingM(fq_nmod_mat_t m, const fq_nmod_ctx_t fq_con, const ring r); 70 #endif 59 71 #endif 60 72 #endif
Note: See TracChangeset
for help on using the changeset viewer.