passagemath-modules 10.5.32__cp310-cp310-macosx_14_0_arm64.whl → 10.6.20__cp310-cp310-macosx_14_0_arm64.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-modules might be problematic. Click here for more details.
- {passagemath_modules-10.5.32.dist-info → passagemath_modules-10.6.20.dist-info}/METADATA +51 -46
- {passagemath_modules-10.5.32.dist-info → passagemath_modules-10.6.20.dist-info}/RECORD +333 -323
- {passagemath_modules-10.5.32.dist-info → passagemath_modules-10.6.20.dist-info}/WHEEL +1 -1
- passagemath_modules.dylibs/libgcc_s.1.1.dylib +0 -0
- passagemath_modules.dylibs/libgfortran.5.dylib +0 -0
- passagemath_modules.dylibs/libgsl.28.dylib +0 -0
- passagemath_modules.dylibs/libmpc.3.dylib +0 -0
- passagemath_modules.dylibs/libopenblasp-r0.3.29.dylib +0 -0
- passagemath_modules.dylibs/libquadmath.0.dylib +0 -0
- sage/algebras/clifford_algebra.py +2 -2
- sage/algebras/clifford_algebra_element.cpython-310-darwin.so +0 -0
- sage/algebras/clifford_algebra_element.pyx +4 -2
- sage/algebras/exterior_algebra_groebner.cpython-310-darwin.so +0 -0
- sage/algebras/exterior_algebra_groebner.pyx +2 -0
- sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py +83 -5
- sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.cpython-310-darwin.so +0 -0
- sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pxd +2 -0
- sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx +28 -3
- sage/algebras/finite_gca.py +1 -1
- sage/algebras/lie_algebras/bgg_dual_module.py +18 -11
- sage/algebras/lie_algebras/classical_lie_algebra.py +3 -3
- sage/algebras/lie_algebras/examples.py +2 -2
- sage/algebras/lie_algebras/free_lie_algebra.py +1 -1
- sage/algebras/lie_algebras/heisenberg.py +4 -4
- sage/algebras/lie_algebras/lie_algebra.py +1 -1
- sage/algebras/lie_algebras/lie_algebra_element.cpython-310-darwin.so +0 -0
- sage/algebras/lie_algebras/lie_algebra_element.pyx +65 -28
- sage/algebras/lie_algebras/quotient.py +40 -29
- sage/algebras/lie_algebras/subalgebra.py +76 -53
- sage/algebras/lie_algebras/verma_module.py +1 -3
- sage/algebras/octonion_algebra.cpython-310-darwin.so +0 -0
- sage/algebras/octonion_algebra.pyx +1 -1
- sage/algebras/orlik_solomon.py +4 -4
- sage/algebras/orlik_terao.py +4 -4
- sage/algebras/steenrod/steenrod_algebra.py +37 -30
- sage/algebras/steenrod/steenrod_algebra_bases.py +2 -2
- sage/algebras/steenrod/steenrod_algebra_misc.py +4 -4
- sage/algebras/steenrod/steenrod_algebra_mult.py +2 -2
- sage/all__sagemath_modules.py +1 -0
- sage/calculus/integration.cpython-310-darwin.so +0 -0
- sage/calculus/integration.pyx +6 -5
- sage/calculus/interpolation.cpython-310-darwin.so +0 -0
- sage/calculus/interpolators.cpython-310-darwin.so +0 -0
- sage/calculus/ode.cpython-310-darwin.so +0 -0
- sage/calculus/ode.pxd +2 -2
- sage/calculus/ode.pyx +6 -4
- sage/calculus/riemann.cpython-310-darwin.so +0 -0
- sage/calculus/riemann.pyx +68 -48
- sage/calculus/transforms/dwt.cpython-310-darwin.so +0 -0
- sage/calculus/transforms/fft.cpython-310-darwin.so +0 -0
- sage/coding/ag_code_decoders.cpython-310-darwin.so +0 -0
- sage/coding/ag_code_decoders.pyx +31 -31
- sage/coding/binary_code.cpython-310-darwin.so +0 -0
- sage/coding/binary_code.pxd +6 -6
- sage/coding/binary_code.pyx +212 -173
- sage/coding/guruswami_sudan/utils.py +3 -5
- sage/coding/kasami_codes.cpython-310-darwin.so +0 -0
- sage/coding/kasami_codes.pyx +20 -24
- sage/coding/linear_code.py +2 -2
- sage/coding/linear_code_no_metric.py +5 -5
- sage/coding/linear_rank_metric.py +81 -19
- sage/combinat/cartesian_product.py +1 -1
- sage/combinat/free_module.py +22 -2
- sage/combinat/root_system/all.py +1 -1
- sage/combinat/root_system/ambient_space.py +1 -1
- sage/combinat/root_system/associahedron.py +4 -4
- sage/combinat/root_system/braid_move_calculator.py +2 -2
- sage/combinat/root_system/braid_orbit.cpython-310-darwin.so +0 -0
- sage/combinat/root_system/braid_orbit.pyx +1 -1
- sage/combinat/root_system/branching_rules.py +3 -3
- sage/combinat/root_system/cartan_type.py +14 -14
- sage/combinat/root_system/coxeter_group.py +3 -3
- sage/combinat/root_system/coxeter_matrix.py +1 -1
- sage/combinat/root_system/coxeter_type.py +12 -1
- sage/combinat/root_system/extended_affine_weyl_group.py +9 -9
- sage/combinat/root_system/fundamental_group.py +3 -5
- sage/combinat/root_system/hecke_algebra_representation.py +1 -1
- sage/combinat/root_system/integrable_representations.py +1 -1
- sage/combinat/root_system/pieri_factors.py +3 -3
- sage/combinat/root_system/root_lattice_realization_algebras.py +1 -1
- sage/combinat/root_system/root_lattice_realizations.py +1 -1
- sage/combinat/root_system/type_folded.py +3 -3
- sage/combinat/root_system/type_reducible.py +8 -7
- sage/combinat/root_system/type_super_A.py +2 -2
- sage/combinat/root_system/weight_lattice_realizations.py +9 -8
- sage/combinat/root_system/weyl_characters.py +2 -2
- sage/crypto/__init__.py +1 -0
- sage/crypto/block_cipher/des.py +1 -1
- sage/crypto/block_cipher/miniaes.py +3 -3
- sage/crypto/block_cipher/present.py +3 -3
- sage/crypto/block_cipher/sdes.py +3 -3
- sage/crypto/boolean_function.cpython-310-darwin.so +0 -0
- sage/crypto/boolean_function.pyx +22 -23
- sage/crypto/key_exchange/diffie_hellman.py +4 -9
- sage/crypto/mq/sr.py +1 -1
- sage/crypto/public_key/blum_goldwasser.py +3 -3
- sage/crypto/sbox.cpython-310-darwin.so +0 -0
- sage/crypto/sbox.pyx +1 -1
- sage/crypto/sboxes.py +22 -0
- sage/crypto/util.py +4 -6
- sage/ext/interpreters/__init__.py +1 -1
- sage/ext/interpreters/all__sagemath_modules.py +1 -1
- sage/ext/interpreters/wrapper_cc.cpython-310-darwin.so +0 -0
- sage/ext/interpreters/wrapper_cc.pxd +5 -5
- sage/ext/interpreters/wrapper_cc.pyx +1 -1
- sage/ext/interpreters/wrapper_cdf.cpython-310-darwin.so +0 -0
- sage/ext/interpreters/wrapper_cdf.pxd +5 -7
- sage/ext/interpreters/wrapper_cdf.pyx +4 -10
- sage/ext/interpreters/wrapper_rdf.cpython-310-darwin.so +0 -0
- sage/ext/interpreters/wrapper_rdf.pxd +1 -1
- sage/ext/interpreters/wrapper_rdf.pyx +1 -1
- sage/ext/interpreters/wrapper_rr.cpython-310-darwin.so +0 -0
- sage/ext/interpreters/wrapper_rr.pxd +5 -5
- sage/ext/interpreters/wrapper_rr.pyx +1 -2
- sage/geometry/toric_lattice.py +3 -3
- sage/geometry/toric_lattice_element.cpython-310-darwin.so +0 -0
- sage/groups/additive_abelian/additive_abelian_group.py +1 -1
- sage/groups/additive_abelian/qmodnz.py +4 -4
- sage/groups/matrix_gps/coxeter_group.py +17 -4
- sage/groups/matrix_gps/group_element.cpython-310-darwin.so +0 -0
- sage/groups/misc_gps/argument_groups.py +2 -2
- sage/groups/misc_gps/imaginary_groups.py +4 -4
- sage/groups/perm_gps/partn_ref/refinement_binary.cpython-310-darwin.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_matrices.cpython-310-darwin.so +0 -0
- sage/homology/chain_complex.py +0 -2
- sage/homology/hochschild_complex.py +3 -3
- sage/homology/homology_morphism.py +6 -6
- sage/homology/homology_vector_space_with_basis.py +1 -1
- sage/libs/gsl/array.cpython-310-darwin.so +0 -0
- sage/libs/mpmath/utils.cpython-310-darwin.so +0 -0
- sage/matrix/action.cpython-310-darwin.so +0 -0
- sage/matrix/args.cpython-310-darwin.so +0 -0
- sage/matrix/args.pyx +25 -10
- sage/matrix/benchmark.py +8 -4
- sage/matrix/compute_J_ideal.py +2 -2
- sage/matrix/constructor.cpython-310-darwin.so +0 -0
- sage/matrix/echelon_matrix.cpython-310-darwin.so +0 -0
- sage/matrix/echelon_matrix.pyx +1 -1
- sage/matrix/matrix0.cpython-310-darwin.so +0 -0
- sage/matrix/matrix0.pxd +3 -3
- sage/matrix/matrix0.pyx +7 -5
- sage/matrix/matrix1.cpython-310-darwin.so +0 -0
- sage/matrix/matrix1.pyx +87 -48
- sage/matrix/matrix2.cpython-310-darwin.so +0 -0
- sage/matrix/matrix2.pxd +3 -3
- sage/matrix/matrix2.pyx +1261 -63
- sage/matrix/matrix_cdv.cpython-310-darwin.so +0 -0
- sage/matrix/matrix_complex_double_dense.cpython-310-darwin.so +0 -0
- sage/matrix/matrix_complex_double_dense.pyx +1 -1
- sage/matrix/matrix_dense.cpython-310-darwin.so +0 -0
- sage/matrix/matrix_dense.pyx +2 -3
- sage/matrix/matrix_double_dense.cpython-310-darwin.so +0 -0
- sage/matrix/matrix_double_dense.pyx +11 -5
- sage/matrix/matrix_double_sparse.cpython-310-darwin.so +0 -0
- sage/matrix/matrix_generic_dense.cpython-310-darwin.so +0 -0
- sage/matrix/matrix_generic_sparse.cpython-310-darwin.so +0 -0
- sage/matrix/matrix_generic_sparse.pyx +1 -1
- sage/matrix/matrix_laurent_mpolynomial_dense.cpython-310-darwin.so +0 -0
- sage/matrix/matrix_numpy_dense.cpython-310-darwin.so +0 -0
- sage/matrix/matrix_numpy_integer_dense.cpython-310-darwin.so +0 -0
- sage/matrix/matrix_polynomial_dense.cpython-310-darwin.so +0 -0
- sage/matrix/matrix_polynomial_dense.pyx +952 -261
- sage/matrix/matrix_real_double_dense.cpython-310-darwin.so +0 -0
- sage/matrix/matrix_sparse.cpython-310-darwin.so +0 -0
- sage/matrix/matrix_sparse.pyx +6 -7
- sage/matrix/matrix_window.cpython-310-darwin.so +0 -0
- sage/matrix/matrix_window.pyx +2 -2
- sage/matrix/misc_mpfr.cpython-310-darwin.so +0 -0
- sage/matrix/operation_table.py +0 -2
- sage/matrix/special.py +5 -1
- sage/matrix/strassen.cpython-310-darwin.so +0 -0
- sage/matrix/strassen.pyx +1 -1
- sage/matroids/basis_exchange_matroid.cpython-310-darwin.so +0 -0
- sage/matroids/basis_matroid.cpython-310-darwin.so +0 -0
- sage/matroids/chow_ring.py +68 -65
- sage/matroids/chow_ring_ideal.py +41 -38
- sage/matroids/circuit_closures_matroid.cpython-310-darwin.so +0 -0
- sage/matroids/circuits_matroid.cpython-310-darwin.so +0 -0
- sage/matroids/database_matroids.py +16 -5
- sage/matroids/dual_matroid.py +2 -2
- sage/matroids/extension.cpython-310-darwin.so +0 -0
- sage/matroids/flats_matroid.cpython-310-darwin.so +0 -0
- sage/matroids/gammoid.py +1 -1
- sage/matroids/graphic_matroid.cpython-310-darwin.so +0 -0
- sage/matroids/graphic_matroid.pyx +3 -3
- sage/matroids/lean_matrix.cpython-310-darwin.so +0 -0
- sage/matroids/lean_matrix.pyx +22 -22
- sage/matroids/linear_matroid.cpython-310-darwin.so +0 -0
- sage/matroids/linear_matroid.pyx +13 -13
- sage/matroids/matroid.cpython-310-darwin.so +0 -0
- sage/matroids/matroid.pyx +15 -15
- sage/matroids/matroids_plot_helpers.py +48 -46
- sage/matroids/minor_matroid.py +2 -2
- sage/matroids/set_system.cpython-310-darwin.so +0 -0
- sage/matroids/transversal_matroid.cpython-310-darwin.so +0 -0
- sage/matroids/transversal_matroid.pyx +3 -3
- sage/matroids/union_matroid.cpython-310-darwin.so +0 -0
- sage/matroids/union_matroid.pyx +3 -0
- sage/matroids/unpickling.cpython-310-darwin.so +0 -0
- sage/matroids/utilities.py +2 -2
- sage/misc/c3.cpython-310-darwin.so +0 -0
- sage/misc/compat.py +1 -2
- sage/misc/pickle_old.cpython-310-darwin.so +0 -0
- sage/modules/diamond_cutting.py +117 -30
- sage/modules/fg_pid/fgp_module.py +3 -3
- sage/modules/filtered_vector_space.py +4 -4
- sage/modules/finite_submodule_iter.cpython-310-darwin.so +0 -0
- sage/modules/fp_graded/free_module.py +2 -2
- sage/modules/fp_graded/module.py +2 -2
- sage/modules/fp_graded/morphism.py +4 -4
- sage/modules/fp_graded/steenrod/morphism.py +1 -1
- sage/modules/free_module.py +162 -26
- sage/modules/free_module_element.cpython-310-darwin.so +0 -0
- sage/modules/free_module_element.pyx +4 -4
- sage/modules/free_module_integer.py +2 -2
- sage/modules/free_module_morphism.py +3 -3
- sage/modules/free_module_pseudohomspace.py +352 -0
- sage/modules/free_module_pseudomorphism.py +578 -0
- sage/modules/free_quadratic_module_integer_symmetric.py +24 -13
- sage/modules/matrix_morphism.py +9 -9
- sage/modules/multi_filtered_vector_space.py +4 -4
- sage/modules/ore_module.py +2208 -0
- sage/modules/ore_module_element.py +178 -0
- sage/modules/ore_module_homspace.py +147 -0
- sage/modules/ore_module_morphism.py +968 -0
- sage/modules/quotient_module.py +11 -1
- sage/modules/submodule.py +1 -1
- sage/modules/torsion_quadratic_module.py +1 -1
- sage/modules/vector_complex_double_dense.cpython-310-darwin.so +0 -0
- sage/modules/vector_double_dense.cpython-310-darwin.so +0 -0
- sage/modules/vector_integer_dense.cpython-310-darwin.so +0 -0
- sage/modules/vector_integer_sparse.cpython-310-darwin.so +0 -0
- sage/modules/vector_integer_sparse.pyx +4 -4
- sage/modules/vector_modn_dense.cpython-310-darwin.so +0 -0
- sage/modules/vector_modn_sparse.cpython-310-darwin.so +0 -0
- sage/modules/vector_numpy_dense.cpython-310-darwin.so +0 -0
- sage/modules/vector_numpy_integer_dense.cpython-310-darwin.so +0 -0
- sage/modules/vector_rational_dense.cpython-310-darwin.so +0 -0
- sage/modules/vector_rational_dense.pyx +1 -1
- sage/modules/vector_rational_sparse.cpython-310-darwin.so +0 -0
- sage/modules/vector_rational_sparse.pyx +5 -5
- sage/modules/vector_real_double_dense.cpython-310-darwin.so +0 -0
- sage/modules/vector_space_morphism.py +2 -2
- sage/modules/with_basis/cell_module.py +17 -0
- sage/modules/with_basis/indexed_element.cpython-310-darwin.so +0 -0
- sage/modules/with_basis/indexed_element.pyx +1 -1
- sage/modules/with_basis/invariant.py +1 -1
- sage/modules/with_basis/representation.py +0 -1
- sage/modules/with_basis/subquotient.py +2 -2
- sage/numerical/gauss_legendre.cpython-310-darwin.so +0 -0
- sage/probability/probability_distribution.cpython-310-darwin.so +0 -0
- sage/quadratic_forms/binary_qf.py +11 -11
- sage/quadratic_forms/bqf_class_group.py +26 -92
- sage/quadratic_forms/count_local_2.cpython-310-darwin.so +0 -0
- sage/quadratic_forms/extras.py +1 -1
- sage/quadratic_forms/quadratic_form.py +5 -4
- sage/quadratic_forms/quadratic_form__equivalence_testing.py +7 -4
- sage/quadratic_forms/quadratic_form__evaluate.cpython-310-darwin.so +0 -0
- sage/quadratic_forms/quadratic_form__local_field_invariants.py +10 -10
- sage/quadratic_forms/quadratic_form__ternary_Tornaria.py +2 -2
- sage/quadratic_forms/ternary.cpython-310-darwin.so +0 -0
- sage/quadratic_forms/ternary_qf.py +50 -83
- sage/rings/cfinite_sequence.py +16 -17
- sage/rings/complex_conversion.cpython-310-darwin.so +0 -0
- sage/rings/complex_double.cpython-310-darwin.so +0 -0
- sage/rings/complex_double.pxd +1 -0
- sage/rings/complex_double.pyx +37 -32
- sage/rings/complex_mpc.cpython-310-darwin.so +0 -0
- sage/rings/complex_mpc.pyx +27 -23
- sage/rings/complex_mpfr.cpython-310-darwin.so +0 -0
- sage/rings/complex_mpfr.pyx +11 -11
- sage/rings/function_field/drinfeld_modules/charzero_drinfeld_module.py +277 -21
- sage/rings/function_field/drinfeld_modules/drinfeld_module.py +10 -1
- sage/rings/function_field/drinfeld_modules/finite_drinfeld_module.py +1 -1
- sage/rings/function_field/drinfeld_modules/homset.py +1 -2
- sage/rings/function_field/drinfeld_modules/morphism.py +2 -2
- sage/rings/function_field/hermite_form_polynomial.cpython-310-darwin.so +0 -0
- sage/rings/function_field/khuri_makdisi.cpython-310-darwin.so +0 -0
- sage/rings/function_field/khuri_makdisi.pyx +27 -25
- sage/rings/invariants/invariant_theory.py +61 -60
- sage/rings/invariants/reconstruction.py +8 -8
- sage/rings/polynomial/laurent_polynomial_mpair.cpython-310-darwin.so +0 -0
- sage/rings/polynomial/ore_function_element.py +1 -1
- sage/rings/polynomial/ore_polynomial_element.cpython-310-darwin.so +0 -0
- sage/rings/polynomial/ore_polynomial_element.pyx +8 -8
- sage/rings/polynomial/ore_polynomial_ring.py +134 -17
- sage/rings/polynomial/polynomial_real_mpfr_dense.cpython-310-darwin.so +0 -0
- sage/rings/polynomial/skew_polynomial_element.cpython-310-darwin.so +0 -0
- sage/rings/polynomial/skew_polynomial_finite_field.cpython-310-darwin.so +0 -0
- sage/rings/polynomial/skew_polynomial_finite_field.pyx +3 -4
- sage/rings/polynomial/skew_polynomial_finite_order.cpython-310-darwin.so +0 -0
- sage/rings/polynomial/skew_polynomial_finite_order.pyx +2 -5
- sage/rings/real_double_element_gsl.cpython-310-darwin.so +0 -0
- sage/rings/real_mpfr.cpython-310-darwin.so +0 -0
- sage/rings/real_mpfr.pyx +25 -7
- sage/rings/ring_extension.cpython-310-darwin.so +0 -0
- sage/rings/ring_extension.pyx +4 -2
- sage/rings/ring_extension_conversion.cpython-310-darwin.so +0 -0
- sage/rings/ring_extension_element.cpython-310-darwin.so +0 -0
- sage/rings/ring_extension_element.pyx +42 -0
- sage/rings/ring_extension_morphism.cpython-310-darwin.so +0 -0
- sage/schemes/all__sagemath_modules.py +1 -0
- sage/schemes/projective/all__sagemath_modules.py +1 -0
- sage/schemes/projective/coherent_sheaf.py +300 -0
- sage/schemes/projective/cohomology.py +510 -0
- sage/stats/basic_stats.py +17 -15
- sage/stats/distributions/dgs_misc.h +11 -4
- sage/stats/distributions/discrete_gaussian_integer.cpython-310-darwin.so +0 -0
- sage/stats/distributions/discrete_gaussian_integer.pyx +9 -7
- sage/stats/hmm/chmm.cpython-310-darwin.so +0 -0
- sage/stats/hmm/chmm.pyx +13 -13
- sage/stats/hmm/distributions.cpython-310-darwin.so +0 -0
- sage/stats/hmm/distributions.pxd +3 -3
- sage/stats/hmm/distributions.pyx +3 -3
- sage/stats/hmm/hmm.cpython-310-darwin.so +0 -0
- sage/stats/hmm/hmm.pxd +3 -3
- sage/stats/hmm/hmm.pyx +6 -6
- sage/stats/hmm/util.cpython-310-darwin.so +0 -0
- sage/stats/hmm/util.pyx +6 -6
- sage/stats/intlist.cpython-310-darwin.so +0 -0
- sage/stats/intlist.pxd +3 -3
- sage/stats/time_series.cpython-310-darwin.so +0 -0
- sage/tensor/modules/alternating_contr_tensor.py +3 -3
- sage/tensor/modules/comp.py +3 -3
- sage/tensor/modules/ext_pow_free_module.py +3 -3
- sage/tensor/modules/format_utilities.py +3 -3
- sage/tensor/modules/free_module_linear_group.py +3 -3
- sage/tensor/modules/free_module_morphism.py +0 -1
- sage/tensor/modules/tensor_free_module.py +3 -3
- sage/tensor/modules/tensor_free_submodule.py +1 -1
- sage/tensor/modules/tensor_free_submodule_basis.py +1 -1
- sage/tensor/modules/tensor_with_indices.py +5 -5
- passagemath_modules.dylibs/libopenblas_armv8p-r0.3.28.dylib +0 -0
- {passagemath_modules-10.5.32.dist-info → passagemath_modules-10.6.20.dist-info}/top_level.txt +0 -0
|
@@ -617,7 +617,7 @@ def is_hyperbolic(self, p) -> bool:
|
|
|
617
617
|
self.hasse_invariant(p) == 1)
|
|
618
618
|
|
|
619
619
|
|
|
620
|
-
def is_anisotropic(self, p):
|
|
620
|
+
def is_anisotropic(self, p) -> bool:
|
|
621
621
|
r"""
|
|
622
622
|
Check if the quadratic form is anisotropic over the `p`-adic numbers `\QQ_p` or `\RR`.
|
|
623
623
|
|
|
@@ -687,7 +687,7 @@ def is_anisotropic(self, p):
|
|
|
687
687
|
raise NotImplementedError("we have not established a convention for 0-dim'l quadratic forms")
|
|
688
688
|
|
|
689
689
|
|
|
690
|
-
def is_isotropic(self, p):
|
|
690
|
+
def is_isotropic(self, p) -> bool:
|
|
691
691
|
r"""
|
|
692
692
|
Check if `Q` is isotropic over the `p`-adic numbers `\QQ_p` or `\RR`.
|
|
693
693
|
|
|
@@ -926,9 +926,9 @@ def compute_definiteness_string_by_determinants(self):
|
|
|
926
926
|
return "pos_def" if first_coeff > 0 else "neg_def"
|
|
927
927
|
|
|
928
928
|
|
|
929
|
-
def is_positive_definite(self):
|
|
929
|
+
def is_positive_definite(self) -> bool:
|
|
930
930
|
"""
|
|
931
|
-
|
|
931
|
+
Determine if the given quadratic form is positive-definite.
|
|
932
932
|
|
|
933
933
|
.. NOTE::
|
|
934
934
|
|
|
@@ -963,9 +963,9 @@ def is_positive_definite(self):
|
|
|
963
963
|
return (def_str == "pos_def") or (def_str == "zero")
|
|
964
964
|
|
|
965
965
|
|
|
966
|
-
def is_negative_definite(self):
|
|
966
|
+
def is_negative_definite(self) -> bool:
|
|
967
967
|
"""
|
|
968
|
-
|
|
968
|
+
Determine if the given quadratic form is negative-definite.
|
|
969
969
|
|
|
970
970
|
.. NOTE::
|
|
971
971
|
|
|
@@ -1000,9 +1000,9 @@ def is_negative_definite(self):
|
|
|
1000
1000
|
return (def_str == "neg_def") or (def_str == "zero")
|
|
1001
1001
|
|
|
1002
1002
|
|
|
1003
|
-
def is_indefinite(self):
|
|
1003
|
+
def is_indefinite(self) -> bool:
|
|
1004
1004
|
"""
|
|
1005
|
-
|
|
1005
|
+
Determine if the given quadratic form is indefinite.
|
|
1006
1006
|
|
|
1007
1007
|
.. NOTE::
|
|
1008
1008
|
|
|
@@ -1037,9 +1037,9 @@ def is_indefinite(self):
|
|
|
1037
1037
|
return def_str == "indefinite"
|
|
1038
1038
|
|
|
1039
1039
|
|
|
1040
|
-
def is_definite(self):
|
|
1040
|
+
def is_definite(self) -> bool:
|
|
1041
1041
|
"""
|
|
1042
|
-
|
|
1042
|
+
Determine if the given quadratic form is (positive or negative) definite.
|
|
1043
1043
|
|
|
1044
1044
|
.. NOTE::
|
|
1045
1045
|
|
|
@@ -90,7 +90,7 @@ def content(self):
|
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
# in quadratic_form.py
|
|
93
|
-
# def is_primitive(self):
|
|
93
|
+
# def is_primitive(self) -> bool:
|
|
94
94
|
# """
|
|
95
95
|
# Checks if the form is a multiple of another form... only over ZZ for now.
|
|
96
96
|
# """
|
|
@@ -111,7 +111,7 @@ def content(self):
|
|
|
111
111
|
|
|
112
112
|
def adjoint(self):
|
|
113
113
|
"""
|
|
114
|
-
|
|
114
|
+
Return the adjoint (integral) quadratic form associated to the
|
|
115
115
|
given form, essentially defined by taking the adjoint of the matrix.
|
|
116
116
|
|
|
117
117
|
EXAMPLES::
|
|
Binary file
|
|
@@ -71,7 +71,8 @@ class TernaryQF(SageObject):
|
|
|
71
71
|
sage: TestSuite(TernaryQF).run()
|
|
72
72
|
"""
|
|
73
73
|
|
|
74
|
-
__slots__ = ['_a', '_b', '_c', '_r', '_s', '_t',
|
|
74
|
+
__slots__ = ['_a', '_b', '_c', '_r', '_s', '_t',
|
|
75
|
+
'_automorphisms', '_number_of_automorphisms']
|
|
75
76
|
|
|
76
77
|
possible_automorphisms = None
|
|
77
78
|
|
|
@@ -91,7 +92,6 @@ class TernaryQF(SageObject):
|
|
|
91
92
|
[1 2 3]
|
|
92
93
|
[4 5 6]
|
|
93
94
|
"""
|
|
94
|
-
|
|
95
95
|
if len(v) != 6:
|
|
96
96
|
# Check we have six coefficients
|
|
97
97
|
raise ValueError("Ternary quadratic form must be given by a list of six coefficients")
|
|
@@ -99,9 +99,9 @@ class TernaryQF(SageObject):
|
|
|
99
99
|
self._automorphisms = None
|
|
100
100
|
self._number_of_automorphisms = None
|
|
101
101
|
|
|
102
|
-
def coefficients(self):
|
|
102
|
+
def coefficients(self) -> tuple:
|
|
103
103
|
r"""
|
|
104
|
-
Return the
|
|
104
|
+
Return the tuple of coefficients of the ternary quadratic form.
|
|
105
105
|
|
|
106
106
|
EXAMPLES::
|
|
107
107
|
|
|
@@ -114,7 +114,7 @@ class TernaryQF(SageObject):
|
|
|
114
114
|
"""
|
|
115
115
|
return self._a, self._b, self._c, self._r, self._s, self._t
|
|
116
116
|
|
|
117
|
-
def __hash__(self):
|
|
117
|
+
def __hash__(self) -> int:
|
|
118
118
|
"""
|
|
119
119
|
Return a hash for ``self``.
|
|
120
120
|
|
|
@@ -125,7 +125,6 @@ class TernaryQF(SageObject):
|
|
|
125
125
|
5881802312257552497 # 64-bit
|
|
126
126
|
1770036893 # 32-bit
|
|
127
127
|
"""
|
|
128
|
-
|
|
129
128
|
return hash(self.coefficients())
|
|
130
129
|
|
|
131
130
|
def coefficient(self, n):
|
|
@@ -167,7 +166,7 @@ class TernaryQF(SageObject):
|
|
|
167
166
|
x, y, z = polygens(ZZ, names)
|
|
168
167
|
return self._a * x**2 + self._b * y**2 + self._c * z**2 + self._t * x*y + self._s * x*z + self._r * y*z
|
|
169
168
|
|
|
170
|
-
def _repr_(self):
|
|
169
|
+
def _repr_(self) -> str:
|
|
171
170
|
r"""
|
|
172
171
|
Display the quadratic form.
|
|
173
172
|
|
|
@@ -231,19 +230,19 @@ class TernaryQF(SageObject):
|
|
|
231
230
|
# Check if v has 3 cols
|
|
232
231
|
if v.ncols() == 3:
|
|
233
232
|
M = v.transpose() * self.matrix() * v
|
|
234
|
-
return TernaryQF([M[0, 0]//2, M[1, 1]//2, M[2, 2]//2,
|
|
233
|
+
return TernaryQF([M[0, 0] // 2, M[1, 1] // 2, M[2, 2] // 2,
|
|
235
234
|
M[1, 2], M[0, 2], M[0, 1]])
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
235
|
+
|
|
236
|
+
return QuadraticForm(ZZ, v.transpose() * self.matrix() * v)
|
|
237
|
+
if isinstance(v, (Vector, list, tuple)):
|
|
239
238
|
# Check that v has length 3
|
|
240
239
|
if len(v) != 3:
|
|
241
240
|
raise TypeError("your vector needs to have length 3")
|
|
242
241
|
v0, v1, v2 = v
|
|
243
242
|
a, b, c, r, s, t = self.coefficients()
|
|
244
243
|
return a*v0**2 + b*v1**2 + c*v2**2 + r*v1*v2 + s*v0*v2 + t*v0*v1
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
|
|
245
|
+
raise TypeError("presently we can only evaluate a quadratic form on a list, tuple, vector or matrix")
|
|
247
246
|
|
|
248
247
|
def quadratic_form(self):
|
|
249
248
|
r"""
|
|
@@ -261,11 +260,13 @@ class TernaryQF(SageObject):
|
|
|
261
260
|
sage: bool(QF1 == QF2)
|
|
262
261
|
True
|
|
263
262
|
"""
|
|
264
|
-
return QuadraticForm(ZZ, 3, [self._a, self._t, self._s,
|
|
263
|
+
return QuadraticForm(ZZ, 3, [self._a, self._t, self._s,
|
|
264
|
+
self._b, self._r, self._c])
|
|
265
265
|
|
|
266
266
|
def matrix(self):
|
|
267
267
|
r"""
|
|
268
268
|
Return the Hessian matrix associated to the ternary quadratic form.
|
|
269
|
+
|
|
269
270
|
That is, if `Q` is a ternary quadratic form, `Q(x,y,z) = a\cdot x^2 + b\cdot y^2 + c\cdot z^2 + r\cdot y\cdot z + s\cdot x\cdot z + t\cdot x\cdot y`,
|
|
270
271
|
then the Hessian matrix associated to `Q` is
|
|
271
272
|
::
|
|
@@ -290,12 +291,15 @@ class TernaryQF(SageObject):
|
|
|
290
291
|
sage: (v*M*v.column())[0]//2
|
|
291
292
|
28
|
|
292
293
|
"""
|
|
293
|
-
|
|
294
|
-
|
|
294
|
+
return matrix(ZZ, 3, 3, [2 * self._a, self._t, self._s,
|
|
295
|
+
self._t, 2 * self._b, self._r,
|
|
296
|
+
self._s, self._r, 2 * self._c])
|
|
295
297
|
|
|
296
298
|
def disc(self):
|
|
297
299
|
r"""
|
|
298
|
-
Return the discriminant of the ternary quadratic form
|
|
300
|
+
Return the discriminant of the ternary quadratic form.
|
|
301
|
+
|
|
302
|
+
This is the determinant of the matrix divided by 2.
|
|
299
303
|
|
|
300
304
|
EXAMPLES::
|
|
301
305
|
|
|
@@ -305,7 +309,8 @@ class TernaryQF(SageObject):
|
|
|
305
309
|
sage: Q.matrix().det()
|
|
306
310
|
-50
|
|
307
311
|
"""
|
|
308
|
-
return 4*self._a*self._b*self._c + self._r*self._s*self._t
|
|
312
|
+
return (4*self._a*self._b*self._c + self._r*self._s*self._t
|
|
313
|
+
- self._a*self._r**2 - self._b*self._s**2 - self._c*self._t**2)
|
|
309
314
|
|
|
310
315
|
def is_definite(self) -> bool:
|
|
311
316
|
"""
|
|
@@ -325,28 +330,13 @@ class TernaryQF(SageObject):
|
|
|
325
330
|
d1 = self._a
|
|
326
331
|
if d1 == 0:
|
|
327
332
|
return False
|
|
328
|
-
d2 = 4*self._a*self._b-self._t**2
|
|
329
|
-
if d2
|
|
333
|
+
d2 = 4 * self._a * self._b - self._t**2
|
|
334
|
+
if d2 <= 0:
|
|
330
335
|
return False
|
|
331
336
|
d3 = self.disc()
|
|
332
337
|
if d3 == 0:
|
|
333
338
|
return False
|
|
334
|
-
|
|
335
|
-
if d2 > 0:
|
|
336
|
-
if d3 > 0:
|
|
337
|
-
return True
|
|
338
|
-
else:
|
|
339
|
-
return False
|
|
340
|
-
else:
|
|
341
|
-
return False
|
|
342
|
-
else:
|
|
343
|
-
if d2 > 0:
|
|
344
|
-
if d3 < 0:
|
|
345
|
-
return True
|
|
346
|
-
else:
|
|
347
|
-
return False
|
|
348
|
-
else:
|
|
349
|
-
return False
|
|
339
|
+
return (d1 > 0) == (d3 > 0)
|
|
350
340
|
|
|
351
341
|
def is_positive_definite(self) -> bool:
|
|
352
342
|
"""
|
|
@@ -371,22 +361,13 @@ class TernaryQF(SageObject):
|
|
|
371
361
|
d1 = self._a
|
|
372
362
|
if d1 == 0:
|
|
373
363
|
return False
|
|
374
|
-
d2 = 4*self._a*self._b-self._t**2
|
|
375
|
-
if d2
|
|
364
|
+
d2 = 4 * self._a * self._b - self._t**2
|
|
365
|
+
if d2 <= 0:
|
|
376
366
|
return False
|
|
377
367
|
d3 = self.disc()
|
|
378
368
|
if d3 == 0:
|
|
379
369
|
return False
|
|
380
|
-
|
|
381
|
-
if d2 > 0:
|
|
382
|
-
if d3 > 0:
|
|
383
|
-
return True
|
|
384
|
-
else:
|
|
385
|
-
return False
|
|
386
|
-
else:
|
|
387
|
-
return False
|
|
388
|
-
else:
|
|
389
|
-
return False
|
|
370
|
+
return d1 > 0 and d3 > 0
|
|
390
371
|
|
|
391
372
|
def is_negative_definite(self) -> bool:
|
|
392
373
|
"""
|
|
@@ -406,22 +387,13 @@ class TernaryQF(SageObject):
|
|
|
406
387
|
d1 = self._a
|
|
407
388
|
if d1 == 0:
|
|
408
389
|
return False
|
|
409
|
-
d2 = 4*self._a*self._b-self._t**2
|
|
410
|
-
if d2
|
|
390
|
+
d2 = 4 * self._a * self._b - self._t**2
|
|
391
|
+
if d2 <= 0:
|
|
411
392
|
return False
|
|
412
393
|
d3 = self.disc()
|
|
413
394
|
if d3 == 0:
|
|
414
395
|
return False
|
|
415
|
-
|
|
416
|
-
if d2 > 0:
|
|
417
|
-
if d3 < 0:
|
|
418
|
-
return True
|
|
419
|
-
else:
|
|
420
|
-
return False
|
|
421
|
-
else:
|
|
422
|
-
return False
|
|
423
|
-
else:
|
|
424
|
-
return False
|
|
396
|
+
return d1 < 0 and d3 < 0
|
|
425
397
|
|
|
426
398
|
def __neg__(self):
|
|
427
399
|
"""
|
|
@@ -488,7 +460,7 @@ class TernaryQF(SageObject):
|
|
|
488
460
|
"""
|
|
489
461
|
l = self.coefficients()
|
|
490
462
|
g = gcd(l)
|
|
491
|
-
return TernaryQF([a//g for a in l])
|
|
463
|
+
return TernaryQF([a // g for a in l])
|
|
492
464
|
|
|
493
465
|
def scale_by_factor(self, k):
|
|
494
466
|
"""
|
|
@@ -951,7 +923,6 @@ class TernaryQF(SageObject):
|
|
|
951
923
|
sage: neig.count(Q2)
|
|
952
924
|
3
|
|
953
925
|
"""
|
|
954
|
-
|
|
955
926
|
z = self.find_zeros_mod_p(p)
|
|
956
927
|
return [self.find_p_neighbor_from_vec(p, v, mat) for v in z]
|
|
957
928
|
|
|
@@ -965,7 +936,6 @@ class TernaryQF(SageObject):
|
|
|
965
936
|
sage: Q.basic_lemma(3)
|
|
966
937
|
4
|
|
967
938
|
"""
|
|
968
|
-
|
|
969
939
|
return _basic_lemma(self._a, self._b, self._c, self._r, self._s, self._t, p)
|
|
970
940
|
|
|
971
941
|
def xi(self, p):
|
|
@@ -1056,7 +1026,7 @@ class TernaryQF(SageObject):
|
|
|
1056
1026
|
|
|
1057
1027
|
return identity_matrix(3) - v.column()*matrix(v)*self.matrix()/self(v)
|
|
1058
1028
|
|
|
1059
|
-
def automorphism_symmetries(self, A):
|
|
1029
|
+
def automorphism_symmetries(self, A) -> list:
|
|
1060
1030
|
"""
|
|
1061
1031
|
Given the automorphism `A`, if `A` is the identity, return the empty list.
|
|
1062
1032
|
Otherwise, return a list of two vectors `v_1`, `v_2` such that the product of
|
|
@@ -1086,20 +1056,15 @@ class TernaryQF(SageObject):
|
|
|
1086
1056
|
sage: Q.automorphism_symmetries(identity_matrix(ZZ,3))
|
|
1087
1057
|
[]
|
|
1088
1058
|
"""
|
|
1089
|
-
|
|
1090
1059
|
if A == identity_matrix(3):
|
|
1091
1060
|
return []
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
for b2 in bs:
|
|
1100
|
-
if b2 != 0:
|
|
1101
|
-
break
|
|
1102
|
-
return [b1, b2]
|
|
1061
|
+
|
|
1062
|
+
bs = (A - 1).columns()
|
|
1063
|
+
b1 = next(v for v in bs if v)
|
|
1064
|
+
A1 = self.symmetry(b1) * A
|
|
1065
|
+
bs = (A1 - 1).columns()
|
|
1066
|
+
b2 = next(v for v in bs if v)
|
|
1067
|
+
return [b1, b2]
|
|
1103
1068
|
|
|
1104
1069
|
def automorphism_spin_norm(self, A):
|
|
1105
1070
|
"""
|
|
@@ -1118,14 +1083,17 @@ class TernaryQF(SageObject):
|
|
|
1118
1083
|
"""
|
|
1119
1084
|
if A == identity_matrix(ZZ, 3):
|
|
1120
1085
|
return 1
|
|
1121
|
-
|
|
1122
|
-
s = self(
|
|
1086
|
+
b1, b2 = self.automorphism_symmetries(A)
|
|
1087
|
+
s = self(b1) * self(b2)
|
|
1123
1088
|
return s.squarefree_part()
|
|
1124
1089
|
|
|
1125
|
-
def _border(self, n):
|
|
1090
|
+
def _border(self, n) -> bool:
|
|
1126
1091
|
"""
|
|
1127
1092
|
Auxiliary function to find the automorphisms of a positive definite ternary quadratic form.
|
|
1128
|
-
|
|
1093
|
+
|
|
1094
|
+
It returns a boolean whether the n-condition is true.
|
|
1095
|
+
|
|
1096
|
+
If ``Q = TernaryQF([a,b,c,r,s,t])``, the conditions are:
|
|
1129
1097
|
|
|
1130
1098
|
1. a = t, s = 2r.
|
|
1131
1099
|
2. a = s, t = 2r.
|
|
@@ -1195,7 +1163,6 @@ class TernaryQF(SageObject):
|
|
|
1195
1163
|
sage: Q16._border(16)
|
|
1196
1164
|
True
|
|
1197
1165
|
"""
|
|
1198
|
-
|
|
1199
1166
|
a, b, c, r, s, t = self.coefficients()
|
|
1200
1167
|
if n == 1:
|
|
1201
1168
|
return (a == t) and (s == 2*r)
|
|
@@ -1308,7 +1275,6 @@ class TernaryQF(SageObject):
|
|
|
1308
1275
|
sage: Q._automorphisms_reduced_fast()
|
|
1309
1276
|
[(1, 0, 0, 0, 1, 0, 0, 0, 1)]
|
|
1310
1277
|
"""
|
|
1311
|
-
|
|
1312
1278
|
if self._border(1):
|
|
1313
1279
|
if self._border(2):
|
|
1314
1280
|
if self._border(14):
|
|
@@ -1673,6 +1639,7 @@ class TernaryQF(SageObject):
|
|
|
1673
1639
|
def _automorphisms_reduced_slow(self):
|
|
1674
1640
|
"""
|
|
1675
1641
|
Return the automorphisms of the reduced ternary quadratic form.
|
|
1642
|
+
|
|
1676
1643
|
It searches over all 3x3 matrices with coefficients -1, 0, 1,
|
|
1677
1644
|
determinant 1 and finite order, because Eisenstein reduced forms
|
|
1678
1645
|
are Minkowski reduced. See Cassels.
|
|
@@ -2024,7 +1991,7 @@ def find_all_ternary_qf_by_level_disc(N, d):
|
|
|
2024
1991
|
...
|
|
2025
1992
|
ValueError: There are no ternary forms of this level and discriminant
|
|
2026
1993
|
"""
|
|
2027
|
-
return [TernaryQF(
|
|
1994
|
+
return [TernaryQF(qf) for qf in _find_all_ternary_qf_by_level_disc(N, d)]
|
|
2028
1995
|
|
|
2029
1996
|
|
|
2030
1997
|
def find_a_ternary_qf_by_level_disc(N, d):
|
sage/rings/cfinite_sequence.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# sage_setup: distribution = sagemath-modules
|
|
2
2
|
r"""
|
|
3
|
-
C-
|
|
3
|
+
C-finite sequences
|
|
4
4
|
|
|
5
5
|
C-finite infinite sequences satisfy homogeneous linear recurrences with constant coefficients:
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ C-finite infinite sequences satisfy homogeneous linear recurrences with constant
|
|
|
8
8
|
|
|
9
9
|
a_{n+d} = c_0a_n + c_1a_{n+1} + \cdots + c_{d-1}a_{n+d-1}, \quad d>0.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
They are completely defined by their ordinary generating function (o.g.f., which
|
|
12
12
|
is always a :mod:`fraction <sage.rings.fraction_field_element>` of
|
|
13
13
|
:mod:`polynomials <sage.rings.polynomial.polynomial_element>` over `\ZZ` or `\QQ` ).
|
|
14
14
|
|
|
@@ -69,9 +69,17 @@ can be guessed::
|
|
|
69
69
|
|
|
70
70
|
:func:`fibonacci`, :class:`BinaryRecurrenceSequence`
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
.. TODO::
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
Implement a feature enabling::
|
|
75
|
+
|
|
76
|
+
sage: # not implemented
|
|
77
|
+
sage: CFiniteSequence(x+x^2+x^3+x^4+x^5+O(x^6))
|
|
78
|
+
sage: latex(r)
|
|
79
|
+
\big\{a_{n\ge0}\big|a_{n+2}=\sum_{i=0}^{1}c_ia_{n+i}, c=\{1,1\}, a_{n<2}=\{0,0,0,1\}\big\}
|
|
80
|
+
sage: r.egf()
|
|
81
|
+
exp(2*x)
|
|
82
|
+
sage: r = CFiniteSequence(1/(1-y-x*y), x)
|
|
75
83
|
|
|
76
84
|
REFERENCES:
|
|
77
85
|
|
|
@@ -79,6 +87,10 @@ REFERENCES:
|
|
|
79
87
|
- [KP2011]_
|
|
80
88
|
- [SZ1994]_
|
|
81
89
|
- [Zei2011]_
|
|
90
|
+
|
|
91
|
+
AUTHORS:
|
|
92
|
+
|
|
93
|
+
- Ralf Stephan (2014): initial version
|
|
82
94
|
"""
|
|
83
95
|
|
|
84
96
|
# ****************************************************************************
|
|
@@ -1292,16 +1304,3 @@ class CFiniteSequences_generic(Parent, UniqueRepresentation):
|
|
|
1292
1304
|
if num == 0 or sequence != S(num / den).list():
|
|
1293
1305
|
return 0
|
|
1294
1306
|
return CFiniteSequence(num / den)
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
r"""
|
|
1298
|
-
.. TODO::
|
|
1299
|
-
|
|
1300
|
-
sage: # not implemented
|
|
1301
|
-
sage: CFiniteSequence(x+x^2+x^3+x^4+x^5+O(x^6))
|
|
1302
|
-
sage: latex(r)
|
|
1303
|
-
\big\{a_{n\ge0}\big|a_{n+2}=\sum_{i=0}^{1}c_ia_{n+i}, c=\{1,1\}, a_{n<2}=\{0,0,0,1\}\big\}
|
|
1304
|
-
sage: r.egf()
|
|
1305
|
-
exp(2*x)
|
|
1306
|
-
sage: r = CFiniteSequence(1/(1-y-x*y), x)
|
|
1307
|
-
"""
|
|
Binary file
|
|
Binary file
|
sage/rings/complex_double.pxd
CHANGED
sage/rings/complex_double.pyx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# sage_setup: distribution = sagemath-modules
|
|
2
2
|
# distutils: extra_compile_args = -D_XPG6
|
|
3
|
-
# distutils: libraries =
|
|
3
|
+
# distutils: libraries = M_LIBRARIES
|
|
4
|
+
# distutils: language = c++
|
|
5
|
+
# distutils: extra_compile_args = -std=c++11
|
|
4
6
|
r"""
|
|
5
7
|
Double precision floating point complex numbers
|
|
6
8
|
|
|
@@ -75,9 +77,8 @@ from sage.misc.randstate cimport randstate, current_randstate
|
|
|
75
77
|
|
|
76
78
|
from sage.libs.gsl.complex cimport *
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
double cabs(double complex)
|
|
80
|
+
cimport libcpp.complex
|
|
81
|
+
from libcpp.complex cimport abs, sqrt
|
|
81
82
|
|
|
82
83
|
import sage.rings.abc
|
|
83
84
|
cimport sage.rings.integer
|
|
@@ -1077,7 +1078,7 @@ cdef class ComplexDoubleElement(FieldElement):
|
|
|
1077
1078
|
|
|
1078
1079
|
INPUT:
|
|
1079
1080
|
|
|
1080
|
-
- ``format_spec`` -- string; a floating point format
|
|
1081
|
+
- ``format_spec`` -- string; a floating point format specifier as
|
|
1081
1082
|
defined by :python:`the format specification mini-language
|
|
1082
1083
|
<library/string.html#formatspec>` in Python
|
|
1083
1084
|
|
|
@@ -2289,10 +2290,10 @@ cdef class ComplexDoubleElement(FieldElement):
|
|
|
2289
2290
|
|
|
2290
2291
|
sage: a = CDF(-0.95,-0.65)
|
|
2291
2292
|
sage: b = CDF(0.683,0.747)
|
|
2292
|
-
sage: a.agm(b, algorithm='optimal')
|
|
2293
|
-
-0.3715916523517613 + 0.
|
|
2294
|
-
sage: a.agm(b, algorithm='principal') # rel tol
|
|
2295
|
-
0.33817546298618006 - 0.
|
|
2293
|
+
sage: a.agm(b, algorithm='optimal') # rel tol 1e-15
|
|
2294
|
+
-0.3715916523517613 + 0.31989466020683005*I
|
|
2295
|
+
sage: a.agm(b, algorithm='principal') # rel tol 2e-15
|
|
2296
|
+
0.33817546298618006 - 0.013532696956540483*I
|
|
2296
2297
|
sage: a.agm(b, algorithm='pari') # needs sage.libs.pari
|
|
2297
2298
|
-0.37159165235176134 + 0.31989466020683005*I
|
|
2298
2299
|
|
|
@@ -2305,7 +2306,7 @@ cdef class ComplexDoubleElement(FieldElement):
|
|
|
2305
2306
|
sage: a.agm(-a)
|
|
2306
2307
|
0.0
|
|
2307
2308
|
"""
|
|
2308
|
-
cdef double
|
|
2309
|
+
cdef libcpp.complex.complex[double] a, b, a1, b1, r
|
|
2309
2310
|
cdef double d, e, eps = 2.0**-51
|
|
2310
2311
|
|
|
2311
2312
|
if algorithm == "pari":
|
|
@@ -2326,21 +2327,21 @@ cdef class ComplexDoubleElement(FieldElement):
|
|
|
2326
2327
|
if algorithm=="optimal":
|
|
2327
2328
|
while True:
|
|
2328
2329
|
a1 = (a+b)/2
|
|
2329
|
-
b1 =
|
|
2330
|
+
b1 = sqrt(a*b)
|
|
2330
2331
|
r = b1/a1
|
|
2331
|
-
d =
|
|
2332
|
-
e =
|
|
2332
|
+
d = abs(r-1)
|
|
2333
|
+
e = abs(r+1)
|
|
2333
2334
|
if e < d:
|
|
2334
2335
|
b1=-b1
|
|
2335
2336
|
d = e
|
|
2336
|
-
if d < eps: return ComplexDoubleElement_from_doubles(a1.real, a1.imag)
|
|
2337
|
+
if d < eps: return ComplexDoubleElement_from_doubles(a1.real(), a1.imag())
|
|
2337
2338
|
a, b = a1, b1
|
|
2338
2339
|
|
|
2339
2340
|
elif algorithm=="principal":
|
|
2340
2341
|
while True:
|
|
2341
2342
|
a1 = (a+b)/2
|
|
2342
|
-
b1 =
|
|
2343
|
-
if
|
|
2343
|
+
b1 = sqrt(a*b)
|
|
2344
|
+
if abs((b1/a1)-1) < eps: return ComplexDoubleElement_from_doubles(a1.real(), a1.imag())
|
|
2344
2345
|
a, b = a1, b1
|
|
2345
2346
|
|
|
2346
2347
|
else:
|
|
@@ -2441,34 +2442,38 @@ cdef class ComplexDoubleElement(FieldElement):
|
|
|
2441
2442
|
from sage.libs.pari.convert_sage_complex_double import complex_double_element_zeta
|
|
2442
2443
|
return complex_double_element_zeta(self)
|
|
2443
2444
|
|
|
2444
|
-
def
|
|
2445
|
+
def algebraic_dependency(self, long n):
|
|
2445
2446
|
"""
|
|
2446
2447
|
Return a polynomial of degree at most `n` which is
|
|
2447
|
-
approximately satisfied by this complex number.
|
|
2448
|
-
returned polynomial need not be irreducible, and indeed usually
|
|
2449
|
-
won't be if `z` is a good approximation to an algebraic
|
|
2450
|
-
number of degree less than `n`.
|
|
2448
|
+
approximately satisfied by this complex number.
|
|
2451
2449
|
|
|
2452
|
-
|
|
2450
|
+
Note that the returned polynomial need not be irreducible, and
|
|
2451
|
+
indeed usually will not be if `z` is a good approximation to an
|
|
2452
|
+
algebraic number of degree less than `n`.
|
|
2453
|
+
|
|
2454
|
+
ALGORITHM: Uses the PARI C-library :pari:`algdep` command.
|
|
2453
2455
|
|
|
2454
2456
|
EXAMPLES::
|
|
2455
2457
|
|
|
2456
2458
|
sage: z = (1/2)*(1 + RDF(sqrt(3)) * CDF.0); z # abs tol 1e-16 # needs sage.symbolic
|
|
2457
2459
|
0.5 + 0.8660254037844387*I
|
|
2458
|
-
sage: p = z.
|
|
2460
|
+
sage: p = z.algebraic_dependency(5); p # needs sage.libs.pari sage.symbolic
|
|
2459
2461
|
x^2 - x + 1
|
|
2460
2462
|
sage: abs(z^2 - z + 1) < 1e-14 # needs sage.symbolic
|
|
2461
2463
|
True
|
|
2462
2464
|
|
|
2463
2465
|
::
|
|
2464
2466
|
|
|
2465
|
-
sage: CDF(0,2).
|
|
2467
|
+
sage: CDF(0,2).algebraic_dependency(10) # needs sage.libs.pari
|
|
2466
2468
|
x^2 + 4
|
|
2467
|
-
sage: CDF(1,5).
|
|
2469
|
+
sage: CDF(1,5).algebraic_dependency(2) # needs sage.libs.pari
|
|
2468
2470
|
x^2 - 2*x + 26
|
|
2469
2471
|
"""
|
|
2470
|
-
from sage.arith.misc import
|
|
2471
|
-
return
|
|
2472
|
+
from sage.arith.misc import algebraic_dependency
|
|
2473
|
+
return algebraic_dependency(self, n)
|
|
2474
|
+
|
|
2475
|
+
algdep = algebraic_dependency
|
|
2476
|
+
|
|
2472
2477
|
|
|
2473
2478
|
cdef class FloatToCDF(Morphism):
|
|
2474
2479
|
"""
|
|
@@ -2624,13 +2629,13 @@ def ComplexDoubleField():
|
|
|
2624
2629
|
from sage.misc.parser import Parser
|
|
2625
2630
|
cdef cdf_parser = Parser(float, float, {"I": _CDF.gen(), "i": _CDF.gen()})
|
|
2626
2631
|
|
|
2627
|
-
cdef inline double
|
|
2632
|
+
cdef inline libcpp.complex.complex[double] extract_double_complex(ComplexDoubleElement x) noexcept:
|
|
2628
2633
|
"""
|
|
2629
|
-
Return the value of ``x`` as a
|
|
2634
|
+
Return the value of ``x`` as a C++ complex<double>
|
|
2630
2635
|
"""
|
|
2631
|
-
cdef double
|
|
2632
|
-
z.real
|
|
2633
|
-
z.imag
|
|
2636
|
+
cdef libcpp.complex.complex[double] z
|
|
2637
|
+
z.real(GSL_REAL(x._complex))
|
|
2638
|
+
z.imag(GSL_IMAG(x._complex))
|
|
2634
2639
|
return z
|
|
2635
2640
|
|
|
2636
2641
|
|
|
Binary file
|