MCPcopy Create free account
hub / github.com/Singular/Singular / solveSystemFq

Function solveSystemFq

factory/cfModGcd.cc:1895–1961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1893}
1894
1895CFArray
1896solveSystemFq (const CFMatrix& M, const CFArray& L, const Variable& alpha)
1897{
1898 ASSERT (L.size() <= M.rows(), "dimension exceeded");
1899 CFMatrix *N;
1900 N= new CFMatrix (M.rows(), M.columns() + 1);
1901
1902 for (int i= 1; i <= M.rows(); i++)
1903 for (int j= 1; j <= M.columns(); j++)
1904 (*N) (i, j)= M (i, j);
1905 int j= 1;
1906 for (int i= 0; i < L.size(); i++, j++)
1907 (*N) (j, M.columns() + 1)= L[i];
1908 #ifdef HAVE_FLINT
1909 // convert mipo
1910 nmod_poly_t mipo1;
1911 convertFacCF2nmod_poly_t(mipo1,getMipo(alpha));
1912 fq_nmod_ctx_t ctx;
1913 fq_nmod_ctx_init_modulus(ctx,mipo1,"t");
1914 nmod_poly_clear(mipo1);
1915 // convert matrix
1916 fq_nmod_mat_t FLINTN;
1917 convertFacCFMatrix2Fq_nmod_mat_t (FLINTN, ctx, *N);
1918 // rank
1919 #if __FLINT_RELEASE >= 30100
1920 long rk= fq_nmod_mat_rref (FLINTN,FLINTN,ctx);
1921 #else
1922 long rk= fq_nmod_mat_rref (FLINTN,ctx);
1923 #endif
1924 #elif defined(HAVE_NTL)
1925 int p= getCharacteristic ();
1926 if (fac_NTL_char != p)
1927 {
1928 fac_NTL_char= p;
1929 zz_p::init (p);
1930 }
1931 zz_pX NTLMipo= convertFacCF2NTLzzpX (getMipo (alpha));
1932 zz_pE::init (NTLMipo);
1933 mat_zz_pE *NTLN= convertFacCFMatrix2NTLmat_zz_pE(*N);
1934 long rk= gauss (*NTLN);
1935 #else
1936 factoryError("NTL/FLINT missing: solveSystemFq");
1937 #endif
1938
1939 delete N;
1940 if (rk != M.columns())
1941 {
1942 #if defined(HAVE_NTL) && !defined(HAVE_FLINT)
1943 delete NTLN;
1944 #endif
1945 return CFArray();
1946 }
1947 #ifdef HAVE_FLINT
1948 // convert and clean up
1949 N=convertFq_nmod_mat_t2FacCFMatrix(FLINTN,ctx,alpha);
1950 fq_nmod_mat_clear (FLINTN,ctx);
1951 fq_nmod_ctx_clear(ctx);
1952 #elif defined(HAVE_NTL)

Callers 1

nonMonicSparseInterpolFunction · 0.85

Calls 13

MFunction · 0.85
convertFacCF2nmod_poly_tFunction · 0.85
getMipoFunction · 0.85
getCharacteristicFunction · 0.85
initFunction · 0.85
convertFacCF2NTLzzpXFunction · 0.85
readOffSolutionFunction · 0.85
rowsMethod · 0.80

Tested by

no test coverage detected