Skip to content

Wrong kernel dimension nmod_poly_mat_kernel_zls_approx #32

@gilvillard

Description

@gilvillard

In nmod_poly_mat_kernel_zls_approx called by nmod_poly_mat_kernel

nmod_poly_mat_kernel(NN, pivind, shift, A, ORD_WEAK_POPOV, COL_UPPER);

See two examples below. Actually, Example 1 is created recursively from Example 2 by the implementation.

After an initial inspection with Example 1
Its seems that the easy degree-based detection if (shift[i] < order + diff_shift) detects only 4 kernel vectors, then, after the early termination test if (nz >= m - n), which is 7-3 >= 4 the algorithm terminates.

Hint (?): order and diff_shift have to be checked.

Example 1. Dimensions nxm = 3x7, the dimension of the kernel is 5, 4 is returned

prime = 2;
m= 3;
n= 7;
nmod_poly_mat_init(A, m, n , prime);
nmod_poly_set_str(nmod_poly_mat_entry(A,0,0),"1 2  1");
nmod_poly_set_str(nmod_poly_mat_entry(A,1,1),"1 2  1");
slong shift[n];
shift[0]=9;
shift[1]=9;
shift[2]=10;
shift[3]=8;
shift[4]=8;
shift[5]=8;
shift[6]=8;

nmod_poly_mat_kernel(NN, pivind, shift, A, ORD_WEAK_POPOV, COL_UPPER);

Example 2. Dimensions nxm = 12x31, the dimension of the kernel is 22, 20 is returned

prime= 2;
m= 12;
n= 31;
nmod_poly_mat_init(A, m, n , prime);
nmod_poly_set_str(nmod_poly_mat_entry(A,0,0),"5 2  0 1 0 0 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,0,11),"8 2  0 0 0 0 0 0 0 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,3,2),"7 2  0 1 0 0 0 0 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,3,8),"1 2  1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,3,15),"4 2  0 0 0 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,3,17),"8 2  1 0 0 1 0 0 1 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,3,23),"7 2  1 0 1 1 1 1 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,4,7),"2 2  0 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,4,17),"8 2  1 0 0 1 1 1 1 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,5,13),"3 2  0 1 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,5,22),"4 2  1 1 1 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,5,24),"6 2  1 0 1 0 0 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,5,29),"1 2  1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,6,1),"6 2  1 0 0 0 1 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,6,5),"5 2  1 1 1 1 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,6,9),"1 2  1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,6,12),"8 2  0 1 0 1 1 1 0 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,7,12),"6 2  1 1 0 1 1 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,7,21),"7 2  0 0 0 0 0 0 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,8,20),"5 2  1 0 0 0 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,8,24),"4 2  1 1 1 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,8,26),"1 2  1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,9,2),"8 2  0 1 0 1 0 1 1 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,9,13),"7 2  0 0 0 0 0 0 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,9,20),"1 2  1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,9,23),"5 2  1 1 0 1 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,9,25),"9 2  0 0 0 1 1 0 0 0 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,10,3),"3 2  1 0 1 ");
nmod_poly_set_str(nmod_poly_mat_entry(A,10,22),"1 2  1 ");

nmod_poly_mat_kernel(NN, pivind, NULL, A, ORD_WEAK_POPOV, COL_UPPER);

Configuration
Apple M2 macOS Tahoe clang version 17.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions