Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zabm #90

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Zabm #90

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 56 additions & 0 deletions cypari2/gen.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3213,6 +3213,62 @@ cdef class Gen(Gen_base):
raise ValueError("%s is not a square modulo %s" % (self, n))
return new_gen(s)

def ZabM_ker(self, Gen P, long n):
r"""
Return an integral primitive basis of the kernel of this matrix.

INPUT:

- ``P`` - cyclotomic polynomial

- ``n`` - order of the cyclotomic polynomial

Examples:

>>> from cypari2 import Pari
>>> pari = Pari()

>>> x = pari('x')
>>> M = pari([[2*x + 5, x - 4], [-2*x**2 - 5*x, -x**2 + 4*x]])
>>> M.ZabM_ker(pari.polcyclo(5), 5)
[x; 1]
"""
cdef GEN s
sig_on()
s = ZabM_ker(self.g, P.g, n)
return new_gen(s)

def ZabM_indexrank(self, Gen P, long n):
r"""
Return a vector with two t_VECSMALL components giving the rank profile of this
matrix.

Inefficient (but correct) when the matrix does not have almost full column rank.

INPUT:

- ``P`` - cyclotomic polynomial

- ``n`` - order of the cyclotomic polynomial

Examples:

>>> from cypari2 import Pari
>>> pari = Pari()

>>> x = pari('x')
>>> M = pari([[2*x + 5, x - 4], [-2*x**2 - 5*x, -x**2 + 4*x]])
>>> M.ZabM_indexrank(pari.polcyclo(5), 5)
[Vecsmall([1]), Vecsmall([1])]
>>> M = pari([[2*x + 5, x - 3], [-2*x**2 - 5*x, -x**2 + 4*x]])
>>> M.ZabM_indexrank(pari.polcyclo(5), 5)
[Vecsmall([1, 2]), Vecsmall([1, 2])]
"""
cdef GEN s
sig_on()
s = ZabM_indexrank(self.g, P.g, n)
return new_gen(s)

def ellan(self, long n, python_ints=False):
"""
Return the first `n` Fourier coefficients of the modular
Expand Down
11 changes: 11 additions & 0 deletions cypari2/paridecl.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -771,16 +771,19 @@ cdef extern from *: # PARI headers already included by types.pxd
GEN F2m_F2c_mul(GEN x, GEN y)
GEN F2m_mul(GEN x, GEN y)
GEN F2m_powu(GEN x, ulong n)
GEN Flc_Flv_mul(GEN x, GEN y, ulong p)
GEN Flc_to_mod(GEN z, ulong pp)
GEN Flm_Fl_add(GEN x, ulong y, ulong p)
GEN Flm_Fl_mul(GEN y, ulong x, ulong p)
void Flm_Fl_mul_inplace(GEN y, ulong x, ulong p)
GEN Flm_Flc_mul(GEN x, GEN y, ulong p)
GEN Flm_Flc_mul_pre(GEN x, GEN y, ulong p, ulong pi)
GEN Flm_Flc_mul_pre_Flx(GEN x, GEN y, ulong p, ulong pi, long sv)
GEN Flm_add(GEN x, GEN y, ulong p)
GEN Flm_center(GEN z, ulong p, ulong ps2)
GEN Flm_mul(GEN x, GEN y, ulong p)
GEN Flm_neg(GEN y, ulong p)
GEN Flm_powers(GEN x, ulong n, ulong p)
GEN Flm_powu(GEN x, ulong n, ulong p)
GEN Flm_sub(GEN x, GEN y, ulong p)
GEN Flm_to_mod(GEN z, ulong pp)
Expand Down Expand Up @@ -834,6 +837,11 @@ cdef extern from *: # PARI headers already included by types.pxd
GEN FpV_to_mod(GEN z, GEN p)
GEN FpVV_to_mod(GEN z, GEN p)
GEN FpX_to_mod(GEN z, GEN p)
GEN ZabM_ker(GEN M, GEN P, long n)
GEN ZabM_indexrank(GEN M, GEN P, long n)
GEN ZabM_inv(GEN M, GEN P, long n, GEN *pden)
GEN ZabM_inv_ratlift(GEN M, GEN P, long n, GEN *pden)
GEN ZabM_pseudoinv(GEN M, GEN P, long n, GEN *pv, GEN *den)
GEN ZV_zMs_mul(GEN B, GEN M)
GEN ZpMs_ZpCs_solve(GEN M, GEN B, long nbrow, GEN p, long e)
GEN gen_FpM_Wiedemann(void *E, GEN (*f)(void*, GEN), GEN B, GEN p)
Expand All @@ -843,6 +851,9 @@ cdef extern from *: # PARI headers already included by types.pxd
GEN matid_Flm(long n)
GEN matid_F2xqM(long n, GEN T)
GEN matid_FlxqM(long n, GEN T, ulong p)
GEN random_Flv(long n, ulong p)
GEN random_FpC(long d, GEN p)
GEN random_FpV(long d, GEN p)
GEN scalar_Flm(long s, long n)
GEN zCs_to_ZC(GEN C, long nbrow)
GEN zMs_to_ZM(GEN M, long nbrow)
Expand Down