Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
83bc9fe
finalize the removal of mbasis1
vneiger Jan 3, 2026
8dcc890
kernel: general conventions/definitions
vneiger Jan 3, 2026
82103b6
add kernel via approx, and test
vneiger Jan 3, 2026
29f1ab4
profile updated
vneiger Jan 3, 2026
c3edea3
zls-approx : splitting columns is ok
vneiger Jan 4, 2026
a01c0bd
ZLS works, missing one early exit and some cleaning
vneiger Jan 4, 2026
ae90690
make test more complete
vneiger Jan 4, 2026
0bb1805
make test more complete for ZLS
vneiger Jan 4, 2026
9b023a2
early exit
vneiger Jan 5, 2026
1791de2
general interface
vneiger Jan 5, 2026
9ec7685
add notes about choice of approximation order
vneiger Jan 5, 2026
3422c0e
general interface: support NULL shift and pivind
vneiger Jan 5, 2026
fb45b7a
Cleaning for kernel
gilvillard Apr 8, 2026
30a6c03
cleaning .h
gilvillard Apr 8, 2026
02b1b5f
cleaning
gilvillard Apr 8, 2026
c8117b3
for check ubuntu that fails
gilvillard Apr 8, 2026
4ec7606
new attempt
gilvillard Apr 8, 2026
f1b57aa
Merge pull request #30 from gilvillard/enhance_kernel_basis
gilvillard Apr 8, 2026
c8d3069
fix p-kernel.c after recent changes
vneiger Apr 11, 2026
41d8743
add stype to p-kernel
vneiger Apr 11, 2026
443e201
add unbalanced degrees to profile
vneiger Apr 13, 2026
a4f3c2d
in default kernel shift, use row degrees and column degrees with defa…
vneiger Apr 13, 2026
69e6533
some notes
vneiger Apr 15, 2026
5ac4734
minor change to row degree
vneiger Apr 16, 2026
800409d
remove old versions
vneiger Apr 16, 2026
6cd3377
Merge branch 'main' into enhance_kernel_basis
vneiger Apr 16, 2026
4b86aa8
merge main and adapt code a bit
vneiger Apr 16, 2026
17d57f9
updating testing collection
vneiger Apr 16, 2026
ca44774
updating testing collection
vneiger Apr 16, 2026
8cd64c5
updating testing of mbasis
vneiger Apr 16, 2026
886ac96
updating testing of pmbasis
vneiger Apr 16, 2026
8818235
updating testing
vneiger Apr 16, 2026
8b7eae7
big growth of test kernel
vneiger Apr 16, 2026
fa4f18c
kernel test in progress almost complete
vneiger Apr 16, 2026
1932311
clean kernel code and fix test issue
vneiger Apr 16, 2026
1b1fc96
add testing on whole collection
vneiger Apr 16, 2026
0077c89
fix early exit
vneiger Apr 16, 2026
9219277
minor fixes and add explanations in comments
vneiger Apr 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions flint-extras/src/nmod_mat_poly.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ nmod_mat_poly_set_from_poly_mat(nmod_mat_poly_t matp, const nmod_poly_mat_t pmat
* The functions here compute a `shift`-minimal ordered weak Popov approximant
* basis for `(pmat,orders)` in the case where `orders` is given by a single
* integer `orders = (order,...order)`. They iterate from `1` to `order`,
* computing at each step a basis at order `1` (see @ref mbasis1) and using it
* computing at each step a basis at order `1` and using it
* to update the output `appbas`, the so-called _residual matrix_, and the
* considered shift. At step `d`, we have `appbas*pmat = 0 mod x^{d-1}`, and we
* want to update `appbas` so that this becomes zero modulo `x^d`.
Expand All @@ -614,8 +614,8 @@ nmod_mat_poly_set_from_poly_mat(nmod_mat_poly_t matp, const nmod_poly_mat_t pmat
* \todo integrate
*/
// Complexity: pmat is m x n
// - 'order' calls to mbasis1 with dimension m x n, each one gives a
// constant matrix K which is generically m-n x m (may have more rows in
// - 'order' calls to constant nullspace with dimension m x n, each one gives
// a constant matrix K which is generically m-n x m (may have more rows in
// exceptional cases)
// - order products (X Id + K ) * appbas to update the approximant basis
// - order computations of "coeff k of appbas*pmat" to find residuals
Expand All @@ -639,8 +639,8 @@ nmod_mat_poly_set_from_poly_mat(nmod_mat_poly_t matp, const nmod_poly_mat_t pmat
// Residual (X^-d appbas*pmat mod X^(order-d)) is continuously updated along
// the iterations
// Complexity: pmat is m x n
// - 'order' calls to mbasis1 with dimension m x n, each one gives a
// constant matrix K which is generically m-n x m (may have more rows in
// - 'order' calls to constant nullspace with dimension m x n, each one gives
// a constant matrix K which is generically m-n x m (may have more rows in
// exceptional cases)
// - order products (X Id + K ) * appbas to update the approximant basis
// - order-1 products (X Id + K ) * (matrix of degree order-ord) to update
Expand Down Expand Up @@ -675,7 +675,6 @@ nmod_mat_poly_set_from_poly_mat(nmod_mat_poly_t matp, const nmod_poly_mat_t pmat
// // To understand the threshold (cdim > rdim/2 + 1), see the complexities
// // mentioned above for these two variants of mbasis
//}
// TODO DOC (see @ref mbasis1)
// TODO resupdate version
// TODO general version with choice
void nmod_mat_poly_mbasis(nmod_mat_poly_t appbas,
Expand Down
3 changes: 0 additions & 3 deletions flint-extras/src/nmod_mat_poly_extra/nmod_mat_poly_mbasis.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,3 @@ _PROFILER_REGION_STOP(t_others)
_MBASIS_PROFILER_OUTPUT
return;
}

/* -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// vim:sts=4:sw=4:ts=4:et:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
81 changes: 3 additions & 78 deletions flint-extras/src/nmod_poly_mat_approximant.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,13 @@
* \param[in] order order
* \param[in] shift shift
* \param[in] form required form for `appbas` (see #poly_mat_form_t)
* \param[in] row_wise indicates whether to compute left approximants (working row-wise) or right approximants (working column-wise)
* \param[in] orient indicates the orientation (left/right approximants) and the definition of pivots
* \param[in] randomized if `true`, the algorithm may use a Monte Carlo or Las Vegas verification algorithm
*
* \return boolean, result of the verification
*
* \todo add parameter row_wise
* \todo update documentation
* \todo support all options, make doc more clear concerning Las Vegas / Monte Carlo
* \todo WARNING! for the moment, does not really check generation!
* \todo WARNING! for the moment, hardcoded to check for ordered weak Popov
*/
int nmod_poly_mat_is_approximant_basis(const nmod_poly_mat_t appbas,
Expand Down Expand Up @@ -243,82 +242,16 @@ int nmod_poly_mat_is_approximant_basis(const nmod_poly_mat_t appbas,


/** @name Approximant basis via linear algebra
* \anchor mbasis1
* \anchor approx_linalg
*
* These functions compute a shifted minimal or shifted Popov approximant
* basis using fast linear algebra on constant matrices.
*
* Currently, this is only implemented for the uniform order `(1,...,1)`, following
* the algorithm _mbasis_ described in
* - P. Giorgi, C.-P. Jeannerod, G. Villard. Proceeding ISSAC 2003,
* - P. Giorgi, R. Lebreton. Proceedings ISSAC 2014,
* - C.-P. Jeannerod, V. Neiger, G. Villard. Preprint 2018.
*
* The latter reference explicitly shows how to ensure that we obtain the
* canonical s-Popov approximant basis.
*
* \todo implement the general Krylov-based approach from JNSV17, which
* efficiently solves the problem when the sum of the orders is small
*/
//@{

/** Computes a shifted Popov approximant basis at order `(1,...,1)` using fast
* linear algebra on constant matrices. Thus, in this context, the input matrix
* `pmat` is a constant matrix. This approximant basis consists of two sets of
* rows:
* - rows forming a left kernel basis in reduced row echelon form of some
* row-permutation of `pmat` (the permutation depends on the shift)
* - the other rows are coordinate vectors multiplied by the variable `x`;
* there is one such row at each index `i` which is not among the pivot
* indices of the left kernel basis above.
*
* Here the whole approximant basis is stored in the OUT parameter `appbas`.
*
* \param[out] appbas polynomial matrix
* \param[in] pmat constant matrix
* \param[in] shift shift (vector of integers)
*
* \todo modify shift in place
* \todo does it return Popov? if yes name it popov_mbasis1 and write mbasis1
* if that makes sense; otherwise write other version popov_mbasis1
* \todo safety correctness checks
* \todo is output Popov by this method? check
* \todo seems that it does not return owP ? (see test_mbasis1.c)
*/
void mbasis1(nmod_poly_mat_t appbas,
slong * res_shift,
const nmod_mat_t mat,
const slong * shift);

/** Computes a shifted Popov approximant basis at order `(1,...,1)` using fast
* linear algebra on constant matrices. Thus, in this context, the input matrix
* `pmat` is a constant matrix. This approximant basis consists of two sets of
* rows:
* - rows forming a left kernel basis in reduced row echelon form of some
* row-permutation of `pmat` (the permutation depends on the shift)
* - the other rows are coordinate vectors multiplied by the variable `x`;
* there is one such row at each index `i` which is not among the pivot
* indices of the left kernel basis above.
*
* Here only the first set of rows is stored in the OUT parameter `kerbas`,
* along with permutation...
* \todo improve doc, to say exactly what this computes (and what is the return
* value?)
*
* \param[out] kerbas constant matrix
* \param[in] pmat constant matrix
* \param[in] shift shift (vector of integers)
*
* \todo modify shift in place
* \todo safety correctness checks
* \todo is output Popov by this method? check
*/
slong mbasis1_for_mbasis(nmod_mat_t kerbas,
slong * res_shift,
slong * res_perm,
const nmod_mat_t mat,
const slong * shift);

//@} // doxygen group: Approximant basis via linear algebra

/** @name M-Basis algorithm (uniform approximant order)
Expand Down Expand Up @@ -378,14 +311,6 @@ void nmod_poly_mat_mbasis(nmod_poly_mat_t appbas,
*/
//@{

/**
* TODO old doc, to be cleaned (new doc below, maybe not complete enough)
* F \in K[x]^{nxm} <-> F_prime K^{mxn}[x] FIX and
* Compute P_{k-1} \in K[x]^{mxm} with the list structured_multiplication_blocks
* Compute x^{-k} P_{k-1} F mod x iteratively with a naive polynomial multiplication
*
* Use naive polynomial multiplication and list_structured_multiplication_blocks
*/
/** Computes a `shift`-ordered weak Popov approximant basis for `(pmat,order)`
* using the algorithm PM-Basis (see @ref pmbasis) */

Expand Down
2 changes: 1 addition & 1 deletion flint-extras/src/nmod_poly_mat_dixon.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef NMOD_POLY_MAT_DIXON_H
#define NMOD_POLY_MAT_DIXON_H

#include <nmod_poly_mat_approximant.h>
#include "nmod_poly_mat_approximant.h"

#ifdef __cplusplus
extern "C" {
Expand Down
30 changes: 0 additions & 30 deletions flint-extras/src/nmod_poly_mat_extra.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@
#include "nmod_poly_mat_kernel.h"



// TODO remove once using flint's comp instead
NMOD_POLY_MAT_INLINE void
apply_perm_to_vector(slong *res, const slong *initial_vect,
const slong *perm, slong length)
{
for (slong i = 0; i < length; i++)
res[perm[i]] = initial_vect[i];
}

/* TODO move in suitable header */
void nmod_poly_mat_det_iter(nmod_poly_t det, nmod_poly_mat_t mat);

Expand All @@ -86,24 +76,4 @@ void nmod_poly_mat_det_iter(nmod_poly_t det, nmod_poly_mat_t mat);
*/


/*****************************
* Verification algorithms *
*****************************/

int nmod_poly_mat_is_approximant_basis(const nmod_poly_mat_t appbas,
const nmod_poly_mat_t pmat,
slong order,
const slong * shift,
orientation_t orient);

int nmod_poly_mat_is_kernel(const nmod_poly_mat_t ker,
const nmod_poly_mat_t pmat,
const slong * shift,
orientation_t orient);



#endif // NMOD_POLY_MAT_EXTRA_H

/* -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// vim:sts=4:sw=4:ts=4:et:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
Loading