passagemath-pari 10.6.32__cp314-cp314-musllinux_1_2_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of passagemath-pari might be problematic. Click here for more details.
- PARIKernel/__init__.py +2 -0
- PARIKernel/__main__.py +5 -0
- PARIKernel/io.cpython-314-x86_64-linux-musl.so +0 -0
- PARIKernel/io.pxd +7 -0
- PARIKernel/io.pyx +84 -0
- PARIKernel/kernel.cpython-314-x86_64-linux-musl.so +0 -0
- PARIKernel/kernel.pyx +260 -0
- PARIKernel/paridecl.pxd +95 -0
- PARIKernel/svg.cpython-314-x86_64-linux-musl.so +0 -0
- PARIKernel/svg.pyx +52 -0
- cypari2/__init__.py +8 -0
- cypari2/auto_paridecl.pxd +1070 -0
- cypari2/closure.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/closure.pxd +5 -0
- cypari2/closure.pyx +246 -0
- cypari2/convert.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/convert.pxd +80 -0
- cypari2/convert.pyx +613 -0
- cypari2/custom_block.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/custom_block.pyx +30 -0
- cypari2/cypari.h +13 -0
- cypari2/gen.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/gen.pxd +69 -0
- cypari2/gen.pyx +4819 -0
- cypari2/handle_error.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/handle_error.pxd +7 -0
- cypari2/handle_error.pyx +232 -0
- cypari2/pari_instance.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/pari_instance.pxd +27 -0
- cypari2/pari_instance.pyx +1438 -0
- cypari2/paridecl.pxd +5353 -0
- cypari2/paripriv.pxd +34 -0
- cypari2/pycore_long.h +98 -0
- cypari2/pycore_long.pxd +9 -0
- cypari2/stack.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/stack.pxd +27 -0
- cypari2/stack.pyx +278 -0
- cypari2/string_utils.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/string_utils.pxd +29 -0
- cypari2/string_utils.pyx +65 -0
- cypari2/types.pxd +147 -0
- passagemath_pari-10.6.32.data/data/etc/jupyter/nbconfig/notebook.d/gp-mode.json +5 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/kernel.js +28 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/kernel.json +6 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/logo-64x64.png +0 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/kernel.json +13 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-32x32.png +0 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-64x64.png +0 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-svg.svg +75 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/nbextensions/gp-mode/gp.js +284 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/nbextensions/gp-mode/main.js +15 -0
- passagemath_pari-10.6.32.dist-info/METADATA +209 -0
- passagemath_pari-10.6.32.dist-info/RECORD +331 -0
- passagemath_pari-10.6.32.dist-info/WHEEL +5 -0
- passagemath_pari-10.6.32.dist-info/top_level.txt +4 -0
- passagemath_pari.libs/libcrypto-f04afe95.so.3 +0 -0
- passagemath_pari.libs/libflint-fd6f12fc.so.21.0.0 +0 -0
- passagemath_pari.libs/libgcc_s-0cd532bd.so.1 +0 -0
- passagemath_pari.libs/libgf2x-9e30c3e3.so.3.0.0 +0 -0
- passagemath_pari.libs/libgfortran-2c33b284.so.5.0.0 +0 -0
- passagemath_pari.libs/libgivaro-9a94c711.so.9.2.1 +0 -0
- passagemath_pari.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
- passagemath_pari.libs/libgmpxx-9e08595c.so.4.7.0 +0 -0
- passagemath_pari.libs/libgsl-42cda06f.so.28.0.0 +0 -0
- passagemath_pari.libs/libmpfr-aaecbfc0.so.6.2.1 +0 -0
- passagemath_pari.libs/libncursesw-9c9e32c3.so.6.5 +0 -0
- passagemath_pari.libs/libntl-26885ca2.so.44.0.1 +0 -0
- passagemath_pari.libs/libopenblasp-r0-905cb27d.3.29.so +0 -0
- passagemath_pari.libs/libpari-gmp-tls-f31f908f.so.2.17.2 +0 -0
- passagemath_pari.libs/libquadmath-bb76a5fc.so.0.0.0 +0 -0
- passagemath_pari.libs/libreadline-06542304.so.8.2 +0 -0
- passagemath_pari.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
- passagemath_pari.libs/libuuid-f3770415.so.1.3.0 +0 -0
- passagemath_pari.libs/libxeus-735780ff.so.13.1.0 +0 -0
- passagemath_pari.libs/libxeus-zmq-c68577b4.so.6.0.1 +0 -0
- passagemath_pari.libs/libzmq-1ba9a3da.so.5.2.5 +0 -0
- sage/all__sagemath_pari.py +26 -0
- sage/databases/all__sagemath_pari.py +7 -0
- sage/databases/conway.py +274 -0
- sage/ext/all__sagemath_pari.py +1 -0
- sage/ext/memory.cpython-314-x86_64-linux-musl.so +0 -0
- sage/ext/memory.pyx +98 -0
- sage/ext_data/pari/buzzard/DimensionSk.g +286 -0
- sage/ext_data/pari/buzzard/Tpprog.g +179 -0
- sage/ext_data/pari/buzzard/genusn.g +129 -0
- sage/ext_data/pari/dokchitser/computel.gp +740 -0
- sage/ext_data/pari/dokchitser/computel.gp.template +740 -0
- sage/ext_data/pari/dokchitser/ex-bsw +43 -0
- sage/ext_data/pari/dokchitser/ex-chgen +48 -0
- sage/ext_data/pari/dokchitser/ex-chqua +37 -0
- sage/ext_data/pari/dokchitser/ex-delta +35 -0
- sage/ext_data/pari/dokchitser/ex-eisen +30 -0
- sage/ext_data/pari/dokchitser/ex-gen2 +38 -0
- sage/ext_data/pari/dokchitser/ex-gen3 +49 -0
- sage/ext_data/pari/dokchitser/ex-gen4 +54 -0
- sage/ext_data/pari/dokchitser/ex-nf +48 -0
- sage/ext_data/pari/dokchitser/ex-shin +50 -0
- sage/ext_data/pari/dokchitser/ex-tau2 +30 -0
- sage/ext_data/pari/dokchitser/ex-zeta +27 -0
- sage/ext_data/pari/dokchitser/ex-zeta2 +47 -0
- sage/ext_data/pari/dokchitser/testall +13 -0
- sage/ext_data/pari/simon/ell.gp +2129 -0
- sage/ext_data/pari/simon/ellQ.gp +2151 -0
- sage/ext_data/pari/simon/ellcommon.gp +126 -0
- sage/ext_data/pari/simon/qfsolve.gp +722 -0
- sage/ext_data/pari/simon/resultant3.gp +306 -0
- sage/groups/all__sagemath_pari.py +3 -0
- sage/groups/pari_group.py +175 -0
- sage/interfaces/all__sagemath_pari.py +1 -0
- sage/interfaces/genus2reduction.py +464 -0
- sage/interfaces/gp.py +1114 -0
- sage/libs/all__sagemath_pari.py +2 -0
- sage/libs/linkages/__init__.py +1 -0
- sage/libs/linkages/padics/API.pxi +617 -0
- sage/libs/linkages/padics/Polynomial_ram.pxi +388 -0
- sage/libs/linkages/padics/Polynomial_shared.pxi +554 -0
- sage/libs/linkages/padics/__init__.py +1 -0
- sage/libs/linkages/padics/fmpz_poly_unram.pxi +869 -0
- sage/libs/linkages/padics/mpz.pxi +691 -0
- sage/libs/linkages/padics/relaxed/API.pxi +518 -0
- sage/libs/linkages/padics/relaxed/__init__.py +1 -0
- sage/libs/linkages/padics/relaxed/flint.pxi +543 -0
- sage/libs/linkages/padics/unram_shared.pxi +247 -0
- sage/libs/pari/__init__.py +210 -0
- sage/libs/pari/all.py +5 -0
- sage/libs/pari/convert_flint.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_flint.pxd +14 -0
- sage/libs/pari/convert_flint.pyx +159 -0
- sage/libs/pari/convert_gmp.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_gmp.pxd +14 -0
- sage/libs/pari/convert_gmp.pyx +210 -0
- sage/libs/pari/convert_sage.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage.pxd +16 -0
- sage/libs/pari/convert_sage.pyx +588 -0
- sage/libs/pari/convert_sage_complex_double.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage_complex_double.pxd +14 -0
- sage/libs/pari/convert_sage_complex_double.pyx +132 -0
- sage/libs/pari/convert_sage_matrix.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage_matrix.pyx +106 -0
- sage/libs/pari/convert_sage_real_double.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage_real_double.pxd +5 -0
- sage/libs/pari/convert_sage_real_double.pyx +14 -0
- sage/libs/pari/convert_sage_real_mpfr.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage_real_mpfr.pxd +7 -0
- sage/libs/pari/convert_sage_real_mpfr.pyx +108 -0
- sage/libs/pari/misc.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/misc.pxd +4 -0
- sage/libs/pari/misc.pyx +26 -0
- sage/libs/pari/tests.py +1848 -0
- sage/matrix/all__sagemath_pari.py +1 -0
- sage/matrix/matrix_integer_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/matrix/matrix_integer_pari.pyx +187 -0
- sage/matrix/matrix_rational_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/matrix/matrix_rational_pari.pyx +160 -0
- sage/quadratic_forms/all__sagemath_pari.py +10 -0
- sage/quadratic_forms/genera/all.py +9 -0
- sage/quadratic_forms/genera/genus.py +3506 -0
- sage/quadratic_forms/genera/normal_form.py +1519 -0
- sage/quadratic_forms/genera/spinor_genus.py +243 -0
- sage/quadratic_forms/qfsolve.py +255 -0
- sage/quadratic_forms/quadratic_form__automorphisms.py +427 -0
- sage/quadratic_forms/quadratic_form__genus.py +141 -0
- sage/quadratic_forms/quadratic_form__local_density_interfaces.py +140 -0
- sage/quadratic_forms/quadratic_form__local_normal_form.py +421 -0
- sage/quadratic_forms/quadratic_form__local_representation_conditions.py +889 -0
- sage/quadratic_forms/quadratic_form__mass.py +69 -0
- sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py +663 -0
- sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py +373 -0
- sage/quadratic_forms/quadratic_form__siegel_product.py +198 -0
- sage/quadratic_forms/special_values.py +323 -0
- sage/rings/all__sagemath_pari.py +15 -0
- sage/rings/factorint_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/factorint_pari.pyx +80 -0
- sage/rings/finite_rings/all__sagemath_pari.py +1 -0
- sage/rings/finite_rings/element_givaro.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/element_givaro.pxd +91 -0
- sage/rings/finite_rings/element_givaro.pyx +1769 -0
- sage/rings/finite_rings/element_ntl_gf2e.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/element_ntl_gf2e.pxd +22 -0
- sage/rings/finite_rings/element_ntl_gf2e.pyx +1333 -0
- sage/rings/finite_rings/element_pari_ffelt.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/element_pari_ffelt.pxd +13 -0
- sage/rings/finite_rings/element_pari_ffelt.pyx +1441 -0
- sage/rings/finite_rings/finite_field_givaro.py +612 -0
- sage/rings/finite_rings/finite_field_pari_ffelt.py +238 -0
- sage/rings/finite_rings/hom_finite_field_givaro.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/hom_finite_field_givaro.pxd +28 -0
- sage/rings/finite_rings/hom_finite_field_givaro.pyx +280 -0
- sage/rings/finite_rings/residue_field_givaro.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/residue_field_givaro.pyx +133 -0
- sage/rings/finite_rings/residue_field_pari_ffelt.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/residue_field_pari_ffelt.pyx +128 -0
- sage/rings/function_field/all__sagemath_pari.py +1 -0
- sage/rings/function_field/valuation.py +1450 -0
- sage/rings/function_field/valuation_ring.py +212 -0
- sage/rings/number_field/all__sagemath_pari.py +14 -0
- sage/rings/number_field/totallyreal.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/number_field/totallyreal.pyx +509 -0
- sage/rings/number_field/totallyreal_data.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/number_field/totallyreal_data.pxd +26 -0
- sage/rings/number_field/totallyreal_data.pyx +928 -0
- sage/rings/number_field/totallyreal_phc.py +144 -0
- sage/rings/number_field/totallyreal_rel.py +1018 -0
- sage/rings/padics/CA_template.pxi +1847 -0
- sage/rings/padics/CA_template_header.pxi +50 -0
- sage/rings/padics/CR_template.pxi +2563 -0
- sage/rings/padics/CR_template_header.pxi +57 -0
- sage/rings/padics/FM_template.pxi +1575 -0
- sage/rings/padics/FM_template_header.pxi +50 -0
- sage/rings/padics/FP_template.pxi +2176 -0
- sage/rings/padics/FP_template_header.pxi +57 -0
- sage/rings/padics/all.py +3 -0
- sage/rings/padics/all__sagemath_pari.py +11 -0
- sage/rings/padics/common_conversion.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/common_conversion.pxd +15 -0
- sage/rings/padics/common_conversion.pyx +508 -0
- sage/rings/padics/eisenstein_extension_generic.py +232 -0
- sage/rings/padics/factory.py +3623 -0
- sage/rings/padics/generic_nodes.py +1615 -0
- sage/rings/padics/lattice_precision.py +2889 -0
- sage/rings/padics/morphism.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/morphism.pxd +11 -0
- sage/rings/padics/morphism.pyx +366 -0
- sage/rings/padics/padic_base_generic.py +467 -0
- sage/rings/padics/padic_base_leaves.py +1235 -0
- sage/rings/padics/padic_capped_absolute_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_capped_absolute_element.pxd +15 -0
- sage/rings/padics/padic_capped_absolute_element.pyx +520 -0
- sage/rings/padics/padic_capped_relative_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_capped_relative_element.pxd +14 -0
- sage/rings/padics/padic_capped_relative_element.pyx +614 -0
- sage/rings/padics/padic_extension_generic.py +990 -0
- sage/rings/padics/padic_extension_leaves.py +738 -0
- sage/rings/padics/padic_fixed_mod_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_fixed_mod_element.pxd +15 -0
- sage/rings/padics/padic_fixed_mod_element.pyx +584 -0
- sage/rings/padics/padic_floating_point_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_floating_point_element.pxd +14 -0
- sage/rings/padics/padic_floating_point_element.pyx +447 -0
- sage/rings/padics/padic_generic_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_generic_element.pxd +48 -0
- sage/rings/padics/padic_generic_element.pyx +4642 -0
- sage/rings/padics/padic_lattice_element.py +1342 -0
- sage/rings/padics/padic_printing.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_printing.pxd +38 -0
- sage/rings/padics/padic_printing.pyx +1505 -0
- sage/rings/padics/padic_relaxed_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_relaxed_element.pxd +56 -0
- sage/rings/padics/padic_relaxed_element.pyx +18 -0
- sage/rings/padics/padic_relaxed_errors.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_relaxed_errors.pxd +11 -0
- sage/rings/padics/padic_relaxed_errors.pyx +71 -0
- sage/rings/padics/padic_template_element.pxi +1212 -0
- sage/rings/padics/padic_template_element_header.pxi +50 -0
- sage/rings/padics/padic_valuation.py +1423 -0
- sage/rings/padics/pow_computer_flint.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/pow_computer_flint.pxd +38 -0
- sage/rings/padics/pow_computer_flint.pyx +641 -0
- sage/rings/padics/pow_computer_relative.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/pow_computer_relative.pxd +29 -0
- sage/rings/padics/pow_computer_relative.pyx +415 -0
- sage/rings/padics/qadic_flint_CA.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/qadic_flint_CA.pxd +21 -0
- sage/rings/padics/qadic_flint_CA.pyx +130 -0
- sage/rings/padics/qadic_flint_CR.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/qadic_flint_CR.pxd +13 -0
- sage/rings/padics/qadic_flint_CR.pyx +172 -0
- sage/rings/padics/qadic_flint_FM.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/qadic_flint_FM.pxd +14 -0
- sage/rings/padics/qadic_flint_FM.pyx +111 -0
- sage/rings/padics/qadic_flint_FP.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/qadic_flint_FP.pxd +12 -0
- sage/rings/padics/qadic_flint_FP.pyx +165 -0
- sage/rings/padics/relative_extension_leaves.py +429 -0
- sage/rings/padics/relative_ramified_CA.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/relative_ramified_CA.pxd +9 -0
- sage/rings/padics/relative_ramified_CA.pyx +33 -0
- sage/rings/padics/relative_ramified_CR.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/relative_ramified_CR.pxd +8 -0
- sage/rings/padics/relative_ramified_CR.pyx +33 -0
- sage/rings/padics/relative_ramified_FM.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/relative_ramified_FM.pxd +9 -0
- sage/rings/padics/relative_ramified_FM.pyx +33 -0
- sage/rings/padics/relative_ramified_FP.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/relative_ramified_FP.pxd +8 -0
- sage/rings/padics/relative_ramified_FP.pyx +33 -0
- sage/rings/padics/relaxed_template.pxi +4229 -0
- sage/rings/padics/relaxed_template_header.pxi +160 -0
- sage/rings/padics/tests.py +35 -0
- sage/rings/padics/tutorial.py +341 -0
- sage/rings/padics/unramified_extension_generic.py +335 -0
- sage/rings/padics/witt_vector.py +917 -0
- sage/rings/padics/witt_vector_ring.py +934 -0
- sage/rings/pari_ring.py +235 -0
- sage/rings/polynomial/all__sagemath_pari.py +1 -0
- sage/rings/polynomial/padics/all.py +1 -0
- sage/rings/polynomial/padics/polynomial_padic.py +360 -0
- sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py +1324 -0
- sage/rings/polynomial/padics/polynomial_padic_flat.py +72 -0
- sage/rings/power_series_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/power_series_pari.pxd +6 -0
- sage/rings/power_series_pari.pyx +934 -0
- sage/rings/tate_algebra.py +1282 -0
- sage/rings/tate_algebra_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/tate_algebra_element.pxd +49 -0
- sage/rings/tate_algebra_element.pyx +3464 -0
- sage/rings/tate_algebra_ideal.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/tate_algebra_ideal.pxd +7 -0
- sage/rings/tate_algebra_ideal.pyx +1307 -0
- sage/rings/valuation/all.py +7 -0
- sage/rings/valuation/augmented_valuation.py +2118 -0
- sage/rings/valuation/developing_valuation.py +362 -0
- sage/rings/valuation/gauss_valuation.py +812 -0
- sage/rings/valuation/inductive_valuation.py +1686 -0
- sage/rings/valuation/limit_valuation.py +946 -0
- sage/rings/valuation/mapped_valuation.py +656 -0
- sage/rings/valuation/scaled_valuation.py +322 -0
- sage/rings/valuation/trivial_valuation.py +382 -0
- sage/rings/valuation/valuation.py +1119 -0
- sage/rings/valuation/valuation_space.py +1615 -0
- sage/rings/valuation/valuations_catalog.py +10 -0
- sage/rings/valuation/value_group.py +697 -0
- sage/schemes/all__sagemath_pari.py +1 -0
- sage/schemes/elliptic_curves/all__sagemath_pari.py +1 -0
- sage/schemes/elliptic_curves/descent_two_isogeny_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/schemes/elliptic_curves/descent_two_isogeny_pari.pyx +46 -0
- sage_wheels/bin/gp +0 -0
- sage_wheels/bin/gp2c +0 -0
- sage_wheels/bin/gp2c-run +57 -0
- sage_wheels/bin/xeus-gp +0 -0
- sage_wheels/share/gp2c/func.dsc +18414 -0
|
@@ -0,0 +1,722 @@
|
|
|
1
|
+
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
2
|
+
\\ Copyright (C) 2014 Denis Simon
|
|
3
|
+
\\
|
|
4
|
+
\\ Distributed under the terms of the GNU General Public License (GPL)
|
|
5
|
+
\\
|
|
6
|
+
\\ This code is distributed in the hope that it will be useful,
|
|
7
|
+
\\ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
8
|
+
\\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
9
|
+
\\ General Public License for more details.
|
|
10
|
+
\\
|
|
11
|
+
\\ The full text of the GPL is available at:
|
|
12
|
+
\\
|
|
13
|
+
\\ http://www.gnu.org/licenses/
|
|
14
|
+
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
Author:
|
|
18
|
+
Denis SIMON -> simon@math.unicaen.fr
|
|
19
|
+
address of the file:
|
|
20
|
+
www.math.unicaen.fr/~simon/qfsolve.gp
|
|
21
|
+
|
|
22
|
+
*********************************************
|
|
23
|
+
* VERSION 09/01/2014 *
|
|
24
|
+
*********************************************
|
|
25
|
+
|
|
26
|
+
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
27
|
+
\\ English help \\
|
|
28
|
+
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
29
|
+
|
|
30
|
+
This package provides functions to solve quadratic equations over Q.
|
|
31
|
+
language: GP
|
|
32
|
+
It can be run under GP by the command
|
|
33
|
+
gp > \r qfsolve.gp
|
|
34
|
+
|
|
35
|
+
This package contains 4 main functions:
|
|
36
|
+
|
|
37
|
+
- qfsolve(G,{factD}): Solve over Q the quadratic equation X~*G*X = 0.
|
|
38
|
+
G must be a symmetric matrix n*n, with coefficients in Z.
|
|
39
|
+
The solution might be a single vector (vectorv)
|
|
40
|
+
or a matrix (whose columns generate a totally isotropic subspace).
|
|
41
|
+
If no solution exists, the output is a prime number
|
|
42
|
+
indicating that there is no solution in the local field Q_p
|
|
43
|
+
(-1 for the reals, p for Q_p).
|
|
44
|
+
factD is an optional parameter. If present, it must be equal to
|
|
45
|
+
the factorization of -abs(2*matdet(G)). This saves a lot of time.
|
|
46
|
+
|
|
47
|
+
Example:
|
|
48
|
+
gp > G = [1,0,0;0,1,0;0,0,-34];
|
|
49
|
+
gp > qfsolve(G)
|
|
50
|
+
%1 = [-3, -5, 1]~
|
|
51
|
+
|
|
52
|
+
- qfparam(G,sol,fl): Coefficients of quadratic forms that parametrize the
|
|
53
|
+
solutions of the ternary quadratic form G, using the particular
|
|
54
|
+
solution sol.
|
|
55
|
+
fl is optional and can be 1, 2, or 3, in which case the 'fl'th form is
|
|
56
|
+
reduced. The default is fl=3.
|
|
57
|
+
|
|
58
|
+
Example:
|
|
59
|
+
gp > qfparam(G,[-3,-5,1]~)
|
|
60
|
+
%2 =
|
|
61
|
+
[ 3 -10 -3]
|
|
62
|
+
|
|
63
|
+
[-5 -6 5]
|
|
64
|
+
|
|
65
|
+
[ 1 0 1]
|
|
66
|
+
Indeed, the solutions can be parametrized as
|
|
67
|
+
[3*x^2 - 10*y*x - 3*y^2, -5*x^2 - 6*y*x + 5*y^2, x^2 + y^2]~
|
|
68
|
+
|
|
69
|
+
- qflllgram_indef(G,c): Solve or reduce the quadratic form G with
|
|
70
|
+
integral coefficients. G might be definite or indefinite.
|
|
71
|
+
This is an lll-type algorithm with a constant 1/4<c<=1.
|
|
72
|
+
c is optional and the default is c=1.
|
|
73
|
+
|
|
74
|
+
- quadclass2(d,factd): Compute the 2-Sylow of the (narrow) class group
|
|
75
|
+
of discriminant d. d must be a fondamental discriminant.
|
|
76
|
+
factD is an optional parameter. If present, it must be equal to
|
|
77
|
+
the factorization of abs(2*d). In this case, the
|
|
78
|
+
algorithm runs in polynomial time.
|
|
79
|
+
|
|
80
|
+
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
81
|
+
\\ Description des fonctions \\
|
|
82
|
+
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
83
|
+
|
|
84
|
+
Programme de resolution des equations quadratiques
|
|
85
|
+
langage: GP
|
|
86
|
+
pour l'utiliser, lancer gp, puis taper
|
|
87
|
+
\r qfsolve.gp
|
|
88
|
+
|
|
89
|
+
Ce fichier contient 4 principales fonctions:
|
|
90
|
+
|
|
91
|
+
- qfsolve(G,{factD}): pour resoudre l'equation quadratique X^t*G*X = 0
|
|
92
|
+
G doit etre une matrice symetrique n*n, a coefficients dans Z.
|
|
93
|
+
S'il n'existe pas de solution, la reponse est un entier
|
|
94
|
+
indiquant un corps local dans lequel aucune solution n'existe
|
|
95
|
+
(-1 pour les reels, p pour Q_p).
|
|
96
|
+
factD est optionnel. Il doit etre egal a -abs(2*matdet(G)),
|
|
97
|
+
Cela entraine un gain de temps.
|
|
98
|
+
|
|
99
|
+
Exemple:
|
|
100
|
+
gp > G = [1,0,0;0,1,0;0,0,-34];
|
|
101
|
+
gp > qfsolve(G)
|
|
102
|
+
%1 = [-3, -5, 1]~
|
|
103
|
+
|
|
104
|
+
- qfparam(G,sol,fl): pour parametrer les solutions de la forme
|
|
105
|
+
quadratique ternaire G, en utilisant la solution particuliere sol.
|
|
106
|
+
fl est optionnel et peut prendre les valeurs 1,2 ou 3.
|
|
107
|
+
Il indique que la 'fl'eme forme quadratique est reduite.
|
|
108
|
+
Par defaut, fl=3
|
|
109
|
+
|
|
110
|
+
Exemple:
|
|
111
|
+
gp > qfparam(G,[-3,-5,1]~)
|
|
112
|
+
%2 =
|
|
113
|
+
[ 3 -10 -3]
|
|
114
|
+
|
|
115
|
+
[-5 -6 5]
|
|
116
|
+
|
|
117
|
+
[ 1 0 1]
|
|
118
|
+
Ici, les solutions sont parametrees par
|
|
119
|
+
[3*x^2 - 10*y*x - 3*y^2, -5*x^2 - 6*y*x + 5*y^2, x^2 + y^2]~
|
|
120
|
+
|
|
121
|
+
- qflllgram_indef(G,c): pour resoudre ou reduire la forme quadratique
|
|
122
|
+
G a coefficients entiers. Il s'agit d'un algorithme type LLL, avec la
|
|
123
|
+
constante 1/4<c<=1.
|
|
124
|
+
c est optionnel et par defaut c=1.
|
|
125
|
+
|
|
126
|
+
- quadclass2(d,factd): determine le 2-Sylow du (narrow) groupe de classes de
|
|
127
|
+
discriminant d, ou d est un discriminant fondamental.
|
|
128
|
+
factd est optionnel. Il doit etre egal a -abs(2*d),
|
|
129
|
+
et dans ce cas le reste de l'algorithme est polynomial.
|
|
130
|
+
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
\\
|
|
134
|
+
\\ Usual global variables
|
|
135
|
+
\\
|
|
136
|
+
|
|
137
|
+
global(DEBUGLEVEL_qfsolve):small;
|
|
138
|
+
|
|
139
|
+
DEBUGLEVEL_qfsolve = 0;
|
|
140
|
+
|
|
141
|
+
\\ use the variable DEBUGLEVEL_qfsolve :
|
|
142
|
+
\\ From 0 to 5 : choose a higher value to have
|
|
143
|
+
\\ more details printed.
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
147
|
+
\\ SCRIPT \\
|
|
148
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
149
|
+
|
|
150
|
+
{default_qfsolve(DEBUGLEVEL_qfsolve_val:small = 0) =
|
|
151
|
+
|
|
152
|
+
DEBUGLEVEL_qfsolve = DEBUGLEVEL_qfsolve_val;
|
|
153
|
+
print(" DEBUGLEVEL_qfsolve = ",DEBUGLEVEL_qfsolve);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
157
|
+
\\ TYPE CONVERSIONS \\
|
|
158
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
159
|
+
|
|
160
|
+
\\ THIS FUNCTION WILL BE REPLACED BY matconcat(matdiagonal(v))
|
|
161
|
+
\\ IN VERSION >= 2.6.0
|
|
162
|
+
\\ build the matrix whose diagonal blocks are listed in the vector v.
|
|
163
|
+
{matdiagonalblock(v) =
|
|
164
|
+
my(M);
|
|
165
|
+
my(lv,lt=0);
|
|
166
|
+
|
|
167
|
+
if( type(v) != "t_VEC" && type(v) != "t_COL",
|
|
168
|
+
error("wrong type in matdiagonalblock()"));
|
|
169
|
+
|
|
170
|
+
lv = length(v);
|
|
171
|
+
for( i = 1, lv, lt += length(v[i]));
|
|
172
|
+
M = matrix(lt,lt);
|
|
173
|
+
lt = 0;
|
|
174
|
+
for( i = 1, lv,
|
|
175
|
+
my( lvi = length(v[i]));
|
|
176
|
+
for( j = 1, lvi,
|
|
177
|
+
for( k = 1, lvi,
|
|
178
|
+
M[lt+j,lt+k] = v[i][j,k]));
|
|
179
|
+
lt += lvi
|
|
180
|
+
);
|
|
181
|
+
return(M);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
185
|
+
\\ LINEAR ALGEBRA \\
|
|
186
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
187
|
+
|
|
188
|
+
\\ Gives a unimodular matrix with the last column equal to v.
|
|
189
|
+
\\ redflag = 0 or 1. If redflag = 1, then the n-#v first columns are reduced.
|
|
190
|
+
{completebasis(v,redflag=0) =
|
|
191
|
+
my(Mv,U,re);
|
|
192
|
+
my(n);
|
|
193
|
+
|
|
194
|
+
if( type(v) != "t_COL" && type(v) != "t_MAT",
|
|
195
|
+
error("wrong type in completebasis"));
|
|
196
|
+
|
|
197
|
+
if( type(v) == "t_COL", Mv = Mat(v), Mv = v);
|
|
198
|
+
n = length(Mv[,1]);
|
|
199
|
+
if( n == length(Mv), return(Mv));
|
|
200
|
+
U = (mathnf(Mv~,1)[2]~)^-1;
|
|
201
|
+
if( n==1 || !redflag, return(U));
|
|
202
|
+
\\ extract the n-#v columns and LLL-reduce them
|
|
203
|
+
re = qflll(vecextract(U,1<<n-1,1<<(n-#Mv)-1));
|
|
204
|
+
\\ apply the reduction
|
|
205
|
+
re = U*matdiagonalblock([re,matid(#Mv)]);
|
|
206
|
+
|
|
207
|
+
return(re);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
\\ Compute the kernel of M mod p.
|
|
211
|
+
\\ returns [d,U], where
|
|
212
|
+
\\ d = dim (ker M mod p)
|
|
213
|
+
\\ U in GLn(Z), and its first d columns span the kernel.
|
|
214
|
+
{kermodp(M,p) =
|
|
215
|
+
my(U);
|
|
216
|
+
my(n,d);
|
|
217
|
+
|
|
218
|
+
n = length(M);
|
|
219
|
+
U = centerlift(matker(M*Mod(1,p)));
|
|
220
|
+
d = length(U);
|
|
221
|
+
U = completebasis(U,0);
|
|
222
|
+
U = matrix(n,n,i,j,U[i,n+1-j]);
|
|
223
|
+
|
|
224
|
+
return([d,U]);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
228
|
+
\\ INVARIANTS COMPUTATIONS \\
|
|
229
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
230
|
+
|
|
231
|
+
\\ Compute the Hilbert symbol at p
|
|
232
|
+
\\ where p = -1 means real place and not p = 0 as in gp
|
|
233
|
+
{myhilbert(a,b,p) =
|
|
234
|
+
if( sign(p) < 0, return(hilbert(a,b,0)));
|
|
235
|
+
return(hilbert(a,b,p));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
\\ Given a symmetric matrix G over Z, compute the local invariant
|
|
239
|
+
\\ (=Witt invariant) of G at the prime p (at real place if p = -1)
|
|
240
|
+
\\ Assume that none of the determinant G[1..i,1..i] is 0.
|
|
241
|
+
{qflocalinvariant(G,p) =
|
|
242
|
+
my(vdet,diag);
|
|
243
|
+
my(n,c);
|
|
244
|
+
|
|
245
|
+
n = length(G);
|
|
246
|
+
\\ Diagonalize G first.
|
|
247
|
+
vdet = vector( n+1, i, matdet(matrix(i-1,i-1,j,k,G[j,k])));
|
|
248
|
+
diag = vector( n, i, vdet[i+1]*vdet[i]);
|
|
249
|
+
|
|
250
|
+
\\ Then compute the product of the Hilbert symbols
|
|
251
|
+
\\ (diag[i],diag[j])_p for i < j
|
|
252
|
+
c = 1;
|
|
253
|
+
for( i = 1, n,
|
|
254
|
+
for( j = i+1, n,
|
|
255
|
+
c *= myhilbert( diag[i], diag[j], p)));
|
|
256
|
+
return(c);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
\\ G is a quadratic form, or a symmetrix matrix,
|
|
260
|
+
\\ or a list of quadratic forms with the same discriminant.
|
|
261
|
+
\\ If given, fa must be equal to factor(-abs(2*matdet(G)))[,1].
|
|
262
|
+
{qflocalinvariants(G,fa=[]) =
|
|
263
|
+
my(vG,sol,vdet);
|
|
264
|
+
my(lG);
|
|
265
|
+
|
|
266
|
+
if( DEBUGLEVEL_qfsolve >= 4, print(" starting qflocalinvariants ",G));
|
|
267
|
+
|
|
268
|
+
\\ convert G into a vector of symmetric matrices
|
|
269
|
+
if( type(G) == "t_VEC", vG = G , vG = [G]);
|
|
270
|
+
lG = length(vG);
|
|
271
|
+
for( j = 1, lG,
|
|
272
|
+
if( type(vG[j]) == "t_QFI" || type(vG[j]) == "t_QFR",
|
|
273
|
+
vG[j] = Mat(vG[j])));
|
|
274
|
+
|
|
275
|
+
\\ compute the factorization of -2*abs(det(G))
|
|
276
|
+
if( !length(fa),
|
|
277
|
+
fa = (factor(-abs(2*matdet(vG[1])))[,1]));
|
|
278
|
+
|
|
279
|
+
\\ in dimension 2, each invariant is a single Hilbert symbol.
|
|
280
|
+
if( length(vG[1]) == 2,
|
|
281
|
+
sol = matrix(length(fa),lG,i,j,
|
|
282
|
+
myhilbert(vG[j][1,1],-matdet(vG[1]),fa[i]) < 0);
|
|
283
|
+
if( DEBUGLEVEL_qfsolve >= 4, print(" end of qflocalinvariants"));
|
|
284
|
+
return([fa,sol])
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
sol = matrix(length(fa),lG);
|
|
288
|
+
for( j = 1, lG,
|
|
289
|
+
my( n = length(vG[j]));
|
|
290
|
+
\\ in dimension n, we need to compute a product of n Hilbert symbols.
|
|
291
|
+
vdet = vector(n+1, i, matdet(matrix(i-1,i-1,k,m,vG[j][k,m])));
|
|
292
|
+
for( i = 1, length(fa),
|
|
293
|
+
my( p = fa[i]);
|
|
294
|
+
my( h = 1);
|
|
295
|
+
for( k = 1, n-1, h *= myhilbert(-vdet[k],vdet[k+1],p));
|
|
296
|
+
h *= myhilbert(vdet[n],vdet[n+1],p);
|
|
297
|
+
sol[i,j] = h < 0;
|
|
298
|
+
)
|
|
299
|
+
);
|
|
300
|
+
if( DEBUGLEVEL_qfsolve >= 4, print(" end of qflocalinvariants"));
|
|
301
|
+
return([fa,sol]);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
305
|
+
\\ QUADRATIC FORMS REDUCTION \\
|
|
306
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
307
|
+
|
|
308
|
+
\\ M = [a,b;b;c] has integral coefficients.
|
|
309
|
+
\\ Gauss reduction of the binary quadratic form
|
|
310
|
+
\\ qf = (a,b,c)=a*X^2+2*b*X*Y+c*Y^2
|
|
311
|
+
\\ Returns the reduction matrix with det = +1.
|
|
312
|
+
{qfbreduce(M) =
|
|
313
|
+
my(H,di,aux);
|
|
314
|
+
my(a,b,c,q,r,nexta,nextb,nextc);
|
|
315
|
+
my(test);
|
|
316
|
+
|
|
317
|
+
if( DEBUGLEVEL_qfsolve >= 5, print(" starting qfbreduce with ",M));
|
|
318
|
+
|
|
319
|
+
a = M[1,1]; b = M[1,2]; c = M[2,2];
|
|
320
|
+
|
|
321
|
+
H = matid(2); test = 1;
|
|
322
|
+
while( test && a,
|
|
323
|
+
di = divrem(b,a); q = di[1]; r = di[2];
|
|
324
|
+
if( 2*r > abs(a), r -= abs(a); q += sign(a));
|
|
325
|
+
H[,2] -= q*H[,1];
|
|
326
|
+
nextc = a; nextb = -r; nexta= (nextb-b)*q+c;
|
|
327
|
+
|
|
328
|
+
test = abs(nexta) < abs(a);
|
|
329
|
+
if( test,
|
|
330
|
+
c = nextc; b = nextb; a = nexta;
|
|
331
|
+
aux = H[,1]; H[,1] = -H[,2]; H[,2] = aux
|
|
332
|
+
)
|
|
333
|
+
);
|
|
334
|
+
|
|
335
|
+
if( DEBUGLEVEL_qfsolve >= 5, print(" end of qfbreduce with ",H));
|
|
336
|
+
return(H);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
\\ Performs first a LLL reduction on a positive definite
|
|
340
|
+
\\ quadratic form QD bounding the indefinite G.
|
|
341
|
+
\\ Then finishes the reduction with qfsolvetriv().
|
|
342
|
+
{qflllgram_indef(G,c=1,base=0) =
|
|
343
|
+
my(M,QD,M1,S,red);
|
|
344
|
+
my(n);
|
|
345
|
+
|
|
346
|
+
if( DEBUGLEVEL_qfsolve >= 4, print(" qflllgram_indef with G = ",G));
|
|
347
|
+
n = length(G);
|
|
348
|
+
M = matid(n);
|
|
349
|
+
QD = G;
|
|
350
|
+
for( i = 1, n-1,
|
|
351
|
+
if( !QD[i,i],
|
|
352
|
+
return(qfsolvetriv(G,base))
|
|
353
|
+
);
|
|
354
|
+
M1 = matid(n);
|
|
355
|
+
M1[i,] = -QD[i,]/QD[i,i];
|
|
356
|
+
M1[i,i] = 1;
|
|
357
|
+
M = (M*M1);
|
|
358
|
+
QD = (M1~*QD*M1)
|
|
359
|
+
);
|
|
360
|
+
M = (M^(-1));
|
|
361
|
+
QD = (M~*abs(QD)*M);
|
|
362
|
+
S = qflllgram(QD/content(QD));
|
|
363
|
+
if( #S < n, S = completebasis(S));
|
|
364
|
+
red = qfsolvetriv(S~*G*S,base);
|
|
365
|
+
if( type(red) == "t_COL",
|
|
366
|
+
red = (S*red);
|
|
367
|
+
return(red));
|
|
368
|
+
red[2] = S*red[2];
|
|
369
|
+
if( length(red) == 3,
|
|
370
|
+
red[3] = S*red[3]);
|
|
371
|
+
return(red);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
\\ LLL reduction of the quadratic form G (Gram matrix)
|
|
375
|
+
\\ where we go on, even if an isotropic vector is found.
|
|
376
|
+
{qflllgram_indefgoon(G,c=1) =
|
|
377
|
+
my(red,U1,G2,U2,G3,U3,G4,U,V,B,U4,G5,U5,G6);
|
|
378
|
+
my(n);
|
|
379
|
+
|
|
380
|
+
red = qflllgram_indef(G,c,1);
|
|
381
|
+
\\ If no isotropic vector is found, nothing to do.
|
|
382
|
+
if( length(red) == 2, return(red));
|
|
383
|
+
\\ otherwise a solution is found:
|
|
384
|
+
U1 = red[2];
|
|
385
|
+
G2 = red[1]; \\ On a G2[1,1] = 0
|
|
386
|
+
U2 = mathnf(Mat(G2[1,]),4)[2];
|
|
387
|
+
G3 = U2~*G2*U2;
|
|
388
|
+
\\ The first line of the matrix G3 only contains 0,
|
|
389
|
+
\\ except some 'g' on the right, where g^2| det G.
|
|
390
|
+
n = length(G);
|
|
391
|
+
U3 = matid(n); U3[1,n] = round(-G3[n,n]/G3[1,n]/2);
|
|
392
|
+
G4 = U3~*G3*U3;
|
|
393
|
+
\\ The coeff G4[n,n] is reduced modulo 2g
|
|
394
|
+
U = vecextract(G4,[1,n],[1,n]);
|
|
395
|
+
if( n == 2,
|
|
396
|
+
V = matrix(2,0)
|
|
397
|
+
, V = vecextract(G4,[1,n],1<<(n-1)-2));
|
|
398
|
+
B = round(-U^-1*V);
|
|
399
|
+
U4 = matid(n);
|
|
400
|
+
for( j = 2, n-1,
|
|
401
|
+
U4[1,j] = B[1,j-1];
|
|
402
|
+
U4[n,j] = B[2,j-1]
|
|
403
|
+
);
|
|
404
|
+
G5 = U4~*G4*U4;
|
|
405
|
+
\\ The last column of G5 is reduced
|
|
406
|
+
if( n < 4, return([G5,U1*U2*U3*U4]));
|
|
407
|
+
|
|
408
|
+
red = qflllgram_indefgoon(matrix(n-2,n-2,i,j,G5[i+1,j+1]),c);
|
|
409
|
+
U5 = matdiagonalblock([Mat(1),red[2],Mat(1)]);
|
|
410
|
+
G6 = U5~*G5*U5;
|
|
411
|
+
return([G6,U1*U2*U3*U4*U5]);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
\\ LLL reduction of the quadratic form G (Gram matrix)
|
|
415
|
+
\\ in dim 3 only, with detG = -1 and sign(G) = [2,1];
|
|
416
|
+
{qflllgram_indefgoon2(G,c=1) =
|
|
417
|
+
my(red,U1,G2,bez,U2,G3,U3);
|
|
418
|
+
my(cc);
|
|
419
|
+
|
|
420
|
+
red = qflllgram_indef(G,c,1);
|
|
421
|
+
\\ We always find an isotropic vector.
|
|
422
|
+
U1 = [0,0,1;0,1,0;1,0,0];
|
|
423
|
+
G2 = U1~*red[1]*U1;
|
|
424
|
+
\\ G2 has a 0 at the bottom right corner.
|
|
425
|
+
bez = bezout(G2[3,1],G2[3,2]);
|
|
426
|
+
U2 = [bez[1],G2[3,2]/bez[3],0;bez[2],-G2[3,1]/bez[3],0;0,0,-1];
|
|
427
|
+
G3 = U2~*G2*U2;
|
|
428
|
+
\\ G3 has 0 under the co-diagonal.
|
|
429
|
+
cc = (G3[1,1])%2;
|
|
430
|
+
U3 = [1,0,0; cc,1,0;
|
|
431
|
+
round(-(G3[1,1]+cc*(2*G3[1,2]+G3[2,2]*cc))/2/G3[1,3]),
|
|
432
|
+
round(-(G3[1,2]+cc*G3[2,2])/G3[1,3]),1];
|
|
433
|
+
|
|
434
|
+
return([U3~*G3*U3,red[2]*U1*U2*U3]);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
438
|
+
\\ CLASS GROUP COMPUTATIONS \\
|
|
439
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
440
|
+
|
|
441
|
+
\\ Compute the square root of the quadratic form qfb.
|
|
442
|
+
\\ This function is not fully implemented.
|
|
443
|
+
\\ For the moment it only works for detqfb squarefree
|
|
444
|
+
\\ (except at 2, where the valuation is 2 or 3).
|
|
445
|
+
\\ factdet must be given and equal to factor(2*abs(det qfb))
|
|
446
|
+
{qfbsqrt(qfb,factdet) =
|
|
447
|
+
my(G,m,n);
|
|
448
|
+
my(a,b,c,d,p);
|
|
449
|
+
my(aux,Q1,M);
|
|
450
|
+
|
|
451
|
+
if( DEBUGLEVEL_qfsolve >=3, print(" starting qfbsqrt with ",qfb,factdet));
|
|
452
|
+
G = Vec(qfb);
|
|
453
|
+
a = G[1]; b = (G[2]/2); c = G[3]; d = a*c-b^2;
|
|
454
|
+
|
|
455
|
+
\\ 1st step: solve m^2 = a (d), m*n = -b (d), n^2 = c (d)
|
|
456
|
+
m = n = Mod(1,1);
|
|
457
|
+
factdet[1,2] -= 3;
|
|
458
|
+
for( i = 1, length(factdet[,1]),
|
|
459
|
+
if( !factdet[i,2], next);
|
|
460
|
+
p = factdet[i,1];
|
|
461
|
+
if( gcd(a,p) == 1,
|
|
462
|
+
aux = sqrt(Mod(a,p));
|
|
463
|
+
m = chinese(m,aux);
|
|
464
|
+
n = chinese(n,-b/aux)
|
|
465
|
+
,
|
|
466
|
+
aux = sqrt(Mod(c,p));
|
|
467
|
+
n = chinese(n,aux);
|
|
468
|
+
m = chinese(m,-b/aux)
|
|
469
|
+
)
|
|
470
|
+
);
|
|
471
|
+
m = centerlift(m);
|
|
472
|
+
n = centerlift(n);
|
|
473
|
+
if( DEBUGLEVEL_qfsolve >=4, print(" m = ",m); print(" n = ",n));
|
|
474
|
+
|
|
475
|
+
\\ 2nd step: build Q1, with det=-1 such that Q1(x,y,0) = G(x,y)
|
|
476
|
+
Q1 = [(n^2-c)/d, (m*n+b)/d, n ;
|
|
477
|
+
(m*n+b)/d, (m^2-a)/d, m ;
|
|
478
|
+
n, m, d ];
|
|
479
|
+
Q1 = -matadjoint(Q1);
|
|
480
|
+
|
|
481
|
+
\\ 3rd step: reduce Q1 to [0,0,-1;0,1,0;-1,0,0]
|
|
482
|
+
M = qflllgram_indefgoon2(Q1)[2][3,];
|
|
483
|
+
if( M[1] < 0, M = -M);
|
|
484
|
+
if( DEBUGLEVEL_qfsolve >=3, print(" end of qfbsqrt"));
|
|
485
|
+
if( M[1]%2,
|
|
486
|
+
return(Qfb(M[1],2*M[2],2*M[3]))
|
|
487
|
+
, return(Qfb(M[3],-2*M[2],2*M[1])));
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
\\ Implementation of Shanks/Bosma-Stevenhagen algorithm
|
|
491
|
+
\\ to compute the 2-Sylow of the class group of discriminant D.
|
|
492
|
+
\\ Only works for D = fundamental discriminant.
|
|
493
|
+
\\ When D = 1(4), work with 4D.
|
|
494
|
+
\\ If given, factdetG must be equal to factor(abs(2*D)).
|
|
495
|
+
\\ Apart from this factorization, the algorithm is polynomial time.
|
|
496
|
+
\\ If Winvariants is given, the algorithm stops as soon as
|
|
497
|
+
\\ an element having these W-invariants is found.
|
|
498
|
+
{quadclass2(D,factdetG,Winvariants,U2) =
|
|
499
|
+
my(factD,listgen,E,invgen,im,Ker,Kerim,listgen2,G2,clgp2,red,auxg);
|
|
500
|
+
my(p,aux);
|
|
501
|
+
my(n,rang,m,vD,vp);
|
|
502
|
+
|
|
503
|
+
if( DEBUGLEVEL_qfsolve >= 1, print(" Construction of the 2-class group of discriminant ",D));
|
|
504
|
+
if( D%4 == 2 || D%4 == 3, error("quadclass2: Discriminant not congruent to 0,1 mod 4"));
|
|
505
|
+
|
|
506
|
+
if( D==-4, return([[1],[Qfb(1,0,1)]]));
|
|
507
|
+
|
|
508
|
+
if( !factdetG, factdetG = factor(2*abs(D)));
|
|
509
|
+
factD = concat([-1],factdetG[,1]~);
|
|
510
|
+
if( D%4 == 1, D *= 4; factdetG[1,2] += 2);
|
|
511
|
+
|
|
512
|
+
n = length(factD); rang = n-3;
|
|
513
|
+
if(D>0, m = rang+1, m = rang);
|
|
514
|
+
if(m<0, m=0);
|
|
515
|
+
if( DEBUGLEVEL_qfsolve >= 3, print(" factD = ",factD));
|
|
516
|
+
listgen = vector(m);
|
|
517
|
+
|
|
518
|
+
vD = valuation(D,2);
|
|
519
|
+
if( vD,
|
|
520
|
+
E = Qfb(1,0,-D/4)
|
|
521
|
+
, E = Qfb(1,1,(1-D)/4)
|
|
522
|
+
);
|
|
523
|
+
if( DEBUGLEVEL_qfsolve >= 3, print(" E = ",E));
|
|
524
|
+
|
|
525
|
+
if( type(Winvariants) == "t_COL"
|
|
526
|
+
&& (Winvariants == 0
|
|
527
|
+
|| length(matinverseimage(U2*Mod(1,2),Winvariants))>0)
|
|
528
|
+
, return([[1],[E]]));
|
|
529
|
+
|
|
530
|
+
for( i = 1, m, \\ no need to look at factD[1]=-1, nor factD[2]=2
|
|
531
|
+
p = factD[i+2];
|
|
532
|
+
vp = valuation(D,p);
|
|
533
|
+
aux = (p^vp);
|
|
534
|
+
if( vD,
|
|
535
|
+
listgen[i] = Qfb(aux,0,-D/4/aux)
|
|
536
|
+
, listgen[i] = Qfb(aux,aux,(aux-D/aux)/4))
|
|
537
|
+
);
|
|
538
|
+
if( vD == 2 && D%16 != 4,
|
|
539
|
+
m++; rang++; listgen = concat(listgen,[Qfb(2,2,(4-D)/8)]));
|
|
540
|
+
if( vD == 3,
|
|
541
|
+
m++; rang++; listgen = concat(listgen,[Qfb(2^(vD-2),0,-D/2^vD)]));
|
|
542
|
+
|
|
543
|
+
if( DEBUGLEVEL_qfsolve >= 3, print(" listgen = ",listgen));
|
|
544
|
+
if( DEBUGLEVEL_qfsolve >= 2, print(" rank = ",rang));
|
|
545
|
+
|
|
546
|
+
if( !rang, return([[1],[E]]));
|
|
547
|
+
|
|
548
|
+
invgen = qflocalinvariants(listgen,factD)[2]*Mod(1,2);
|
|
549
|
+
if( DEBUGLEVEL_qfsolve >= 3, print(" invgen = ",lift(invgen)));
|
|
550
|
+
|
|
551
|
+
clgp2 = vector(m,i,2);
|
|
552
|
+
im = lift(matinverseimage(invgen,matimage(invgen)));
|
|
553
|
+
while( (length(im) < rang)
|
|
554
|
+
|| (type(Winvariants) == "t_COL" && length(matinverseimage(concat(invgen,U2),Winvariants) == 0)),
|
|
555
|
+
Ker = lift(matker(invgen));
|
|
556
|
+
Kerim = concat(Ker,im);
|
|
557
|
+
listgen2 = vector(m);
|
|
558
|
+
for( i = 1, m,
|
|
559
|
+
listgen2[i] = E;
|
|
560
|
+
for( j = 1, m,
|
|
561
|
+
if( Kerim[j,i],
|
|
562
|
+
listgen2[i] = qfbcompraw(listgen2[i],listgen[j])));
|
|
563
|
+
if( norml2(Kerim[,i]) > 1,
|
|
564
|
+
red = qfbreduce(auxg=Mat(listgen2[i]));
|
|
565
|
+
auxg = red~*auxg*red;
|
|
566
|
+
listgen2[i] = Qfb(auxg[1,1],2*auxg[1,2],auxg[2,2]))
|
|
567
|
+
);
|
|
568
|
+
listgen = listgen2;
|
|
569
|
+
invgen = invgen*Kerim;
|
|
570
|
+
|
|
571
|
+
if( DEBUGLEVEL_qfsolve >= 4, print(" listgen = ",listgen));
|
|
572
|
+
if( DEBUGLEVEL_qfsolve >= 4, print(" invgen = ",lift(invgen)));
|
|
573
|
+
|
|
574
|
+
for( i = 1, length(Ker),
|
|
575
|
+
G2 = qfbsqrt(listgen[i],factdetG);
|
|
576
|
+
clgp2[i] <<= 1;
|
|
577
|
+
listgen[i] = G2;
|
|
578
|
+
invgen[,i] = qflocalinvariants(G2,factD)[2][,1]*Mod(1,2)
|
|
579
|
+
);
|
|
580
|
+
|
|
581
|
+
if( DEBUGLEVEL_qfsolve >= 3, print(" listgen = ",listgen));
|
|
582
|
+
if( DEBUGLEVEL_qfsolve >= 3, print(" invgen = ",lift(invgen)));
|
|
583
|
+
if( DEBUGLEVEL_qfsolve >= 3, print(" clgp2 = ",clgp2));
|
|
584
|
+
|
|
585
|
+
im = lift(matinverseimage(invgen,matimage(invgen)))
|
|
586
|
+
);
|
|
587
|
+
|
|
588
|
+
listgen2 = vector(rang);
|
|
589
|
+
for( i = 1, rang,
|
|
590
|
+
listgen2[i] = E;
|
|
591
|
+
for( j = 1, m,
|
|
592
|
+
if( im[j,i],
|
|
593
|
+
listgen2[i] = qfbcompraw(listgen2[i],listgen[j])));
|
|
594
|
+
if( norml2(im[,i]) > 1,
|
|
595
|
+
red = qfbreduce(auxg=Mat(listgen2[i]));
|
|
596
|
+
auxg = red~*auxg*red;
|
|
597
|
+
listgen2[i] = Qfb(auxg[1,1],2*auxg[1,2],auxg[2,2]))
|
|
598
|
+
);
|
|
599
|
+
listgen = listgen2;
|
|
600
|
+
\\ listgen = vector(rang,i,listgen[m-rang+i]);
|
|
601
|
+
clgp2 = vector(rang,i,clgp2[m-rang+i]);
|
|
602
|
+
|
|
603
|
+
if( DEBUGLEVEL_qfsolve >= 2, print(" listgen = ",listgen));
|
|
604
|
+
if( DEBUGLEVEL_qfsolve >= 2, print(" clgp2 = ",clgp2));
|
|
605
|
+
|
|
606
|
+
return([clgp2,listgen]);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
610
|
+
\\ QUADRATIC EQUATIONS \\
|
|
611
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
612
|
+
|
|
613
|
+
\\ Try to solve G = 0 with small coefficients
|
|
614
|
+
\\ This is proved to work if
|
|
615
|
+
\\ - det(G) = 1, dim <= 6 and G is LLL reduced
|
|
616
|
+
\\
|
|
617
|
+
\\ Returns [G,matid] if no solution is found.
|
|
618
|
+
\\ Exit with a norm 0 vector if one such is found.
|
|
619
|
+
\\ If base == 1 and norm 0 is obtained, returns [H~*G*H,H,sol] where
|
|
620
|
+
\\ sol is a norm 0 vector and is the 1st column of H.
|
|
621
|
+
{qfsolvetriv(G,base=0) =
|
|
622
|
+
my(n);
|
|
623
|
+
my(H,sol,GG);
|
|
624
|
+
|
|
625
|
+
n = length(G);
|
|
626
|
+
H = matid(n);
|
|
627
|
+
|
|
628
|
+
\\ case 1: A basis vector is isotropic
|
|
629
|
+
for( i = 1, n,
|
|
630
|
+
if( G[i,i] == 0,
|
|
631
|
+
sol = H[,i];
|
|
632
|
+
if( base == 0, return(sol));
|
|
633
|
+
H[,i] = H[,1]; H[,1] = sol;
|
|
634
|
+
return([H~*G*H,H,sol])
|
|
635
|
+
)
|
|
636
|
+
);
|
|
637
|
+
|
|
638
|
+
\\ case 2: G has a block +- [1,0;0,-1] on the diagonal
|
|
639
|
+
for( i = 2, n,
|
|
640
|
+
if( G[i-1,i] == 0 && G[i-1,i-1]*G[i,i] == -1,
|
|
641
|
+
H[i-1,i] = -1; sol = H[,i];
|
|
642
|
+
if( base == 0, return(sol));
|
|
643
|
+
H[,i] = H[,1]; H[,1] = sol;
|
|
644
|
+
return([H~*G*H,H,sol])
|
|
645
|
+
)
|
|
646
|
+
);
|
|
647
|
+
|
|
648
|
+
\\ case 3: a principal minor is 0
|
|
649
|
+
for( i = 1, n,
|
|
650
|
+
GG = vecextract(G,1<<i-1,1<<i-1);
|
|
651
|
+
if( matdet(GG) != 0, next);
|
|
652
|
+
sol = matker(GG)[,1];
|
|
653
|
+
sol /= content(sol);
|
|
654
|
+
sol = concat(sol,vectorv(n-i));
|
|
655
|
+
if( base == 0, return(sol));
|
|
656
|
+
H = completebasis(sol);
|
|
657
|
+
H[,n] = -H[,1]; H[,1] = sol;
|
|
658
|
+
return([H~*G*H,H,sol])
|
|
659
|
+
);
|
|
660
|
+
|
|
661
|
+
return([G,H]);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
\\ p a prime number.
|
|
665
|
+
\\ finds a solution mod p for the quadratic form G
|
|
666
|
+
\\ such that det(G) !=0 mod p and dim G = n>=3;
|
|
667
|
+
{qfsolvemodp(G,p) =
|
|
668
|
+
my(vdet,G2,sol,x1,x2,x3,N1,N2,N3,s);
|
|
669
|
+
my(r);
|
|
670
|
+
my(n);
|
|
671
|
+
|
|
672
|
+
n = length(G);
|
|
673
|
+
vdet = [0,0,0];
|
|
674
|
+
for( i = 1, 3,
|
|
675
|
+
G2 = vecextract(G,1<<i-1,1<<i-1)*Mod(1,p);
|
|
676
|
+
vdet[i] = matdet(G2);
|
|
677
|
+
if( !vdet[i],
|
|
678
|
+
sol = kermodp(lift(G2),p)[2][,1];
|
|
679
|
+
sol = vectorv(n, j, if( j <= i, sol[j], 0));
|
|
680
|
+
return(sol)
|
|
681
|
+
)
|
|
682
|
+
);
|
|
683
|
+
|
|
684
|
+
\\ now, solve in dimension 3...
|
|
685
|
+
\\ reduction to the diagonal case:
|
|
686
|
+
|
|
687
|
+
x1 = [1,0,0]~;
|
|
688
|
+
x2 = [-G2[1,2],G2[1,1],0]~;
|
|
689
|
+
x3 = [G2[2,2]*G2[1,3]-G2[2,3]*G2[1,2],G2[1,1]*G2[2,3]-G2[1,3]*G2[1,2],G2[1,2]^2-G2[1,1]*G2[2,2]]~;
|
|
690
|
+
while(1,
|
|
691
|
+
if( issquare( N1 = -vdet[2]), s = sqrt(N1); sol = s*x1+x2; break);
|
|
692
|
+
if( issquare( N2 = -vdet[3]/vdet[1]), s = sqrt(N2); sol = s*x2+x3; break);
|
|
693
|
+
if( issquare( N3 = -vdet[2]*vdet[3]/vdet[1]), s = sqrt(N3); sol = s*x1+x3; break);
|
|
694
|
+
r = 1;
|
|
695
|
+
while( !issquare( s = (1-N1*r^2)/N3), r = random(p));
|
|
696
|
+
s = sqrt(s); sol = x1+r*x2+s*x3; break
|
|
697
|
+
);
|
|
698
|
+
sol = vectorv(n, j, if( j <= 3, sol[j]));
|
|
699
|
+
return(sol);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
703
|
+
\\ HELP MESSAGES \\
|
|
704
|
+
\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
705
|
+
|
|
706
|
+
{
|
|
707
|
+
addhelp(default_qfsolve,
|
|
708
|
+
"default_qfsolve(DEBUGLEVEL_qfsolve):
|
|
709
|
+
output or set the value of the global variable DEBUGLEVEL_qfsolve.
|
|
710
|
+
The higher the value, the more information you get about intermediate
|
|
711
|
+
results concerning functions related to qfsolve.
|
|
712
|
+
default is 0: print nothing.");
|
|
713
|
+
addhelp(qflllgram_indef,
|
|
714
|
+
"qflllgram_indef(G,{c}): Solve or reduce the quadratic form G with integral coefficients. G might be definite or indefinite. This is an lll-type algorithm with a constant 1/4<c<=1.
|
|
715
|
+
c is optional and the default is c=1.
|
|
716
|
+
The output is either a vectorv which is a solution of v~*G*v=0, or a 2-component vector [H,U], where U is a unimodular matrix such that H = U~*G*U is LLL-reduced.
|
|
717
|
+
Example:
|
|
718
|
+
gp > G=[1637490518557, -9118398255553, -17114399686722; -9118398255553, -40039266946520, 44178901566187; -17114399686722, 44178901566187, 150094052078168];
|
|
719
|
+
gp > qflllgram_indef(G)
|
|
720
|
+
%1 = [-24749181067550, 1904107022307, -3382470700136]~
|
|
721
|
+
");
|
|
722
|
+
}
|