From a5801c75f8d767f138c14ba048c3f9668947b725 Mon Sep 17 00:00:00 2001 From: Erik Paemurru <143521159+paemurru@users.noreply.github.com> Date: Wed, 2 Oct 2024 20:32:18 +0200 Subject: [PATCH 01/51] Add missing Abelian groups docs (#1631) --- docs/Build.jl | 6 +++++- docs/src/manual/abelian/elements.md | 6 ++++++ docs/src/manual/abelian/introduction.md | 1 + docs/src/manual/abelian/maps.md | 9 ++++++++- docs/src/manual/abelian/structural.md | 6 ++++++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/Build.jl b/docs/Build.jl index 6038062de1..225a37b263 100644 --- a/docs/Build.jl +++ b/docs/Build.jl @@ -36,7 +36,11 @@ using Pkg, Nemo, Documenter, DocumenterVitepress, DocumenterCitations "elliptic_curves/basics.md", "elliptic_curves/finite_fields.md", "elliptic_curves/number_fields.md",], - "Abelian groups" => "abelian/introduction.md", + "Abelian groups" => [ "abelian/introduction.md", + "abelian/elements.md", + "abelian/maps.md", + "abelian/structural.md", + ], "Class field theory" => "class_fields/intro.md", "Misc" => ["FacElem.md", "sparse/intro.md", diff --git a/docs/src/manual/abelian/elements.md b/docs/src/manual/abelian/elements.md index 1434705bbe..15d9464c00 100644 --- a/docs/src/manual/abelian/elements.md +++ b/docs/src/manual/abelian/elements.md @@ -1,3 +1,9 @@ +```@meta +CurrentModule = Hecke +DocTestSetup = quote + using Hecke +end +``` ## Elements Elements in a finitely generated abelian group are of type `FinGenAbGroupElem` and are always given as a linear combination of the generators. diff --git a/docs/src/manual/abelian/introduction.md b/docs/src/manual/abelian/introduction.md index 363e11a08c..7610939ab4 100644 --- a/docs/src/manual/abelian/introduction.md +++ b/docs/src/manual/abelian/introduction.md @@ -1,4 +1,5 @@ ```@meta +CurrentModule = Hecke DocTestSetup = quote using Hecke end diff --git a/docs/src/manual/abelian/maps.md b/docs/src/manual/abelian/maps.md index 665f241c3f..f507f23618 100644 --- a/docs/src/manual/abelian/maps.md +++ b/docs/src/manual/abelian/maps.md @@ -1,7 +1,14 @@ +```@meta +CurrentModule = Hecke +DocTestSetup = quote + using Hecke +end +``` +## Maps Maps between abelian groups are mainly of type `FinGenAbGroupHom`. They allow normal map operations such as `image`, `preimage`, `domain`, `codomain` and can be created in a variety of situations. -## Maps + Maps between abelian groups can be constructed via - images of the generators - pairs of elements diff --git a/docs/src/manual/abelian/structural.md b/docs/src/manual/abelian/structural.md index 2201408c5d..2149f9d81c 100644 --- a/docs/src/manual/abelian/structural.md +++ b/docs/src/manual/abelian/structural.md @@ -1,3 +1,9 @@ +```@meta +CurrentModule = Hecke +DocTestSetup = quote + using Hecke +end +``` ## Structural Computations Abelian groups support a wide range of structural operations such as - enumeration of subgroups From b671e6ffcdfcb6c1a6d87ea611ffdca0af094d10 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Mon, 7 Oct 2024 12:40:46 +0200 Subject: [PATCH 02/51] oscarci: fix running on master (#1635) --- .github/workflows/oscar.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oscar.yml b/.github/workflows/oscar.yml index 723b4c0ee1..9088f1902a 100644 --- a/.github/workflows/oscar.yml +++ b/.github/workflows/oscar.yml @@ -22,7 +22,7 @@ jobs: outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} env: - PR_NUMBER: ${{github.event.number}} + PR_NUMBER: ${{github.event.number || '0' }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v4 From fc09bc16eb5c4a002c4478b5c4ada1eed48b1b6b Mon Sep 17 00:00:00 2001 From: Erik Paemurru <143521159+paemurru@users.noreply.github.com> Date: Wed, 9 Oct 2024 08:53:58 +0200 Subject: [PATCH 03/51] Remove the unused `build` variable (#1636) --- docs/Build.jl | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) diff --git a/docs/Build.jl b/docs/Build.jl index 225a37b263..7e006fa73b 100644 --- a/docs/Build.jl +++ b/docs/Build.jl @@ -6,55 +6,6 @@ module Build using Pkg, Nemo, Documenter, DocumenterVitepress, DocumenterCitations - pages = [ - "index.md", - "Number fields" => [ "number_fields/intro.md", - "number_fields/fields.md", - "number_fields/elements.md", - "number_fields/complex_embeddings.md", - "number_fields/internal.md"], - "Function fields" => [ "function_fields/intro.md", - "function_fields/basics.md", - "function_fields/elements.md", - "function_fields/internal.md", - "function_fields/degree_localization.md"], - "Orders" => [ "orders/introduction.md", - "orders/orders.md", - "orders/elements.md", - "orders/ideals.md", - "orders/frac_ideals.md" - ], - "Quadratic and hermitian forms" => [ "quad_forms/introduction.md", - "quad_forms/basics.md", - "quad_forms/lattices.md", - "quad_forms/genusherm.md", - "quad_forms/integer_lattices.md", - "quad_forms/Zgenera.md", - "quad_forms/discriminant_group.md" - ], - "Elliptic curves" => [ "elliptic_curves/intro.md", - "elliptic_curves/basics.md", - "elliptic_curves/finite_fields.md", - "elliptic_curves/number_fields.md",], - "Abelian groups" => [ "abelian/introduction.md", - "abelian/elements.md", - "abelian/maps.md", - "abelian/structural.md", - ], - "Class field theory" => "class_fields/intro.md", - "Misc" => ["FacElem.md", - "sparse/intro.md", - "pmat/introduction.md", - "misc/conjugacy.md", - ], - "Extra features" => ["features/mset.md", - ], - "Examples" => "examples.md", - "References" => "references.md", - "Developer" => [ "dev/test.md", - ] - ] - # Overwrite printing to make the header not full of redundant nonsense # Turns # Hecke.Order - Method From f17181dfbe667ecb98f33e8279dcb62b6e229c42 Mon Sep 17 00:00:00 2001 From: Erik Paemurru <143521159+paemurru@users.noreply.github.com> Date: Wed, 9 Oct 2024 08:54:07 +0200 Subject: [PATCH 04/51] Add missing "Conventions" section to docs (#1637) --- docs/src/.vitepress/config.mts | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/src/.vitepress/config.mts b/docs/src/.vitepress/config.mts index 910aecd99d..e063348242 100644 --- a/docs/src/.vitepress/config.mts +++ b/docs/src/.vitepress/config.mts @@ -57,6 +57,7 @@ export default defineConfig({ collapsed: true, items: [ { text: 'Introduction', link: 'manual/number_fields/intro'}, + { text: 'Conventions', link: 'manual/number_fields/conventions'}, { text: 'Number field operations', link: 'manual/number_fields/fields'}, { text: 'Elements', link: 'manual/number_fields/elements'}, { text: 'Complex embeddings', link: 'manual/number_fields/complex_embeddings'}, From 137e6292bdf39ec1b8ea6188abd9cb48fe5eef87 Mon Sep 17 00:00:00 2001 From: Erik Paemurru <143521159+paemurru@users.noreply.github.com> Date: Wed, 9 Oct 2024 08:54:32 +0200 Subject: [PATCH 05/51] Update abelian group docs (#1638) To match with the other documentation. Also fix one typo. --- docs/src/manual/abelian/elements.md | 12 ++++++------ docs/src/manual/abelian/introduction.md | 10 +++------- docs/src/manual/abelian/maps.md | 2 +- docs/src/manual/abelian/structural.md | 10 +++++----- docs/src/manual/number_fields/conventions.md | 2 +- docs/src/manual/orders/orders.md | 2 +- 6 files changed, 17 insertions(+), 21 deletions(-) diff --git a/docs/src/manual/abelian/elements.md b/docs/src/manual/abelian/elements.md index 15d9464c00..159c127b73 100644 --- a/docs/src/manual/abelian/elements.md +++ b/docs/src/manual/abelian/elements.md @@ -4,13 +4,13 @@ DocTestSetup = quote using Hecke end ``` -## Elements +# Elements Elements in a finitely generated abelian group are of type `FinGenAbGroupElem` and are always given as a linear combination of the generators. Internally this representation is normliased to have a unique representative. -### Creation +## Creation In addition to the standard function `id`, `zero` and `one` that can be used to create the neutral element, we also support more targeted creation: ```@docs @@ -22,22 +22,22 @@ rand(G::FinGenAbGroup) rand(G::FinGenAbGroup, B::ZZRingElem) parent(x::FinGenAbGroupElem) ``` -### Access +## Access ```@docs getindex(x::FinGenAbGroupElem, i::Int) ``` -### Predicates +## Predicates We have the standard predicates `iszero`, `isone` and `is_identity` to test an element for being trivial. -### Invariants +## Invariants ```@docs order(A::FinGenAbGroupElem) ``` -### Iterator +## Iterator One can iterate over the elements of a finite abelian group. ```@repl diff --git a/docs/src/manual/abelian/introduction.md b/docs/src/manual/abelian/introduction.md index 7610939ab4..16fc882ad9 100644 --- a/docs/src/manual/abelian/introduction.md +++ b/docs/src/manual/abelian/introduction.md @@ -4,18 +4,14 @@ DocTestSetup = quote using Hecke end ``` -# [Abelian Groups](@id AbelianGroupLink2) - -Here we describe the interface to abelian groups in Hecke. - -## Introduction +# [Introduction](@id AbelianGroupLink2) Within Hecke, abelian groups are of generic abstract type `GrpAb` which does not have to be finitely generated, $\mathbb Q/\mathbb Z$ is an example of a more general abelian group. Having said that, most of the functionality is restricted to abelian groups that are finitely presented as $\mathbb Z$-modules. -### Basic Creation +## Basic Creation Finitely presented (as $\mathbb Z$-modules) abelian groups are of type `FinGenAbGroup` with elements of type `FinGenAbGroupElem`. The creation is mostly via a relation @@ -51,7 +47,7 @@ using Hecke # hide abelian_groups(8) ``` -### Invariants +## Invariants ```@docs is_snf(A::FinGenAbGroup) number_of_generators(A::FinGenAbGroup) diff --git a/docs/src/manual/abelian/maps.md b/docs/src/manual/abelian/maps.md index f507f23618..f3df9fbdf1 100644 --- a/docs/src/manual/abelian/maps.md +++ b/docs/src/manual/abelian/maps.md @@ -4,7 +4,7 @@ DocTestSetup = quote using Hecke end ``` -## Maps +# Maps Maps between abelian groups are mainly of type `FinGenAbGroupHom`. They allow normal map operations such as `image`, `preimage`, `domain`, `codomain` and can be created in a variety of situations. diff --git a/docs/src/manual/abelian/structural.md b/docs/src/manual/abelian/structural.md index 2149f9d81c..df518389df 100644 --- a/docs/src/manual/abelian/structural.md +++ b/docs/src/manual/abelian/structural.md @@ -4,7 +4,7 @@ DocTestSetup = quote using Hecke end ``` -## Structural Computations +# Structural Computations Abelian groups support a wide range of structural operations such as - enumeration of subgroups - (outer) direct products @@ -17,7 +17,7 @@ snf(A::FinGenAbGroup) Hecke.find_isomorphism(G, op, A::Hecke.GrpAb) ``` -### Subgroups and Quotients +## Subgroups and Quotients ```@docs torsion_subgroup(G::FinGenAbGroup) sub(G::FinGenAbGroup, s::Vector{FinGenAbGroupElem}) @@ -81,7 +81,7 @@ The difference between `issubset =` $\subset$ and intersect(mG::FinGenAbGroupHom, mH::FinGenAbGroupHom) ``` -### Direct Products +## Direct Products ```@docs direct_product(G::FinGenAbGroup...) canonical_injection(G::FinGenAbGroup, i::Int) @@ -89,13 +89,13 @@ canonical_projection(G::FinGenAbGroup, i::Int) flat(G::FinGenAbGroup) ``` -### Tensor Producs +## Tensor Producs ```@docs tensor_product(G::FinGenAbGroup...) hom_tensor(G::FinGenAbGroup, H::FinGenAbGroup, A::Vector{ <: Map{FinGenAbGroup, FinGenAbGroup}}) ``` -### Hom-Group +## Hom-Group ```@docs hom(::FinGenAbGroup, ::FinGenAbGroup) ``` diff --git a/docs/src/manual/number_fields/conventions.md b/docs/src/manual/number_fields/conventions.md index d9e86e3739..90f90237b9 100644 --- a/docs/src/manual/number_fields/conventions.md +++ b/docs/src/manual/number_fields/conventions.md @@ -1,4 +1,4 @@ -### Number fields +# Conventions By an absolute number field we mean finite extensions of $\mathbf Q$, which is of type `AbsSimpleNumField` and whose elements are of type `AbsSimpleNumFieldElem`. Such an diff --git a/docs/src/manual/orders/orders.md b/docs/src/manual/orders/orders.md index a0dcc12f06..0960c1c57e 100644 --- a/docs/src/manual/orders/orders.md +++ b/docs/src/manual/orders/orders.md @@ -100,7 +100,7 @@ All of the functions have a very similar interface: they return an abelian group and a map converting elements of the group into the objects required. The maps also allow a point-wise inverse to server as the *discrete logarithm* map. -For more information on abelian group, see [here](@ref AbelianGroupLink2), +For more information on abelian groups, see [here](@ref AbelianGroupLink2), for ideals, [here](@ref NfOrdIdlLink2). - [`torsion_unit_group(::AbsSimpleNumFieldOrder)`](@ref) From 506e87c56a3af7c009105d6aeb8ed118485f5481 Mon Sep 17 00:00:00 2001 From: Erik Paemurru <143521159+paemurru@users.noreply.github.com> Date: Wed, 9 Oct 2024 22:29:47 +0200 Subject: [PATCH 06/51] Add function that prints Hecke banner (#1641) --- src/Hecke.jl | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/Hecke.jl b/src/Hecke.jl index a4da653ada..e2564f0d9f 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -144,30 +144,32 @@ end global const maximal_order = MaximalOrder +function _print_banner() + println("") + print("Welcome to \n") + printstyled(raw" + _ _ _ + | | | | | | + | |__| | ___ ___| | _____ + | __ |/ _ \/ __| |/ / _ \ + | | | | __/ (__| < __/ + |_| |_|\___|\___|_|\_\___|", color = :red) + println() + print("Version") + printstyled(" $VERSION_NUMBER ", color = :green) + print("... \n ... which comes with absolutely no warranty whatsoever") + println() + println("(c) 2015-2024 by Claus Fieker, Tommy Hofmann and Carlo Sircana") + println() +end + function __init__() # verify some base rings survived serialization/deserialization @assert base_ring(Hecke.Globals.Zx) === FlintZZ @assert base_ring(Hecke.Globals.Qx) === FlintQQ if AbstractAlgebra.should_show_banner() && get(ENV, "HECKE_PRINT_BANNER", "true") != "false" - println("") - print("Welcome to \n") - printstyled(" - _ _ _ - | | | | | | - | |__| | ___ ___| | _____ - | __ |/ _ \\/ __| |/ / _ \\ - | | | | __/ (__| < __/ - |_| |_|\\___|\\___|_|\\_\\___| - ", color = :red) - - println() - print("Version") - printstyled(" $VERSION_NUMBER ", color = :green) - print("... \n ... which comes with absolutely no warranty whatsoever") - println() - println("(c) 2015-2024 by Claus Fieker, Tommy Hofmann and Carlo Sircana") - println() + _print_banner() end #if inNotebook() # to make toggle work in IJulia From 142fe2bb881d1eed69032266d95e386aea7a0e8a Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Thu, 10 Oct 2024 01:48:43 +0200 Subject: [PATCH 07/51] test: add example for #1629 (#1644) Closes #1625 --- test/RCF/rcf.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/RCF/rcf.jl b/test/RCF/rcf.jl index 8a3abd90b8..61f26e5d45 100644 --- a/test/RCF/rcf.jl +++ b/test/RCF/rcf.jl @@ -372,3 +372,11 @@ let ll1 = abelian_extensions(K, [2, 2], ZZRingElem(10)^12, signatures = [(4, 4)], conductors = conds) @test length(l1) == length(ll1) end + +let + # https://github.com/thofma/Hecke.jl/issues/1625 + K, a = cyclotomic_field(7, :a) + P, x = polynomial_ring(K, :x) + L, = number_field(x^3 - 840539241479//13824*a^5 - 18036715089631//9216*a^4 - 18036715089631//9216*a^3 - 840539241479//13824*a^2 - 7320065966297//9216) + @test !is_abelian(L) +end From 8e02c5b3b482f410e07ba3b14854ad5873cb1443 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Thu, 10 Oct 2024 09:15:34 +0200 Subject: [PATCH 08/51] doc: add instructions to build documentation (#1645) Closes #1642 --- docs/src/.vitepress/config.mts | 2 +- docs/src/manual/developer/documentation.md | 27 ++++++++++++++++++++++ src/Hecke.jl | 7 +++--- 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 docs/src/manual/developer/documentation.md diff --git a/docs/src/.vitepress/config.mts b/docs/src/.vitepress/config.mts index e063348242..32af371ea7 100644 --- a/docs/src/.vitepress/config.mts +++ b/docs/src/.vitepress/config.mts @@ -132,8 +132,8 @@ export default defineConfig({ text: 'Developer', collapsed: true, items: [ - { text: 'Macros', link: 'manual/developer/macros'}, { text: 'Tests', link: 'manual/developer/test'}, + { text: 'Documentation', link: 'manual/developer/documentation'}, ] } ] diff --git a/docs/src/manual/developer/documentation.md b/docs/src/manual/developer/documentation.md new file mode 100644 index 0000000000..0434f803e8 --- /dev/null +++ b/docs/src/manual/developer/documentation.md @@ -0,0 +1,27 @@ +# Documentation + +The files for the documentation are located in the +`docs/src/manual/` directory. + +## Adding files to the documentation + +To add files to the documentation edit directly the file +`docs/src/.vitepress/config.mts`. + +## Building the documentation + +1. Run julia and execute (with Hecke developed in your current environment) +```julia-repl +julia> using Hecke + +julia> Hecke.build_doc() # or Hecke.build_doc(;doctest = false) to speed things up +``` + +2. In the terminal, navigate to `docs/` and run +```bash +Hecke/docs> npm run docs:build +``` +(This step takes place outside of julia.) + +!!! note + To speed up the development process, step 1 can be repeated within the same julia session. diff --git a/src/Hecke.jl b/src/Hecke.jl index e2564f0d9f..8227336652 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -787,11 +787,10 @@ function build_doc(; doctest=false, strict=false, format=:vitepress) if format == :html open_doc() elseif format == :vitepress - println("""Run `mkdocs serve` inside `../Hecke/docs/` to view the documentation. - - Use `format = :html` for a simplified version of the docs which does - not require `mkdocs`. + println("""Run `npm run docs:dev` inside `../Hecke/docs/` to view the documentation. """) + else + error("format :$(format) not recognized") end end From f170a5cf8c9e7cc6e9aebe32319ff1bf7df655fe Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Thu, 10 Oct 2024 09:15:44 +0200 Subject: [PATCH 09/51] chore: update .gitignore (#1646) --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 84a8c8f0a6..5d49503ede 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ docs/site/* docs/build/* Manifest.toml .DS_Store +docs/node_modules/* +docs/package-lock.json From bc98930c4b1f920ee549dbd6cb88f6bca131a545 Mon Sep 17 00:00:00 2001 From: Erik Paemurru <143521159+paemurru@users.noreply.github.com> Date: Thu, 10 Oct 2024 09:15:53 +0200 Subject: [PATCH 10/51] Fix missing newline from banner (#1647) --- src/Hecke.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Hecke.jl b/src/Hecke.jl index 8227336652..bd63987ead 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -155,6 +155,7 @@ function _print_banner() | | | | __/ (__| < __/ |_| |_|\___|\___|_|\_\___|", color = :red) println() + println() print("Version") printstyled(" $VERSION_NUMBER ", color = :green) print("... \n ... which comes with absolutely no warranty whatsoever") From 29108df76de53b8b75aac7cae4c364e61311d224 Mon Sep 17 00:00:00 2001 From: Erik Paemurru <143521159+paemurru@users.noreply.github.com> Date: Fri, 11 Oct 2024 19:33:46 +0200 Subject: [PATCH 11/51] Building documentation creates temporary files (#1648) These should be ignored. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 5d49503ede..d30b7eac59 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ deps/hecke/libhecke.so.0 deps/hecke/libhecke.so.0.0.0 docs/site/* docs/build/* +docs/node_modules/* +docs/package-lock.json Manifest.toml .DS_Store docs/node_modules/* From 4ffee6eaccf3be4c5ddcf97cb7b8387cb3924853 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 17 Oct 2024 01:37:30 +0200 Subject: [PATCH 12/51] Use set!, zero!, etc. in yet more places (#1649) --- Project.toml | 2 +- examples/Det.jl | 22 +++++++++++----------- src/AlgAss/AlgGrp.jl | 6 +++--- src/AlgAss/Elem.jl | 2 +- src/AlgAssRelOrd/Eichler.jl | 3 ++- src/Hecke.jl | 2 +- src/LargeField/misc2.jl | 4 ++-- src/LocalField/Conjugates.jl | 2 +- src/LocalField/qAdic.jl | 2 +- src/Misc/Matrix.jl | 12 ++++++------ src/Misc/coprime.jl | 4 ++-- src/NumField/NfAbs/NonSimple.jl | 2 +- src/NumFieldOrd/NfOrd/Ideal/TwoElement.jl | 2 +- src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl | 2 +- src/QuadForm/Enumeration.jl | 10 +++------- src/Sparse/Matrix.jl | 2 +- 16 files changed, 38 insertions(+), 41 deletions(-) diff --git a/Project.toml b/Project.toml index f568c74ad5..bb51168006 100644 --- a/Project.toml +++ b/Project.toml @@ -37,7 +37,7 @@ LazyArtifacts = "1.6" Libdl = "1.6" LinearAlgebra = "1.6" Markdown = "1.6" -Nemo = "^0.47.1" +Nemo = "^0.47.2" Pkg = "1.6" Polymake = "0.10, 0.11" Printf = "1.6" diff --git a/examples/Det.jl b/examples/Det.jl index 073a914bc6..390f6b0014 100644 --- a/examples/Det.jl +++ b/examples/Det.jl @@ -69,12 +69,12 @@ function perturb!(A, n::Int = 100, c::AbstractRange = -10:10; side::Symbol = :bo else error("side has to be :right, :left or :both") end - for i=1:n + for i=1:n x = rand(c) while iszero(x) x = rand(c) end - if rnd() + if rnd() k = rand(1:nrows(A)) l = rand(1:nrows(A)) while l == k @@ -583,7 +583,7 @@ function UniSolve(A::ZZMatrix, bb::ZZMatrix) EntrySize = maximum(abs, A) e = max(16, Int(2+ceil(2*log2(n)+log2(EntrySize)))); println("Modulus has $e bits"); - + B0 = zero_matrix(ZZ,n,n) ## will be computed by crt in loop below m = ZZ(1); p = 2^29; # MAGIC NUMBER (initial prime, probably should be about 2^29?) @time while (nbits(m) < e) @@ -688,9 +688,9 @@ function renorm(U::ZZMatrix, m::ZZRingElem; start::Int = 1, last::Int = nrows(U) R_ptr = Nemo.mat_entry_ptr(R, 1, 1) U_ptr = Nemo.mat_entry_ptr(U, i, 1) for j=1:ncols(U) - ccall((:fmpz_add, Nemo.libflint), Cvoid, (Ptr{ZZRingElem}, Ptr{ZZRingElem}, Ptr{ZZRingElem}), R_ptr, R_ptr, U_ptr) + add!(R_ptr, R_ptr, U_ptr) mod_sym!(U_ptr, R_ptr, m, t) - ccall((:fmpz_sub, Nemo.libflint), Cvoid, (Ptr{ZZRingElem}, Ptr{ZZRingElem}, Ptr{ZZRingElem}), R_ptr, R_ptr, U_ptr) + sub!(R_ptr, R_ptr, U_ptr) ccall((:fmpz_divexact, Nemo.libflint), Cvoid, (Ptr{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), R_ptr, R_ptr, m) R_ptr += sizeof(Clong) U_ptr += sizeof(Clong) @@ -705,8 +705,8 @@ function renorm(U::ZZMatrix, m::ZZRingElem; start::Int = 1, last::Int = nrows(U) U_ptr = Nemo.mat_entry_ptr(U, i, 1) R_ptr = Nemo.mat_entry_ptr(R, 1, 1) for j=1:ncols(U) - ccall((:fmpz_set, Nemo.libflint), Cvoid, (Ptr{ZZRingElem}, Ptr{ZZRingElem}), U_ptr, R_ptr) - ccall((:fmpz_zero, Nemo.libflint), Cvoid, (Ptr{ZZRingElem},), R_ptr) + set!(U_ptr, R_ptr) + zero!(R_ptr) R_ptr += sizeof(Clong) U_ptr += sizeof(Clong) end @@ -957,7 +957,7 @@ function DetS(A::ZZMatrix, U::AbstractArray= -100:100; use_rns::Bool = false) isone(d) && break d1 *= d @show (Had - nbits(d1) - nbits(prod_p))/60 - @show mod_sym(d1, prod_p) , det_p + @show mod_sym(d1, prod_p) , det_p if Had - nbits(d1) < nbits(prod_p) @show "at H-bound", (Had - nbits(d1) - nbits(prod_p))/60 return d1 @@ -1039,7 +1039,7 @@ function induce_rational_reconstruction(a::ZZMatrix, b::ZZRingElem) A_ptr = Nemo.mat_entry_ptr(A, i, 1) for j=1:ncols(a) # @show i, j - ccall((:fmpz_set, Nemo.libflint), Cvoid, (Ref{ZZRingElem}, Ptr{ZZRingElem}), T, a_ptr) + set!(T, a_ptr) Nemo.mul!(T, T, D) Nemo.mod!(T, T, b) fl = ratrec!(n, d, T, b) @@ -1048,7 +1048,7 @@ function induce_rational_reconstruction(a::ZZMatrix, b::ZZRingElem) D = D*d Nemo.mul!(A, A, d) end - ccall((:fmpz_set, Nemo.libflint), Cvoid, (Ptr{ZZRingElem}, Ref{ZZRingElem}), A_ptr, n) + set!(A_ptr, n) a_ptr += sizeof(ZZRingElem) A_ptr += sizeof(ZZRingElem) @@ -1179,7 +1179,7 @@ function dixon_init(A::ZZMatrix, B::ZZMatrix, T::DataType = fpMatrix) D.bound = 2*maximum(abs, [_D, _N])^2 * 2^30 D.crt_primes = UInt[] D.A_mod = T[] - + pr = ZZ(1) xp = next_prime(p) maxA = maximum(abs, A) *(p-1)*n*2 diff --git a/src/AlgAss/AlgGrp.jl b/src/AlgAss/AlgGrp.jl index 1c044879f4..68365e56dc 100644 --- a/src/AlgAss/AlgGrp.jl +++ b/src/AlgAss/AlgGrp.jl @@ -875,7 +875,7 @@ function __set_row!(y::QQMatrix, k, c) begin for i in 1:length(c) t = mat_entry_ptr(y, k, i) - ccall((:fmpq_set, libflint), Cvoid, (Ptr{QQFieldElem}, Ref{QQFieldElem}), t, c[i]) + set!(t, c[i]) end end nothing @@ -886,7 +886,7 @@ function __set_row!(c::Vector{QQFieldElem}, y::QQMatrix, k) begin for i in 1:length(c) t = mat_entry_ptr(y, k, i) - ccall((:fmpq_set, libflint), Cvoid, (Ref{QQFieldElem}, Ptr{QQFieldElem}), c[i], t) + set!(c[i], t) end end nothing @@ -895,7 +895,7 @@ end function __set!(y, k, c) GC.@preserve y begin t = mat_entry_ptr(y, 1, k) - ccall((:fmpq_set, libflint), Cvoid, (Ptr{QQFieldElem}, Ref{QQFieldElem}), t, c) + set!(t, c) end nothing end diff --git a/src/AlgAss/Elem.jl b/src/AlgAss/Elem.jl index 8347287191..86eefa2243 100644 --- a/src/AlgAss/Elem.jl +++ b/src/AlgAss/Elem.jl @@ -836,7 +836,7 @@ function elem_to_mat_row!(x::ZZMatrix, i::Int, d::ZZRingElem, a::AbstractAssocia x[i, j] = z_q.num[1, j] end - ccall((:fmpz_set, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}), d, z_q.den) + set!(d, z_q.den) return nothing end diff --git a/src/AlgAssRelOrd/Eichler.jl b/src/AlgAssRelOrd/Eichler.jl index 631760d54f..dbc94a9839 100644 --- a/src/AlgAssRelOrd/Eichler.jl +++ b/src/AlgAssRelOrd/Eichler.jl @@ -207,7 +207,8 @@ function _eichler_find_transforming_unit(I::AlgAssRelOrdIdl, J::AlgAssRelOrdIdl) end function get_coeff_fmpz!(x::fqPolyRepFieldElem, n::Int, z::ZZRingElem) - ccall((:fmpz_set_ui, libflint), Nothing, (Ref{ZZRingElem}, UInt), z, ccall((:nmod_poly_get_coeff_ui, libflint), UInt, (Ref{fqPolyRepFieldElem}, Int), x, n)) + c = ccall((:nmod_poly_get_coeff_ui, libflint), UInt, (Ref{fqPolyRepFieldElem}, Int), x, n) + set!(z, c) return z end diff --git a/src/Hecke.jl b/src/Hecke.jl index bd63987ead..7bf61b03f6 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -122,7 +122,7 @@ import Nemo: acb_struct, Ring, Group, Field, zzModRing, zzModRingElem, arf_struc FpField, acb_vec, array, acb_vec_clear, force_coerce, force_op, fmpz_mod_ctx_struct, divisors, is_zero_entry, IntegerUnion, remove!, valuation!, is_cyclo_type, is_embedded, is_maxreal_type, - mat_entry_ptr, factor_trial_range + mat_entry_ptr, factor_trial_range, set! AbstractAlgebra.@include_deprecated_bindings() Nemo.@include_deprecated_bindings() diff --git a/src/LargeField/misc2.jl b/src/LargeField/misc2.jl index c1e0445e9f..934d03f62b 100644 --- a/src/LargeField/misc2.jl +++ b/src/LargeField/misc2.jl @@ -131,7 +131,7 @@ function local_norm!(n::ZZRingElem, ap::Vector{fqPolyRepFieldElem}, me::Hecke.mo ccall((:fq_nmod_norm, libflint), Nothing, (Ref{ZZRingElem}, Ref{fqPolyRepFieldElem}, Ref{fqPolyRepField}), n, ap[j], ap[j].parent) nn = ccall((:n_mulmod2_preinv, libflint), UInt, (UInt, UInt, UInt, UInt), nn, UInt(n), me.up, me.upinv) end - ccall((:fmpz_set_ui, libflint), Nothing, (Ref{ZZRingElem}, UInt), n, nn) + set!(n, nn) return n end @@ -259,7 +259,7 @@ function local_norm!(n::ZZRingElem, ap::zzModMatrix, me::Hecke.modular_env) np = Nemo.getindex_raw(ap, j, 1) nn = ccall((:n_mulmod2_preinv, libflint), UInt, (UInt, UInt, UInt, UInt), nn, np, me.up, me.upinv) end - ccall((:fmpz_set_ui, libflint), Nothing, (Ref{ZZRingElem}, UInt), n, nn) + set!(n, nn) return n end diff --git a/src/LocalField/Conjugates.jl b/src/LocalField/Conjugates.jl index d68b62246f..379984d332 100644 --- a/src/LocalField/Conjugates.jl +++ b/src/LocalField/Conjugates.jl @@ -600,7 +600,7 @@ function completion(K::AbsSimpleNumField, ca::QadicFieldElem) # djj = lift_root(f, ajj, bjj, p, 10) # d = K(parent(K.pol)(djj)) ccall((:nf_elem_set, libantic), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), c, d, K) - ccall((:fmpz_set_si, libflint), Nothing, (Ref{ZZRingElem}, Cint), pc, precision(x)) + set!(pc, precision(x)) elseif precision(x) < pc d = mod_sym(c, p^precision(x)) else diff --git a/src/LocalField/qAdic.jl b/src/LocalField/qAdic.jl index 849ff75808..d8dad62c43 100644 --- a/src/LocalField/qAdic.jl +++ b/src/LocalField/qAdic.jl @@ -56,7 +56,7 @@ end function getUnit(a::PadicFieldElem) u = ZZRingElem() - ccall((:fmpz_set, libflint), Cvoid, (Ref{ZZRingElem}, Ref{Int}), u, a.u) + u = set!(u, a.u) return u, a.v, a.N end diff --git a/src/Misc/Matrix.jl b/src/Misc/Matrix.jl index 356091a70a..d41a6786b9 100644 --- a/src/Misc/Matrix.jl +++ b/src/Misc/Matrix.jl @@ -330,7 +330,7 @@ function _copy_matrix_into_matrix(A::ZZMatrix, i::Int, j::Int, B::ZZMatrix) for l in 0:ncols(B) - 1 d = mat_entry_ptr(B, 1 + k, 1 + l) t = mat_entry_ptr(A, i + k, j + l) - ccall((:fmpz_set, libflint), Nothing, (Ptr{ZZRingElem}, Ptr{ZZRingElem}), t, d) + set!(t, d) end end end @@ -342,7 +342,7 @@ function _copy_matrix_into_matrix(A::QQMatrix, i::Int, j::Int, B::QQMatrix) for l in 0:ncols(B) - 1 d = mat_entry_ptr(B, 1 + k, 1 + l) t = mat_entry_ptr(A, i + k, j + l) - ccall((:fmpq_set, libflint), Nothing, (Ptr{QQFieldElem}, Ptr{QQFieldElem}), t, d) + set!(t, d) end end end @@ -532,13 +532,13 @@ function snf_for_groups(A::ZZMatrix, mod::ZZRingElem) Rik = mat_entry_ptr(R, i, k) Rjk = mat_entry_ptr(R, j, k) aux = ZZRingElem() - ccall((:fmpz_mul, libflint), Nothing, (Ref{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), aux, Rik, e) + mul!(aux, Rik, e) ccall((:fmpz_addmul, libflint), Nothing, (Ref{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), aux, Rjk, f) aux1 = ZZRingElem() - ccall((:fmpz_mul, libflint), Nothing, (Ref{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), aux1, Rjk, a) + mul!(aux1, Rjk, a) ccall((:fmpz_submul, libflint), Nothing, (Ref{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), aux1, Rik, b) - ccall((:fmpz_set, libflint), Nothing, (Ptr{ZZRingElem}, Ref{ZZRingElem}), Rik, aux) - ccall((:fmpz_set, libflint), Nothing, (Ptr{ZZRingElem}, Ref{ZZRingElem}), Rjk, aux1) + set!(Rik, aux) + set!(Rjk, aux1) #R[i, k], R[j, k] = e*R[i,k]+f*R[j,k], -b*R[i,k]+a*R[j,k] end end diff --git a/src/Misc/coprime.jl b/src/Misc/coprime.jl index b632f18c10..8b02a2a12e 100644 --- a/src/Misc/coprime.jl +++ b/src/Misc/coprime.jl @@ -50,12 +50,12 @@ function copy_into!(a::MPolyRingElem, b::MPolyRingElem) end function copy_into!(a::ZZRingElem, b::ZZRingElem) - ccall((:fmpz_set, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}), a, b) + set!(a, b) return a end function copy_into!(a::QQFieldElem, b::QQFieldElem) - ccall((:fmpq_set, libflint), Nothing, (Ref{QQFieldElem}, Ref{QQFieldElem}), a, b) + set!(a, b) return a end diff --git a/src/NumField/NfAbs/NonSimple.jl b/src/NumField/NfAbs/NonSimple.jl index 114c722fc9..1748690b4c 100644 --- a/src/NumField/NfAbs/NonSimple.jl +++ b/src/NumField/NfAbs/NonSimple.jl @@ -412,7 +412,7 @@ function elem_to_mat_row!(M::ZZMatrix, i::Int, d::ZZRingElem, a::AbsNonSimpleNum M[i, j] = z_q.num[1, j] end - ccall((:fmpz_set, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}), d, z_q.den) + set!(d, z_q.den) return nothing end diff --git a/src/NumFieldOrd/NfOrd/Ideal/TwoElement.jl b/src/NumFieldOrd/NfOrd/Ideal/TwoElement.jl index 20ac0a022a..e527268c86 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/TwoElement.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/TwoElement.jl @@ -192,7 +192,7 @@ function _assure_weakly_normal_presentation(A::AbsNumFieldOrderIdeal) # Put the entries of B into the (1 x d)-Matrix m for i in 1:degree(O) s = mat_entry_ptr(m, 1, i) - ccall((:fmpz_set, libflint), Nothing, (Ptr{ZZRingElem}, Ref{ZZRingElem}), s, B[i]) + set!(s, B[i]) end if iszero(m) diff --git a/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl b/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl index 9070ef5cc0..96780ddc64 100644 --- a/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl +++ b/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl @@ -865,7 +865,7 @@ function find_random_second_gen(A::AbsNumFieldOrderIdeal{S, T}) where {S, T} # Put the entries of B into the (1 x d)-Matrix m for i in 1:degree(O) s = mat_entry_ptr(m, 1, i) - ccall((:fmpz_set, libflint), Nothing, (Ptr{ZZRingElem}, Ref{ZZRingElem}), s, B[i]) + set!(s, B[i]) end if iszero(m) continue diff --git a/src/QuadForm/Enumeration.jl b/src/QuadForm/Enumeration.jl index fa09753e0d..11a1028d9a 100644 --- a/src/QuadForm/Enumeration.jl +++ b/src/QuadForm/Enumeration.jl @@ -522,7 +522,7 @@ function ___enumerate_cholesky(::Type{Vector}, Q::Matrix{QQFieldElem}, l::Union{ if _short_enough # t1 must be a UInt #z = QQFieldElem() - #ccall((:fmpq_set, libflint), Cvoid, (Ref{QQFieldElem}, Ref{QQFieldElem}), z, t1) + #set!(z, t1) # Todo y = Vector{elem_type}(undef, n) if S === elem_type @@ -752,11 +752,7 @@ end return s end -function _deepcopy_cheap(x::QQFieldElem) - z = QQFieldElem() - ccall((:fmpq_set, libflint), Cvoid, (Ref{QQFieldElem}, Ref{QQFieldElem}), z, x) - return z -end +_deepcopy_cheap(x::QQFieldElem) = set!(QQFieldElem(), x) function is_lessorequal(x::QQFieldElem, y::UInt) c = ccall((:fmpq_cmp_ui, libflint), Cint, (Ref{QQFieldElem}, UInt), x, y) @@ -1050,7 +1046,7 @@ end end @inline function add_two!(z::ZZRingElem, x::ZZRingElem) - ccall((:fmpz_add_ui, libflint), Cvoid, (Ref{ZZRingElem}, Ref{ZZRingElem}, Int), z, x, 2) + add!(z, x, 2) return z end diff --git a/src/Sparse/Matrix.jl b/src/Sparse/Matrix.jl index 800ced222d..a97e81ce45 100644 --- a/src/Sparse/Matrix.jl +++ b/src/Sparse/Matrix.jl @@ -310,7 +310,7 @@ end @inline function _get(x::Ptr{ZZRingElem}) z = ZZRingElem() - ccall((:fmpz_set, libflint), Cvoid, (Ref{ZZRingElem}, Ptr{ZZRingElem}), z, x) + set!(z, x) return z end From 276ac56da998fb5ace7239e82cc241009619682a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 17 Oct 2024 22:42:24 +0200 Subject: [PATCH 13/51] Use set!, zero!, etc. in YET more places (#1650) Also switch to Nemo.denominator! and Nemo.numerator!, and remove add_two! which now is equivalent to `add!(x, 2)`. --- examples/Det.jl | 6 +-- src/AlgAss/Elem.jl | 2 +- src/AlgAss/Map.jl | 2 +- src/AlgAssAbsOrd/PIP/bley_johnston.jl | 14 +++---- src/Hecke.jl | 2 +- src/LinearAlgebra/LatEnum.jl | 4 +- src/Misc/CRT.jl | 6 +-- src/Misc/Matrix.jl | 29 +++++++-------- src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl | 2 +- src/NumFieldOrd/NfOrd/ResidueRing.jl | 6 +-- src/QuadForm/Enumeration.jl | 45 +++++------------------ 11 files changed, 46 insertions(+), 72 deletions(-) diff --git a/examples/Det.jl b/examples/Det.jl index 390f6b0014..2fc89c2108 100644 --- a/examples/Det.jl +++ b/examples/Det.jl @@ -720,7 +720,7 @@ function add_into!(A::ZZMatrix, C::ZZMatrix, c::Int) A_ptr = Nemo.mat_entry_ptr(A, i+c, 1) C_ptr = Nemo.mat_entry_ptr(C, i, 1) for j=1:ncols(A) - ccall((:fmpz_add, Nemo.libflint), Cvoid, (Ptr{ZZRingElem}, Ptr{ZZRingElem}, Ptr{ZZRingElem}), A_ptr, A_ptr, C_ptr) + add!(A_ptr, C_ptr) A_ptr += sizeof(Clong) C_ptr += sizeof(Clong) end @@ -1247,7 +1247,7 @@ function dixon_solve(D::DixonCtx{T}, B::ZZMatrix; block::Int = 10) where T for i=1:nrows(D.x) x_ptr = Nemo.mat_entry_ptr(D.x, i, 1) for j=1:ncols(D.x) - ccall((:fmpz_addmul_si, Nemo.libflint), Cvoid, (Ptr{ZZRingElem}, Ref{ZZRingElem}, Int), x_ptr, ppow, Int(D.y_mod[i, j])) + addmul!(x_ptr, ppow, Int(D.y_mod[i, j])) x_ptr += 8 end end @@ -1302,7 +1302,7 @@ function dixon_solve(D::DixonCtx{T}, B::ZZMatrix; block::Int = 10) where T ccall((:fmpz_zero, Nemo.libflint), Cvoid, (Ptr{ZZRingElem},), Ay_ptr) for j=1:n y_ptr = Nemo.mat_entry_ptr(D.y_mod, j, 1) - ccall((:fmpz_addmul_ui, Nemo.libflint), Cvoid, (Ptr{ZZRingElem}, Ptr{ZZRingElem}, UInt), Ay_ptr, A_ptr, unsafe_load(y_ptr)) + addmul!(Ay_ptr, A_ptr, unsafe_load(y_ptr)) A_ptr += sizeof(ZZRingElem) end end diff --git a/src/AlgAss/Elem.jl b/src/AlgAss/Elem.jl index 86eefa2243..6ea54af3b3 100644 --- a/src/AlgAss/Elem.jl +++ b/src/AlgAss/Elem.jl @@ -890,7 +890,7 @@ end function _addmul!(M::QQMatrix, i, j, a::QQFieldElem, b::QQFieldElem, temp = nothing) GC.@preserve M begin c = mat_entry_ptr(M, i, j) - ccall((:fmpq_addmul, libflint), Nothing, (Ptr{QQFieldElem}, Ref{QQFieldElem}, Ref{QQFieldElem}), c, a, b) + addmul!(c, a, b) end end diff --git a/src/AlgAss/Map.jl b/src/AlgAss/Map.jl index 79fb4a2f30..34cb6cb0e8 100644 --- a/src/AlgAss/Map.jl +++ b/src/AlgAss/Map.jl @@ -115,7 +115,7 @@ function __set!(c_t::QQMatrix, ca) GC.@preserve c_t begin for i in 1:length(ca) t = mat_entry_ptr(c_t, 1, i) - ccall((:fmpq_set, libflint), Cvoid, (Ptr{QQFieldElem}, Ref{QQFieldElem}), t, ca[i]) + set!(t, ca[i]) end end end diff --git a/src/AlgAssAbsOrd/PIP/bley_johnston.jl b/src/AlgAssAbsOrd/PIP/bley_johnston.jl index fdc8fa7675..ed302d9e3c 100644 --- a/src/AlgAssAbsOrd/PIP/bley_johnston.jl +++ b/src/AlgAssAbsOrd/PIP/bley_johnston.jl @@ -192,7 +192,7 @@ function _is_principal_with_data_bj(I, O; side = :right, _alpha = nothing, local F = Hecke._get_a_twosided_conductor(O, M) # Now make corpime to conductor - + Iorig = I if F == 1*O || I + F == one(A) * O # I should improve this @@ -377,7 +377,7 @@ function _old_optimization(dd, local_coeffs, dec, bases_offsets_and_lengths, H, end w = local_coeffs[1][idx[1]] for i in 1:dd - ccall((:fmpq_set, libflint), Ref{Nothing}, (Ref{QQFieldElem}, Ref{QQFieldElem}), vtemp[i], w[i]) + set!(vtemp[i], w[i]) end #@show vtemp for j in 2:(length(dec) - 1) @@ -404,7 +404,7 @@ function _old_optimization(dd, local_coeffs, dec, bases_offsets_and_lengths, H, #@show length(ids) for j in ids #for i in 1:dd - # ccall((:fmpq_set, libflint), Ref{Nothing}, (Ref{QQFieldElem}, Ref{QQFieldElem}), vtemp[i], _vtempcopy[i]) + # set!(vtemp[i], _vtempcopy[i]) #end _vtemp = deepcopy(vtemp) .+ local_coeffs[end][j] if all(is_integral, _vtemp) @@ -420,7 +420,7 @@ function _old_optimization(dd, local_coeffs, dec, bases_offsets_and_lengths, H, end # -function _recursive_iterator!(x, lengths, d, elts::Vector, bases_offsets, indices_integral, indices_nonintegral, k, i, vtemp) +function _recursive_iterator!(x, lengths, d, elts::Vector, bases_offsets, indices_integral, indices_nonintegral, k, i, vtemp::Vector{QQFieldElem}) if i > k println("2", x) elseif i == k # unroll 1-loop base case for speed @@ -466,18 +466,18 @@ function _recursive_iterator!(x, lengths, d, elts::Vector, bases_offsets, indice end end -function _is_admissible(x, i, d, elts, bases_offsets, vtemp) +function _is_admissible(x, i, d, elts, bases_offsets, vtemp::Vector{QQFieldElem}) # Test if x[1,...,i] is admissible w = elts[1][x[1]] for k in 1:d - ccall((:fmpq_set, libflint), Ref{Nothing}, (Ref{QQFieldElem}, Ref{QQFieldElem}), vtemp[k], w[k]) + set!(vtemp[k], w[k]) end #@show vtemp for j in 2:i w = elts[j][x[j]] #@assert all(iszero, @view w[1:bases_offsets[j][1] - 1]) for k in bases_offsets[j][1]:d - add!(vtemp[k], vtemp[k], w[k]) + add!(vtemp[k], w[k]) end end diff --git a/src/Hecke.jl b/src/Hecke.jl index 7bf61b03f6..19b97db45d 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -122,7 +122,7 @@ import Nemo: acb_struct, Ring, Group, Field, zzModRing, zzModRingElem, arf_struc FpField, acb_vec, array, acb_vec_clear, force_coerce, force_op, fmpz_mod_ctx_struct, divisors, is_zero_entry, IntegerUnion, remove!, valuation!, is_cyclo_type, is_embedded, is_maxreal_type, - mat_entry_ptr, factor_trial_range, set! + mat_entry_ptr, factor_trial_range, set!, numerator!, denominator! AbstractAlgebra.@include_deprecated_bindings() Nemo.@include_deprecated_bindings() diff --git a/src/LinearAlgebra/LatEnum.jl b/src/LinearAlgebra/LatEnum.jl index 1afa615224..a48683a838 100644 --- a/src/LinearAlgebra/LatEnum.jl +++ b/src/LinearAlgebra/LatEnum.jl @@ -244,12 +244,12 @@ end @inline function fmpz_mat_entry_incref!(a::ZZMatrix, r::Int, c::Int) z = Nemo.mat_entry_ptr(a, r, c) - ccall((:fmpz_add_ui, libflint), Nothing, (Ptr{ZZRingElem}, Ptr{ZZRingElem}, Int), z, z, 1) + add!(z, 1) end function fmpz_mat_entry_add_ui!(a::ZZMatrix, r::Int, c::Int, v::UInt) z = Nemo.mat_entry_ptr(a, r, c) - ccall((:fmpz_add_ui, libflint), Nothing, (Ptr{ZZRingElem}, Ptr{ZZRingElem}, Int), z, z, v) + add!(z, v) end function enum_ctx_advance_level(E::enum_ctx{A,B,C}, i::Int) where {A,B,C} diff --git a/src/Misc/CRT.jl b/src/Misc/CRT.jl index 46605fce8f..5a11ff495d 100644 --- a/src/Misc/CRT.jl +++ b/src/Misc/CRT.jl @@ -494,13 +494,13 @@ function _num_setcoeff!(a::AbsSimpleNumFieldElem, n::Int, c::UInt) K = a.parent @assert n < degree(K) && n >=0 - ra = pointer_from_objref(a) + ra = Ptr{ZZRingElem}(pointer_from_objref(a)) if degree(K) == 1 - ccall((:fmpz_set_ui, libflint), Nothing, (Ref{Nothing}, UInt), ra, c) + set!(ra, c) ccall((:fmpq_canonicalise, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, ), a) elseif degree(K) == 2 - ccall((:fmpz_set_ui, libflint), Nothing, (Ref{Nothing}, UInt), ra+n*sizeof(Int), c) + set!(ra+n*sizeof(Int), c) else ccall((:fmpq_poly_set_coeff_ui, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Int, UInt), a, n, c) # includes canonicalisation and treatment of den. diff --git a/src/Misc/Matrix.jl b/src/Misc/Matrix.jl index d41a6786b9..74d2c17f4b 100644 --- a/src/Misc/Matrix.jl +++ b/src/Misc/Matrix.jl @@ -243,14 +243,14 @@ function reduce_mod_hnf_ur!(a::ZZMatrix, H::ZZMatrix) q = ZZRingElem() ccall((:fmpz_fdiv_q, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}), q, n, m) #q = fdiv(a[c, j], H[i, j]) - fl = ccall((:fmpz_is_zero, libflint), Bool, (Ref{ZZRingElem},), q) + fl = is_zero(q) if fl continue end for k = j:ncols(a) t = mat_entry_ptr(a, c, k) l = mat_entry_ptr(H, i, k) - ccall((:fmpz_submul, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}), t, q, l) + submul!(t, q, l) #a[c, k] = a[c, k] - q * H[i, k] end end @@ -275,14 +275,14 @@ function reduce_mod_hnf_ll!(a::ZZMatrix, H::ZZMatrix) q = ZZRingElem() ccall((:fmpz_fdiv_q, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}), q, n, m) #q = fdiv(a[c, j], H[i, j]) - fl = ccall((:fmpz_is_zero, libflint), Bool, (Ref{ZZRingElem},), q) + fl = is_zero(q) if fl continue end for k = 1:j t = mat_entry_ptr(a, c, k) l = mat_entry_ptr(H, i, k) - ccall((:fmpz_submul, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}), t, q, l) + submul!(t, q, l) end end end @@ -486,17 +486,17 @@ function snf_for_groups(A::ZZMatrix, mod::ZZRingElem) GC.@preserve S R begin for i=1:min(nrows(S), ncols(S)) Sii = mat_entry_ptr(S, i, i) - fl = ccall((:fmpz_is_one, libflint), Bool, (Ref{ZZRingElem},), Sii) + fl = is_one(Sii) if fl continue end for j=i+1:min(nrows(S), ncols(S)) Sjj = mat_entry_ptr(S, j, j) - fl = ccall((:fmpz_is_zero, libflint), Bool, (Ref{ZZRingElem},), Sjj) + fl = is_zero(Sjj) if fl continue end - fl1 = ccall((:fmpz_is_zero, libflint), Bool, (Ref{ZZRingElem},), Sii) + fl1 = is_zero(Sii) if !fl1 fl2 = Bool(ccall((:fmpz_divisible, libflint), Cint, (Ref{ZZRingElem}, Ref{ZZRingElem}), Sjj, Sii)) @@ -517,13 +517,13 @@ function snf_for_groups(A::ZZMatrix, mod::ZZRingElem) ccall((:fmpz_tdiv_qr, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), a, r, Sii, g) #a = divexact(S[i,i], g) - ccall((:fmpz_set, libflint), Nothing, (Ptr{ZZRingElem}, Ref{ZZRingElem}), Sii, g) + set!(Sii, g) #S[i,i] = g b = ZZRingElem() ccall((:fmpz_tdiv_qr, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), b, r, Sjj, g) #b = divexact(S[j,j], g) - ccall((:fmpz_mul, libflint), Nothing, (Ptr{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), Sjj, Sjj, a) + Sjj = mul!(Sjj, a) #S[j,j] *= a # V = [e -b ; f a]; # so col i and j of R will be transformed. We do it naively @@ -532,19 +532,18 @@ function snf_for_groups(A::ZZMatrix, mod::ZZRingElem) Rik = mat_entry_ptr(R, i, k) Rjk = mat_entry_ptr(R, j, k) aux = ZZRingElem() - mul!(aux, Rik, e) - ccall((:fmpz_addmul, libflint), Nothing, (Ref{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), aux, Rjk, f) + aux = mul!(aux, Rik, e) + aux = addmul!(aux, Rjk, f) aux1 = ZZRingElem() - mul!(aux1, Rjk, a) - ccall((:fmpz_submul, libflint), Nothing, (Ref{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), aux1, Rik, b) + aux1 = mul!(aux1, Rjk, a) + aux1 = submul!(aux1, Rik, b) set!(Rik, aux) set!(Rjk, aux1) #R[i, k], R[j, k] = e*R[i,k]+f*R[j,k], -b*R[i,k]+a*R[j,k] end end end - ccall((:fmpz_mat_transpose, libflint), Nothing, - (Ref{ZZMatrix}, Ref{ZZMatrix}), R, R) + transpose!(R) end return S, R end diff --git a/src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl b/src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl index f2e35fbfb6..42a0f89085 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl @@ -820,7 +820,7 @@ function _idempotents_via_matrices(x::AbsNumFieldOrderIdeal, y::AbsNumFieldOrder @hassert :AbsNumFieldOrder 2 -z in x @hassert :AbsNumFieldOrder 2 1 + z in y - ccall((:fmpz_mat_zero, libflint), Nothing, (Ref{ZZMatrix}, ), V) + zero!(V) return -z, 1 + z end diff --git a/src/NumFieldOrd/NfOrd/ResidueRing.jl b/src/NumFieldOrd/NfOrd/ResidueRing.jl index fa90a34f9b..95fa452def 100644 --- a/src/NumFieldOrd/NfOrd/ResidueRing.jl +++ b/src/NumFieldOrd/NfOrd/ResidueRing.jl @@ -498,14 +498,14 @@ function is_divisible(x::AbsOrdQuoRingElem, y::AbsOrdQuoRingElem) for i in 2:(d + 1) if !iszero(V[1, i]) #if !iszero(sub(V, 1:1, 2:(d + 1))) - ccall((:fmpz_mat_zero, libflint), Nothing, (Ref{ZZMatrix}, ), V) + zero!(V) return false, zero(parent(x)) end end z = R(-base_ring(R)(ZZRingElem[ V[1, i] for i in (d + 2):(2*d + 1)])) # V[1, i] is always a copy - ccall((:fmpz_mat_zero, libflint), Nothing, (Ref{ZZMatrix}, ), V) + zero!(V) @hassert :AbsOrdQuoRing 1 z*y == x return true, z end @@ -776,7 +776,7 @@ function AbstractAlgebra.gcdxx(x::AbsSimpleNumFieldOrderQuoRingElem, y::AbsSimpl @hassert :AbsOrdQuoRing 1 Q(O(1)) == u*e - (v*(-f)) - ccall((:fmpz_mat_zero, libflint), Nothing, (Ref{ZZMatrix}, ), V) + zero!(V) return g, u, v, -f, e end diff --git a/src/QuadForm/Enumeration.jl b/src/QuadForm/Enumeration.jl index 11a1028d9a..da2105dab8 100644 --- a/src/QuadForm/Enumeration.jl +++ b/src/QuadForm/Enumeration.jl @@ -313,8 +313,7 @@ function Base.iterate(C::LatEnumCtx{X, Y, elem_type}) where {X, Y, elem_type} if _short_enough # t1 must be a UInt - #z = QQFieldElem() - #ccall((:fmpq_set, libflint), Cvoid, (Ref{QQFieldElem}, Ref{QQFieldElem}), z, t1) + #z = QQFieldElem(t1) # Todo return (pp_vector(x), pp_length(len)), i #y = Vector{S}(undef, n) @@ -398,8 +397,7 @@ function Base.iterate(C::LatEnumCtx{S, W, V}, it::Int) where {S, W, V} if _short_enough # t1 must be a UInt - #z = QQFieldElem() - #ccall((:fmpq_set, libflint), Cvoid, (Ref{QQFieldElem}, Ref{QQFieldElem}), z, t1) + #z = QQFieldElem(t1) # Todo #y = __clean_and_assemble(x, transform) #return (y, len//scale), i @@ -504,7 +502,7 @@ function ___enumerate_cholesky(::Type{Vector}, Q::Matrix{QQFieldElem}, l::Union{ t2 = numerator!(t2, t1) _short_enough = false if S === Int - _len = ccall((:fmpz_get_si, libflint), Int, (Ref{ZZRingElem}, ), t2) + _len = Int(t2) _short_enough = _len <= c if !(l isa Nothing) _short_enough = _short_enough && _len >= l @@ -638,8 +636,6 @@ function ___enumerate_cholesky(::Type{Vector}, Q::Matrix{S}, l::Union{Int, Nothi end end -@noinline _bound_error() = error("Overflow in bound computation") - @inline function _compute_bounds(Ti::QQFieldElem, Qi, Ui, t1 = QQFieldElem(), t2 = ZZRingElem(), t3 = ZZRingElem(), @@ -649,20 +645,18 @@ end t2 = floor!(t2, t1, t3, t4) t2 = isqrt!(t2, t2) # Now t2 = ceil(sqrt(Ti/Qi)) - t2 = add_two!(t2, t2) + t2 = add!(t2, 2) # Now t2 = ceil(sqrt(Ti/Qi)) + 2 t1 = sub!(t1, Ui, t2) - t1 = neg!(t1, t1) + t1 = neg!(t1) t5 = ceil!(t5, t1, t3, t4) - !fits(Int, t5) && _bound_error() - ub = ccall((:fmpz_get_si, libflint), Int, (Ref{ZZRingElem}, ), t5) + ub = Int(t5) # will throw if t5 does not fit into an Int t1 = add!(t1, Ui, t2) - t1 = neg!(t1, t1) + t1 = neg!(t1) t5 = floor!(t5, t1, t3, t4) - !fits(Int, t5) && _bound_error() - lb = ccall((:fmpz_get_si, libflint), Int, (Ref{ZZRingElem}, ), t5) - 1 + lb = Int(t5) - 1 # will throw if t5 does not fit into an Int return ub, lb end @@ -707,10 +701,10 @@ end @inline function update_U!(U, QQ::Matrix{QQFieldElem}, i, n, x, t = QQFieldElem(), t2 = ZZRingElem()) # U[i] = sum(QQ[i, j] * x[j] for j in (i + 1):n) s = @inbounds U[i] - @inbounds ccall((:fmpz_set_si, libflint), Cvoid, (Ref{ZZRingElem}, Int), t2, x[i + 1]) + @inbounds set!(t2, x[i + 1]) @inbounds s = mul!(s, QQ[i, i + 1], t2) for j in (i + 2):n - @inbounds ccall((:fmpz_set_si, libflint), Cvoid, (Ref{ZZRingElem}, Int), t2, x[j]) + @inbounds set!(t2, x[j]) @inbounds mul!(t, QQ[i, j], t2) s = add!(s, s, t) #addmul!(s, QQ[i, j], t2, t) @@ -1021,16 +1015,6 @@ end # ################################################################################ -@inline function numerator!(z::ZZRingElem, y::QQFieldElem) - ccall((:fmpq_numerator, libflint), Cvoid, (Ref{ZZRingElem}, Ref{QQFieldElem}), z, y) - return z -end - -@inline function denominator!(z::ZZRingElem, y::QQFieldElem) - ccall((:fmpq_denominator, libflint), Cvoid, (Ref{ZZRingElem}, Ref{QQFieldElem}), z, y) - return z -end - @inline function floor!(z::ZZRingElem, y::QQFieldElem, t0::ZZRingElem, t1::ZZRingElem) numerator!(t0, y) denominator!(t1, y) @@ -1045,11 +1029,6 @@ end return z end -@inline function add_two!(z::ZZRingElem, x::ZZRingElem) - add!(z, x, 2) - return z -end - @inline function isqrt!(z::ZZRingElem, a::ZZRingElem) ccall((:fmpz_sqrt, libflint), Cvoid, (Ref{ZZRingElem}, Ref{ZZRingElem}), z, a) return z @@ -1059,8 +1038,4 @@ floor!(z::Int, x::Rational{Int}, y::Int, w::Int) = Int(floor(x)) isqrt!(z::Int, x::Int) = isqrt(x) -add_two!(z::Int, x::Int) = x + 2 - ceil!(z::Int, x::Rational{Int}, y::Int, w::Int) = Int(ceil(x)) - -numerator!(z::Int, x::Rational{Int}) = numerator(x) From 6b7d0e05a0ece0822f3314f55e23246825251fff Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Fri, 18 Oct 2024 18:57:10 +0200 Subject: [PATCH 14/51] fix: linear solving over rings of integers (#1651) - Take into account, that the pseudo-HNF might have zero rows --- src/NumFieldOrd/NfOrd/LinearAlgebra.jl | 9 +++++++-- test/LinearAlgebra/SolveIntegral.jl | 28 +++++++++++++++++--------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/NumFieldOrd/NfOrd/LinearAlgebra.jl b/src/NumFieldOrd/NfOrd/LinearAlgebra.jl index 1e00f61cb8..9a13220ed1 100644 --- a/src/NumFieldOrd/NfOrd/LinearAlgebra.jl +++ b/src/NumFieldOrd/NfOrd/LinearAlgebra.jl @@ -871,10 +871,15 @@ function _contained_in_span_of_pseudohnf(v::Generic.Mat{T}, P::PMat{T, S}, ::Val for i = start:step:stop # find pivot if shape === :upperright - piv = findfirst(k -> !iszero(P.matrix[i, k]), 1:ncols(P))::Int + _piv = findfirst(k -> !iszero(P.matrix[i, k]), 1:ncols(P)) else - piv = findlast(k -> !iszero(P.matrix[i, k]), 1:ncols(P))::Int + _piv = findlast(k -> !iszero(P.matrix[i, k]), 1:ncols(P)) + end + # The pseudo-HNF might be the zero matrix? + if _piv isa Nothing + continue end + piv = _piv::Int if !(w[1, piv]//P.matrix[i, piv] in P.coeffs[i]) if with_solution return false, sol diff --git a/test/LinearAlgebra/SolveIntegral.jl b/test/LinearAlgebra/SolveIntegral.jl index 0b58034fd0..e70c6b899b 100644 --- a/test/LinearAlgebra/SolveIntegral.jl +++ b/test/LinearAlgebra/SolveIntegral.jl @@ -12,9 +12,9 @@ for b in (matrix(OK, 1, 1, [alpha + beta]), OK.([alpha + beta])) b = matrix(OK, 1, 1, [alpha + beta]) fl, X, K = can_solve_with_solution_and_kernel(M, b; side = :left) - @assert fl - @assert X * M == b - @assert is_zero(K * M) + @test fl + @test X * M == b + @test is_zero(K * M) end for b in (matrix(OK, 1, 1, [one(OK)]), [OK(1)]) fl = can_solve(M, b; side = :left) @@ -29,9 +29,9 @@ @test ncols(K) >= 2 b = matrix(OK, 1, 1, [alpha + beta]) fl, X, K = can_solve_with_solution_and_kernel(M, b; side = :right) - @assert fl - @assert M * X == b - @assert is_zero(M * K) + @test fl + @test M * X == b + @test is_zero(M * K) b = matrix(OK, 1, 1, [one(OK)]) fl = can_solve(M, b; side = :right) @test !fl @@ -46,13 +46,21 @@ X = rand(matrix_space(OK, k, n), 5) B = X * A fl, v = can_solve_with_solution(A, B, side = :left) - @assert fl - @assert v * A == B + @test fl + @test v * A == B X = rand(matrix_space(OK, m, k), 5) B = A * X fl, v = can_solve_with_solution(A, B, side = :right) - @assert fl - @assert A * v == B + @test fl + @test A * v == B end + + # fix some issue with matrices not of full rank + + A = zero_matrix(OK, 1, 1) + B = zero_matrix(OK, 2, 1) + fl, v = can_solve_with_solution(A, B, side = :left) + @test fl + @test v * A == B end From 542c23eeb8bb6f19ab14baf89a67886ccfb9cf4d Mon Sep 17 00:00:00 2001 From: Erik Paemurru <143521159+paemurru@users.noreply.github.com> Date: Fri, 18 Oct 2024 19:15:49 +0200 Subject: [PATCH 15/51] Add `components` method to Abelian group (#1632) * Add another getindex method To be able to call `x[begin:end]`. Co-authored-by: Tommy Hofmann --- docs/src/manual/abelian/elements.md | 1 + src/GrpAb/Elem.jl | 20 ++++++++++++++++++++ test/GrpAb/Elem.jl | 3 +++ 3 files changed, 24 insertions(+) diff --git a/docs/src/manual/abelian/elements.md b/docs/src/manual/abelian/elements.md index 159c127b73..1e82be685c 100644 --- a/docs/src/manual/abelian/elements.md +++ b/docs/src/manual/abelian/elements.md @@ -25,6 +25,7 @@ parent(x::FinGenAbGroupElem) ## Access ```@docs +getindex(x::FinGenAbGroupElem, v::AbstractVector{Int}) getindex(x::FinGenAbGroupElem, i::Int) ``` diff --git a/src/GrpAb/Elem.jl b/src/GrpAb/Elem.jl index 402921cc2e..29ec93ea13 100644 --- a/src/GrpAb/Elem.jl +++ b/src/GrpAb/Elem.jl @@ -146,6 +146,26 @@ function getindex(x::FinGenAbGroupElem, i::Int) return x.coeff[1, i] end +@doc raw""" + getindex(x::FinGenAbGroupElem, v::AbstractVector{Int}) -> Vector{ZZRingElem} + +Returns the $i$-th components of the element $x$ where $i \in v$. + +!!! note + This function is inefficient since the elements are internally stored using ZZMatrix but this function outputs a vector. +""" +function getindex(x::FinGenAbGroupElem, v::AbstractVector{Int}) + return [x.coeff[1, i] for i in v] +end + +function Base.firstindex(x::FinGenAbGroupElem) + return Int(1) +end + +function Base.lastindex(x::FinGenAbGroupElem) + return ngens(parent(x)) +end + ################################################################################ # # Comparison diff --git a/test/GrpAb/Elem.jl b/test/GrpAb/Elem.jl index 2e33680942..f767a82dec 100644 --- a/test/GrpAb/Elem.jl +++ b/test/GrpAb/Elem.jl @@ -6,12 +6,14 @@ a = @inferred FinGenAbGroupElem(G, N) @test parent(a) == G @test a.coeff == N + @test a[begin:end] == [0, 0, 0] G = @inferred abelian_group([3, 0]) N = FlintZZ[1 1] a = @inferred FinGenAbGroupElem(G, N) @test @inferred parent(a) == G @test a.coeff == N + @test a[begin:end] == [1, 1] N = matrix(FlintZZ, 1, 2, [ 1, 1 ]) a = @inferred G(N) @@ -21,6 +23,7 @@ a = @inferred G(N) @test @inferred parent(a) == G @test a.coeff == transpose(N) + @test a[begin:end] == [1, 1] end @testset "Generators" begin From 9a1165a9941e3ed6216d6066870104bd032355af Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 18 Oct 2024 20:39:08 +0200 Subject: [PATCH 16/51] Delete two unused functions (#1652) --- src/FieldFactory/ab_exts.jl | 8 -------- src/NumFieldOrd/NfOrd/LinearAlgebra.jl | 10 ---------- 2 files changed, 18 deletions(-) diff --git a/src/FieldFactory/ab_exts.jl b/src/FieldFactory/ab_exts.jl index f3be7eae96..bd47df1cf8 100644 --- a/src/FieldFactory/ab_exts.jl +++ b/src/FieldFactory/ab_exts.jl @@ -699,14 +699,6 @@ function _ext_with_autos(Qx, x, i::Int, j::Int) return Qx(cp1), Qx(cp2) end -function __get_term(a::QQMPolyRingElem, exps::Vector{UInt}) - z = QQFieldElem() - ccall((:fmpq_mpoly_get_coeff_fmpq_ui, libflint), Nothing, - (Ref{QQFieldElem}, Ref{QQMPolyRingElem}, Ptr{UInt}, Ref{QQMPolyRing}), - z, a, exps, parent(a)) - return z -end - function _C22_with_max_ord(l) list = Vector{Tuple{AbsSimpleNumField, Vector{morphism_type(AbsSimpleNumField, AbsSimpleNumField)}, Vector{morphism_type(AbsSimpleNumField, AbsSimpleNumField)}}}() Qx, x = polynomial_ring(FlintQQ, "x", cached = false) diff --git a/src/NumFieldOrd/NfOrd/LinearAlgebra.jl b/src/NumFieldOrd/NfOrd/LinearAlgebra.jl index 9a13220ed1..7699b01937 100644 --- a/src/NumFieldOrd/NfOrd/LinearAlgebra.jl +++ b/src/NumFieldOrd/NfOrd/LinearAlgebra.jl @@ -165,16 +165,6 @@ function set!(z::fpPolyRingElem, x::fpPolyRingElem) ccall((:nmod_poly_set, libflint), Nothing, (Ref{fpPolyRingElem}, Ref{fpPolyRingElem}), z, x) end -function __helper!(z, mF, entries) - s = size(entries) - for i in 1:s[2] - for j in 1:s[1] - z[j, i] = mF(entries[j, i]) - end - end - return z -end - function mod_sym(x::AbsSimpleNumFieldOrderElem, m::ZZRingElem) z = coordinates(x) for i in 1:length(z) From c2ecdc91f2f8cdbab16b9c0b3373889d63ae4c8e Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Fri, 18 Oct 2024 23:39:39 +0200 Subject: [PATCH 17/51] feat: clean up for algebras (#1623) --- docs/src/.vitepress/config.mts | 1 + docs/src/manual/algebras/basics.md | 2 +- docs/src/manual/algebras/structureconstant.md | 2 +- src/AlgAss/AbsAlgAss.jl | 4 +- src/AlgAss/AlgGrp.jl | 2 +- src/AlgAss/AlgMat.jl | 8 +- src/AlgAss/Elem.jl | 5 + src/AlgAss/Ideal.jl | 359 +++++++++--------- src/AlgAss/Map.jl | 3 +- src/AlgAss/Types.jl | 17 +- src/AlgAss/radical.jl | 2 +- src/AlgAssAbsOrd/Ideal.jl | 4 +- src/AlgAssRelOrd/Eichler.jl | 8 +- src/AlgAssRelOrd/Ideal.jl | 4 +- src/exports.jl | 3 + test/AlgAss/AbsAlgAss.jl | 6 +- test/AlgAss/Ideal.jl | 55 ++- test/AlgAss/radical.jl | 8 +- 18 files changed, 284 insertions(+), 209 deletions(-) diff --git a/docs/src/.vitepress/config.mts b/docs/src/.vitepress/config.mts index 32af371ea7..9609aaf411 100644 --- a/docs/src/.vitepress/config.mts +++ b/docs/src/.vitepress/config.mts @@ -95,6 +95,7 @@ export default defineConfig({ { text: 'Introduction', link: 'manual/algebras/intro'}, { text: 'Basics', link: 'manual/algebras/basics'}, { text: 'Structure constant algebras', link: 'manual/algebras/structureconstant'}, + { text: 'Ideals', link: 'manual/algebras/ideals'}, ] }, { diff --git a/docs/src/manual/algebras/basics.md b/docs/src/manual/algebras/basics.md index 9fc7ff026f..154bc3ba04 100644 --- a/docs/src/manual/algebras/basics.md +++ b/docs/src/manual/algebras/basics.md @@ -9,7 +9,7 @@ end ## Creation of algebras -See the corresponding sections in ????? +See the corresponding sections on [structure constant algebras](@ref SCA). ```@docs zero_algebra(::Field) ``` diff --git a/docs/src/manual/algebras/structureconstant.md b/docs/src/manual/algebras/structureconstant.md index 3cc4f003a2..f7c3117989 100644 --- a/docs/src/manual/algebras/structureconstant.md +++ b/docs/src/manual/algebras/structureconstant.md @@ -1,4 +1,4 @@ -# Structure constant algebras +# [Structure constant algebras](@id SCA) ```@meta CurrentModule = Hecke diff --git a/src/AlgAss/AbsAlgAss.jl b/src/AlgAss/AbsAlgAss.jl index 00d854684b..979ab75f20 100644 --- a/src/AlgAss/AbsAlgAss.jl +++ b/src/AlgAss/AbsAlgAss.jl @@ -727,7 +727,7 @@ of the basis elements of $A$ and a map from $B$ to $A$. function regular_matrix_algebra(A::Union{ StructureConstantAlgebra, GroupAlgebra }) K = base_ring(A) B = matrix_algebra(K, [ representation_matrix(A[i], :right) for i = 1:dim(A) ], isbasis = true) - return B, hom(B, A, identity_matrix(K, dim(A)), identity_matrix(K, dim(A))) + return B, hom(B, A, identity_matrix(K, dim(A)), identity_matrix(K, dim(A)); check = false) end ############################################################################### @@ -1117,7 +1117,7 @@ function product_of_components_with_projection(A::AbstractAssociativeAlgebra, a: for b in basis(A) push!(imgs, sum(injstoB[i](injs[i]\b) for i in eachindex(a); init = zero(B))) end - p = hom(A, B, basis_matrix(imgs)) + p = hom(A, B, basis_matrix(imgs); check = false) _transport_refined_wedderburn_decomposition_forward(p) return B, p end diff --git a/src/AlgAss/AlgGrp.jl b/src/AlgAss/AlgGrp.jl index 68365e56dc..1e1517f7ef 100644 --- a/src/AlgAss/AlgGrp.jl +++ b/src/AlgAss/AlgGrp.jl @@ -10,7 +10,7 @@ denominator_of_multiplication_table(A::GroupAlgebra{QQFieldElem}) = one(ZZ) base_ring(A::GroupAlgebra{T}) where {T} = A.base_ring::parent_type(T) -base_ring_type(::Type{GroupAlgebra{T}}) where {T} = parent_type(T) +base_ring_type(::Type{GroupAlgebra{T, S, R}}) where {T, S, R} = parent_type(T) Generic.dim(A::GroupAlgebra) = size(multiplication_table(A, copy = false), 1) diff --git a/src/AlgAss/AlgMat.jl b/src/AlgAss/AlgMat.jl index a9bc5532ca..162c072e65 100644 --- a/src/AlgAss/AlgMat.jl +++ b/src/AlgAss/AlgMat.jl @@ -14,7 +14,13 @@ base_ring_type(::Type{MatAlgebra{T, S}}) where {T, S} = parent_type(T) coefficient_ring(A::MatAlgebra{T, S}) where {T, S} = A.coefficient_ring::base_ring_type(S) -basis(A::MatAlgebra) = A.basis::Vector{elem_type(A)} +function basis(A::MatAlgebra; copy::Bool = true) + if copy + return Base.copy(A.basis::Vector{elem_type(A)}) + else + return A.basis::Vector{elem_type(A)} + end +end has_one(A::MatAlgebra) = true diff --git a/src/AlgAss/Elem.jl b/src/AlgAss/Elem.jl index 6ea54af3b3..976dbfc966 100644 --- a/src/AlgAss/Elem.jl +++ b/src/AlgAss/Elem.jl @@ -644,6 +644,11 @@ function (A::GroupAlgebra)(a::GroupAlgebraElem) return a end +function (A::MatAlgebra)(a::MatAlgebraElem) + @assert parent(a) == A "Wrong parent" + return a +end + # For polynomial substitution for T in subtypes(AbstractAssociativeAlgebra) @eval begin diff --git a/src/AlgAss/Ideal.jl b/src/AlgAss/Ideal.jl index 8103443586..6b741ff0c3 100644 --- a/src/AlgAss/Ideal.jl +++ b/src/AlgAss/Ideal.jl @@ -7,17 +7,39 @@ algebra(a::AbsAlgAssIdl) = a.algebra iszero(a::AbsAlgAssIdl) = (a.iszero == 1) +@doc raw""" + dim(a::AbsAlgAssIdl) -> Int + +Return the vector space dimension an ideal. +""" +dim(a::AbsAlgAssIdl) = nrows(basis_matrix(a, copy = false)) + ############################################################################### # # String I/O # ############################################################################### -function show(io::IO, a::AbsAlgAssIdl) - print(io, "Ideal of ") - print(io, algebra(a)) - println(io, " with basis matrix") - print(io, basis_matrix(a, copy = false)) +function show(io::IO, A::AbsAlgAssIdl) + if is_terse(io) + print(io, "Ideal") + else + io = pretty(io) + print(io, "Ideal of dimension ", dim(A), " in ") + print(terse(io), Lowercase(), algebra(A)) + end +end + +function show(io::IO, mime::MIME"text/plain", a::AbsAlgAssIdl) + println(io, "Ideal") + io = pretty(io) + println(io, Indent(), "of dimension ", dim(a)) + println(io, "in ", Lowercase(), algebra(a)) + println(io, "with basis matrix") + print(io, Indent()) + show(io, MIME"text/plain"(), basis_matrix(a, copy = false)) + print(io, Dedent()) + print(io, Dedent()) end ################################################################################ @@ -66,9 +88,9 @@ Returns the basis of $a$. function basis(a::AbsAlgAssIdl; copy::Bool = true) assure_has_basis(a) if copy - return deepcopy(a.basis) + return Base.copy(a.basis)::Vector{elem_type(algebra(a))} else - return a.basis + return a.basis::Vector{elem_type(algebra(a))} end end @@ -79,9 +101,19 @@ Returns the basis matrix of $a$ with respect to the basis of the algebra. """ function basis_matrix(a::AbsAlgAssIdl; copy::Bool = true) if copy - return deepcopy(a.basis_matrix) + return deepcopy(a.basis_matrix)::dense_matrix_type(base_ring_type(algebra(a))) else - return a.basis_matrix + return a.basis_matrix::dense_matrix_type(base_ring_type(algebra(a))) + end +end + +function basis_matrix_solve_context(a::AbsAlgAssIdl) + if isdefined(a, :basis_matrix_solve_ctx) + return a.basis_matrix_solve_ctx::Solve.solve_context_type(base_ring(algebra(a))) + else + c = Solve.solve_init(basis_matrix(a, copy = false)) + a.basis_matrix_solve_ctx = c + return c end end @@ -91,15 +123,13 @@ end # ################################################################################ -@doc raw""" - in(x::AbstractAssociativeAlgebraElem, a::AbsAlgAssIdl) -> Bool +function in(x, a::AbsAlgAssIdl) + c = basis_matrix_solve_context(a) + return can_solve(c, coefficients(x, copy = false); side = :left) +end -Returns `true` if $x$ is an element of $a$ and `false` otherwise. -""" -function in(x::T, a::AbsAlgAssIdl{S, T, U}) where {S, T, U} - A = algebra(a) - M = matrix(base_ring(A), 1, dim(A), coefficients(x, copy = false)) - return rank(vcat(basis_matrix(a, copy = false), M)) == nrows(basis_matrix(a, copy = false)) # so far we assume nrows(basis_matrix) == rank(basis_matrix) +function is_subset(a::AbsAlgAssIdl, b::AbsAlgAssIdl) + return all(in(b), basis(a, copy = false)) end ################################################################################ @@ -112,18 +142,21 @@ function _test_ideal_sidedness(a::AbsAlgAssIdl, side::Symbol) A = algebra(a) ba = basis(a, copy = false) t = A() - for i = 1:dim(A) - for j = 1:length(ba) - if side == :left + for i in 1:dim(A) + for j in 1:length(ba) + if side === :left || side === :twosided t = mul!(t, A[i], ba[j]) - elseif side == :right + if !(t in a) + return false + end + elseif side === :right || side === :twosided t = mul!(t, ba[j], A[i]) + if !(t in a) + return false + end else error("side must be either :left or :right") end - if !(t in a) - return false - end end end return true @@ -181,16 +214,13 @@ end # ################################################################################ -@doc raw""" - +(a::AbsAlgAssIdl, b::AbsAlgAssIdl) -> AbsAlgAssIdl +function +(a::AbsAlgAssIdl{S}, b::AbsAlgAssIdl{S}) where {S} + @req algebra(a) === algebra(b) "Ideals must have same algebra" -Returns $a + b$. -""" -function +(a::AbsAlgAssIdl{S, T, U}, b::AbsAlgAssIdl{S, T, U}) where {S, T, U} - if iszero(a) - return deepcopy(b) - elseif iszero(b) - return deepcopy(a) + if is_zero(a) + return b + elseif is_zero(b) + return a end M = vcat(basis_matrix(a), basis_matrix(b)) @@ -198,19 +228,15 @@ function +(a::AbsAlgAssIdl{S, T, U}, b::AbsAlgAssIdl{S, T, U}) where {S, T, U} if r != nrows(M) M = sub(M, 1:r, 1:ncols(M)) end - return ideal(algebra(a), M; M_in_rref=true) + return _ideal_from_matrix(algebra(a), M; M_in_rref=true) end -@doc raw""" - *(a::AbsAlgAssIdl, b::AbsAlgAssIdl) -> AbsAlgAssIdl - -Returns $a \cdot b$. -""" -function *(a::AbsAlgAssIdl{S, T, U}, b::AbsAlgAssIdl{S, T, U}) where {S, T, U} +function *(a::AbsAlgAssIdl{S}, b::AbsAlgAssIdl{S}) where {S} + @req algebra(a) === algebra(b) "Ideals must have same algebra" if iszero(a) - return deepcopy(a) + return a elseif iszero(b) - return deepcopy(b) + return b end A = algebra(a) @@ -223,20 +249,15 @@ function *(a::AbsAlgAssIdl{S, T, U}, b::AbsAlgAssIdl{S, T, U}) where {S, T, U} elem_to_mat_row!(M, ii + j, ba[i]*bb[j]) end end - return ideal(algebra(a), M) + return _ideal_from_matrix(algebra(a), M) end -@doc raw""" - ^(a::AbsAlgAssIdl, e::Union{ Int, ZZRingElem }) -> AbsAlgAssIdl - -Returns $a^e$. -""" ^(A::AbsAlgAssIdl, e::Int) = Base.power_by_squaring(A, e) ^(A::AbsAlgAssIdl, e::ZZRingElem) = Base.power_by_squaring(A, BigInt(e)) function one(a::AbsAlgAssIdl) A = algebra(a) - return ideal(A, identity_matrix(base_ring(A), dim(A)); side=:twosided, M_in_rref=true) + return _ideal_from_matrix(A, identity_matrix(base_ring(A), dim(A)); side=:twosided, M_in_rref=true) end function Base.copy(a::AbsAlgAssIdl) @@ -246,11 +267,11 @@ end function *(x::AbstractAssociativeAlgebraElem, a::AbsAlgAssIdl) @assert is_left_ideal(a) "Not a left ideal" if iszero(a) - return deepcopy(a) + return a end basis_a = basis(a, copy = false) - return ideal_from_gens(algebra(a), [ x*basis_a[i] for i = 1:length(basis_a) ]) + return _ideal_from_kgens(algebra(a), [ x*basis_a[i] for i = 1:length(basis_a) ]) end function *(a::AbsAlgAssIdl, x::AbstractAssociativeAlgebraElem) @@ -260,21 +281,18 @@ function *(a::AbsAlgAssIdl, x::AbstractAssociativeAlgebraElem) end basis_a = basis(a, copy = false) - return ideal_from_gens(algebra(a), [ basis_a[i]*x for i = 1:length(basis_a) ]) + return _ideal_from_kgens(algebra(a), [ basis_a[i]*x for i = 1:length(basis_a) ]) end + ################################################################################ # +# # Equality # ################################################################################ -@doc raw""" - ==(a::AbsAlgAssIdl, b::AbsAlgAssIdl) -> Bool - -Returns `true` if $a$ and $b$ are equal and `false` otherwise. -""" function ==(a::AbsAlgAssIdl, b::AbsAlgAssIdl) - algebra(a) != algebra(b) && return false + algebra(a) !== algebra(b) && return false return basis_matrix(a, copy = false) == basis_matrix(b, copy = false) end @@ -284,17 +302,41 @@ end # ################################################################################ -@doc raw""" - ideal_from_gens(A::AbstractAssociativeAlgebra, b::Vector{ <: AbstractAssociativeAlgebraElem}, - side::Symbol = :nothing) - -> AbsAlgAssIdl +# side is necessary +function ideal(A::AbstractAssociativeAlgebra, b::Vector; side::Symbol) + @req side in (:left, :right, :twosided) "Side must be :left, :right or :twosided" + if length(b) == 0 + M = zero_matrix(base_ring(A), 0, dim(A)) + return _ideal_from_matrix(A, M; side, M_in_rref=true) + end + B = basis(A) + + kgens = elem_type(A)[] + for i in 1:length(b) + for j in 1:dim(A) + el = b[i] + if side == :left || side == :twosided + Bel = B[j] * el + if side == :twosided + for k in 1:dim(A) + push!(kgens, Bel * B[k]) + end + else + push!(kgens, Bel) + end + end + if side == :right + push!(kgens, el * B[j]) + end + end + end + return _ideal_from_kgens(A, kgens; side = side) +end -Returns the ideal of $A$ generated by the elements of `b` as a subspace of $A$. -""" -function ideal_from_gens(A::AbstractAssociativeAlgebra, b::Vector{T}, side::Symbol = :nothing) where { T <: AbstractAssociativeAlgebraElem } +function _ideal_from_kgens(A::AbstractAssociativeAlgebra, b::Vector{<:AbstractAssociativeAlgebraElem}; side = nothing) if length(b) == 0 M = zero_matrix(base_ring(A), 0, dim(A)) - return ideal(A, M; side, M_in_rref=true) + return _ideal_from_matrix(A, M; side, M_in_rref=true) end @assert parent(b[1]) == A @@ -303,60 +345,21 @@ function ideal_from_gens(A::AbstractAssociativeAlgebra, b::Vector{T}, side::Symb for i = 1:length(b) elem_to_mat_row!(M, i, b[i]) end - return ideal(A, M; side) + return _ideal_from_matrix(A, M; side) end -@doc raw""" - ideal(A::AbstractAssociativeAlgebra, x::AbstractAssociativeAlgebraElem) -> AbsAlgAssIdl +left_ideal(A::AbstractAssociativeAlgebra, x...; kw...) = ideal(A, x...; side = :left, kw...) -Returns the twosided principal ideal of $A$ generated by $x$. -""" -function ideal(A::AbstractAssociativeAlgebra, x::AbstractAssociativeAlgebraElem) - t1 = A() - t2 = A() - M = zero_matrix(base_ring(A), dim(A)^2, dim(A)) - for i = 1:dim(A) - t1 = mul!(t1, A[i], x) - ii = (i - 1)*dim(A) - for j = 1:dim(A) - t2 = mul!(t2, t1, A[j]) - elem_to_mat_row!(M, ii + j, t2) - end - end +right_ideal(A::AbstractAssociativeAlgebra, x...; kw...) = ideal(A, x...; side = :right, kw...) - return ideal(A, M; side=:twosided) -end - -@doc raw""" - ideal(A::AbstractAssociativeAlgebra, x::AbstractAssociativeAlgebraElem, action::Symbol) -> AbsAlgAssIdl - -Returns the ideal $x \cdot A$ if `action == :left`, and $A \cdot x$ if -`action == :right`. -""" -function ideal(A::AbstractAssociativeAlgebra, x::AbstractAssociativeAlgebraElem, action::Symbol) - M = representation_matrix(x, action) - a = ideal(A, M) +twosided_ideal(A::AbstractAssociativeAlgebra, x...; kw...) = ideal(A, x...; side = :twosided, kw...) - if action == :left - a.isright = 1 - elseif action == :right - a.isleft = 1 - end +*(A::AbstractAssociativeAlgebra, x::NCRingElement) = left_ideal(A, x) - return a -end +*(x::NCRingElement, A::AbstractAssociativeAlgebra) = right_ideal(A, x) @doc raw""" - *(A::AbstractAssociativeAlgebra, x::AbstractAssociativeAlgebraElem) -> AbsAlgAssIdl - *(x::AbstractAssociativeAlgebraElem, A::AbstractAssociativeAlgebra) -> AbsAlgAssIdl - -Returns the ideal $A \cdot x$ or $x \cdot A$ respectively. -""" -*(A::AbstractAssociativeAlgebra, x::AbstractAssociativeAlgebraElem) = ideal(A, x, :right) -*(x::AbstractAssociativeAlgebraElem, A::AbstractAssociativeAlgebra) = ideal(A, x, :left) - -@doc raw""" - ideal(A::AbstractAssociativeAlgebra, M::MatElem; side::Symbol = :nothing, M_in_rref::Bool = false) + _ideal_from_matrix(A::AbstractAssociativeAlgebra, M::MatElem; side::Symbol = :nothing, M_in_rref::Bool = false) -> AbsAlgAssIdl Returns the ideal of $A$ with basis matrix $M$. @@ -365,13 +368,13 @@ set to `:right`/`:left`/`:twosided` respectively. If `M_in_rref == true`, it is assumed that $M$ is already in row reduced echelon form. """ -function ideal(A::AbstractAssociativeAlgebra, M::MatElem; side::Symbol = :nothing, M_in_rref::Bool = false) +function _ideal_from_matrix(A::AbstractAssociativeAlgebra, M::MatElem; side = nothing, M_in_rref::Bool = false) @assert base_ring(M) == base_ring(A) @assert ncols(M) == dim(A) if !M_in_rref r, N = rref(M) if r == 0 - a = AbsAlgAssIdl{typeof(A), typeof(M)}(A, zero_matrix(base_ring(A), 0, dim(A))) + a = AbsAlgAssIdl{typeof(A)}(A, zero_matrix(base_ring(A), 0, dim(A))) a.iszero = 1 return a end @@ -382,12 +385,12 @@ function ideal(A::AbstractAssociativeAlgebra, M::MatElem; side::Symbol = :nothin end end if M_in_rref && nrows(M) == 0 - a = AbsAlgAssIdl{typeof(A), typeof(M)}(A, M) + a = AbsAlgAssIdl{typeof(A)}(A, M) a.iszero = 1 return a end - a = AbsAlgAssIdl{typeof(A), typeof(M)}(A, M) + a = AbsAlgAssIdl{typeof(A)}(A, M) _set_sidedness(a, side) a.iszero = 2 return a @@ -395,7 +398,7 @@ end # Helper function to set the side-flags # side can be :right, :left or :twosided -function _set_sidedness(a::Union{ AbsAlgAssIdl, AlgAssAbsOrdIdl, AlgAssRelOrdIdl }, side::Symbol) +function _set_sidedness(a::Union{ AbsAlgAssIdl, AlgAssAbsOrdIdl, AlgAssRelOrdIdl }, side) if side == :right a.isleft = 0 a.isright = 1 @@ -405,9 +408,11 @@ function _set_sidedness(a::Union{ AbsAlgAssIdl, AlgAssAbsOrdIdl, AlgAssRelOrdIdl elseif side == :twosided a.isleft = 1 a.isright = 1 - else + elseif side === nothing || side === :nothing a.isleft = 0 a.isright = 0 + else + error("Not a valid side") end return nothing end @@ -419,17 +424,19 @@ end ################################################################################ @doc raw""" - quo(A::AbstractAssociativeAlgebra, a::AbsAlgAssIdl) -> AbstractAssociativeAlgebra, AbsAlgAssMor + quo(A::AbstractAssociativeAlgebra, a::AbsAlgAssIdl) + -> AbstractAssociativeAlgebra, AbsAlgAssMor -Returns the quotient algebra $A/a$ and the projection map $A \to A/a$. +Return the quotient algebra $A/a$ and the projection map $A \to A/a$. """ -function quo(A::S, a::AbsAlgAssIdl{S, T, U}) where { S, T, U } - @assert A == algebra(a) +function quo(A::S, a::AbsAlgAssIdl{S}) where {S} + @req A === algebra(a) "Ideal not in the algebra" K = base_ring(A) + d = dim(A) # First compute the vector space quotient Ma = basis_matrix(a, copy = false) - M = hcat(deepcopy(transpose(Ma)), identity_matrix(K, dim(A))) + M = hcat(transpose(Ma), identity_matrix(K, d)) r = rref!(M) pivot_cols = Vector{Int}() j = 1 @@ -446,38 +453,37 @@ function quo(A::S, a::AbsAlgAssIdl{S, T, U}) where { S, T, U } end # We now have the basis (basis of the quotient, basis of the ideal) - n = dim(A) - nrows(Ma) - M = vcat(zero_matrix(K, n, dim(A)), Ma) - oneK = K(1) - zeroK = K() + n = d - nrows(Ma) + M = vcat(zero_matrix(K, n, d), Ma) + oneK = one(K) + zeroK = zero(K) for i = 1:n M[i, pivot_cols[i]] = oneK end iM = inv(M) - N = sub(M, 1:n, 1:dim(A)) - NN = sub(iM, 1:dim(A), 1:n) + N = sub(M, 1:n, 1:d) + NN = sub(iM, 1:d, 1:n) # Lift a basis of the quotient to A quotient_basis = Vector{elem_type(A)}(undef, n) - b = zero_matrix(K, 1, n) + b = elem_type(K)[zero(K) for i in 1:n] for i = 1:n - b[1, i] = oneK + b[i] = oneK bN = b*N - quotient_basis[i] = A([ bN[1, i] for i = 1:dim(A) ]) - b[1, i] = zeroK + quotient_basis[i] = A(bN; copy = true) + b[i] = zeroK end # Build the multiplication table t = A() - s = zero_matrix(K, 1, dim(A)) + s = elem_type(K)[zero(K) for i in d] mult_table = Array{elem_type(K), 3}(undef, n, n, n) - for i = 1:n - for j = 1:n + for i in 1:n + for j in 1:n t = mul!(t, quotient_basis[i], quotient_basis[j]) - elem_to_mat_row!(s, 1, t) - sNN = s*NN - mult_table[i, j, :] = [ sNN[1, k] for k = 1:n ] + sNN = coefficients(t, copy = false) * NN + mult_table[i, j, :] = sNN end end @@ -493,15 +499,19 @@ end Given ideals $b \subseteq a$, this function returns the quotient algebra $a/b$ and the projection map $a \to a/b$. """ -function quo(a::AbsAlgAssIdl{S, T, U}, b::AbsAlgAssIdl{S, T, U}) where { S, T, U } - @assert algebra(a) == algebra(b) +function quo(a::AbsAlgAssIdl{S}, b::AbsAlgAssIdl{S}) where {S} + @req algebra(a) === algebra(b) "Ideals must have same algebra" + @req is_subset(b, a) "Second ideal must be a subsets of the first ideal" + @req _test_ideal_sidedness(b, :twosided) "Second ideal must be two-sided" + A = algebra(a) + d = dim(A) K = base_ring(A) # First compute the vector space quotient Ma = basis_matrix(a, copy = false) Mb = basis_matrix(b, copy = false) - M = hcat(deepcopy(transpose(Mb)), deepcopy(transpose(Ma))) + M = hcat(transpose(Mb), transpose(Ma)) r = rref!(M) pivot_cols = Vector{Int}() j = 1 @@ -519,21 +529,21 @@ function quo(a::AbsAlgAssIdl{S, T, U}, b::AbsAlgAssIdl{S, T, U}) where { S, T, U # Build the basis matrix for the quotient n = nrows(Ma) - nrows(Mb) - M = zero_matrix(K, n, dim(A)) + M = zero_matrix(K, n, d) for i = 1:n - for j = 1:dim(A) + for j = 1:d M[i, j] = deepcopy(Ma[pivot_cols[i], j]) end end # Lift a basis of the quotient to A quotient_basis = Vector{elem_type(A)}(undef, n) - b = zero_matrix(K, 1, n) + b = [zero(K) for i in 1:n] for i = 1:n - b[1, i] = one(K) + b[i] = one(K) bM = b*M - quotient_basis[i] = A([ bM[1, j] for j in 1:dim(A) ]) - b[1, i] = zero(K) + quotient_basis[i] = A(bM; copy = true) + b[i] = zero(K) end # Another basis matrix for a: basis of the quotient + basis of b @@ -541,14 +551,13 @@ function quo(a::AbsAlgAssIdl{S, T, U}, b::AbsAlgAssIdl{S, T, U}) where { S, T, U # Build the multiplication table t = A() - s = zero_matrix(K, 1, dim(A)) mult_table = Array{elem_type(K), 3}(undef, n, n, n) + Nctx = solve_init(N) for i = 1:n for j = 1:n t = mul!(t, quotient_basis[i], quotient_basis[j]) - elem_to_mat_row!(s, 1, t) - y = solve(N, s, side = :left) - mult_table[i, j, :] = [ y[1, k] for k = 1:n ] + y = solve(Nctx, coefficients(t, copy = false), side = :left) + mult_table[i, j, :] = view(y, 1:n) end end @@ -557,21 +566,17 @@ function quo(a::AbsAlgAssIdl{S, T, U}, b::AbsAlgAssIdl{S, T, U}) where { S, T, U AtoB = AbsAlgAssMor{typeof(A), typeof(B), typeof(M)}(A, B) function _image(x::AbstractAssociativeAlgebraElem) - t, y = can_solve_with_solution(N, matrix(K, 1, dim(A), coefficients(x, copy = false)), side = :left) + t, y = can_solve_with_solution(Nctx, coefficients(x, copy = false), side = :left) if t - return B([ y[1, i] for i in 1:dim(B) ]) + return B(y[1:dim(B)]; copy = false) else error("Element is not in the domain") end end function _preimage(x::AbstractAssociativeAlgebraElem) - t = zero_matrix(K, 1, dim(B)) - for i = 1:dim(B) - t[1, i] = x.coeffs[i] - end - tt = t*M - return A([ tt[1, i] for i in 1:dim(A) ]) + tt = coefficients(x, copy = false) * M + return A(tt; copy = false) end AtoB.header.image = _image @@ -586,27 +591,35 @@ end ################################################################################ # TODO: implement for ::Type{AbsAlgAssIdl} -Random.gentype(a::AbsAlgAssIdl) = elem_type(algebra(a)) +#Random.gentype(a::AbsAlgAssIdl) = elem_type(algebra(a)) -function rand(rng::AbstractRNG, a_sp::Random.SamplerTrivial{<:AbsAlgAssIdl}) - a = a_sp[] - A = algebra(a) - x = A() - for b in basis(a, copy = false) - x += rand(rng, base_ring(A))*b +function RandomExtensions.maketype(I::AbsAlgAssIdl, _) + return elem_type(algebra(I)) +end + +function RandomExtensions.make(I::AbsAlgAssIdl, vs...) + R = base_ring(algebra(I)) + if length(vs) == 1 && elem_type(R) == Random.gentype(vs[1]) + RandomExtensions.Make(I, vs[1]) # forward to default Make constructor + else + RandomExtensions.Make(I, make(R, vs...)) end - return x end -function rand(a::AbsAlgAssIdl, rng::AbstractUnitRange{Int}) +function rand(rng::AbstractRNG, a_sp::Random.SamplerTrivial{<:Make2{<:NCRingElem, <:AbsAlgAssIdl}}) + a, v = a_sp[][1:end] A = algebra(a) x = A() for b in basis(a, copy = false) - x += rand(base_ring(A), rng)*b + x = add!(x, rand(rng, v)*b) end return x end +rand(rng::AbstractRNG, a::AbsAlgAssIdl, v...) = rand(rng, make(a, v...)) + +rand(a::AbsAlgAssIdl, v...) = rand(Random.GLOBAL_RNG, a, v...) + ################################################################################ # # Reduction of element modulo ideal @@ -643,8 +656,8 @@ end # ################################################################################ -function left_principal_generator(a::AbsAlgAssIdl{S, T, U}) where { S <: MatAlgebra, T, U } - @assert is_left_ideal(a) "Not a left ideal" +function left_principal_generator(a::AbsAlgAssIdl{S}) where {S <: MatAlgebra} + @req is_left_ideal(a) "Not a left ideal" A = algebra(a) if dim(A) != degree(A)^2*dim_of_coefficient_ring(A) error("Only implemented for full matrix algebras") @@ -674,7 +687,7 @@ function left_principal_generator(a::AbsAlgAssIdl{S, T, U}) where { S <: MatAlge return x end -function right_principal_generator(a::AbsAlgAssIdl{S, T, U}) where { S <: MatAlgebra, T, U } +function right_principal_generator(a::AbsAlgAssIdl{S}) where {S <: MatAlgebra} @assert is_right_ideal(a) "Not a right ideal" A = algebra(a) if dim(A) != degree(A)^2*dim_of_coefficient_ring(A) diff --git a/src/AlgAss/Map.jl b/src/AlgAss/Map.jl index 34cb6cb0e8..83de797722 100644 --- a/src/AlgAss/Map.jl +++ b/src/AlgAss/Map.jl @@ -220,7 +220,8 @@ function hom(A::R, B::S, M::T; check = true) where {R <: AbstractAssociativeAlge return h end -function hom(A::R, B::S, M::T, N::T) where {R <: AbstractAssociativeAlgebra, S <: AbstractAssociativeAlgebra, T <: MatElem} +function hom(A::R, B::S, M::T, N::T; check = true) where {R <: AbstractAssociativeAlgebra, S <: AbstractAssociativeAlgebra, T <: MatElem} + # TODO: add check return AbsAlgAssMor{R, S, T}(A, B, M, N) end diff --git a/src/AlgAss/Types.jl b/src/AlgAss/Types.jl index 693b937e61..d69398e353 100644 --- a/src/AlgAss/Types.jl +++ b/src/AlgAss/Types.jl @@ -236,20 +236,21 @@ end # S is the type of the algebra, T = elem_type(S) and U is the type of matrices # over the base ring of the algebra -mutable struct AbsAlgAssIdl{S, T, U} +mutable struct AbsAlgAssIdl{S} algebra::S - basis::Vector{T} - basis_matrix::U + basis#::Vector{elem_type(algebra)} + basis_matrix#::dense_matrix_type(base_ring_Type(A)) + basis_matrix_solve_ctx#solve_context_type(...) isleft::Int # 0 Not known # 1 Known to be a left ideal # 2 Known not to be a left ideal isright::Int # as for isleft - iszero::Int + iszero::Int # as for isleft - function AbsAlgAssIdl{S, T, U}(A::S) where {S, T, U} - I = new{S, T, U}() + function AbsAlgAssIdl{S}(A::S) where {S} + I = new{S}() I.algebra = A I.isleft = 0 I.isright = 0 @@ -257,8 +258,8 @@ mutable struct AbsAlgAssIdl{S, T, U} return I end - function AbsAlgAssIdl{S, U}(A::S, M::U) where {S, U} - I = new{S, elem_type(S), U}() + function AbsAlgAssIdl{S}(A::S, M::MatElem) where {S} + I = new{S}() I.algebra = A I.basis_matrix = M I.isleft = 0 diff --git a/src/AlgAss/radical.jl b/src/AlgAss/radical.jl index 42704a8de0..b6cc2ec2be 100644 --- a/src/AlgAss/radical.jl +++ b/src/AlgAss/radical.jl @@ -32,7 +32,7 @@ Returns the Jacobson radical of $A$. """ function radical(A::AbstractAssociativeAlgebra) - return ideal_from_gens(A, _radical(A), :twosided) + return _ideal_from_kgens(A, _radical(A); side = :twosided) end function _radical(A::AbstractAssociativeAlgebra) diff --git a/src/AlgAssAbsOrd/Ideal.jl b/src/AlgAssAbsOrd/Ideal.jl index 065dc110eb..71489f799d 100644 --- a/src/AlgAssAbsOrd/Ideal.jl +++ b/src/AlgAssAbsOrd/Ideal.jl @@ -1090,7 +1090,7 @@ function _islocally_free_left(O::AlgAssAbsOrd, I::AlgAssAbsOrdIdl, p::Union{Int, push!(gensJ, toIpI(bb*c)) end end - JinIpI = ideal_from_gens(IpI, gensJ) + JinIpI = _ideal_from_kgens(IpI, gensJ) IJ, toIJ = quo(IpI, JinIpI) a = O() @@ -2049,7 +2049,7 @@ function maximal_integral_ideal_containing(I::AlgAssAbsOrdIdl, p::Union{ ZZRingE B, BtoOP = _as_algebra_over_center(OP) C, toC = _as_matrix_algebra(B) - JinC = ideal_from_gens(C, [ toC(OPtoB(toOP(O(b)))) for b in absolute_basis(J) ]) + JinC = _ideal_from_kgens(C, [ toC(OPtoB(toOP(O(b)))) for b in absolute_basis(J) ]) y = left_principal_generator(JinC) m = matrix(y) r = rref!(m) diff --git a/src/AlgAssRelOrd/Eichler.jl b/src/AlgAssRelOrd/Eichler.jl index dbc94a9839..d6451446ca 100644 --- a/src/AlgAssRelOrd/Eichler.jl +++ b/src/AlgAssRelOrd/Eichler.jl @@ -65,8 +65,8 @@ function _eichler_find_transforming_unit_maximal(M::T, N::T) where { T <: Union{ OpO, toOpO = quo(O, p*O, p) B, toB = _as_matrix_algebra(OpO) - I = ideal_from_gens(B, [ toB(toOpO(O(b))) for b in absolute_basis(M) ]) - J = ideal_from_gens(B, [ toB(toOpO(O(b))) for b in absolute_basis(N) ]) + I = _ideal_from_kgens(B, [ toB(toOpO(O(b))) for b in absolute_basis(M) ]) + J = _ideal_from_kgens(B, [ toB(toOpO(O(b))) for b in absolute_basis(N) ]) # Compute the image of 1 under the canonical projections O -> O/M respectively O -> O/N Fq = base_ring(B) @@ -83,7 +83,7 @@ function _eichler_find_transforming_unit_maximal(M::T, N::T) where { T <: Union{ break end end - v = matrix(Fq, degree(B), 1, [ vv[i, nonZeroCol] for i = 1:degree(B) ]) + v = matrix(Fq, degree(B), 1, elem_type(Fq)[ vv[i, nonZeroCol] for i = 1:degree(B) ]) ww = mod(one(B), J) nonZeroCol = 0 for i = 1:degree(B) @@ -97,7 +97,7 @@ function _eichler_find_transforming_unit_maximal(M::T, N::T) where { T <: Union{ break end end - w = matrix(Fq, degree(B), 1, [ ww[i, nonZeroCol] for i = 1:degree(B) ]) + w = matrix(Fq, degree(B), 1, elem_type(Fq)[ ww[i, nonZeroCol] for i = 1:degree(B) ]) b = ceil(Int, degree(base_ring(B))*dim(B)*log2(BigInt(characteristic(base_ring(B))))) # A minimal set of generators of around b elements should generate B^\times diff --git a/src/AlgAssRelOrd/Ideal.jl b/src/AlgAssRelOrd/Ideal.jl index 78eaa52f12..9cc4b5ce24 100644 --- a/src/AlgAssRelOrd/Ideal.jl +++ b/src/AlgAssRelOrd/Ideal.jl @@ -1096,7 +1096,7 @@ function is_locally_free(O::AlgAssRelOrd, I::AlgAssRelOrdIdl, p::Union{ AbsNumFi push!(gensJ, toIpI(bb*c)) end end - JinIpI = ideal_from_gens(IpI, gensJ) + JinIpI = _ideal_from_kgens(IpI, gensJ) IJ, toIJ = quo(IpI, JinIpI) a = O() @@ -1352,7 +1352,7 @@ function maximal_integral_ideal_containing(I::AlgAssRelOrdIdl, p::Union{ AbsNumF B, BtoOP = _as_algebra_over_center(OP) C, toC = _as_matrix_algebra(B) - JinC = ideal_from_gens(C, elem_type(C)[ toC(BtoOP\(toOP(O(b)))) for b in absolute_basis(J) ]) + JinC = _ideal_from_kgens(C, elem_type(C)[ toC(BtoOP\(toOP(O(b)))) for b in absolute_basis(J) ]) y = left_principal_generator(JinC) m = matrix(y) r = rref!(m) diff --git a/src/exports.jl b/src/exports.jl index da71484562..b5e6d6d2bd 100644 --- a/src/exports.jl +++ b/src/exports.jl @@ -613,6 +613,7 @@ export lattice_with_local_conditions export lcm export leading_coefficient export leech_lattice +export left_ideal export left_order export level export lll @@ -801,6 +802,7 @@ export restrict_scalars export restrict_scalars_with_map export resultant export riemann_roch_space +export right_ideal export right_order export ring_of_integers export ring_of_multipliers @@ -911,6 +913,7 @@ export trivial_morphism export trred export trred_matrix export twists +export twosided_ideal export uniformizer export unit_group export unit_group_fac_elem diff --git a/test/AlgAss/AbsAlgAss.jl b/test/AlgAss/AbsAlgAss.jl index abbd7fa066..1051cffd86 100644 --- a/test/AlgAss/AbsAlgAss.jl +++ b/test/AlgAss/AbsAlgAss.jl @@ -112,7 +112,7 @@ A = StructureConstantAlgebra(f2g3) fg = A(QQFieldElem[-5, 5, -2, 6, 3, 1, 0, 0, 0, 0, 0, 0, 0]) # = f*g J = radical(A) - I = ideal(A, fg) + I = left_ideal(A, fg) @test I == J f = x^2 + 1 @@ -124,7 +124,7 @@ A = StructureConstantAlgebra(g2h3) gh = A(map(K, [10, -5, -28, -13, 2, 1, 0, 0, 0, 0, 0, 0])) # = g*h J = radical(A) - I = ideal(A, gh) + I = left_ideal(A, gh) @test I == J G = small_group(8, 4) @@ -138,7 +138,7 @@ 0 0 0 0 1 0 0 1; 0 0 0 0 0 1 0 1; 0 0 0 0 0 0 1 1] - @test I == ideal(A, bI) + @test I == Hecke._ideal_from_matrix(A, bI) ge = [A(g) - A(one(G)) for g in G] @test all(in(I), ge) AS, AStoA = StructureConstantAlgebra(A) diff --git a/test/AlgAss/Ideal.jl b/test/AlgAss/Ideal.jl index c2bef42730..c337e4b6c9 100644 --- a/test/AlgAss/Ideal.jl +++ b/test/AlgAss/Ideal.jl @@ -1,11 +1,47 @@ @testset "Ideals in algebras" begin + let + A = matrix_algebra(GF(3), 2) + I = A[2]*A + @test algebra(I) === A + @test ideal(A, [A[2]], side = :right) == I + I = A*A[2] + @test algebra(I) === A + @test ideal(A, [A[2]], side = :left) == I + I = A[2]*A + A[3]*A + @test algebra(I) === A + @test ideal(A, [A[2], A[3]], side = :right) == I + I = A*A[2] + A*A[3] + @test algebra(I) === A + @test ideal(A, [A[2], A[3]], side = :left) == I + + sprint(show, "text/plain", I) isa String + sprint(show, I) isa String + @test !is_zero(I) + @test is_one(I) + + @test basis(I) !== basis(I; copy = false) + + I = A*zero(A) + @test algebra(I) === A + @test ideal(A, elem_type(A)[], side = :left) == I + @test is_zero(I) + @test !is_one(I) + end + + @testset "Left / Right" begin A = matrix_algebra(GF(3), 2) I = A[2]*A - @test is_left_ideal(I) == false - @test is_right_ideal(I) == true + @test !is_left_ideal(I) + @test is_right_ideal(I) + + J = ideal(A, [A[1]]; side = :twosided) + @test J == one(A) * A + + J = twosided_ideal(A, [A[2]]) + @test J == one(A) * A end @testset "Quotients" begin @@ -70,8 +106,8 @@ # see https://github.com/thofma/Hecke.jl/issues/1399 . G = small_group(8, 4) A, _ = StructureConstantAlgebra(group_algebra(FlintQQ, G)) - I = ideal(A, one(A)) - J = ideal(A, sum(A[i] for i in 1:8)) + I = left_ideal(A, one(A)) + J = left_ideal(A, sum(A[i] for i in 1:8)) Q, AtoQ = quo(I, J) @test dim(Q) == 7 @@ -108,11 +144,20 @@ E = elem_type(A) @test rand(I) isa E @test rand(rng, I) isa E - @test rand(rng, I, 2, 3) isa Matrix{E} + @test rand(rng, Hecke.RandomExtensions.make(I), 2, 3) isa Matrix{E} Random.seed!(rng, rand_seed) a = rand(rng, I) Random.seed!(rng, rand_seed) @test a == rand(rng, I) end + + let + A = matrix_algebra(GF(3), 2) + J = Hecke.ideal(A, [A[1]]; side = :twosided) + a = @inferred Hecke.left_principal_generator(J) + @test A * a == J + a = @inferred Hecke.right_principal_generator(J) + @test a * A == J + end end diff --git a/test/AlgAss/radical.jl b/test/AlgAss/radical.jl index 6961a7f647..748e820d8b 100644 --- a/test/AlgAss/radical.jl +++ b/test/AlgAss/radical.jl @@ -6,7 +6,7 @@ A = StructureConstantAlgebra(f2g3) fg = A(QQFieldElem[-5, 5, -2, 6, 3, 1, 0, 0, 0, 0, 0, 0, 0]) # = f*g J = radical(A) - I = ideal(A, fg) + I = left_ideal(A, fg) @test I == J f = x^2 + 1 @@ -18,7 +18,7 @@ A = StructureConstantAlgebra(g2h3) gh = A(map(K, [10, -5, -28, -13, 2, 1, 0, 0, 0, 0, 0, 0])) # = g*h J = radical(A) - I = ideal(A, gh) + I = left_ideal(A, gh) @test I == J G = small_group(8, 4) @@ -32,7 +32,7 @@ 0 0 0 0 1 0 0 1; 0 0 0 0 0 1 0 1; 0 0 0 0 0 0 1 1] - @test I == ideal(A, bI) + @test I == Hecke._ideal_from_matrix(A, bI) ge = [A(g) - A(one(G)) for g in G] @test all(in(I), ge) AS, AStoA = StructureConstantAlgebra(A) @@ -65,6 +65,6 @@ for K in [ GF(2), GF(4), Native.GF(2), Native.GF(2, 2), QQ, rationals_as_number_field()[1]] A = matrix_algebra(K, [ matrix(K, 2, 2, [ 1, 0, 0, 0 ]), matrix(K, 2, 2, [ 0, 1, 0, 0 ]), matrix(K, 2, 2, [ 0, 0, 0, 1]) ]) # i. e. upper triangular matrices I = radical(A) - @test nrows(basis_matrix(I, copy = false)) == 1 + @test dim(I) == 1 end end From 2af99ca3cb3104861fc686e4931f7b6d0acca19a Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Sat, 19 Oct 2024 00:31:04 +0200 Subject: [PATCH 18/51] ci: remove 1.9, add 1.11 (#1654) --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9e6b171acb..c946a2d90f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -27,8 +27,8 @@ jobs: matrix: julia-version: - '1.6' - - '1.9' # to be removed in the near future - - '1.10' + - '1.10' # to be removed in the near future + - '1.11' - 'nightly' os: - ubuntu-latest From 3f3b1fc314e7e5edc0325552e80f46ffe6addee1 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Wed, 23 Oct 2024 20:58:41 +0200 Subject: [PATCH 19/51] fix: export `is_subfield_normal` and `principal_subfields` (#1657) Closes #1656 --- src/NumField/NfAbs/NfAbs.jl | 3 +-- src/NumField/SimpleNumField/Subfields.jl | 11 +++++++++++ src/exports.jl | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/NumField/NfAbs/NfAbs.jl b/src/NumField/NfAbs/NfAbs.jl index 17217cc91b..bffbadb3e7 100644 --- a/src/NumField/NfAbs/NfAbs.jl +++ b/src/NumField/NfAbs/NfAbs.jl @@ -470,7 +470,7 @@ end is_subfield_normal(K::AbsSimpleNumField, L::AbsSimpleNumField) -> Bool, NumFieldHom{AbsSimpleNumField, AbsSimpleNumField} Returns `true` and an injection from $K$ to $L$ if $K$ is a subfield of $L$. -Otherwise the function returns "false" and a morphism mapping everything to 0. +Otherwise the function returns `false` and a morphism mapping everything to `0`. This function assumes that $K$ is normal. """ @@ -481,7 +481,6 @@ function is_subfield_normal(K::AbsSimpleNumField, L::AbsSimpleNumField) end b, prim_img = _issubfield_normal(K, L) return b, hom(K, L, prim_img, check = false) - end ################################################################################ diff --git a/src/NumField/SimpleNumField/Subfields.jl b/src/NumField/SimpleNumField/Subfields.jl index f5cfe3ce2f..f730ef75e1 100644 --- a/src/NumField/SimpleNumField/Subfields.jl +++ b/src/NumField/SimpleNumField/Subfields.jl @@ -75,6 +75,17 @@ end Return the principal subfields of $L$ as pairs consisting of a subfield $k$ and an embedding $k \to L$. + +# Examples + +```jldoctest +julia> Qx, x = QQ["x"]; + +julia> K, a = number_field(x^8 - x^4 + 1); + +julia> length(principal_subfields(K)) +8 +``` """ function principal_subfields(K::SimpleNumField) v = get_attribute(K, :principal_subfields) diff --git a/src/exports.jl b/src/exports.jl index b5e6d6d2bd..a7f1b1e77e 100644 --- a/src/exports.jl +++ b/src/exports.jl @@ -557,6 +557,7 @@ export is_snf export is_split export is_squarefree export is_subfield +export is_subfield_normal export is_subgroup export is_sublattice export is_sublattice_with_relations @@ -737,6 +738,7 @@ export prime_ideals_up_to export primes export primitive_closure export principal_generator +export principal_subfields export pselmer_group export pselmer_group_fac_elem export pseudo_basis From 637902bd7fca81238beaf946812573cacc42def1 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Wed, 23 Oct 2024 22:47:11 +0200 Subject: [PATCH 20/51] fix Oscar #4170 - too low precision in factoring (#1640) * fix Oscar #4170 - too low precision in factoring --------- Co-authored-by: Claus Fieker --- src/NumField/NfAbs/Poly.jl | 2 +- src/NumField/NfAbs/PolyFact.jl | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/NumField/NfAbs/Poly.jl b/src/NumField/NfAbs/Poly.jl index e29207fd3b..ed8b8e745b 100644 --- a/src/NumField/NfAbs/Poly.jl +++ b/src/NumField/NfAbs/Poly.jl @@ -522,7 +522,7 @@ function cld_bound(f::PolyRingElem{AbsSimpleNumFieldElem}, k::Vector{Int}) g = Zx() n = degree(base_ring(f)) for i=0:degree(f) - setcoeff!(g, i, Hecke.upper_bound(ZZRingElem, sqrt(t2(coeff(f, i))//n))) + setcoeff!(g, i, Hecke.upper_bound(ZZRingElem, sqrt(t2(coeff(f, i))))) end if is_monic(f) setcoeff!(g, degree(f), ZZRingElem(1)) diff --git a/src/NumField/NfAbs/PolyFact.jl b/src/NumField/NfAbs/PolyFact.jl index 2a38a9c8df..2b080d9b38 100644 --- a/src/NumField/NfAbs/PolyFact.jl +++ b/src/NumField/NfAbs/PolyFact.jl @@ -558,6 +558,8 @@ function van_hoeij(f::PolyRingElem{AbsSimpleNumFieldElem}, P::AbsNumFieldOrderId _, mK = residue_field(order(P), P) mK = extend(mK, K) r = length(factor(map_coefficients(mK, f, cached = false))) + prec_scale = max(nbits(r), prec_scale) + N = degree(f) @vprintln :PolyFactor 1 "Having $r local factors for degree $N" @@ -589,7 +591,7 @@ function van_hoeij(f::PolyRingElem{AbsSimpleNumFieldElem}, P::AbsNumFieldOrderId - the bounds are monotonous in the abs value of the coeffs (I think they are using abs value of coeff) - the math works for real coeffs as well - thus create an ZZPolyRingElem with pos. coeffs. containing upper bounds of the conjugates of the - coeffs. DOne via T_2: sqrt(n*T_2(alpha) is an upper bounds for all conjugates + coeffs. Done via T_2: sqrt(T_2(alpha) is an upper bounds for all conjugates - Fieker/ Friedrichs compares T_2 vs 2-norm (squared) of coeffs - leading coeff as well as den are algebraic CHECK: den*lead*cld in Z[alpha] (or in the order used) @@ -603,7 +605,7 @@ function van_hoeij(f::PolyRingElem{AbsSimpleNumFieldElem}, P::AbsNumFieldOrderId # 2nd block is for additional bits for rounding? bb = landau_mignotte_bound(f)*upper_bound(ZZRingElem, sqrt(t2(den*leading_coefficient(f)))) #CHECK: landau... is a bound on the (abs value) of the coeffs of the factors, - # need everywhere sqrt(n*T_2)? to get conjugate bounds + # need everywhere sqrt(T_2)? to get conjugate bounds kk = ceil(Int, degree(K)/2/log(norm(P))*(log2(c1*c2) + 2*nbits(bb))) @vprintln :PolyFactor 2 "using CLD precision bounds $b" From 413b472461b722633a15fd24e49e1b9e72d95c7d Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Thu, 24 Oct 2024 07:53:26 +0200 Subject: [PATCH 21/51] chore: bump to 0.34.5 (#1660) --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index bb51168006..0e54fc59d5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Hecke" uuid = "3e1990a7-5d81-5526-99ce-9ba3ff248f21" -version = "0.34.4" +version = "0.34.5" [deps] AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d" From 66ab098734eb0b0b2a8fea3f80d6728fb0153a82 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 25 Oct 2024 09:37:47 +0200 Subject: [PATCH 22/51] Fix bug in `add_right_scaled_row!` (#1658) Some issues in `add_scaled_row!` were fixed in #1591, but not to `add_right_scaled_row!`. Rectify this by merging the two functions into one. --- src/Sparse/Row.jl | 51 +++++++++++----------------------------------- test/Sparse/Row.jl | 5 +++++ 2 files changed, 17 insertions(+), 39 deletions(-) diff --git a/src/Sparse/Row.jl b/src/Sparse/Row.jl index 2d0f96c5b5..5745f3be27 100644 --- a/src/Sparse/Row.jl +++ b/src/Sparse/Row.jl @@ -684,21 +684,25 @@ end Returns the row $c A + B$. """ add_scaled_row(a::SRow{T}, b::SRow{T}, c::T) where {T} = add_scaled_row!(a, deepcopy(b), c) -add_left_scaled_row(a::SRow{T}, b::SRow{T}, c::T) where {T} = add_scaled_row!(a, deepcopy(b), c) + +add_left_scaled_row(a::SRow{T}, b::SRow{T}, c::T) where {T} = add_left_scaled_row!(a, deepcopy(b), c) +add_right_scaled_row(a::SRow{T}, b::SRow{T}, c::T) where {T} = add_right_scaled_row!(a, deepcopy(b), c) + + @doc raw""" add_scaled_row!(A::SRow{T}, B::SRow{T}, c::T) -> SRow{T} Adds the left scaled row $c A$ to $B$. """ -function add_scaled_row!(a::SRow{T}, b::SRow{T}, c::T) where T +function add_scaled_row!(a::SRow{T}, b::SRow{T}, c::T, ::Val{left_side} = Val(true)) where {T, left_side} @assert a !== b i = 1 j = 1 t = base_ring(a)() while i <= length(a) && j <= length(b) if a.pos[i] < b.pos[j] - t = mul!(t, c, a.values[i]) + t = left_side ? mul!(t, c, a.values[i]) : mul!(t, a.values[i], c) if !iszero(t) insert!(b.pos, j, a.pos[i]) insert!(b.values, j, c*a.values[i]) @@ -708,7 +712,7 @@ function add_scaled_row!(a::SRow{T}, b::SRow{T}, c::T) where T elseif a.pos[i] > b.pos[j] j += 1 else - t = mul!(t, c, a.values[i]) + t = left_side ? mul!(t, c, a.values[i]) : mul!(t, a.values[i], c) b.values[j] = add!(b.values[j], t) if iszero(b.values[j]) @@ -721,7 +725,7 @@ function add_scaled_row!(a::SRow{T}, b::SRow{T}, c::T) where T end end while i <= length(a) - t = mul!(t, c, a.values[i]) + t = left_side ? mul!(t, c, a.values[i]) : mul!(t, a.values[i], c) if !iszero(t) push!(b.pos, a.pos[i]) push!(b.values, c*a.values[i]) @@ -731,49 +735,18 @@ function add_scaled_row!(a::SRow{T}, b::SRow{T}, c::T) where T return b end +# ignore tmp argument add_scaled_row!(a::SRow{T}, b::SRow{T}, c::T, tmp::SRow{T}) where T = add_scaled_row!(a, b, c) -add_right_scaled_row(a::SRow{T}, b::SRow{T}, c::T) where {T} = add_right_scaled_row!(a, deepcopy(b), c) +add_left_scaled_row!(a::SRow{T}, b::SRow{T}, c::T) where T = add_scaled_row!(a, b, c) @doc raw""" add_right_scaled_row!(A::SRow{T}, B::SRow{T}, c::T) -> SRow{T} Return the right scaled row $c A$ to $B$ by changing $B$ in place. """ +add_right_scaled_row!(a::SRow{T}, b::SRow{T}, c::T) where T = add_scaled_row!(a, b, c, Val(false)) -function add_right_scaled_row!(a::SRow{T}, b::SRow{T}, c::T) where T - @assert a !== b - i = 1 - j = 1 - t = base_ring(a)() - while i <= length(a) && j <= length(b) - if a.pos[i] < b.pos[j] - insert!(b.pos, j, a.pos[i]) - insert!(b.values, j, a.values[i]*c) - i += 1 - j += 1 - elseif a.pos[i] > b.pos[j] - j += 1 - else - t = mul!(t, a.values[i], c) - b.values[j] = add!(b.values[j], t) - - if iszero(b.values[j]) - deleteat!(b.values, j) - deleteat!(b.pos, j) - else - j += 1 - end - i += 1 - end - end - while i <= length(a) - push!(b.pos, a.pos[i]) - push!(b.values, a.values[i]*c) - i += 1 - end - return b -end ################################################################################ # diff --git a/test/Sparse/Row.jl b/test/Sparse/Row.jl index 7e6aaed8c0..5b1e10f9be 100644 --- a/test/Sparse/Row.jl +++ b/test/Sparse/Row.jl @@ -136,6 +136,11 @@ @inferred Hecke.add_scaled_row!(A, B, RR(3)) @test B == sparse_row(RR, [2,3,5,6], [3,6,4,3]) + A = sparse_row(RR, [1,2,3,4,6,7], [4,1,1,2,1,4]) + B = sparse_row(RR, [3,4,5], [3,6,4]) + @inferred Hecke.add_right_scaled_row!(A, B, RR(3)) + @test B == sparse_row(RR, [2,3,5,6], [3,6,4,3]) + # Maximum A = sparse_row(FlintZZ, [1, 2, 3, 5], ZZRingElem[-5, 2, 4, 10]) From 34fb045fb1a608ff2b780cc270b448c764869a19 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Fri, 25 Oct 2024 13:57:26 +0200 Subject: [PATCH 23/51] fix: saturation at large primes (#1661) Use baby-step-giant-step algorithm for large primes to make the complexity not linear in the order. --- src/NumFieldOrd/NfOrd/Clgp/Saturate.jl | 26 ++++++++++++++------- src/NumFieldOrd/NfOrd/ResidueRingMultGrp.jl | 2 ++ test/NfOrd/Clgp.jl | 7 ++++++ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/NumFieldOrd/NfOrd/Clgp/Saturate.jl b/src/NumFieldOrd/NfOrd/Clgp/Saturate.jl index e4b9c33ead..2ede5227c4 100644 --- a/src/NumFieldOrd/NfOrd/Clgp/Saturate.jl +++ b/src/NumFieldOrd/NfOrd/Clgp/Saturate.jl @@ -12,10 +12,11 @@ function mod_p(R::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}}, Q:: pp, e = Hecke.ppio(oF, p) #We now want the discrete logarithm of the images of the elements of R in F #We don't need the full group, just the quotient by p - #We compute a generator and cache the powers in dl - #Then we will compute the discrete logarithms by checking the values in dl + #We compute a generator and + # - cache the powers in dl if pp is small + # - we will compute the discrete logarithms by checking the values in dl + # or via BSGS dl = Dict{Hecke.Nemo.fpFieldElem, Int}() - dl[F(1)] = 0 exp_to_test = divexact(pp, p) x = rand(F) while true @@ -28,12 +29,21 @@ function mod_p(R::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}}, Q:: end x = rand(F) end - y = x - for i = 1:pp-1 - dl[y] = i - y *= x + if nbits(pp) < 19 # seems to be a reasonable cutoff + y = one(F) + for i = 0:pp-1 + dl[y] = i + y *= x + end + end + ma = Vector{Int}(undef, length(R)) + for i in 1:length(R) + imgd = image(mF1, R[i], D[i], cached, pp)^e + ma[i] = get!(dl, imgd) do + Hecke.baby_step_giant_step(x, pp, imgd, dl) % p + end end - return matrix(T, 1, length(R), Int[dl[image(mF1, R[i], D[i], cached, pp)^e] % p for i in 1:length(R)]) + return matrix(T, 1, length(R), ma) end #= idea diff --git a/src/NumFieldOrd/NfOrd/ResidueRingMultGrp.jl b/src/NumFieldOrd/NfOrd/ResidueRingMultGrp.jl index a4e5435ac2..b097317cf8 100644 --- a/src/NumFieldOrd/NfOrd/ResidueRingMultGrp.jl +++ b/src/NumFieldOrd/NfOrd/ResidueRingMultGrp.jl @@ -714,6 +714,8 @@ of the first step. This allows to speed up subsequent calls with the same $g$ and $n$. """ function baby_step_giant_step(g, n, h, cache::Dict) + # if cache is given, it must be empty or contain + # *all* big steps @assert typeof(g) == typeof(h) m = ZZRingElem(isqrt(n) + 1) if isempty(cache) diff --git a/test/NfOrd/Clgp.jl b/test/NfOrd/Clgp.jl index c2fddd16d7..de7e57b614 100644 --- a/test/NfOrd/Clgp.jl +++ b/test/NfOrd/Clgp.jl @@ -285,4 +285,11 @@ end @test order(c) == 892 end end + + # saturation at large primes + + # the cyclotomic units are saturated at any prime l, since the class number h_149^+ is one. + K, = cyclotomic_real_subfield(149, "a") + u = Hecke._cyclotomic_units_totally_real_prime_conductor(K, 149) + @test nrows(Hecke.RelSaturate.compute_candidates_for_saturate(FacElem.(u[2:end]), next_prime(2^25))) == 0 end From dc2560e49b438636383153215e320fd9e31b9731 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Sat, 26 Oct 2024 17:06:15 +0200 Subject: [PATCH 24/51] feat: group algebras with sparse representation (#1655) --- docs/src/.vitepress/config.mts | 1 + docs/src/manual/algebras/groupalgebras.md | 49 +++++++ src/AlgAss/AbsAlgAss.jl | 15 +++ src/AlgAss/AlgGrp.jl | 62 +++++---- src/AlgAss/Elem.jl | 150 +++++++++++++++++----- src/AlgAss/Types.jl | 127 +++++++++++++----- src/Grp/GenGrp.jl | 6 +- src/GrpAb/GrpAbFinGen.jl | 2 + test/AlgAss/AlgGrp.jl | 31 +++++ test/AlgAss/Elem.jl | 9 ++ 10 files changed, 362 insertions(+), 90 deletions(-) create mode 100644 docs/src/manual/algebras/groupalgebras.md diff --git a/docs/src/.vitepress/config.mts b/docs/src/.vitepress/config.mts index 9609aaf411..e4c0427b9c 100644 --- a/docs/src/.vitepress/config.mts +++ b/docs/src/.vitepress/config.mts @@ -95,6 +95,7 @@ export default defineConfig({ { text: 'Introduction', link: 'manual/algebras/intro'}, { text: 'Basics', link: 'manual/algebras/basics'}, { text: 'Structure constant algebras', link: 'manual/algebras/structureconstant'}, + { text: 'Group algebras', link: 'manual/algebras/groupalgebras'}, { text: 'Ideals', link: 'manual/algebras/ideals'}, ] }, diff --git a/docs/src/manual/algebras/groupalgebras.md b/docs/src/manual/algebras/groupalgebras.md new file mode 100644 index 0000000000..d558ccc527 --- /dev/null +++ b/docs/src/manual/algebras/groupalgebras.md @@ -0,0 +1,49 @@ +# Group algebras + +```@meta +CurrentModule = Hecke +DocTestSetup = quote + using Hecke +end +``` + +As is natural, the basis of a group algebra $K[G]$ correspond to the elements of $G$ with respect +to some arbitrary ordering. + +## Creation + +```@docs +group_algebra(::Field, ::Group) +``` + +## Elements + +Given a group algebra `A` and an element of a group `g`, the corresponding group algebra element +can be constructed using the syntax `A(g)`. + +```jldoctest grpalgex1 +julia> G = abelian_group([2, 2]); a = G([0, 1]); + +julia> QG = group_algebra(QQ, G); + +julia> x = QG(a) +[0, 0, 1, 0] +``` + +Vice versa, one can obtain the coordinate of a group algebra element `x` with respect to a group +element `a` using the syntax `x[a]`. + +```jldoctest grpalgex1 +julia> x[a] +1 +``` + +It is also possible to create elements by specifying for each group element the corresponding coordinate either by a list of pairs or a dictionary: + +```jldoctest grpalgex1 +julia> QG(a => 2, zero(G) => 1) == 2 * QG(a) + 1 * QG(zero(G)) +true + +julia> QG(Dict(a => 2, zero(G) => 1)) == 2 * QG(a) + 1 * QG(zero(G)) +true +``` diff --git a/src/AlgAss/AbsAlgAss.jl b/src/AlgAss/AbsAlgAss.jl index 979ab75f20..0714afefd0 100644 --- a/src/AlgAss/AbsAlgAss.jl +++ b/src/AlgAss/AbsAlgAss.jl @@ -1,3 +1,18 @@ +################################################################################ +# +# Internal thingy +# +################################################################################ + +# check if elements are represented using a sparse row + +_is_sparse(A::AbstractAssociativeAlgebra) = false + +_is_sparse(A::GroupAlgebra) = A.sparse + +# because we are lazy +_is_dense(A::AbstractAssociativeAlgebra) = !_is_sparse(A) + _base_ring(A::AbstractAssociativeAlgebra) = base_ring(A) @doc raw""" diff --git a/src/AlgAss/AlgGrp.jl b/src/AlgAss/AlgGrp.jl index 1e1517f7ef..b9c144b547 100644 --- a/src/AlgAss/AlgGrp.jl +++ b/src/AlgAss/AlgGrp.jl @@ -32,8 +32,8 @@ group(A::GroupAlgebra) = A.group has_one(A::GroupAlgebra) = true -function (A::GroupAlgebra{T, S, R})(c::Vector{T}; copy::Bool = false) where {T, S, R} - length(c) != dim(A) && error("Dimensions don't match.") +function (A::GroupAlgebra{T, S, R})(c::Union{Vector{T}, SRow{T}}; copy::Bool = false) where {T, S, R} + c isa Vector && length(c) != dim(A) && error("Dimensions don't match.") return GroupAlgebraElem{T, typeof(A)}(A, copy ? deepcopy(c) : c) end @@ -52,6 +52,14 @@ function multiplication_table(A::GroupAlgebra; copy::Bool = true) end end +# get the underyling group operation, I wish this was part of the group interface + +_op(G::AbstractAlgebra.AdditiveGroup) = + + +_op(G::Group) = * + +_op(A::GroupAlgebra) = _op(group(A)) + ################################################################################ # # Construction @@ -59,17 +67,29 @@ end ################################################################################ @doc raw""" - group_algebra(K::Ring, G; op = *) -> GroupAlgebra + group_algebra(K::Ring, G::Group; cached::Bool = true) -> GroupAlgebra -Returns the group ring $K[G]$. -$G$ may be any set and `op` a group operation on $G$. -""" -group_algebra(K::Ring, G; op = *) = GroupAlgebra(K, G, op = op) +Return the group algebra of the group $G$ over the ring $R$. Shorthand syntax +for this construction is `R[G]`. -group_algebra(K::Ring, G::FinGenAbGroup) = GroupAlgebra(K, G) +# Examples -function group_algebra(K::Field, G; op = *) - A = GroupAlgebra(K, G, op = op) +```jldoctest +julia> QG = group_algebra(QQ, small_group(8, 5)) +Group algebra + of generic group of order 8 with multiplication table + over rational field +``` +""" +group_algebra(K::Ring, G; cached = true) = _group_algebra(K, G; op = *, cached) + +# one additional level of indirection to hide the non-user facing options +# `op` and `sparse`. +function _group_algebra(K::Ring, G; op = *, sparse = _use_sparse_group_algebra(G), cached::Bool = true) + A = GroupAlgebra(K, G; op = _op(G) , sparse = sparse, cached = cached) + if !(K isa Field) + return A + end if iszero(characteristic(K)) A.issemisimple = 1 else @@ -78,21 +98,19 @@ function group_algebra(K::Field, G; op = *) return A end -function group_algebra(K::Field, G::FinGenAbGroup) - A = group_algebra(K, G, op = +) - A.is_commutative = true - return A -end +#_group_algebra(K::Ring, G::FinGenAbGroup; op = +, cached::Bool = true, sparse::Bool = false) = GroupAlgebra(K, G, cached, sparse) -@doc raw""" - (K::Ring)[G::Group] -> GroupAlgebra - (K::Ring)[G::FinGenAbGroup] -> GroupAlgebra - -Returns the group ring $K[G]$. -""" getindex(K::Ring, G::Group) = group_algebra(K, G) getindex(K::Ring, G::FinGenAbGroup) = group_algebra(K, G) +function _use_sparse_group_algebra(G) + if !is_finite(G) + return true + else + return order(G) >= 1000 + end +end + ################################################################################ # # Commutativity @@ -629,7 +647,7 @@ const _reps = [(i=24,j=12,n=5,dims=(1,1,2,3,3), # ################################################################################ -mutable struct AbsAlgAssMorGen{S, T, U, V} <: Map{S, T, HeckeMap, AbsAlgAssMorGen} +mutable struct AbsAlgAssMorGen{S, T, U, V} <: Map{S, T, HeckeMap, Any}#AbsAlgAssMorGen} domain::S codomain::T tempdomain::U diff --git a/src/AlgAss/Elem.jl b/src/AlgAss/Elem.jl index 976dbfc966..908d3cd02a 100644 --- a/src/AlgAss/Elem.jl +++ b/src/AlgAss/Elem.jl @@ -4,6 +4,10 @@ # ################################################################################ +_is_sparse(a::AbstractAssociativeAlgebraElem) = _is_sparse(parent(a)) + +_is_dense(a::AbstractAssociativeAlgebraElem) = _is_dense(parent(a)) + function AbstractAlgebra.promote_rule(U::Type{<:AbstractAssociativeAlgebraElem{T}}, ::Type{S}) where {T, S} if AbstractAlgebra.promote_rule(T, S) === T return U @@ -90,7 +94,11 @@ function one(A::AbstractAssociativeAlgebra) if !has_one(A) error("Algebra does not have a one") end - return A(deepcopy(A.one)) # deepcopy needed by mul! + if _is_dense(A) + return A(deepcopy(A.one)) # deepcopy needed by mul! + else + return A(deepcopy(A.sparse_one)) + end end ################################################################################ @@ -151,20 +159,29 @@ end function +(a::AbstractAssociativeAlgebraElem{T}, b::AbstractAssociativeAlgebraElem{T}) where {T} parent(a) != parent(b) && error("Parents don't match.") - v = Vector{T}(undef, dim(parent(a))) - for i = 1:dim(parent(a)) - v[i] = coefficients(a, copy = false)[i] + coefficients(b, copy = false)[i] + if !_is_sparse(a) + v = Vector{T}(undef, dim(parent(a))) + for i = 1:dim(parent(a)) + v[i] = coefficients(a, copy = false)[i] + coefficients(b, copy = false)[i] + end + return parent(a)(v) + else + vv = a.coeffs_sparse + b.coeffs_sparse + return parent(a)(vv) end - return parent(a)(v) end function -(a::AbstractAssociativeAlgebraElem{T}, b::AbstractAssociativeAlgebraElem{T}) where {T} parent(a) != parent(b) && error("Parents don't match.") - v = Vector{T}(undef, dim(parent(a))) - for i = 1:dim(parent(a)) - v[i] = coefficients(a, copy = false)[i] - coefficients(b, copy = false)[i] + if _is_sparse(a) + return parent(a)(a.coeffs_sparse - b.coeffs_sparse) + else + v = Vector{T}(undef, dim(parent(a))) + for i = 1:dim(parent(a)) + v[i] = coefficients(a, copy = false)[i] - coefficients(b, copy = false)[i] + end + return parent(a)(v) end - return parent(a)(v) end function *(a::AssociativeAlgebraElem{T}, b::AssociativeAlgebraElem{T}) where {T} @@ -200,25 +217,53 @@ end function *(a::GroupAlgebraElem{T, S}, b::GroupAlgebraElem{T, S}) where {T, S} parent(a) != parent(b) && error("Parents don't match.") A = parent(a) - d = dim(A) - v = Vector{T}(undef, d) - for i in 1:d - v[i] = zero(base_ring(A)) - end - t = zero(base_ring(A)) - mt = multiplication_table(A, copy = false) - acoeff = coefficients(a, copy = false) - bcoeff = coefficients(b, copy = false) - for i in 1:d - if iszero(acoeff[i]) - continue + if !_is_sparse(a) + d = dim(A) + v = Vector{T}(undef, d) + for i in 1:d + v[i] = zero(base_ring(A)) end - for j in 1:d - k = mt[i, j] - v[k] = addmul!(v[k], acoeff[i], bcoeff[j], t) + t = zero(base_ring(A)) + mt = multiplication_table(A, copy = false) + acoeff = coefficients(a, copy = false) + bcoeff = coefficients(b, copy = false) + for i in 1:d + if iszero(acoeff[i]) + continue + end + for j in 1:d + k = mt[i, j] + v[k] = addmul!(v[k], acoeff[i], bcoeff[j], t) + end + end + return A(v) + else + op = _op(A) + s = sparse_row(base_ring(A)) + for (i, ci) in a.coeffs_sparse + r = sparse_row(base_ring(A), [(__elem_index(A, op(A.base_to_group[i],A.base_to_group[j])), ci * cj) for (j, cj) in b.coeffs_sparse]) + s += r + end + return A(s) + end +end + +################################################################################ +# +# Getindex for group algebra elements +# +################################################################################ + +function getindex(a::GroupAlgebraElem{S, GroupAlgebra{S, T, U}}, g::U) where {S, T, U} + if _is_sparse(a) + if !haskey(parent(a).group_to_base, g) + return zero(base_ring(parent(a))) + else + return a.coeffs_sparse[parent(a).group_to_base[g]] end + else + return a.coeffs[parent(a).group_to_base[g]] end - return A(v) end ################################################################################ @@ -303,6 +348,9 @@ mul!(c::AbstractAssociativeAlgebraElem{T}, a::Union{ Int, ZZRingElem }, b::Abstr function mul!(c::GroupAlgebraElem{T, S}, a::GroupAlgebraElem{T, S}, b::GroupAlgebraElem{T, S}) where {T, S} parent(a) != parent(b) && error("Parents don't match.") + if _is_sparse(a) + return a * b + end A = parent(a) d = dim(A) @@ -449,7 +497,11 @@ divexact_left(a::AbstractAssociativeAlgebraElem, b::AbstractAssociativeAlgebraEl ################################################################################ function *(a::AbstractAssociativeAlgebraElem{S}, b::S) where {S <: RingElem} - return typeof(a)(parent(a), coefficients(a, copy = false).* Ref(b)) + if !_is_sparse(a) + return typeof(a)(parent(a), coefficients(a, copy = false).* Ref(b)) + else + return typeof(a)(parent(a), a.coeffs_sparse * b) + end end *(b::S, a::AbstractAssociativeAlgebraElem{S}) where {S <: RingElem} = a*b @@ -630,7 +682,21 @@ end #end function (A::GroupAlgebra{T, S, R})(c::R) where {T, S, R} - return GroupAlgebraElem{T, typeof(A)}(A, deepcopy(c)) + return GroupAlgebraElem{T, typeof(A)}(A, c) +end + +function (A::GroupAlgebra{T, S, R})(d::Dict{R, <: Any}) where {T, S, R} + K = base_ring(A) + dd = sparse_row(base_ring(A), [(__elem_index(A, g), K(i)) for (g, i) in d]) + if _is_dense(A) + return GroupAlgebraElem{T, typeof(A)}(A, Vector(dd, dim(A))) + else + return GroupAlgebraElem{T, typeof(A)}(A, dd) + end +end + +function (A::GroupAlgebra{T, S, R})(x0::Pair{R, <: Any}, x::Vararg{U}) where {T, S, R, U <: Pair{R, <: Any}} + return A(Dict(x0, x...)) end # Generic.Mat needs it @@ -676,10 +742,23 @@ function show(io::IO, a::AbstractAssociativeAlgebraElem) if get(io, :compact, false) print(io, coefficients(a, copy = false)) else - print(io, "Element of ") - print(io, parent(a)) - print(io, " with coefficients ") - print(io, coefficients(a, copy = false)) + if _is_sparse(a) + sum = Expr(:call, :+) + if !iszero(a) + for (i, ci) in a.coeffs_sparse + push!(sum.args, + Expr(:call, :*, AbstractAlgebra.expressify(ci, context = io), + AbstractAlgebra.expressify(parent(a).base_to_group[i], context = IOContext(io, :compact => true)))) + end + end + print(io, AbstractAlgebra.expr_to_string(AbstractAlgebra.canonicalize(sum))) + else + ve = Expr(:vect) + for ci in coefficients(a, copy = false) + push!(ve.args, AbstractAlgebra.expressify(ci, context = io)) + end + print(io, AbstractAlgebra.expr_to_string(AbstractAlgebra.canonicalize(ve))) + end end end @@ -721,7 +800,11 @@ end function ==(a::AbstractAssociativeAlgebraElem{T}, b::AbstractAssociativeAlgebraElem{T}) where {T} parent(a) != parent(b) && return false - return coefficients(a, copy = false) == coefficients(b, copy = false) + if !_is_sparse(a) + return coefficients(a, copy = false) == coefficients(b, copy = false) + else + return a.coeffs_sparse == b.coeffs_sparse + end end ################################################################################ @@ -963,6 +1046,9 @@ end isone(a::AbstractAssociativeAlgebraElem) = a == one(parent(a)) function iszero(a::AbstractAssociativeAlgebraElem) + if _is_sparse(a) + return length(a.coeffs_sparse) == 0 + end return all(i -> iszero(i), coefficients(a, copy = false)) end diff --git a/src/AlgAss/Types.jl b/src/AlgAss/Types.jl index d69398e353..1da1e9a9a6 100644 --- a/src/AlgAss/Types.jl +++ b/src/AlgAss/Types.jl @@ -130,6 +130,15 @@ end @attributes mutable struct GroupAlgebra{T, S, R} <: AbstractAssociativeAlgebra{T} base_ring::Ring group::S + # We represent elements using a coefficient vector (which can be either + # sparse or dense), + # so all we have to keep track of is which group element corresponds to + # which basis element of the algebra + # This is what group_to_base, base_to_group are for. They realize the map + # G -> {1,...,n} + # {1,...n} -> G + # (In the sparse version, this map is constructed on demand) + group_to_base::Dict{R, Int} base_to_group::Vector{R} one::Vector{T} @@ -146,77 +155,113 @@ end maps_to_numberfields maximal_order - function GroupAlgebra(K::Ring, G::FinGenAbGroup, cached::Bool = true) - A = GroupAlgebra(K, G, op = +, cached = cached) + # For the sparse presentation + sparse::Bool + ind::Int # This is the number of group elements currently stored in + # group_to_base and base_to_group. + sparse_one # Store the sparse row for the one element + + function GroupAlgebra(K::Ring, G::FinGenAbGroup, cached::Bool = true, sparse::Bool = false) + A = GroupAlgebra(K, G; op = +, cached = cached, sparse = sparse) A.is_commutative = true return A end - function GroupAlgebra(K::Ring, G; op = *, cached = true) - return get_cached!(GroupAlgebraID, (K, G, op), cached) do + function GroupAlgebra(K::Ring, G; op = *, cached::Bool = true, sparse::Bool = false) + return get_cached!(GroupAlgebraID, (K, G, op, sparse), cached) do A = new{elem_type(K), typeof(G), elem_type(G)}() + A.sparse = sparse A.is_commutative = 0 A.is_simple = 0 A.issemisimple = 0 A.base_ring = K A.group = G - d = Int(order(G)) A.group_to_base = Dict{elem_type(G), Int}() - A.base_to_group = Vector{elem_type(G)}(undef, d) - A.mult_table = zeros(Int, d, d) - - i = 2 - for g in collect(G) - if isone(g) - A.group_to_base[deepcopy(g)] = 1 - A.base_to_group[1] = deepcopy(g) - continue - end - A.group_to_base[deepcopy(g)] = i - A.base_to_group[i] = deepcopy(g) - i += 1 + if !sparse + @assert is_finite(G) + d = order(Int, G) + A.base_to_group = Vector{elem_type(G)}(undef, d) + else + A.base_to_group = Vector{elem_type(G)}(undef, 1) end - v = Vector{elem_type(K)}(undef, d) - for i in 1:d - v[i] = zero(K) - end - v[1] = one(K) + if A.sparse + if G isa FinGenAbGroup + el = zero(G) + else + el = one(G) + end + A.group_to_base[el] = 1 + A.base_to_group[1] = el + A.sparse_one = sparse_row(K, [1], [one(K)]) + else + # dense + A.mult_table = zeros(Int, d, d) + i = 2 + for g in collect(G) + if isone(g) + A.group_to_base[deepcopy(g)] = 1 + A.base_to_group[1] = deepcopy(g) + continue + end + A.group_to_base[deepcopy(g)] = i + A.base_to_group[i] = deepcopy(g) + i += 1 + end - A.one = v + v = Vector{elem_type(K)}(undef, d) + for i in 1:d + v[i] = zero(K) + end + v[1] = one(K) + + A.one = v - for i = 1:d - for j = 1:d - l = op(A.base_to_group[i], A.base_to_group[j]) - A.mult_table[i, j] = A.group_to_base[l] + for i = 1:d + for j = 1:d + l = op(A.base_to_group[i], A.base_to_group[j]) + A.mult_table[i, j] = A.group_to_base[l] + end end - end - @assert all(A.mult_table[1, i] == i for i in 1:dim(A)) + @assert all(A.mult_table[1, i] == i for i in 1:dim(A)) + end return A end::GroupAlgebra{elem_type(K), typeof(G), elem_type(G)} end end -const GroupAlgebraID = AbstractAlgebra.CacheDictType{Tuple{Ring, Any, Any}, GroupAlgebra}() +const GroupAlgebraID = AbstractAlgebra.CacheDictType{Tuple{Ring, Any, Any, Bool}, GroupAlgebra}() mutable struct GroupAlgebraElem{T, S} <: AbstractAssociativeAlgebraElem{T} parent::S coeffs::Vector{T} + coeffs_sparse function GroupAlgebraElem{T, S}(A::S) where {T, S} z = new{T, S}() z.parent = A - z.coeffs = Vector{T}(undef, size(A.mult_table, 1)) - for i = 1:length(z.coeffs) - z.coeffs[i] = A.base_ring() + if !A.sparse + z.coeffs = Vector{T}(undef, size(A.mult_table, 1)) + for i = 1:length(z.coeffs) + z.coeffs[i] = A.base_ring() + end + else + z.coeffs_sparse = sparse_row(base_ring(A)) end return z end function GroupAlgebraElem{T, S}(A::S, g::U) where {T, S, U} - return A[A.group_to_base[g]] + if A.sparse + i = __elem_index(A, g) + a = GroupAlgebraElem{T, S}(A) + a.coeffs_sparse = sparse_row(base_ring(A), [i], [one(base_ring(A))]) + return a + else + return A[A.group_to_base[g]] + end end # This does not make a copy of coeffs @@ -226,8 +271,20 @@ mutable struct GroupAlgebraElem{T, S} <: AbstractAssociativeAlgebraElem{T} z.coeffs = coeffs return z end + + function GroupAlgebraElem{T, S}(A::S, coeffs::SRow{T}) where {T, S} + z = new{T, S}() + z.parent = A + z.coeffs_sparse = coeffs + return z + end end +__elem_index(A, g) = get!(A.group_to_base, g) do + push!(A.base_to_group, g) + return length(A.base_to_group) + end + ################################################################################ # # AbsAlgAssIdl diff --git a/src/Grp/GenGrp.jl b/src/Grp/GenGrp.jl index 3222ce0730..e8d9d12c72 100644 --- a/src/Grp/GenGrp.jl +++ b/src/Grp/GenGrp.jl @@ -199,6 +199,8 @@ end # ################################################################################ +is_finite(::MultTableGroup) = true + elem_type(::Type{MultTableGroup}) = MultTableGroupElem Base.hash(G::MultTableGroupElem, h::UInt) = Base.hash(G.i, h) @@ -256,10 +258,12 @@ end # ################################################################################ -function order(G::MultTableGroup) +function order(::Type{Int}, G::MultTableGroup) return size(G.mult_table, 1) end +order(G::MultTableGroup) = order(Int, G) + length(G::MultTableGroup) = order(G) ################################################################################ diff --git a/src/GrpAb/GrpAbFinGen.jl b/src/GrpAb/GrpAbFinGen.jl index a84c70118f..e0431f8627 100644 --- a/src/GrpAb/GrpAbFinGen.jl +++ b/src/GrpAb/GrpAbFinGen.jl @@ -586,6 +586,8 @@ function order(A::FinGenAbGroup) return prod(elementary_divisors(A)) end +order(::Type{Int}, A::FinGenAbGroup) = Int(order(A)) + ################################################################################ # # Exponent diff --git a/test/AlgAss/AlgGrp.jl b/test/AlgAss/AlgGrp.jl index 4b41f9cd2f..d5f923a1b7 100644 --- a/test/AlgAss/AlgGrp.jl +++ b/test/AlgAss/AlgGrp.jl @@ -73,4 +73,35 @@ end end end + + # abelian groups + + QG = group_algebra(QQ, abelian_group([2, 2])) + @test QG isa GroupAlgebra + @test QG !== Hecke._group_algebra(QQ, abelian_group([2, 2]); cached = false) + @test QG !== Hecke._group_algebra(QQ, abelian_group([2, 2]); sparse = true) + + QG = Hecke._group_algebra(QQ, abelian_group([2 for i in 1:10]); sparse = true) + @test QG isa GroupAlgebra + @test QG !== Hecke._group_algebra(QQ, abelian_group([2 for i in 1:10]); sparse = true, cached = false) + + # test sparse arithmetic + + let + G = SymmetricGroup(10) + QG = Hecke._group_algebra(QQ, G; sparse = true, cached = false) + for i in 1:10 + a = rand(G) + b = rand(G) + c = a * b + d = b * a + aa = QG(a) + bb = QG(b) + cc = QG(c) + dd = QG(d) + @test aa * bb == cc + @test bb * aa == dd + @test (aa + bb)^2 == QG(a)^2 + cc + dd + QG(b)^2 + end + end end diff --git a/test/AlgAss/Elem.jl b/test/AlgAss/Elem.jl index b08b5eb9af..4a7150a8b5 100644 --- a/test/AlgAss/Elem.jl +++ b/test/AlgAss/Elem.jl @@ -85,4 +85,13 @@ Hecke.add!(b,b) @test b == A(matrix(QQ, [6 8; 10 12])) end + + # fancy group algebra element constructor + G = abelian_group([2, 2]); a = G([0, 1]); + QG = Hecke._group_algebra(QQ, G; sparse = false); + @test QG(Dict(a => 2, zero(G) => 1)) == 2 * QG(a) + 1 * QG(zero(G)) + @test QG(a => ZZ(2), zero(G) => QQ(1)) == 2 * QG(a) + 1 * QG(zero(G)) + QG = Hecke._group_algebra(QQ, G; sparse = true); + @test QG(Dict(a => 2, zero(G) => 1)) == 2 * QG(a) + 1 * QG(zero(G)) + @test QG(a => ZZ(2), zero(G) => QQ(1)) == 2 * QG(a) + 1 * QG(zero(G)) end From 7900721de79dd2be9d6dbd25852ea3c16c685b82 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Sat, 26 Oct 2024 23:31:14 +0200 Subject: [PATCH 25/51] chore: bump to 0.34.6 (#1662) --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 0e54fc59d5..c15a66b789 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Hecke" uuid = "3e1990a7-5d81-5526-99ce-9ba3ff248f21" -version = "0.34.5" +version = "0.34.6" [deps] AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d" From 4cb3cb9f1549634adcf6af3ad58a8acc85708fa2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 27 Oct 2024 13:29:15 +0100 Subject: [PATCH 26/51] Fix @GC.preserve -> GC.@preserve (#1663) This old syntax has been deprecated for a long time --- examples/IsPower.jl | 4 ++-- src/Misc/Matrix.jl | 4 ++-- src/QuadForm/LineOrbits.jl | 28 ++++++++++++++-------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/IsPower.jl b/examples/IsPower.jl index cbdb4cd986..25958843e9 100644 --- a/examples/IsPower.jl +++ b/examples/IsPower.jl @@ -312,11 +312,11 @@ function Base.getindex(H::Hecke.HenselCtx, s::Symbol, i::Int) return unsafe_load(H.link, i) elseif s == :v f = Hecke.Globals.Zx() - @GC.preserve f H ccall((:fmpz_poly_set, Nemo.libflint), Cvoid, (Ref{ZZPolyRingElem}, Ptr{Hecke.fmpz_poly_raw}), f, H.v+(i-1)*sizeof(Hecke.fmpz_poly_raw)) + GC.@preserve f H ccall((:fmpz_poly_set, Nemo.libflint), Cvoid, (Ref{ZZPolyRingElem}, Ptr{Hecke.fmpz_poly_raw}), f, H.v+(i-1)*sizeof(Hecke.fmpz_poly_raw)) return f elseif s == :w f = Hecke.Globals.Zx() - @GC.preserve f H ccall((:fmpz_poly_set, Nemo.libflint), Cvoid, (Ref{ZZPolyRingElem}, Ptr{Hecke.fmpz_poly_raw}), f, H.w+(i-1)*sizeof(Hecke.fmpz_poly_raw)) + GC.@preserve f H ccall((:fmpz_poly_set, Nemo.libflint), Cvoid, (Ref{ZZPolyRingElem}, Ptr{Hecke.fmpz_poly_raw}), f, H.w+(i-1)*sizeof(Hecke.fmpz_poly_raw)) return f end end diff --git a/src/Misc/Matrix.jl b/src/Misc/Matrix.jl index 74d2c17f4b..e921eae7f8 100644 --- a/src/Misc/Matrix.jl +++ b/src/Misc/Matrix.jl @@ -325,7 +325,7 @@ end # Copy B into A at position (i, j) function _copy_matrix_into_matrix(A::ZZMatrix, i::Int, j::Int, B::ZZMatrix) - @GC.preserve A B begin + GC.@preserve A B begin for k in 0:nrows(B) - 1 for l in 0:ncols(B) - 1 d = mat_entry_ptr(B, 1 + k, 1 + l) @@ -337,7 +337,7 @@ function _copy_matrix_into_matrix(A::ZZMatrix, i::Int, j::Int, B::ZZMatrix) end function _copy_matrix_into_matrix(A::QQMatrix, i::Int, j::Int, B::QQMatrix) - @GC.preserve A B begin + GC.@preserve A B begin for k in 0:nrows(B) - 1 for l in 0:ncols(B) - 1 d = mat_entry_ptr(B, 1 + k, 1 + l) diff --git a/src/QuadForm/LineOrbits.jl b/src/QuadForm/LineOrbits.jl index 70249d0172..4a07c959cd 100644 --- a/src/QuadForm/LineOrbits.jl +++ b/src/QuadForm/LineOrbits.jl @@ -416,7 +416,7 @@ end function _normalize!(x::fpMatrix) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin piv = 0 local ell for j in 1:ncols(x) @@ -474,7 +474,7 @@ end function _normalize!(x::MatElem{FpFieldElem}) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin piv = 0 local ell for j in 1:ncols(x) @@ -533,7 +533,7 @@ end function _isequal(x::fqPolyRepMatrix, y::Vector{fqPolyRepFieldElem}) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin for i in 1:length(y) el = mat_entry_ptr(x, 1, i) b = ccall((:fq_nmod_equal, libflint), Cint, (Ref{fqPolyRepFieldElem}, Ptr{fqPolyRepFieldElem}, Ref{fqPolyRepField}), y[i], el, R) @@ -548,7 +548,7 @@ end function _muleq!(x::fqPolyRepMatrix, y::fqPolyRepFieldElem) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin for i in 1:nrows(x) for j in 1:ncols(x) el = mat_entry_ptr(x, i, j) @@ -561,7 +561,7 @@ end function _normalize!(x::fqPolyRepMatrix) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin piv = 0 local ell for j in 1:ncols(x) @@ -629,7 +629,7 @@ end function _isless(x::Vector{fqPolyRepFieldElem}, y::fqPolyRepMatrix) d = length(x) R = base_ring(y) - @GC.preserve y begin + GC.@preserve y begin for i in 1:d xi = x[i] el = mat_entry_ptr(y, 1, i) @@ -655,7 +655,7 @@ end function _isequal(x::FqPolyRepMatrix, y::Vector{FqPolyRepFieldElem}) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin for i in 1:length(y) el = mat_entry_ptr(x, 1, i) b = ccall((:fq_equal, libflint), Cint, @@ -671,7 +671,7 @@ end function _muleq!(x::FqPolyRepMatrix, y::FqPolyRepFieldElem) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin for i in 1:nrows(x) for j in 1:ncols(x) el = mat_entry_ptr(x, i, j) @@ -685,7 +685,7 @@ end function _normalize!(x::FqPolyRepMatrix) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin piv = 0 local ell for j in 1:ncols(x) @@ -758,7 +758,7 @@ end function _isless(x::Vector{FqPolyRepFieldElem}, y::FqPolyRepMatrix, tx::ZZRingElem = ZZRingElem(), ty::ZZRingElem = ZZRingElem()) d = length(x) R = base_ring(y) - @GC.preserve y begin + GC.@preserve y begin for i in 1:d xi = x[i] el = mat_entry_ptr(y, 1, i) @@ -791,7 +791,7 @@ end function _isequal(x::FqMatrix, y::Vector{FqFieldElem}) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin for i in 1:length(y) el = mat_entry_ptr(x, 1, i) b = ccall((:fq_default_equal, libflint), Cint, @@ -807,7 +807,7 @@ end function _muleq!(x::FqMatrix, y::FqFieldElem) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin for i in 1:nrows(x) for j in 1:ncols(x) el = Nemo.fq_default_mat_entry_ptr(x, i, j) @@ -823,7 +823,7 @@ function _normalize!(x::FqMatrix) R = base_ring(x) piv = 0 local ell - @GC.preserve x begin + GC.@preserve x begin for j in 1:ncols(x) el = Nemo.fq_default_mat_entry_ptr(x, 1, j) b = ccall((:fq_default_is_zero, libflint), Cint, @@ -895,7 +895,7 @@ end function _isless(x::Vector{FqFieldElem}, y::FqMatrix, tx::ZZRingElem = ZZRingElem(), ty::ZZRingElem = ZZRingElem()) d = length(x) R = base_ring(y) - @GC.preserve y begin + GC.@preserve y begin for i in 1:d xi = x[i] el = Nemo.fq_default_mat_entry_ptr(y, 1, i) From bd5a960b9d19048dce65f60cecfd01c943a656e9 Mon Sep 17 00:00:00 2001 From: Simon Brandhorst Date: Mon, 28 Oct 2024 23:34:01 +0100 Subject: [PATCH 27/51] fix automorphism_group_generators for indefinite, ambiguous, isotropic, binary quadratic forms (#1664) * fix automorphism_group_generators for indefinite, ambiguous, isotropic, binary quadratic forms --- src/QuadForm/Quad/GenusRep.jl | 32 ++++++++++++++++++++++++-------- test/QuadForm/QuadBin.jl | 2 +- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/QuadForm/Quad/GenusRep.jl b/src/QuadForm/Quad/GenusRep.jl index 9be54667f1..5d4613439a 100644 --- a/src/QuadForm/Quad/GenusRep.jl +++ b/src/QuadForm/Quad/GenusRep.jl @@ -2254,24 +2254,40 @@ function automorphism_group_generators(g::QuadBin{ZZRingElem}) d = discriminant(g) @assert d > 0 if is_square(d) + # if d is a square, the form represents zero + # Let e_1, e_2 be primitive with e_1^2 = 0, e_2^2 = 0 and e_1.e_2>0. + # Then any isometry preserves the set {e_1,e_2, -e_1, -e_2}. + # We see that the orthogonal group is generated by -id and + # possibly the one exchanging e_1 <-> e_2 if it is integral. + push!(gens, matrix(FlintZZ, 2, 2, [-1, 0, 0, -1])) + g = primitive_form(g) + gg = binary_quadratic_form(g.a, -g.b, g.c) + is_ambiguous = is_equivalent(g, gg, proper = true) + gred, t = reduction_with_transformation(g) - push!(gens, matrix(FlintZZ, 2, 2, [-1, 0, 0, -1])) a = gred.a b = gred.b c = gred.c @assert a == 0 || c == 0 - if a == c == 0 - push!(gens, t * matrix(FlintZZ, 2, 2, [0, 1, 1, 0]) * inv(t)) - elseif a == 0 && c != 0 + + # bring it to the form x^2 + b xy + if a == 0 && c != 0 a = gred.c c = gred.a t = t * matrix(ZZ, 2, 2, [0, 1, 1, 0]) - elseif a != 0 && c ==0 && b % (2*a) == 0 - n = b//(2*a) - t = t * matrix(ZZ, 2, 2, [1, -n, 0, 1]) - push!(gens, t * matrix(FlintZZ, 2, 2, [1,0,0,-1]) * inv(t) ) end + + fl, n = divides(1 - a^2, b) + @assert fl == is_ambiguous + if fl + f = matrix(ZZ, 2, 2, [a, b, n, -a]) + push!(gens, t* f * inv(t)) + end + # Stevell can make sense of this: +# if is_ambiguous && !(a==0 ||(a != 0 && c ==0 && b % (2*a) == 0)) +# error("missing case") +# end for T in gens @assert _action(g, T) == g end diff --git a/test/QuadForm/QuadBin.jl b/test/QuadForm/QuadBin.jl index 5189be461d..31afa1a3a5 100644 --- a/test/QuadForm/QuadBin.jl +++ b/test/QuadForm/QuadBin.jl @@ -216,7 +216,7 @@ g = binary_quadratic_form(-4, 3, 0) gens = automorphism_group_generators(g) - @test gens == [ZZ[-1 0;0 -1]] + @test gens == [ZZ[-1 0;0 -1], ZZ[-4 3; -5 4]] g = binary_quadratic_form(1, 2, 0) gens = automorphism_group_generators(g) From 5601795affba0e5b82d8332bd41d1f6900f1a2ec Mon Sep 17 00:00:00 2001 From: Stevell Muller <78619134+StevellM@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:45:42 +0100 Subject: [PATCH 28/51] should be a print, not a show (#1666) --- src/QuadForm/Quad/Genus.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/QuadForm/Quad/Genus.jl b/src/QuadForm/Quad/Genus.jl index 3237f0765a..ce51a0dbf7 100644 --- a/src/QuadForm/Quad/Genus.jl +++ b/src/QuadForm/Quad/Genus.jl @@ -1613,7 +1613,7 @@ function show(io::IO, ::MIME"text/plain", G::QuadGenus) print(io, Indent()) for (pl, v) in sig println(io) - Base.show(terse(io), Lowercase(), pl) + print(terse(io), Lowercase(), pl) print(io, " => ", v) end print(io, Dedent()) From 2b1fd06306d20d83886fb1388c62ef01c0eb6801 Mon Sep 17 00:00:00 2001 From: Stevell Muller <78619134+StevellM@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:04:38 +0100 Subject: [PATCH 29/51] remove comment and add new ambiguous example (#1665) --- src/QuadForm/Quad/GenusRep.jl | 6 +----- test/QuadForm/Quad/GenusRep.jl | 6 ++++++ test/QuadForm/QuadBin.jl | 6 +++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/QuadForm/Quad/GenusRep.jl b/src/QuadForm/Quad/GenusRep.jl index 5d4613439a..ac5f34e35a 100644 --- a/src/QuadForm/Quad/GenusRep.jl +++ b/src/QuadForm/Quad/GenusRep.jl @@ -2135,7 +2135,7 @@ end function _lattice_to_binary_quadratic_form(L::QuadLat) M = absolute_basis_matrix(L) # This corresponds to a basis of L - @assert nrows(M) == 2 && ncols(M) == 2 + @assert nrows(M) == 2 G = gram_matrix(ambient_space(L), M) GG = change_base_ring(FlintQQ, G) d = denominator(GG) @@ -2284,10 +2284,6 @@ function automorphism_group_generators(g::QuadBin{ZZRingElem}) f = matrix(ZZ, 2, 2, [a, b, n, -a]) push!(gens, t* f * inv(t)) end - # Stevell can make sense of this: -# if is_ambiguous && !(a==0 ||(a != 0 && c ==0 && b % (2*a) == 0)) -# error("missing case") -# end for T in gens @assert _action(g, T) == g end diff --git a/test/QuadForm/Quad/GenusRep.jl b/test/QuadForm/Quad/GenusRep.jl index eb882e2697..b9e16e3b72 100644 --- a/test/QuadForm/Quad/GenusRep.jl +++ b/test/QuadForm/Quad/GenusRep.jl @@ -1107,6 +1107,12 @@ end @test rank(L2) != degree(L2) Ns2 = @inferred genus_representatives(L2, use_auto = false) @test length(Ns2) == length(Ns) + + # Binary case + B = matrix(FlintQQ, 2, 23 ,[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + G = matrix(FlintQQ, 23, 23 ,[-4, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 0, 0, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 0, 0, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 1, -1, 3, 1//2, -1//2, 3//2, -3//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 3, -3, -1//2, 3//2, -3//2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, -3, 10, 3//2, -3//2, 5, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -3, 10, -10, -3//2, 5, -5, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1//2, -1//2, 3//2, -3//2, -1//2, 1, -1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 3//2, -3//2, 5, 1, -1, 3, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3//2, -3//2, 5, -5, -1, 3, -3, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3//2, 5, -5, 17, 3, -3, 10, -10]); + L = integer_lattice(B, gram = G); + @test length(representatives(genus(L))) == 1 end @testset "More ZZGenus representatives" begin diff --git a/test/QuadForm/QuadBin.jl b/test/QuadForm/QuadBin.jl index 31afa1a3a5..bddfacce07 100644 --- a/test/QuadForm/QuadBin.jl +++ b/test/QuadForm/QuadBin.jl @@ -216,7 +216,11 @@ g = binary_quadratic_form(-4, 3, 0) gens = automorphism_group_generators(g) - @test gens == [ZZ[-1 0;0 -1], ZZ[-4 3; -5 4]] + @test gens == [ZZ[-1 0; 0 -1], ZZ[-4 3; -5 4]] + + g = binary_quadratic_form(-4, 16, 0) + gens = automorphism_group_generators(g) + @test gens == [ZZ[-1 0; 0 -1], ZZ[-1 4; 0 1]] g = binary_quadratic_form(1, 2, 0) gens = automorphism_group_generators(g) From d2e2b83bab0111d304a84be8e4dcce64d691d55a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 31 Oct 2024 08:26:56 +0100 Subject: [PATCH 30/51] Don't re-export RDF from AbstractAlgebra (#1669) --- src/Hecke.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Hecke.jl b/src/Hecke.jl index 19b97db45d..e912906088 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -108,7 +108,7 @@ import Pkg exclude = [:Nemo, :AbstractAlgebra, :RealNumberField, :zz, :qq, :call, :factors, :parseint, :strongequal, :window, :xgcd, :rows, :cols, - :set_entry!,] + :set_entry!, :RDF] for i in names(Nemo) (i in exclude || !isdefined(Nemo, i)) && continue From 6d4697c180d56424d47494c4b91e8fbb115e9020 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 31 Oct 2024 08:28:08 +0100 Subject: [PATCH 31/51] Don't export `coprime_base_insert` & `subalgebra` (#1668) * Don't export removed function coprime_base_insert * Don't export nonexisting subalgebra function --- src/AlgAss/AbsAlgAss.jl | 2 +- src/exports.jl | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/AlgAss/AbsAlgAss.jl b/src/AlgAss/AbsAlgAss.jl index 0714afefd0..bdf064a76f 100644 --- a/src/AlgAss/AbsAlgAss.jl +++ b/src/AlgAss/AbsAlgAss.jl @@ -272,7 +272,7 @@ function _subalgebra(A::AbstractAssociativeAlgebra{T}, e::AbstractAssociativeAlg end @doc raw""" - subalgebra(A::AbstractAssociativeAlgebra, basis::Vector{AbstractAssociativeAlgebraElem}) + _subalgebra(A::AbstractAssociativeAlgebra, basis::Vector{AbstractAssociativeAlgebraElem}) -> StructureConstantAlgebra, AbsAlgAssMor Returns the subalgebra $A$ generated by the elements in `basis` and a map diff --git a/src/exports.jl b/src/exports.jl index a7f1b1e77e..c678111538 100644 --- a/src/exports.jl +++ b/src/exports.jl @@ -241,7 +241,6 @@ export content_ideal export contract export coordinates export coprime_base -export coprime_base_insert export copy export cos export cover @@ -867,7 +866,6 @@ export strong_echelon_form export structure_constant_algebra export structure_constant_table export sub -export subalgebra export subfields export subgroups export submodules From ab9b6d28b018fe421fbab1a87c762106a6d0dabc Mon Sep 17 00:00:00 2001 From: Erik Paemurru <143521159+paemurru@users.noreply.github.com> Date: Thu, 31 Oct 2024 19:59:59 +0100 Subject: [PATCH 32/51] Update license (#1667) * Update license --------- Co-authored-by: Johannes Schmitt --- LICENSE | 30 ------------------------------ LICENSE.md | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 30 deletions(-) delete mode 100644 LICENSE create mode 100644 LICENSE.md diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 8490f552d1..0000000000 --- a/LICENSE +++ /dev/null @@ -1,30 +0,0 @@ -Unless otherwise specified in a file, Hecke is licensed under the BSD 2-Clause -"Simplified" License. - -Copyright (c) 2015: Claus Fieker, Tommy Hofmann -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The following components included in Hecke have their own licences: - -- src/Misc/AVLTrees [MIT] (see https://github.com/JuliaCollections/DataStructures.jl) diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000000..190185baac --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,29 @@ +Unless otherwise specified in a file, Hecke is licensed under the BSD 2-Clause +"Simplified" License. + +> Copyright (c) 2015-2024: Hecke contributors, see +> +> Redistribution and use in source and binary forms, with or without +> modification, are permitted provided that the following conditions are met: +> +> 1. Redistributions of source code must retain the above copyright notice, this +> list of conditions and the following disclaimer. +> +> 2. Redistributions in binary form must reproduce the above copyright notice, +> this list of conditions and the following disclaimer in the documentation +> and/or other materials provided with the distribution. +> +> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +> AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +> IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +> DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +> FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +> DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +> SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +> OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +> OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The following components included in Hecke have their own licences: + +- src/Misc/AVLTrees [MIT] (see https://github.com/JuliaCollections/DataStructures.jl) From 7d52dcbac2c388e552f8b46ee47d5c449b961c07 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Fri, 1 Nov 2024 20:05:03 +0100 Subject: [PATCH 33/51] feat: subgroup enumeration with no subgroups (#1670) --- docs/src/index.md | 2 +- src/GrpAb/SubgroupEnum.jl | 15 +++++++-------- test/GrpAb/SubgroupEnum.jl | 11 +++++++++++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index e20f63b3a5..e3c86c3b2d 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -46,7 +46,7 @@ If your research depends on computations done with Hecke, please consider giving - Claus Fieker, William Hart, Tommy Hofmann and Fredrik Johansson, [Nemo/Hecke: Computer Algebra and Number Theory Packages for the Julia Programming Language](https://doi.acm.org/10.1145/3087604.3087611). In: Proceedings of ISSAC '17, pages 157–164, New York, NY, USA, 2017. ACM. -```bib +``` @inproceedings{nemo, author = {Fieker, Claus and Hart, William and Hofmann, Tommy and Johansson, Fredrik}, title = {Nemo/Hecke: Computer Algebra and Number Theory Packages for the Julia Programming Language}, diff --git a/src/GrpAb/SubgroupEnum.jl b/src/GrpAb/SubgroupEnum.jl index a3d93c100d..d3d8726449 100644 --- a/src/GrpAb/SubgroupEnum.jl +++ b/src/GrpAb/SubgroupEnum.jl @@ -875,6 +875,13 @@ end # Same as above but now allow a function to be applied to the output function _subgroups(G::FinGenAbGroup; subtype = [-1], quotype = [-1], order = -1, index = -1, fun = sub) + if !is_divisible_by(Hecke.order(G), order) || # the -1 default is ok + !is_divisible_by(Hecke.order(G), index) || + (subtype != [-1] && !has_quotient(G, subtype)) || + (quotype != [-1] && !has_quotient(G, quotype)) + return () + end + return ( fun(G, convert(Vector{FinGenAbGroupElem}, z)) for z in _subgroups_gens(G, subtype, quotype, order, index)) end @@ -919,14 +926,6 @@ function subgroups(G::FinGenAbGroup; subtype = :all, options = Int16[ subtype != :all, quotype != :all, order != -1, index != -1] - if mod(Hecke.order(G), index) != 0 - error("Index must divide the group order") - end - - if mod(Hecke.order(G), order) != 0 - error("Index must divide the group order") - end - if sum(options) > 1 error("Currently only one non-default parameter is supported.") end diff --git a/test/GrpAb/SubgroupEnum.jl b/test/GrpAb/SubgroupEnum.jl index 7fbee0d149..034b06f74c 100644 --- a/test/GrpAb/SubgroupEnum.jl +++ b/test/GrpAb/SubgroupEnum.jl @@ -220,4 +220,15 @@ @test all([order(t[1]) == 7*3 for t in T]) end end + + # test for no subgroups + + G = abelian_group([9, 3, 3]) + @test length(collect(subgroups(G; index = 2))) == 0 + @test length(collect(subgroups(G; order = 10001323))) == 0 + @test length(collect(subgroups(G; subtype = [6, 6, 6]))) == 0 + @test length(collect(subgroups(G; quotype = [6, 6, 6]))) == 0 + + G = abelian_group([2]) + @test length(collect(subgroups(G; quotype = [3]))) == 0 end From 8564bb01c1ee3e8bf12acaecdc46662d3cdbe8e9 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Tue, 5 Nov 2024 08:08:49 +0100 Subject: [PATCH 34/51] fix: expressifying empty factored elements (#1672) --- src/Misc/FactoredElem.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Misc/FactoredElem.jl b/src/Misc/FactoredElem.jl index 4c699a4755..ee9561a251 100644 --- a/src/Misc/FactoredElem.jl +++ b/src/Misc/FactoredElem.jl @@ -226,7 +226,7 @@ end function AbstractAlgebra.expressify(x::FacElem; context=nothing) if length(x.fac) == 0 - return Expr(:1) + return 1 end prod = Expr(:call, :*) for (k,v) = x.fac From 0904b0b0939390f567bb72eaf9f56efc9d48a4d5 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Wed, 6 Nov 2024 11:48:17 +0100 Subject: [PATCH 35/51] feat: multiplicative dependencies for matrices (#1671) --- src/AlgAss/AbsAlgAss.jl | 93 ++++++++++++++++++++++++++++++++++++++++ src/AlgAss/Elem.jl | 47 ++++++++++++++++++++ src/GrpAb/stable_sub.jl | 1 + test/AlgAss/AbsAlgAss.jl | 22 ++++++++++ test/AlgAss/Elem.jl | 11 +++++ 5 files changed, 174 insertions(+) diff --git a/src/AlgAss/AbsAlgAss.jl b/src/AlgAss/AbsAlgAss.jl index bdf064a76f..c2ad2e79e7 100644 --- a/src/AlgAss/AbsAlgAss.jl +++ b/src/AlgAss/AbsAlgAss.jl @@ -1241,3 +1241,96 @@ function _skolem_noether(h::AbsAlgAssMor) error("Not impelemented yet") end end + +################################################################################ +# +# Maximal separable subalgebra +# +################################################################################ + +# (Part of) Algorithm 5.5 of Lenstra-Silverberg, Algorithms for Commutative Algebras Over the Rational Numbers +# (they only state it for QQ, but should be valid in charcteristic zero) +function maximal_separable_subalgebra(A::AbstractAssociativeAlgebra) + @req is_commutative(A) "Algebra must be commutative" + @req is_zero(characteristic(base_ring(A))) "Characteristic of base ring must be zero" + + B = basis(A) + BU = eltype(B)[] + for b in B + u, v = jordan_chevalley_decomposition(b) + push!(BU, u) + end + R = echelon_form(basis_matrix(BU); trim = true) + return _subalgebra(A, [elem_from_mat_row(A, R, i) for i in 1:nrows(R)]) +end + +################################################################################ +# +# Multiplicative dependencies +# +################################################################################ + +function _multiplicative_dependencies(A::AbstractAssociativeAlgebra, S::Vector) + @req is_commutative(A) "Algebra must be commutative" + @req is_zero(characteristic(base_ring(A))) "Characteristic of base ring must be zero" + + B, BtoA = maximal_separable_subalgebra(A) + + nfs = _as_number_fields(B) + + jcs = first.(jordan_chevalley_decomposition.(S)) + jc = [has_preimage_with_preimage(BtoA, x)[2] for x in first.(jordan_chevalley_decomposition.(S))] + + F = free_abelian_group(length(S)) + + kernels = ZZMatrix[] + + for (K, BtoK) in nfs + eltsinK = BtoK.(jc) + if any(is_zero, eltsinK) + error("oopsie, elements not invertible") + end + # hack to get something + v = _mult_dep(K, eltsinK) + Hm = reduce(vcat, v) + push!(kernels, Hm) + end + + J = radical(A) + m = dim(A) # TODO: compute the nilpotency index + logimgs = elem_type(A)[] + for (s, pis) in zip(S, jcs) + w = s*inv(pis) + v = 1 - w + logimg = -sum(v^i * QQ(1//i) for i in 1:m) + push!(logimgs, logimg) + end + Blog, = integral_split(basis_matrix(logimgs), ZZ) + + push!(kernels, kernel(Blog, side = :left)) + + RtoF = reduce((x, y) -> intersect(x, y, false)[2], [sub(F, k, false)[2] for k in kernels]) + return [_eltseq(x.coeff) for x in RtoF.(gens(domain(RtoF)))] +end + +function _multiplicative_dependencies(v::Vector{<:MatElem}) + A = matrix_algebra(QQ, v) + S = A.(v) + _multiplicative_dependencies(A, S) +end + +# TODO: Use Ge +function _mult_dep(K::AbsSimpleNumField, S::Vector) + OK = maximal_order(K) + sup = reduce(vcat, [ support(s, OK) for s in S]) + # I don't know why noone ever implemented this + if isempty(sup) + push!(sup, prime_ideals_over(OK, 2)[1]) + end + U, mU = sunit_group(unique!(sup)) + SinU = .\(mU, S) + F = free_abelian_group(length(SinU)) + h = hom(F, U, SinU) + K, mK = kernel(h) + [x.coeff for x in mK.(gens(K))] +end diff --git a/src/AlgAss/Elem.jl b/src/AlgAss/Elem.jl index 908d3cd02a..a7b164db1f 100644 --- a/src/AlgAss/Elem.jl +++ b/src/AlgAss/Elem.jl @@ -1227,3 +1227,50 @@ end function denominator(x::AbstractAssociativeAlgebraElem) return lcm([ denominator(y) for y in coefficients(x, copy = false) ]) end + +################################################################################ +# +# Jordan-Chevalley decomposition +# +################################################################################ + +function _gcdx3(a, b, c) + g, u, v = gcdx(b, c) + g, s, t = gcdx(a, g) + @assert s * a + u * t * b + v * t * c == g + return g, s, u * t, v * t +end + +# Algorithm 5.1 of Lenstra-Silverberg, Algorithms for Commutative Algebras Over the Rational Numbers +# (they only state it for QQ, but should be valid in charcteristic zero +function jordan_chevalley_decomposition(x::AbstractAssociativeAlgebraElem) + @req is_commutative(parent(x)) "Algebra must be commutative" + @req is_zero(characteristic(base_ring(parent(x)))) "Base field must be of characteristic zero" + g = minpoly(x) + gp = derivative(g) + ggpgcd = gcd(g, gp) + ghat = divexact(g, ggpgcd) + ghatp = derivative(ghat) + m = zero_matrix(base_ring(gp), degree(ggpgcd), degree(ggpgcd)) + h = mod(ghatp, ggpgcd) + for l in 0:degree(h) + m[1, l + 1] = coeff(h, l) + end + for i in 1:(degree(ggpgcd)-1) + h = mod(i * shift_left(ghat, i - 1) + shift_left(ghatp, i), ggpgcd) + for l in 0:degree(h) + m[i + 1, l + 1] = coeff(h, l) + end + end + v = [zero(QQ) for k in 1:degree(ggpgcd)] + if length(v) > 0 + v[1] = 1 + end + fl, _q = can_solve_with_solution(m, v; side = :left) + @assert fl + q = parent(g)(_q) + v = q(x)*ghat(x) + u = x - v + return u, v +end + diff --git a/src/GrpAb/stable_sub.jl b/src/GrpAb/stable_sub.jl index 42f63ab63e..882ec357b2 100644 --- a/src/GrpAb/stable_sub.jl +++ b/src/GrpAb/stable_sub.jl @@ -432,6 +432,7 @@ Given a ZpnGModule $M$, the function returns all the submodules of $M$. """ function submodules(M::ZpnGModule; typequo=Int[-1], typesub=Int[-1], ord=-1) + @show typequo if typequo!=[-1] return submodules_with_quo_struct(M,typequo) diff --git a/test/AlgAss/AbsAlgAss.jl b/test/AlgAss/AbsAlgAss.jl index 1051cffd86..8dff9477a6 100644 --- a/test/AlgAss/AbsAlgAss.jl +++ b/test/AlgAss/AbsAlgAss.jl @@ -247,4 +247,26 @@ h = hom(A, A, inv(X) .* basis(A) .* X) a = Hecke._skolem_noether(h) @test all(h(b) == inv(a) * b * a for b in basis(A)) + + let + # maximal separable subalgebra + Qx, x = QQ[:x] + A = associative_algebra((x^2 + 1)^2) + B, BtoA = Hecke.maximal_separable_subalgebra(A) + @test domain(BtoA) === B + @test codomain(BtoA) == A + @test dim(B) == 2 + @test is_simple(B) + end + + let + # multiplicative depdendencies + a = QQ[1 2; 3 4] + c = QQ[-3 2; 3 0] + v = [a, a^2, c, c*a] + m = Hecke._multiplicative_dependencies([a, a^2, c, c*a]) + for w in m + @test isone(prod(v[i]^Int(w[i]) for i in 1:length(v))) + end + end end diff --git a/test/AlgAss/Elem.jl b/test/AlgAss/Elem.jl index 4a7150a8b5..99a1de452e 100644 --- a/test/AlgAss/Elem.jl +++ b/test/AlgAss/Elem.jl @@ -94,4 +94,15 @@ QG = Hecke._group_algebra(QQ, G; sparse = true); @test QG(Dict(a => 2, zero(G) => 1)) == 2 * QG(a) + 1 * QG(zero(G)) @test QG(a => ZZ(2), zero(G) => QQ(1)) == 2 * QG(a) + 1 * QG(zero(G)) + + let + # Jordan-Chevalley + Qx, x = QQ[:x] + A = associative_algebra((x^2 + 1)^2) + alpha = basis(A)[2] + u, v = Hecke.jordan_chevalley_decomposition(alpha) + @test u == A(QQ.([0, 3//2, 0, 1//2])) + @test v == A(QQ.([0, -1//2, 0, -1//2])) + @test u + v == alpha + end end From 04ace7e68a80bc67edc472b6aaa341c366bcfcb8 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 7 Nov 2024 00:10:24 +0100 Subject: [PATCH 36/51] Fix a very important typo (#1676) --- test/NfAbs/Subfields.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/NfAbs/Subfields.jl b/test/NfAbs/Subfields.jl index 34bab2b58f..4086f82c86 100644 --- a/test/NfAbs/Subfields.jl +++ b/test/NfAbs/Subfields.jl @@ -12,7 +12,7 @@ @test degree(fixed_field(K,[s,t])[1]) == 2 end - @testset "FixedField: realtiv" begin + @testset "FixedField: relative" begin K,b = number_field(x-1,"b") Ky,y = K["y"] f = y^8+236*y^6+12158*y^4+201788*y^2+779689 From 39fc9cbf659945479d457badfaf39e25cc0c54a0 Mon Sep 17 00:00:00 2001 From: Erik Paemurru <143521159+paemurru@users.noreply.github.com> Date: Thu, 7 Nov 2024 22:17:37 +0100 Subject: [PATCH 37/51] Update Hecke banner (#1675) * Update Hecke banner * Fix coloring --- README.md | 26 +++++++++----------------- src/Hecke.jl | 27 ++++++++++++--------------- 2 files changed, 21 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index be1377672d..35bfd850d8 100644 --- a/README.md +++ b/README.md @@ -68,24 +68,16 @@ If your research depends on computations done with Hecke, please consider giving Here is a quick example of using Hecke: -```julia +``` julia> using Hecke - -Welcome to - - _ _ _ - | | | | | | - | |__| | ___ ___| | _____ - | __ |/ _ \/ __| |/ / _ \ - | | | | __/ (__| < __/ - |_| |_|\___|\___|_|\_\___| - -Version 0.22.8... - ... which comes with absolutely no warranty whatsoever -(c) 2015-2024 by Claus Fieker, Tommy Hofmann and Carlo Sircana - - -julia> Qx, x = polynomial_ring(FlintQQ, "x"); + _ _ _ +| | | | | | | Software package for +| |__| | ___ ___| | _____ | algorithmic algebraic number theory +| __ |/ _ \/ __| |/ / _ \ | +| | | | __/ (__| < __/ | Manual: https://thofma.github.io/Hecke.jl +|_| |_|\___|\___|_|\_\___| | Version 0.34.6 + +julia> Qx, x = polynomial_ring(FlintQQ, "x"); julia> f = x^3 + 2; diff --git a/src/Hecke.jl b/src/Hecke.jl index e912906088..8e90819aec 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -145,22 +145,19 @@ end global const maximal_order = MaximalOrder function _print_banner() + printstyled(raw""" _ _ _ """, color = :red) println("") - print("Welcome to \n") - printstyled(raw" - _ _ _ - | | | | | | - | |__| | ___ ___| | _____ - | __ |/ _ \/ __| |/ / _ \ - | | | | __/ (__| < __/ - |_| |_|\___|\___|_|\_\___|", color = :red) - println() - println() - print("Version") - printstyled(" $VERSION_NUMBER ", color = :green) - print("... \n ... which comes with absolutely no warranty whatsoever") - println() - println("(c) 2015-2024 by Claus Fieker, Tommy Hofmann and Carlo Sircana") + printstyled(raw"""| | | | | | """, color = :red) + println("| Software package for") + printstyled(raw"""| |__| | ___ ___| | _____ """, color = :red) + println("| algorithmic algebraic number theory") + printstyled(raw"""| __ |/ _ \/ __| |/ / _ \ """, color = :red) + println("| ") + printstyled(raw"""| | | | __/ (__| < __/ """, color = :red) + println("| Manual: https://thofma.github.io/Hecke.jl") + printstyled(raw"""|_| |_|\___|\___|_|\_\___| """, color = :red) + print("| Version ") + printstyled("$VERSION_NUMBER", color = :green) println() end From e526417a622eeb96a018bcc0a7ce194866bec818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 8 Nov 2024 22:46:53 +0100 Subject: [PATCH 38/51] Don't use `Flint*` globals (#1674) * `FlintQQ` -> `QQ` * `FlintZZ` -> `ZZ` --- README.md | 2 +- docs/src/manual/number_fields/class_fields.md | 4 +- docs/src/manual/orders/orders.md | 2 +- docs/src/manual/quad_forms/genusherm.md | 2 +- examples/Clgp.jl | 2 +- examples/FieldEnumeration/FieldEnumeration.jl | 4 +- examples/FieldEnumeration/absolute_abelian.jl | 2 +- examples/FieldEnumeration/cubic.jl | 2 +- examples/FieldEnumeration/smallest_field.jl | 2 +- examples/IsPower.jl | 4 +- examples/MultDep.jl | 24 +-- examples/MultiQuad.jl | 34 ++-- examples/NFDB.jl | 6 +- examples/Plesken.jl | 12 +- examples/RayClass.jl | 10 +- examples/RelNeq.jl | 10 +- examples/Round2.jl | 12 +- examples/Suri.jl | 4 +- examples/pAdicConj.jl | 10 +- examples/parallel_LLL.jl | 6 +- examples/polymake.jl | 40 ++-- ext/GAPExt/abelian_layer.jl | 2 +- ext/GAPExt/brauer.jl | 8 +- ext/PolymakeExt.jl | 18 +- src/AlgAss/AbsAlgAss.jl | 6 +- src/AlgAss/AlgGrp.jl | 14 +- src/AlgAss/AlgQuat.jl | 16 +- src/AlgAss/ChangeRing.jl | 2 +- src/AlgAss/Conversions.jl | 2 +- src/AlgAss/Elem.jl | 2 +- src/AlgAss/StructureConstantAlgebra.jl | 2 +- src/AlgAss/radical.jl | 2 +- src/AlgAssAbsOrd/Conjugacy.jl | 18 +- src/AlgAssAbsOrd/Conjugacy/Conjugacy.jl | 62 +++--- src/AlgAssAbsOrd/Conjugacy/Husert.jl | 46 ++--- src/AlgAssAbsOrd/Elem.jl | 8 +- src/AlgAssAbsOrd/ICM.jl | 6 +- src/AlgAssAbsOrd/Ideal.jl | 38 ++-- src/AlgAssAbsOrd/LocallyFreeClassGroup.jl | 4 +- src/AlgAssAbsOrd/NEQ.jl | 6 +- src/AlgAssAbsOrd/Order.jl | 40 ++-- src/AlgAssAbsOrd/PIP/bley_hofmann_johnston.jl | 24 +-- src/AlgAssAbsOrd/PIP/maximal.jl | 20 +- src/AlgAssAbsOrd/PIP/misc.jl | 2 +- src/AlgAssAbsOrd/PicardGroup.jl | 22 +- src/AlgAssAbsOrd/ResidueRingMultGrp.jl | 10 +- src/AlgAssAbsOrd/Types.jl | 2 +- src/AlgAssAbsOrd/UnitGroup.jl | 4 +- src/AlgAssRelOrd/NEQ.jl | 12 +- src/AlgAssRelOrd/Order.jl | 4 +- src/EllCrv/Finite.jl | 22 +- src/EllCrv/Heights.jl | 2 +- src/EllCrv/LocalData.jl | 120 +++++------ src/EllCrv/Misc.jl | 20 +- src/EllCrv/RationalPointSearch.jl | 2 +- src/EllCrv/Torsion.jl | 4 +- src/FieldFactory/ab_exts.jl | 20 +- src/FieldFactory/rayclassgrp.jl | 10 +- src/FieldFactory/read_write.jl | 2 +- src/FieldFactory/relative_to_absolute.jl | 2 +- src/FunField/HessQR.jl | 10 +- src/GrpAb/Elem.jl | 8 +- src/GrpAb/GrpAbFinGen.jl | 60 +++--- src/GrpAb/Map.jl | 20 +- src/GrpAb/SubgroupEnum.jl | 2 +- src/GrpAb/stable_sub.jl | 8 +- src/Hecke.jl | 10 +- src/HeckeTypes.jl | 42 ++-- src/LargeField/basis.jl | 6 +- src/LargeField/misc2.jl | 4 +- src/LinearAlgebra/FakeFmpqMat.jl | 8 +- src/LinearAlgebra/Howell.jl | 2 +- src/LinearAlgebra/LatEnum.jl | 6 +- src/LinearAlgebra/Solve.jl | 6 +- src/LocalField/Completions.jl | 10 +- src/LocalField/Conjugates.jl | 10 +- src/LocalField/LocalField.jl | 2 +- src/LocalField/Poly.jl | 6 +- src/LocalField/qAdic.jl | 2 +- src/Map/GrpAb.jl | 6 +- src/Map/NumField.jl | 2 +- src/Map/NumberField.jl | 18 +- src/Map/automorphisms.jl | 18 +- src/Misc/CRT.jl | 8 +- src/Misc/Fields.jl | 2 +- src/Misc/IJulia.jl | 4 +- src/Misc/Integer.jl | 10 +- src/Misc/Matrix.jl | 16 +- src/Misc/Plesken.jl | 2 +- src/Misc/Poly.jl | 20 +- src/Misc/PseudoPolynomial.jl | 2 +- src/Misc/RatRecon.jl | 14 +- src/Misc/UnitsModM.jl | 10 +- src/Misc/nmod_poly.jl | 44 ++-- src/Misc/psibound.jl | 10 +- src/Misc/toHecke.jl | 2 +- src/Misc/toPari.jl | 4 +- src/ModAlgAss/Lattices/Basics.jl | 6 +- src/ModAlgAss/ModAlgAss.jl | 2 +- src/NumField/Elem.jl | 6 +- src/NumField/Embedded.jl | 2 +- src/NumField/Field.jl | 2 +- src/NumField/Hilbert.jl | 4 +- src/NumField/NfAbs/CompactRepresentation.jl | 6 +- src/NumField/NfAbs/Elem.jl | 18 +- src/NumField/NfAbs/MPolyAbsFact.jl | 4 +- src/NumField/NfAbs/MPolyGcd.jl | 12 +- src/NumField/NfAbs/NfAbs.jl | 18 +- src/NumField/NfAbs/NonSimple.jl | 36 ++-- src/NumField/NfAbs/NormRelation/SUnits.jl | 18 +- src/NumField/NfAbs/NormRelation/Setup.jl | 52 ++--- src/NumField/NfAbs/Poly.jl | 8 +- src/NumField/NfAbs/PolyFact.jl | 20 +- src/NumField/NfAbs/Simplify.jl | 10 +- src/NumField/NfRel/NfRel.jl | 4 +- src/NumField/NfRel/NfRelNS.jl | 6 +- src/NumField/NfRel/NfRelNSMor.jl | 6 +- src/NumField/NfRel/Simplify.jl | 2 +- src/NumField/QQ.jl | 8 +- src/NumField/Subfields.jl | 12 +- src/NumFieldOrd/NfOrd/Clgp/Ctx.jl | 4 +- src/NumFieldOrd/NfOrd/Clgp/FacBase_Idl.jl | 14 +- src/NumFieldOrd/NfOrd/Clgp/Map.jl | 22 +- src/NumFieldOrd/NfOrd/Clgp/Rel_LLL.jl | 4 +- src/NumFieldOrd/NfOrd/Clgp/Rel_add.jl | 4 +- src/NumFieldOrd/NfOrd/Clgp/Saturate.jl | 12 +- src/NumFieldOrd/NfOrd/Clgp/Sunits.jl | 14 +- src/NumFieldOrd/NfOrd/Clgp/cm_field.jl | 4 +- src/NumFieldOrd/NfOrd/Elem.jl | 10 +- src/NumFieldOrd/NfOrd/FacElem.jl | 2 +- src/NumFieldOrd/NfOrd/FactorBaseBound.jl | 2 +- src/NumFieldOrd/NfOrd/FracIdeal.jl | 2 +- src/NumFieldOrd/NfOrd/Hensel.jl | 18 +- src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl | 24 +-- src/NumFieldOrd/NfOrd/Ideal/FacElem.jl | 4 +- src/NumFieldOrd/NfOrd/Ideal/Ideal.jl | 72 +++---- src/NumFieldOrd/NfOrd/Ideal/Prime.jl | 42 ++-- src/NumFieldOrd/NfOrd/Ideal/Relative.jl | 10 +- src/NumFieldOrd/NfOrd/Ideal/TwoElement.jl | 4 +- src/NumFieldOrd/NfOrd/Ideal/Valuation.jl | 10 +- src/NumFieldOrd/NfOrd/LLL.jl | 38 ++-- src/NumFieldOrd/NfOrd/LLLctx.jl | 14 +- src/NumFieldOrd/NfOrd/LinearAlgebra.jl | 22 +- .../NfOrd/MaxOrd/DedekindCriterion.jl | 12 +- src/NumFieldOrd/NfOrd/MaxOrd/MaxOrd.jl | 38 ++-- src/NumFieldOrd/NfOrd/MaxOrd/MaxOrdNS.jl | 10 +- src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl | 16 +- src/NumFieldOrd/NfOrd/NarrowPicardGroup.jl | 2 +- src/NumFieldOrd/NfOrd/NfOrd.jl | 40 ++-- src/NumFieldOrd/NfOrd/Overorders.jl | 18 +- src/NumFieldOrd/NfOrd/PicardGroup.jl | 10 +- src/NumFieldOrd/NfOrd/RayClassGrp.jl | 20 +- src/NumFieldOrd/NfOrd/ResidueField.jl | 2 +- src/NumFieldOrd/NfOrd/ResidueRing.jl | 2 +- src/NumFieldOrd/NfOrd/ResidueRingMultGrp.jl | 12 +- src/NumFieldOrd/NfOrd/StrongEchelonForm.jl | 14 +- src/NumFieldOrd/NfOrd/TorsionUnits.jl | 4 +- src/NumFieldOrd/NfOrd/Unit/FindUnits.jl | 2 +- src/NumFieldOrd/NfOrd/Unit/Reduction.jl | 4 +- src/NumFieldOrd/NfOrd/Unit/Relation.jl | 2 +- src/NumFieldOrd/NfOrd/Unit/UnitGrpCtx.jl | 8 +- src/NumFieldOrd/NfOrd/Zeta.jl | 8 +- src/NumFieldOrd/NfOrd/norm_eqn.jl | 2 +- src/NumFieldOrd/NfRelOrd/FracIdeal.jl | 2 +- src/NumFieldOrd/NumFieldOrdIdl.jl | 12 +- src/QuadForm/Database.jl | 4 +- src/QuadForm/Enumeration.jl | 32 +-- src/QuadForm/Herm/Mass.jl | 2 +- src/QuadForm/IO.jl | 10 +- src/QuadForm/Lattices.jl | 18 +- src/QuadForm/MassQuad.jl | 14 +- src/QuadForm/Misc.jl | 12 +- src/QuadForm/Morphism.jl | 62 +++--- src/QuadForm/Quad/GenusRep.jl | 16 +- src/QuadForm/Quad/NormalForm.jl | 36 ++-- src/QuadForm/Quad/Spaces.jl | 8 +- src/QuadForm/Quad/ZGenus.jl | 2 +- src/QuadForm/Quad/ZLattices.jl | 68 +++---- src/QuadForm/QuadBin.jl | 30 +-- src/QuadForm/Spaces.jl | 6 +- src/QuadForm/Torsion.jl | 28 +-- src/QuadForm/Types.jl | 4 +- src/RCF/conductor.jl | 12 +- src/RCF/cyclo.jl | 12 +- src/RCF/rcf.jl | 8 +- src/RieSrf/Theta.jl | 2 +- src/Sparse/Matrix.jl | 8 +- src/Sparse/Module.jl | 2 +- src/Sparse/Row.jl | 10 +- src/Sparse/Solve.jl | 20 +- src/Sparse/ZZRow.jl | 2 +- src/conjugates.jl | 4 +- test/AlgAss/AbsAlgAss.jl | 12 +- test/AlgAss/AlgGrp.jl | 4 +- test/AlgAss/AlgMat.jl | 14 +- test/AlgAss/Elem.jl | 8 +- test/AlgAss/Ideal.jl | 4 +- test/AlgAss/StructureConstantAlgebra.jl | 8 +- test/AlgAssAbsOrd/Conjugacy/Conjugacy.jl | 2 +- test/AlgAssAbsOrd/ICM.jl | 14 +- test/AlgAssAbsOrd/Ideal.jl | 6 +- test/AlgAssAbsOrd/LocallyFreeClassGroup.jl | 14 +- test/AlgAssAbsOrd/Order.jl | 8 +- test/AlgAssAbsOrd/PicardGroup.jl | 10 +- test/AlgAssAbsOrd/ResidueRingMultGrp.jl | 2 +- test/AlgAssRelOrd/Ideal.jl | 2 +- test/AlgAssRelOrd/Order.jl | 4 +- test/EllCrv/EllCrv.jl | 16 +- test/FieldFactory/FieldFactory.jl | 4 +- test/GrpAb/Elem.jl | 60 +++--- test/GrpAb/GrpAbFinGen.jl | 32 +-- test/LocalField/LocalField.jl | 10 +- test/LocalField/Poly.jl | 4 +- test/LocalField/neq.jl | 2 +- test/Map/NumField.jl | 4 +- test/Map/NumberField.jl | 10 +- test/Misc/NumberField.jl | 6 +- test/Misc/OrdLocalization.jl | 2 +- test/Misc/Poly.jl | 4 +- test/Misc/jordan_test.jl | 12 +- test/Misc/stable_subgroups.jl | 8 +- test/NfAbs/Conjugates.jl | 6 +- test/NfAbs/Elem.jl | 16 +- test/NfAbs/NonSimple.jl | 12 +- test/NfAbs/NormRelation.jl | 4 +- test/NfAbs/Simplify.jl | 2 +- test/NfAbs/Subfields.jl | 4 +- test/NfOrd/Clgp.jl | 8 +- test/NfOrd/Elem.jl | 16 +- test/NfOrd/FracIdl.jl | 48 ++--- test/NfOrd/Ideal.jl | 32 +-- test/NfOrd/Ideal/Prime.jl | 6 +- test/NfOrd/LinearAlgebra.jl | 12 +- test/NfOrd/NfOrd.jl | 50 ++--- test/NfOrd/Overorders.jl | 4 +- test/NfOrd/PicardGroup.jl | 2 +- test/NfOrd/RayClassGroup.jl | 6 +- test/NfOrd/ResidueField.jl | 2 +- test/NfOrd/ResidueRing.jl | 4 +- test/NfOrd/ResidueRingMultGrp.jl | 10 +- test/NfRel/Elem.jl | 2 +- test/NfRel/FracIdeal.jl | 2 +- test/NfRel/Ideal.jl | 8 +- test/NfRel/NEQ_Kirschmer.jl | 2 +- test/NfRel/NfRel.jl | 10 +- test/NfRel/NfRelOrd.jl | 10 +- test/NfRel/NonSimple.jl | 2 +- test/NumField/Elem.jl | 10 +- test/NumField/Hilbert.jl | 2 +- test/NumField/NfAbs/NfAbs.jl | 10 +- test/NumFieldOrd/NumFieldOrd.jl | 10 +- test/QuadForm/Basic.jl | 2 +- test/QuadForm/Genus.jl | 6 +- test/QuadForm/Herm/Genus.jl | 10 +- test/QuadForm/Herm/GenusRep.jl | 14 +- test/QuadForm/Herm/Lattices.jl | 6 +- test/QuadForm/Herm/Mass.jl | 6 +- test/QuadForm/Herm/Spaces.jl | 12 +- test/QuadForm/IO.jl | 8 +- test/QuadForm/Lattices.jl | 30 +-- test/QuadForm/MassQuad.jl | 20 +- test/QuadForm/Quad/Genus.jl | 8 +- test/QuadForm/Quad/GenusRep.jl | 38 ++-- test/QuadForm/Quad/Lattices.jl | 2 +- test/QuadForm/Quad/NormalForm.jl | 66 +++--- test/QuadForm/Quad/Spaces.jl | 14 +- test/QuadForm/Quad/ZLattices.jl | 36 ++-- test/QuadForm/QuadBin.jl | 2 +- test/QuadForm/Torsion.jl | 24 +-- test/RCF/conductor_sieve.jl | 4 +- test/RCF/rcf.jl | 8 +- test/Sparse/HNF.jl | 2 +- test/Sparse/Matrix.jl | 190 +++++++++--------- test/Sparse/Row.jl | 64 +++--- test/Sparse/Rref.jl | 10 +- test/Sparse/Solve.jl | 4 +- test/Sparse/Trafo.jl | 22 +- 277 files changed, 1853 insertions(+), 1853 deletions(-) diff --git a/README.md b/README.md index 35bfd850d8..d85edc32f8 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ julia> using Hecke | | | | __/ (__| < __/ | Manual: https://thofma.github.io/Hecke.jl |_| |_|\___|\___|_|\_\___| | Version 0.34.6 -julia> Qx, x = polynomial_ring(FlintQQ, "x"); +julia> Qx, x = polynomial_ring(QQ, "x"); julia> f = x^3 + 2; diff --git a/docs/src/manual/number_fields/class_fields.md b/docs/src/manual/number_fields/class_fields.md index 7f63c20813..44cce6df11 100644 --- a/docs/src/manual/number_fields/class_fields.md +++ b/docs/src/manual/number_fields/class_fields.md @@ -60,7 +60,7 @@ ring_class_field(::AbsNumFieldOrder) ```@repl using Hecke # hide -Qx, x = polynomial_ring(FlintQQ, "x"); +Qx, x = polynomial_ring(QQ, "x"); K, a = number_field(x^2 - 10, "a"); c, mc = class_group(K) A = ray_class_field(mc) @@ -82,7 +82,7 @@ number_field(C::ClassField) ```@repl using Hecke; # hide -Qx, x = polynomial_ring(FlintQQ, "x"); +Qx, x = polynomial_ring(QQ, "x"); k, a = number_field(x^2 - 10, "a"); c, mc = class_group(k); A = ray_class_field(mc) diff --git a/docs/src/manual/orders/orders.md b/docs/src/manual/orders/orders.md index 0960c1c57e..3bef025d7f 100644 --- a/docs/src/manual/orders/orders.md +++ b/docs/src/manual/orders/orders.md @@ -38,7 +38,7 @@ any_order(K::AbsSimpleNumField) ```@repl using Hecke; # hide -Qx, x = polynomial_ring(FlintQQ, "x"); +Qx, x = polynomial_ring(QQ, "x"); K, a = number_field(x^2 - 2, "a"); O = EquationOrder(K) ``` diff --git a/docs/src/manual/quad_forms/genusherm.md b/docs/src/manual/quad_forms/genusherm.md index 438ba52b9f..50051679c6 100644 --- a/docs/src/manual/quad_forms/genusherm.md +++ b/docs/src/manual/quad_forms/genusherm.md @@ -385,7 +385,7 @@ mass(::HermLat) ```@repl 2 using Hecke # hide -Qx, x = polynomial_ring(FlintQQ, "x"); +Qx, x = polynomial_ring(QQ, "x"); f = x^2 - 2; K, a = number_field(f, "a", cached = false); Kt, t = polynomial_ring(K, "t"); diff --git a/examples/Clgp.jl b/examples/Clgp.jl index 83bbe5fbb4..2ca930593c 100644 --- a/examples/Clgp.jl +++ b/examples/Clgp.jl @@ -1,5 +1,5 @@ # Hard class group of Carlo -# Qx, x = polynomial_ring(FlintQQ, "x"); +# Qx, x = polynomial_ring(QQ, "x"); # f = x^4-x^3-378*x^2+2081*x-67; # K, a = number_field(f); # C = cyclotomic_extension(K, 7) diff --git a/examples/FieldEnumeration/FieldEnumeration.jl b/examples/FieldEnumeration/FieldEnumeration.jl index 3dde2e87f4..5adf571807 100644 --- a/examples/FieldEnumeration/FieldEnumeration.jl +++ b/examples/FieldEnumeration/FieldEnumeration.jl @@ -11,7 +11,7 @@ function __to_univariate(Qx, f) z = zero(Qx) x = gen(Qx) for (c, m) in zip(coefficients(f), monomials(f)) - z = z + FlintQQ(c) * x^total_degree(m) + z = z + QQ(c) * x^total_degree(m) end return z end @@ -30,7 +30,7 @@ end function _read_fields(filename::String) f=open(filename, "r") - Qx,x=polynomial_ring(FlintQQ,"x") + Qx,x=polynomial_ring(QQ,"x") pols = [] for s in eachline(f) a=Main.eval(Meta.parse(s)) diff --git a/examples/FieldEnumeration/absolute_abelian.jl b/examples/FieldEnumeration/absolute_abelian.jl index 579cc9ab26..af539e6c8c 100644 --- a/examples/FieldEnumeration/absolute_abelian.jl +++ b/examples/FieldEnumeration/absolute_abelian.jl @@ -7,7 +7,7 @@ function _get_simple_extension_and_maximal_order(K) pol = K.pol k = length(pol) gensK = gens(K) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) basesofmaximalorders = Vector{elem_type(K)}[] discs = ZZRingElem[] for i in 1:k diff --git a/examples/FieldEnumeration/cubic.jl b/examples/FieldEnumeration/cubic.jl index 2b3295f22e..d2270eb521 100644 --- a/examples/FieldEnumeration/cubic.jl +++ b/examples/FieldEnumeration/cubic.jl @@ -182,7 +182,7 @@ end function Gunter_Qi(r::Range, pref="Qi.new") - Qt, t = FlintQQ["t"] + Qt, t = QQ["t"] k, a = number_field(t^2+1, "k.1") s = Hecke.NumFieldHom{AbsSimpleNumField, AbsSimpleNumField}(k, k, -a) M = maximal_order(k) diff --git a/examples/FieldEnumeration/smallest_field.jl b/examples/FieldEnumeration/smallest_field.jl index a1537fa9fc..a30126dfdd 100644 --- a/examples/FieldEnumeration/smallest_field.jl +++ b/examples/FieldEnumeration/smallest_field.jl @@ -19,7 +19,7 @@ end function _read_fields(filename::String) f=open(filename, "r") - Qx,x=polynomial_ring(FlintQQ,"x") + Qx,x=polynomial_ring(QQ,"x") pols=Tuple{QQPolyRingElem, ZZRingElem}[] for s in eachline(f) a=eval(parse(s)) diff --git a/examples/IsPower.jl b/examples/IsPower.jl index 25958843e9..d7b99ddb4a 100644 --- a/examples/IsPower.jl +++ b/examples/IsPower.jl @@ -106,7 +106,7 @@ function ispower_mod_p(a::AbsSimpleNumFieldElem, i::Int) con_pr_j = [[one(parent(x)) for x = y] for y = con_pr] no_fac = sum(map(length, con_pr)) j = 0 - trafo = identity_matrix(FlintZZ, no_fac) + trafo = identity_matrix(ZZ, no_fac) no_rt = no_fac while true j += 1 @@ -128,7 +128,7 @@ function ispower_mod_p(a::AbsSimpleNumFieldElem, i::Int) continue end trafo = hcat(trafo, data) - data = zero_matrix(FlintZZ, 1, ncols(trafo)) + data = zero_matrix(ZZ, 1, ncols(trafo)) data[1, end] = pk trafo = vcat(trafo, data) #= roots: products of the local roots that ar small diff --git a/examples/MultDep.jl b/examples/MultDep.jl index dfe934b2bf..149064a45e 100644 --- a/examples/MultDep.jl +++ b/examples/MultDep.jl @@ -13,7 +13,7 @@ function multiplicative_group_mod_units_fac_elem(A::Vector{AbsSimpleNumFieldElem cp = coprime_base(A) end sort!(cp, lt = (a,b) -> norm(a) > norm(b)) - M = sparse_matrix(FlintZZ) + M = sparse_matrix(ZZ) for a = A T = Tuple{Int, ZZRingElem}[] for i = 1:length(cp) @@ -24,7 +24,7 @@ function multiplicative_group_mod_units_fac_elem(A::Vector{AbsSimpleNumFieldElem end # isone(I) && break end - push!(M, sparse_row(FlintZZ, T)) + push!(M, sparse_row(ZZ, T)) end h, t = Hecke.hnf_kannan_bachem(M, Val(true), truncate = true) return h, t, cp @@ -92,7 +92,7 @@ function *(O1::AbsNumFieldOrder, O2::AbsNumFieldOrder) b2 = basis(O2, k) p = [x*y for (x,y) in Base.Iterators.ProductIterator((b1, b2))] d = reduce(lcm, [denominator(x) for x = p]) - M = zero_matrix(FlintZZ, n*n, n) + M = zero_matrix(ZZ, n*n, n) z = ZZRingElem() for i = 1:n*n a = p[i]*d @@ -244,7 +244,7 @@ function mult_syzygies_units(A::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleN else # length == 1 extend the module s = QQFieldElem[] for x in k[1, :] - @vtime :qAdic 1 y = lift_reco(FlintQQ, x, reco = true) + @vtime :qAdic 1 y = lift_reco(QQ, x, reco = true) if y === nothing prec *= 2 @vprint :qAdic 1 "increase prec to ", prec @@ -257,7 +257,7 @@ function mult_syzygies_units(A::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleN continue end d = reduce(lcm, map(denominator, s)) - gamma = ZZRingElem[FlintZZ(x*d)::ZZRingElem for x = s] + gamma = ZZRingElem[ZZ(x*d)::ZZRingElem for x = s] @assert reduce(gcd, gamma) == 1 # should be a primitive relation @time if !verify_gamma(push!(copy(u), a), gamma, ZZRingElem(p)^prec) prec *= 2 @@ -295,12 +295,12 @@ function mult_syzygies_units(A::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleN =# for i=1:length(uu)-1 - append!(uu[i][2], zeros(FlintZZ, length(uu[end][2])-length(uu[i][2]))) + append!(uu[i][2], zeros(ZZ, length(uu[end][2])-length(uu[i][2]))) end if length(uu) == 0 - U = matrix(FlintZZ, length(uu), length(uu[end][2]), reduce(vcat, [x[2] for x = uu])) + U = matrix(ZZ, length(uu), length(uu[end][2]), reduce(vcat, [x[2] for x = uu])) else - U = matrix(FlintZZ, length(uu), length(uu[end][2]), reduce(vcat, [x[2] for x = uu])) + U = matrix(ZZ, length(uu), length(uu[end][2]), reduce(vcat, [x[2] for x = uu])) end _, U = hnf_with_transform(U') if false @@ -308,8 +308,8 @@ function mult_syzygies_units(A::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleN V = sub(U, 1:rows(U), 1:cols(U)-length(u)) U = sub(U, 1:rows(U), cols(U)-length(u)+1:cols(U)) #U can be reduced modulo V... - Z = zero_matrix(FlintZZ, cols(V), cols(U)) - I = identity_matrix(FlintZZ, cols(U)) * p^(2*prec) + Z = zero_matrix(ZZ, cols(V), cols(U)) + I = identity_matrix(ZZ, cols(U)) * p^(2*prec) k = base_ring(A[1]) A = [ Z V'; I U'] l = lll(A) @@ -353,14 +353,14 @@ function lift_reco(::QQField, a::PadicFieldElem; reco::Bool = false) fl, c, d = rational_reconstruction(u, prime(R, N-v)) !fl && return nothing - x = FlintQQ(c, d) + x = QQ(c, d) if v < 0 return x//prime(R, -v) else return x*prime(R, v) end else - return lift(FlintQQ, a) + return lift(QQ, a) end end diff --git a/examples/MultiQuad.jl b/examples/MultiQuad.jl index 9167df9b1d..2428b1f9a9 100644 --- a/examples/MultiQuad.jl +++ b/examples/MultiQuad.jl @@ -23,7 +23,7 @@ function _combine(f::QQPolyRingElem, g::QQPolyRingElem, Qxy) end function multi_quad_with_aut(d::Vector{ZZRingElem}) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) Qxy, y = polynomial_ring(Qx, "y", cached = false) lp = [ number_field(x^2-a)[1] for a = d] aut = [ [gen(x), -gen(x)] for x = lp] @@ -48,7 +48,7 @@ function multi_quad_with_aut(d::Vector{ZZRingElem}) end function multi_quad_with_emb(d::Vector{ZZRingElem}) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) Qxy, y = polynomial_ring(Qx, "y", cached = false) lp = [ number_field(x^2-a)[1] for a = d] aut = [ [gen(x)] for x = lp] @@ -102,7 +102,7 @@ function multi_quad(d::Vector{ZZRingElem}, B::Int) t_ord = 0 local t_u - Zx, x = FlintZZ["x"] + Zx, x = ZZ["x"] for i = 2:length(all_d) k, a = number_field(x^2-all_d[i], cached = false) @@ -222,7 +222,7 @@ function _nullspace(A::zzModMatrix) if valuation(p, i) > 1 continue end - b = matrix(residue_ring(FlintZZ, Int(i))[1], A_orig) + b = matrix(residue_ring(ZZ, Int(i))[1], A_orig) b = nullspace(b) b = rref(b[1]') c = matrix(base_ring(b[2]), A)' @@ -261,7 +261,7 @@ function mod_p(R, Q::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldE end end # =# - return matrix(residue_ring(FlintZZ, p)[1], 1, length(R), [dlog(dl, mF(x)^e, pp) % p for x = R]) + return matrix(residue_ring(ZZ, p)[1], 1, length(R), [dlog(dl, mF(x)^e, pp) % p for x = R]) end Hecke.lift(A::ZZMatrix) = A @@ -283,7 +283,7 @@ function saturate_exp(c::Hecke.ClassGrpCtx, p::Int, stable = 1.5) else #println("NOT doint zeta") end - T = residue_ring(FlintZZ, p)[1] + T = residue_ring(ZZ, p)[1] A = identity_matrix(T, length(R)) i = 1 for (up, k) = factor(p).fac @@ -293,10 +293,10 @@ function saturate_exp(c::Hecke.ClassGrpCtx, p::Int, stable = 1.5) all_p = [up^k] end #@show all_p - AA = identity_matrix(FlintZZ, ncols(A)) + AA = identity_matrix(ZZ, ncols(A)) for pp = all_p #println("doin' $pp") - AA = matrix(residue_ring(FlintZZ, Int(pp))[1], lift(AA)) + AA = matrix(residue_ring(ZZ, Int(pp))[1], lift(AA)) Ap = matrix(base_ring(AA), A) i = 1 S = Hecke.PrimesSet(Hecke.p_start, -1, Int(pp), 1) @@ -397,15 +397,15 @@ function elems_from_sat(c::Hecke.ClassGrpCtx, z) res = [] fac = [] for i=1:ncols(z) - a = fe(c.R_gen[1])^FlintZZ(z[1, i]) - b = FlintZZ(z[1, i]) * c.M.bas_gens[1] + a = fe(c.R_gen[1])^ZZ(z[1, i]) + b = ZZ(z[1, i]) * c.M.bas_gens[1] for j=2:length(c.R_gen) - a *= fe(c.R_gen[j])^FlintZZ(z[j, i]) - b += FlintZZ(z[j, i]) * c.M.bas_gens[j] + a *= fe(c.R_gen[j])^ZZ(z[j, i]) + b += ZZ(z[j, i]) * c.M.bas_gens[j] end for j=1:length(c.R_rel) - a *= fe(c.R_rel[j])^FlintZZ(z[j + length(c.R_gen), i]) - b += FlintZZ(z[j + length(c.R_gen), i]) * c.M.rel_gens[j] + a *= fe(c.R_rel[j])^ZZ(z[j + length(c.R_gen), i]) + b += ZZ(z[j + length(c.R_gen), i]) * c.M.rel_gens[j] end push!(res, (a, b)) @@ -414,10 +414,10 @@ function elems_from_sat(c::Hecke.ClassGrpCtx, z) end function saturate(c::Hecke.ClassGrpCtx, n::Int, stable = 3.5) - e = matrix(FlintZZ, saturate_exp(c, n%8 == 0 ? 2*n : n, stable)) + e = matrix(ZZ, saturate_exp(c, n%8 == 0 ? 2*n : n, stable)) se = sparse_matrix(e)' - A = sparse_matrix(FlintZZ) + A = sparse_matrix(ZZ) K = nf(c) _, zeta = get_attribute(K, :torsion_units) @@ -551,7 +551,7 @@ function simplify(c::Hecke.ClassGrpCtx) end end for i=1:length(U.units) - Hecke.class_group_add_relation(d, U.units[i], sparse_row(FlintZZ)) + Hecke.class_group_add_relation(d, U.units[i], sparse_row(ZZ)) end return d end diff --git a/examples/NFDB.jl b/examples/NFDB.jl index acc604ba3f..2becfebf90 100644 --- a/examples/NFDB.jl +++ b/examples/NFDB.jl @@ -1,5 +1,5 @@ function _class_group(c::Vector{BigInt}) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = Qx(c) K, a = number_field(f, cached = false) OK = lll(maximal_order(K)) @@ -11,7 +11,7 @@ function _class_group_batch(polys::Vector{QQPolyRingElem}) res = Dict() for i in 1:length(polys) f = polys[i] - c = BigInt[FlintZZ(coeff(f, j)) for j in 0:degree(f)] + c = BigInt[ZZ(coeff(f, j)) for j in 0:degree(f)] res[i] = @spawn _class_group(c) end @@ -1454,7 +1454,7 @@ mutable struct NFDBGeneric{T, S} return z end end - + function NFDBGeneric(L::Vector{RelSimpleNumField{AbsSimpleNumFieldElem}}) res = NFDBGeneric{1, eltype(L)}() for K in L diff --git a/examples/Plesken.jl b/examples/Plesken.jl index b9c8936cb9..b87745756f 100644 --- a/examples/Plesken.jl +++ b/examples/Plesken.jl @@ -26,7 +26,7 @@ function steinitz(a::zzModPolyRingElem) p = characteristic(base_ring(a)) - ZZx = polynomial_ring(FlintZZ)[1] + ZZx = polynomial_ring(ZZ)[1] # f = lift(ZZx, a) ## bloody stupid lift for poly uses symmetric residue f = [lift(coeff(a, i))::ZZRingElem for i=0:degree(a)] return Nemo.evaluate(ZZx(f), p) @@ -38,7 +38,7 @@ end function steinitz(a::ResElem{T}) where T <: Union{zzModPolyRingElem, fqPolyRepPolyRingElem, PolyRingElem} f = [steinitz(coeff(a.data, i))::ZZRingElem for i=0:degree(a.data)] - ZZx = polynomial_ring(FlintZZ)[1] + ZZx = polynomial_ring(ZZ)[1] S = base_ring(base_ring(parent(a))) return evaluate(ZZx(f), size(S)) end @@ -217,8 +217,8 @@ function plesken_kummer(p::ZZRingElem, r::Int, s::Int) R = finite_field(p) descent = false else - f = cyclotomic(r, polynomial_ring(FlintZZ)[2]) - f = polynomial_ring(residue_ring(FlintZZ, p)[1])[1](f) + f = cyclotomic(r, polynomial_ring(ZZ)[2]) + f = polynomial_ring(residue_ring(ZZ, p)[1])[1](f) f = factor(f) k = keys(f.fac) st = start(k) @@ -235,7 +235,7 @@ function plesken_kummer(p::ZZRingElem, r::Int, s::Int) descent = true ord = degree(opt) R = Native.finite_field(opt, "a")[1] - T = residue_ring(FlintZZ, p)[1] + T = residue_ring(ZZ, p)[1] J = CoerceMap(T, R) end zeta = primitive_root_r_div_qm1(R, r) @@ -355,7 +355,7 @@ function h_minus(p::Int, nb::Int) # is the asymptotic size, so that's what nb should be - Zx, x = polynomial_ring(FlintZZ) + Zx, x = polynomial_ring(ZZ) F = Vector{ZZRingElem}(p-1) g = rand(1:p-1) diff --git a/examples/RayClass.jl b/examples/RayClass.jl index 157efc8768..fcf640ee27 100644 --- a/examples/RayClass.jl +++ b/examples/RayClass.jl @@ -94,9 +94,9 @@ function ray_class_group_std(m::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimp RG=rels(G) RC=rels(C) - A=vcat(RC, matrix_space(FlintZZ, ngens(G)+ngens(U), ncols(RC))()) - B=vcat(matrix_space(FlintZZ, ngens(C), ncols(RG))(), RG) - B=vcat(B, matrix_space(FlintZZ, ngens(U) , ncols(RG))()) + A=vcat(RC, matrix_space(ZZ, ngens(G)+ngens(U), ncols(RC))()) + B=vcat(matrix_space(ZZ, ngens(C), ncols(RG))(), RG) + B=vcat(B, matrix_space(ZZ, ngens(U) , ncols(RG))()) # # We compute the relation matrix given by the image of the map U -> (O/m)^* @@ -250,7 +250,7 @@ function ray_class_group_p_part(p::Integer, m::AbsNumFieldOrderIdeal{AbsSimpleNu expo=exponent(G) inverse_d=gcdx(nonppartclass,expo)[2] - R=zero_matrix(FlintZZ, ngens(C)+ngens(U)+ngens(G), ngens(C)+ngens(G)) + R=zero_matrix(ZZ, ngens(C)+ngens(U)+ngens(G), ngens(C)+ngens(G)) for i=1:ngens(C) R[i,i]=C.snf[i] end @@ -298,7 +298,7 @@ function ray_class_group_p_part(p::Integer, m::AbsNumFieldOrderIdeal{AbsSimpleNu a=(mG\(evals[i])).coeff if p==2 && !isempty(pr) if i==1 - a=hcat(a, matrix(FlintZZ,1,length(pr), [1 for i in pr])) + a=hcat(a, matrix(ZZ,1,length(pr), [1 for i in pr])) else b=lH(tobeeval[length(tobeeval)-ngens(C)-ngens(U)+i]) a=hcat(a, b.coeff) diff --git a/examples/RelNeq.jl b/examples/RelNeq.jl index ddf8d43a6e..3003cbc0e7 100644 --- a/examples/RelNeq.jl +++ b/examples/RelNeq.jl @@ -122,7 +122,7 @@ function norm_1_subgroup(A::RelNeq) lP = Hecke.prime_decomposition_nonindex(A.m_k_K, P[1]) end f = [ZZRingElem(div(degree(Q[1]), degree(P[1]))) for Q = lP] - m = matrix(FlintZZ, 1, length(f), f) + m = matrix(ZZ, 1, length(f), f) n = kernel(m, side = :right) r = ncols(n) @@ -318,8 +318,8 @@ function Hecke.evaluate(N::Norm1Group) # want the group extension (and the disc log and such) s1, ms1 = snf(N.sC[1]) s2, ms2 = snf(N.sU[1]) - R = [rels(s2) zero_matrix(FlintZZ, ngens(s2), ngens(s1)); - zero_matrix(FlintZZ, ngens(s1), ngens(s2)) rels(s1)] + R = [rels(s2) zero_matrix(ZZ, ngens(s2), ngens(s1)); + zero_matrix(ZZ, ngens(s1), ngens(s2)) rels(s1)] for i = 1:ngens(s1) x = ms1(s1[i]) @@ -387,7 +387,7 @@ function n1group(A::RelNeq, B::Int) else lq = Hecke.prime_decomposition_nonindex(A.m_k_K, P) end - f = matrix(FlintZZ, 1, length(lq), ZZRingElem[div(degree(Q[1]), degree(P)) for Q = lq]) + f = matrix(ZZ, 1, length(lq), ZZRingElem[div(degree(Q[1]), degree(P)) for Q = lq]) n = kernel(f, side = :right) r = ncols(n) res = false @@ -444,7 +444,7 @@ function doit(f::ZZPolyRingElem) return C end -Zx, x = FlintZZ["x"] +Zx, x = ZZ["x"] function doit(n::String) f = open(n, "r") fo = open("$n.out", "w") diff --git a/examples/Round2.jl b/examples/Round2.jl index f61457729e..a7a5fa34f6 100644 --- a/examples/Round2.jl +++ b/examples/Round2.jl @@ -572,7 +572,7 @@ function Hecke.basis(F::Generic.FunctionField) return bas end -Hecke.base_ring(::AbsSimpleNumField) = FlintQQ +Hecke.base_ring(::AbsSimpleNumField) = QQ function (R::PolyRing{T})(a::Generic.RationalFunctionFieldElem{T}) where {T} @assert isone(denominator(a)) @@ -785,10 +785,10 @@ mutable struct HessQRElem <: RingElem return r end if parent(f) != P.R - f = map_coefficients(FlintZZ, f, parent = P.R) + f = map_coefficients(ZZ, f, parent = P.R) end if parent(g) != P.R - g = map_coefficients(FlintZZ, g, parent = P.R) + g = map_coefficients(ZZ, g, parent = P.R) end gc = gcd(f, g) f = divexact(f, gc) @@ -812,8 +812,8 @@ mutable struct HessQRElem <: RingElem function HessQRElem(P::HessQR, f::QQPolyRingElem, g::QQPolyRingElem) df = reduce(lcm, map(denominator, coefficients(f)), init = ZZRingElem(1)) dg = reduce(lcm, map(denominator, coefficients(g)), init = ZZRingElem(1)) - ff = map_coefficients(FlintZZ, df*f, parent = P.R) - gg = map_coefficients(FlintZZ, dg*g, parent = P.R) + ff = map_coefficients(ZZ, df*f, parent = P.R) + gg = map_coefficients(ZZ, dg*g, parent = P.R) #ff/df//gg/dg = dg/df * ff/gg return HessQRElem(P, divexact(dg, df), ff, gg) end @@ -1041,7 +1041,7 @@ function Nemo.residue_field(a::HessQR, b::HessQRElem) end function Nemo.residue_ring(a::HessQR, b::HessQRElem) - F, _ = residue_ring(FlintZZ, b.c) + F, _ = residue_ring(ZZ, b.c) return F, MapFromFunc(a, F, x->F(x.c), y->a(lift(y))) end diff --git a/examples/Suri.jl b/examples/Suri.jl index 9cfce70392..5a2ed34fb8 100644 --- a/examples/Suri.jl +++ b/examples/Suri.jl @@ -35,8 +35,8 @@ function mod_lll(a::AbsNumFieldOrderElem, I::AbsNumFieldOrderIdeal) l = lll(I)[2] S = l*basis_matrix(I) Si = pseudo_inv(S) - c = matrix(FlintZZ, 1, nrows(l), coordinates(a)) * Si[1] - d = matrix(FlintZZ, 1, nrows(l), [round(ZZRingElem, x, Si[2]) for x = c]) + c = matrix(ZZ, 1, nrows(l), coordinates(a)) * Si[1] + d = matrix(ZZ, 1, nrows(l), [round(ZZRingElem, x, Si[2]) for x = c]) return a - Hecke.parent(a)(collect(d*S)) end diff --git a/examples/pAdicConj.jl b/examples/pAdicConj.jl index 1c170cbd33..77b6a6cc0b 100644 --- a/examples/pAdicConj.jl +++ b/examples/pAdicConj.jl @@ -32,7 +32,7 @@ function mult_syzygies_units(a::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleN push!(u, a[i]) lu = vcat(lu, la[i]) else # length == 1 extend the module - r = [lift_reco(FlintQQ, x, reco = true) for x = k[1]] + r = [lift_reco(QQ, x, reco = true) for x = k[1]] #lift can fail if precision wrong. #or at least result is (can be) garbage #= bound on relation @@ -61,7 +61,7 @@ function mult_syzygies_units(a::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleN ignore bounds? =# d = reduce(lcm, map(denominator, r)) - gamma = [FlintZZ(x*d) for x = r] + gamma = [ZZ(x*d) for x = r] #technically, this relations needs to be verified. #= we have a relation mod p^k, which means @@ -84,7 +84,7 @@ function mult_syzygies_units(a::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleN Not done. =# @assert reduce(gcd, gamma) == 1 # should be a primitive relation - _, U = hnf_with_transform(matrix(FlintZZ, length(r), 1, gamma)) + _, U = hnf_with_transform(matrix(ZZ, length(r), 1, gamma)) U = inv(U) U = sub(U, 1:nrows(U), 2:ncols(U)) #new basis is the cols of U @@ -99,7 +99,7 @@ end =# function non_torsion_lower_bound(R::AbsSimpleNumFieldOrder, B::Int = 2*degree(R)) - L = Hecke.enum_ctx_from_ideal(1*R, zero_matrix(FlintZZ, 0, 0)) + L = Hecke.enum_ctx_from_ideal(1*R, zero_matrix(ZZ, 0, 0)) n = degree(R) i = B while true @@ -118,7 +118,7 @@ function non_torsion_lower_bound(R::AbsSimpleNumFieldOrder, B::Int = 2*degree(R) end function unit_lower_bound(R::AbsSimpleNumFieldOrder, B::Int = 2*degree(R)) - L = Hecke.enum_ctx_from_ideal(1*R, zero_matrix(FlintZZ, 0, 0)) + L = Hecke.enum_ctx_from_ideal(1*R, zero_matrix(ZZ, 0, 0)) n = degree(R) i = B while true diff --git a/examples/parallel_LLL.jl b/examples/parallel_LLL.jl index ef2579602f..826bbdc5f5 100644 --- a/examples/parallel_LLL.jl +++ b/examples/parallel_LLL.jl @@ -38,8 +38,8 @@ function minkowski_gram_mat_scaled_parallel(O::AbsSimpleNumFieldOrder, prec::Int Hecke.shift!(A, prec - O.minkowski_gram_mat_scaled[2]) else c = minkowski_matrix_parallel(O, prec) - d = zero_matrix(FlintZZ, degree(O), degree(O)) - A = zero_matrix(FlintZZ, degree(O), degree(O)) + d = zero_matrix(ZZ, degree(O), degree(O)) + A = zero_matrix(ZZ, degree(O), degree(O)) round_scale!(d, c, prec) ccall((:fmpz_mat_gram, libflint), Nothing, (Ref{ZZMatrix}, Ref{ZZMatrix}), A, d) Hecke.shift!(A, -prec) @@ -87,7 +87,7 @@ function parallel_lll_precomputation(M::AbsSimpleNumFieldOrder, prec::Int, nbloc block += 1 end @vprintln :LLL 3 "Blocks selection finished" - g = identity_matrix(FlintZZ, n) + g = identity_matrix(ZZ, n) while true try Hecke.minkowski_gram_mat_scaled(M, prec) diff --git a/examples/polymake.jl b/examples/polymake.jl index 4a44af17b6..72094ff8af 100644 --- a/examples/polymake.jl +++ b/examples/polymake.jl @@ -5,7 +5,7 @@ using Polymake, Hecke Hecke.number_of_rows(A::Polymake.MatrixAllocated) = Int(size(A)[1]) Hecke.number_of_columns(A::Polymake.MatrixAllocated) = Int(size(A)[2]) -function _polytope(; A::ZZMatrix=zero_matrix(FlintZZ, 1, 1), b::ZZMatrix=zero_matrix(FlintZZ, ncols(A), 1), C::ZZMatrix=zero_matrix(FlintZZ, 1, 1)) +function _polytope(; A::ZZMatrix=zero_matrix(ZZ, 1, 1), b::ZZMatrix=zero_matrix(ZZ, ncols(A), 1), C::ZZMatrix=zero_matrix(ZZ, 1, 1)) if !iszero(A) bA = Matrix{BigInt}(hcat(-b, A)) z = findall(i->!is_zero_row(bA, i), 1:nrows(bA)) @@ -15,7 +15,7 @@ function _polytope(; A::ZZMatrix=zero_matrix(FlintZZ, 1, 1), b::ZZMatrix=zero_ma end if !iszero(C) z = findall(i->!is_zero_row(C, i), 1:nrows(C)) - zI = Matrix{BigInt}(hcat(zero_matrix(FlintZZ, nrows(C), 1), C))[z, :] + zI = Matrix{BigInt}(hcat(zero_matrix(ZZ, nrows(C), 1), C))[z, :] else zI = Matrix{BigInt}(undef, 0, 0) end @@ -43,7 +43,7 @@ function solve_ineq(A::ZZMatrix, b::ZZMatrix) inner = p.INTERIOR_LATTICE_POINTS out = p.BOUNDARY_LATTICE_POINTS - res = zero_matrix(FlintZZ, nrows(inner) + nrows(out), ncols(A)) + res = zero_matrix(ZZ, nrows(inner) + nrows(out), ncols(A)) for i=1:nrows(out) @assert out[i,1] == 1 for j=1:ncols(A) @@ -65,11 +65,11 @@ end Finds all solutions to $Ax = b$, $x>=0$. Assumes a finite set of solutions. """ function solve_non_negative(A::ZZMatrix, b::ZZMatrix) - p = _polytope(A = A, b = b, C = identity_matrix(FlintZZ, ncols(A))) + p = _polytope(A = A, b = b, C = identity_matrix(ZZ, ncols(A))) inner = p.INTERIOR_LATTICE_POINTS out = p.BOUNDARY_LATTICE_POINTS - res = zero_matrix(FlintZZ, nrows(inner) + nrows(out), ncols(A)) + res = zero_matrix(ZZ, nrows(inner) + nrows(out), ncols(A)) for i=1:nrows(out) @assert out[i,1] == 1 for j=1:ncols(A) @@ -95,7 +95,7 @@ function solve_mixed(A::ZZMatrix, b::ZZMatrix, C::ZZMatrix) # Ax == b && Cx >= inner = p.INTERIOR_LATTICE_POINTS out = p.BOUNDARY_LATTICE_POINTS - res = zero_matrix(FlintZZ, nrows(inner) + nrows(out), ncols(A)) + res = zero_matrix(ZZ, nrows(inner) + nrows(out), ncols(A)) for i=1:nrows(out) if out[i,1] != 1 println("unbounded polytope!!") @@ -126,9 +126,9 @@ Solves $Ax = b$ under $Cx >= d$, assumes a finite solution set. """ function solve_mixed(A::ZZMatrix, b::ZZMatrix, C::ZZMatrix, d::ZZMatrix) n = ncols(A) - A = cat(A, identity_matrix(FlintZZ, ncols(d)), dims=(1,2)) - b = vcat(b, identity_matrix(FlintZZ, ncols(d))) - C = [C -d; zero_matrix(FlintZZ, ncols(d), ncols(C)) identity_matrix(FlintZZ, ncols(d))] + A = cat(A, identity_matrix(ZZ, ncols(d)), dims=(1,2)) + b = vcat(b, identity_matrix(ZZ, ncols(d))) + C = [C -d; zero_matrix(ZZ, ncols(d), ncols(C)) identity_matrix(ZZ, ncols(d))] s = solve_mixed(A, b, C) return s[:, 1:n] end @@ -141,11 +141,11 @@ function norm_equation2_fac_elem(R::AbsNumFieldOrder, k::ZZRingElem; abs::Bool = @assert Hecke.is_maximal(R) lp = factor(k*R) s, ms = Hecke.sunit_mod_units_group_fac_elem(collect(keys(lp))) - C = reduce(vcat, [matrix(FlintZZ, 1, ngens(s), [valuation(ms(s[i]), p) for i=1:ngens(s)]) for p = keys(lp)]) + C = reduce(vcat, [matrix(ZZ, 1, ngens(s), [valuation(ms(s[i]), p) for i=1:ngens(s)]) for p = keys(lp)]) lp = factor(k) - A = reduce(vcat, [matrix(FlintZZ, 1, ngens(s), [valuation(Hecke.factored_norm(ms(s[i])), p) for i=1:ngens(s)]) for p = keys(lp.fac)]) - b = matrix(FlintZZ, length(lp.fac), 1, [valuation(k, p) for p = keys(lp.fac)]) + A = reduce(vcat, [matrix(ZZ, 1, ngens(s), [valuation(Hecke.factored_norm(ms(s[i])), p) for i=1:ngens(s)]) for p = keys(lp.fac)]) + b = matrix(ZZ, length(lp.fac), 1, [valuation(k, p) for p = keys(lp.fac)]) so = solve_mixed(A, b, C) sol = [ms(s(sub(so, i:i, 1:ncols(so)))) for i=1:nrows(so)] @@ -170,7 +170,7 @@ function norm_equation_fac_elem(R::AbsNumFieldOrder, k::ZZRingElem; abs::Bool = S = [] for (p, k) = lp.fac P = prime_decomposition(R, p) - s = solve_non_negative(matrix(FlintZZ, 1, length(P), [degree(x[1]) for x = P]), matrix(FlintZZ, 1, 1, [k])) + s = solve_non_negative(matrix(ZZ, 1, length(P), [degree(x[1]) for x = P]), matrix(ZZ, 1, 1, [k])) push!(S, (P, [view(s, i:i, 1:ncols(s)) for i=1:nrows(s)])) end sol = [] @@ -225,10 +225,10 @@ function norm_equation_fac_elem(R::Hecke.RelNumFieldOrder{AbsSimpleNumFieldElem, q, mms = snf(q) mq = mq*inv(mms) - C = reduce(vcat, [matrix(FlintZZ, 1, ngens(q), [valuation(mS(preimage(mq, q[i])), p) for i=1:ngens(q)]) for p = keys(lp)]) + C = reduce(vcat, [matrix(ZZ, 1, ngens(q), [valuation(mS(preimage(mq, q[i])), p) for i=1:ngens(q)]) for p = keys(lp)]) - A = reduce(vcat, [matrix(FlintZZ, 1, ngens(q), [valuation(norm(mkK, mS(preimage(mq, g))), p) for g in gens(q)]) for p = keys(la)]) - b = matrix(FlintZZ, length(la), 1, [valuation(a, p) for p = keys(la)]) + A = reduce(vcat, [matrix(ZZ, 1, ngens(q), [valuation(norm(mkK, mS(preimage(mq, g))), p) for g in gens(q)]) for p = keys(la)]) + b = matrix(ZZ, length(la), 1, [valuation(a, p) for p = keys(la)]) so = solve_mixed(A, b, C) u, mu = Hecke.unit_group_fac_elem(parent(a)) @@ -268,16 +268,16 @@ function Hecke.is_irreducible(a::AbsSimpleNumFieldOrderElem) # if this is possible, then a is not irreducible as a # is then ms(Ax) * ms(Ay) and neither is trivial. - I = identity_matrix(FlintZZ, length(S)) + I = identity_matrix(ZZ, length(S)) A = hcat(I, I) #so A*(x|y) = x+y = sol is the 1. condition C = cat(V, V, dims=(1,2)) # C(x|y) >=0 iff Cx >=0 and Cy >=0 #Cx <> 0 iff (1,..1)*Cx >= 1 - one = matrix(FlintZZ, 1, length(S), [1 for p = S]) - zer = matrix(FlintZZ, 1, length(S), [0 for p = S]) + one = matrix(ZZ, 1, length(S), [1 for p = S]) + zer = matrix(ZZ, 1, length(S), [0 for p = S]) C = vcat(C, hcat(one, zer), hcat(zer, one)) - d = matrix(FlintZZ, 2*length(S)+2, 1, [0 for i = 1:2*length(S) + 2]) + d = matrix(ZZ, 2*length(S)+2, 1, [0 for i = 1:2*length(S) + 2]) d[end-1, 1] = 1 d[end, 1] = 1 global last_irr = a diff --git a/ext/GAPExt/abelian_layer.jl b/ext/GAPExt/abelian_layer.jl index 93e9293094..f8e454a4c9 100644 --- a/ext/GAPExt/abelian_layer.jl +++ b/ext/GAPExt/abelian_layer.jl @@ -99,7 +99,7 @@ end function _abelian_extensionsQQ(gtype::Vector{Int}, absolute_discriminant_bound::ZZRingElem, only_real::Bool = false; unramified_outside::Vector{ZZRingElem} = ZZRingElem[]) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) K, _ = number_field(x-1, "a", cached = false) O = maximal_order(K) n = prod(gtype) diff --git a/ext/GAPExt/brauer.jl b/ext/GAPExt/brauer.jl index c2fbabaf07..42e2596ffd 100644 --- a/ext/GAPExt/brauer.jl +++ b/ext/GAPExt/brauer.jl @@ -1148,12 +1148,12 @@ function _find_theta(G::Vector{<: NumFieldHom{AbsSimpleNumField, AbsSimpleNumFie gF = gen(F) igF = K(mF\gF) q = 2 - R = residue_ring(FlintZZ, q, cached = false)[1] + R = residue_ring(ZZ, q, cached = false)[1] Rt = polynomial_ring(R, "t", cached = false)[1] fmod = Rt(K.pol) while iszero(discriminant(fmod)) q = next_prime(q) - R = residue_ring(FlintZZ, q, cached = false)[1] + R = residue_ring(ZZ, q, cached = false)[1] Rt = polynomial_ring(R, "t", cached = false)[1] fmod = Rt(K.pol) end @@ -1183,12 +1183,12 @@ function _find_frob(G::Vector{<: NumFieldHom{AbsSimpleNumField, AbsSimpleNumFiel K = domain(G[1]) O = maximal_order(K) q1 = 2 - R = residue_ring(FlintZZ, q1, cached = false)[1] + R = residue_ring(ZZ, q1, cached = false)[1] Rt = polynomial_ring(R, "t", cached = false)[1] fmod = Rt(K.pol) while iszero(discriminant(fmod)) q1 = next_prime(q1) - R = residue_ring(FlintZZ, q1, cached = false)[1] + R = residue_ring(ZZ, q1, cached = false)[1] Rt = polynomial_ring(R, "t", cached = false)[1] fmod = Rt(K.pol) end diff --git a/ext/PolymakeExt.jl b/ext/PolymakeExt.jl index 8f3fb1b4e2..a01ade6767 100644 --- a/ext/PolymakeExt.jl +++ b/ext/PolymakeExt.jl @@ -14,7 +14,7 @@ import Hecke: Hecke.number_of_rows(A::Polymake.MatrixAllocated) = Int(size(A)[1]) Hecke.number_of_columns(A::Polymake.MatrixAllocated) = Int(size(A)[2]) -function _polytope(; A::ZZMatrix=zero_matrix(FlintZZ, 1, 1), b::ZZMatrix=zero_matrix(FlintZZ, ncols(A), 1), C::ZZMatrix=zero_matrix(FlintZZ, 1, 1)) +function _polytope(; A::ZZMatrix=zero_matrix(ZZ, 1, 1), b::ZZMatrix=zero_matrix(ZZ, ncols(A), 1), C::ZZMatrix=zero_matrix(ZZ, 1, 1)) if !iszero(A) bA = Matrix{BigInt}(hcat(-b, A)) z = findall(i->!is_zero_row(bA, i), 1:nrows(bA)) @@ -24,7 +24,7 @@ function _polytope(; A::ZZMatrix=zero_matrix(FlintZZ, 1, 1), b::ZZMatrix=zero_ma end if !iszero(C) z = findall(i->!is_zero_row(C, i), 1:nrows(C)) - zI = Matrix{BigInt}(hcat(zero_matrix(FlintZZ, nrows(C), 1), C))[z, :] + zI = Matrix{BigInt}(hcat(zero_matrix(ZZ, nrows(C), 1), C))[z, :] else zI = Matrix{BigInt}(undef, 0, 0) end @@ -52,7 +52,7 @@ function solve_ineq(A::ZZMatrix, b::ZZMatrix) inner = p.INTERIOR_LATTICE_POINTS out = p.BOUNDARY_LATTICE_POINTS - res = zero_matrix(FlintZZ, nrows(inner) + nrows(out), ncols(A)) + res = zero_matrix(ZZ, nrows(inner) + nrows(out), ncols(A)) for i=1:nrows(out) @assert out[i,1] == 1 for j=1:ncols(A) @@ -74,11 +74,11 @@ end Finds all solutions to $Ax = b$, $x>=0$. Assumes a finite set of solutions. """ function solve_non_negative(A::ZZMatrix, b::ZZMatrix) - p = _polytope(A = A, b = b, C = identity_matrix(FlintZZ, ncols(A))) + p = _polytope(A = A, b = b, C = identity_matrix(ZZ, ncols(A))) inner = p.INTERIOR_LATTICE_POINTS out = p.BOUNDARY_LATTICE_POINTS - res = zero_matrix(FlintZZ, nrows(inner) + nrows(out), ncols(A)) + res = zero_matrix(ZZ, nrows(inner) + nrows(out), ncols(A)) for i=1:nrows(out) @assert out[i,1] == 1 for j=1:ncols(A) @@ -104,7 +104,7 @@ function Hecke.solve_mixed(A::ZZMatrix, b::ZZMatrix, C::ZZMatrix) # Ax == b && inner = p.INTERIOR_LATTICE_POINTS out = p.BOUNDARY_LATTICE_POINTS - res = zero_matrix(FlintZZ, (nrows(inner) + nrows(out))::Int, ncols(A)::Int) + res = zero_matrix(ZZ, (nrows(inner) + nrows(out))::Int, ncols(A)::Int) for i=1:nrows(out) if out[i,1] != 1 println("unbounded polytope!!") @@ -135,9 +135,9 @@ Solves $Ax = b$ under $Cx >= d$, assumes a finite solution set. """ function solve_mixed(A::ZZMatrix, b::ZZMatrix, C::ZZMatrix, d::ZZMatrix) n = ncols(A) - A = cat(A, identity_matrix(FlintZZ, ncols(d)), dims=(1,2)) - b = vcat(b, identity_matrix(FlintZZ, ncols(d))) - C = [C -d; zero_matrix(FlintZZ, ncols(d), ncols(C)) identity_matrix(FlintZZ, ncols(d))] + A = cat(A, identity_matrix(ZZ, ncols(d)), dims=(1,2)) + b = vcat(b, identity_matrix(ZZ, ncols(d))) + C = [C -d; zero_matrix(ZZ, ncols(d), ncols(C)) identity_matrix(ZZ, ncols(d))] s = solve_mixed(A, b, C) return s[:, 1:n] end diff --git a/src/AlgAss/AbsAlgAss.jl b/src/AlgAss/AbsAlgAss.jl index c2ad2e79e7..f8c7e8b666 100644 --- a/src/AlgAss/AbsAlgAss.jl +++ b/src/AlgAss/AbsAlgAss.jl @@ -314,7 +314,7 @@ function rand(A::AbstractAssociativeAlgebra{T}, rng::AbstractUnitRange{Int}) whe end function rand(A::StructureConstantAlgebra{QQFieldElem}, rng::AbstractUnitRange{Int} = -20:20) - c = [QQFieldElem(rand(FlintZZ, rng)) for i = 1:dim(A)] + c = [QQFieldElem(rand(ZZ, rng)) for i = 1:dim(A)] return A(c) end @@ -802,7 +802,7 @@ function CrossedProductAlgebra(K::AbsSimpleNumField, G::Vector{T}, cocval::Matri end end end - return StructureConstantAlgebra(FlintQQ, M) + return StructureConstantAlgebra(QQ, M) end @@ -853,7 +853,7 @@ function CrossedProductAlgebra(O::AbsSimpleNumFieldOrder, G::Vector{T}, cocval:: j = find_elem(G, j1) O1 = QQFieldElem[0 for i=1:n*m] O1[j] = QQFieldElem(1) - A = StructureConstantAlgebra(FlintQQ, M, O1) + A = StructureConstantAlgebra(QQ, M, O1) A.is_simple = 1 return A diff --git a/src/AlgAss/AlgGrp.jl b/src/AlgAss/AlgGrp.jl index b9c144b547..abeeaa10e4 100644 --- a/src/AlgAss/AlgGrp.jl +++ b/src/AlgAss/AlgGrp.jl @@ -517,7 +517,7 @@ automorphism_map(f::NfToAlgGrpMor) = f.mG #function galois_module(K::AbsSimpleNumField, aut::Map = automorphism_group(K)[2]; normal_basis_generator = normal_basis(K)) # G = domain(aut) -# A = FlintQQ[G] +# A = QQ[G] # return _galois_module(K, A, aut, normal_basis_generator = normal_basis_generator) #end # @@ -594,7 +594,7 @@ automorphism_map(f::NfToAlgGrpMor) = f.mG ## to Q[G] and one from Q[G] to K #function _galois_module(K::AbsSimpleNumField, to_automorphisms::Map = automorphism_group(K)[2]; normal_basis_generator = normal_basis(K)) # G = domain(to_automorphisms) -# A = FlintQQ[G] +# A = QQ[G] # alpha = normal_basis_generator # # basis_alpha = Vector{elem_type(K)}(undef, dim(A)) @@ -722,10 +722,10 @@ end function _as_full_matrix_algebra_over_Q(A::MatAlgebra{AbsSimpleNumFieldElem}) K = base_ring(A) @assert is_absolute(K) && degree(K) == 1 - B = matrix_algebra(FlintQQ, degree(A)) + B = matrix_algebra(QQ, degree(A)) M = identity_matrix(K, dim(B)) - Minv = identity_matrix(FlintQQ, dim(B)) + Minv = identity_matrix(QQ, dim(B)) return B, AbsAlgAssMorGen(B, A, M, Minv) end @@ -836,7 +836,7 @@ function _compute_matrix_algebras_from_reps(A, res) forward_matrix = zero_matrix(field, dim(B), dim(MB)) - back_matrix = zero_matrix(FlintQQ, dim(B), dim(B)) + back_matrix = zero_matrix(QQ, dim(B), dim(B)) BinMB = elem_type(MB)[] @@ -967,7 +967,7 @@ end function _evaluate_rep(el, d, rep) c = coefficients(el) A = parent(el) - z = zero_matrix(FlintQQ, d, d) + z = zero_matrix(QQ, d, d) for (g, M) in rep i = A.group_to_base[g] z += c[i] * M @@ -1109,7 +1109,7 @@ function is_almost_maximally_ramified(K::AbsSimpleNumField, p::ZZRingElem) t += 1 end - QG = group_algebra(FlintQQ, G) + QG = group_algebra(QQ, G) A, KtoA = galois_module(K) I = KtoA(maximal_order(K)) assOrd = right_order(I) diff --git a/src/AlgAss/AlgQuat.jl b/src/AlgAss/AlgQuat.jl index 5e2f5f711d..50a6b32a6c 100644 --- a/src/AlgAss/AlgQuat.jl +++ b/src/AlgAss/AlgQuat.jl @@ -231,7 +231,7 @@ end function _reduce_standard_form(a::AbsSimpleNumFieldElem, b::AbsSimpleNumFieldElem) K = parent(a) if is_rational(a) && is_rational(b) - n, m, ap, bp = _reduce_standard_form(FlintQQ(a), FlintQQ(b)) + n, m, ap, bp = _reduce_standard_form(QQ(a), QQ(b)) return K(n), K(m), K(ap), K(bp) else return one(K), one(K), a, b @@ -283,10 +283,10 @@ function Base.enumerate(O::Union{AlgAssRelOrd, AlgAssAbsOrd}, b::Int, equal::Boo f = standard_involution(A) B = elem_in_algebra.(absolute_basis(O)) d = length(B) - G = zero_matrix(FlintQQ, d, d) + G = zero_matrix(QQ, d, d) for i in 1:d for j in 1:d - G[i, j] = FlintZZ(absolute_tr(trred(B[i] * f(B[j]))))//2 + G[i, j] = ZZ(absolute_tr(trred(B[i] * f(B[j]))))//2 end end @@ -322,10 +322,10 @@ function unit_group_modulo_scalars(O::AlgAssRelOrd) gens = elem_type(O)[] for e in q _x = mu(mq\e) - _n = abs(FlintZZ(absolute_tr(_x))) + _n = abs(ZZ(absolute_tr(_x))) # Reduce modulo squares, so that the trace is hopefully small x = evaluate(reduce_mod_powers(elem_in_nf(_x), 2)) - n = abs(FlintZZ(absolute_tr(x))) + n = abs(ZZ(absolute_tr(x))) if _n < n # the old x has smaller trace x = _x @@ -472,7 +472,7 @@ function _is_principal_maximal_quaternion_generic_proper(a, M, side = :right) Babs = absolute_basis(a) d = length(Babs) - G = zero_matrix(FlintZZ, d, d) + G = zero_matrix(ZZ, d, d) #@show reps for z in reps Nnu = z * u * c @@ -486,7 +486,7 @@ function _is_principal_maximal_quaternion_generic_proper(a, M, side = :right) for i in 1:d for j in 1:d - G[i, j] = FlintZZ(absolute_tr(alpha * trred(Babs[i] * f(Babs[j])))) + G[i, j] = ZZ(absolute_tr(alpha * trred(Babs[i] * f(Babs[j])))) end end @@ -502,7 +502,7 @@ function _is_principal_maximal_quaternion_generic_proper(a, M, side = :right) #@show B - v = _short_vectors_gram_integral(Vector, G, FlintZZ(B), hard = true) + v = _short_vectors_gram_integral(Vector, G, ZZ(B), hard = true) #if min == degree(base_ring(A)) for w in v diff --git a/src/AlgAss/ChangeRing.jl b/src/AlgAss/ChangeRing.jl index 0f215560fa..8868f1b4df 100644 --- a/src/AlgAss/ChangeRing.jl +++ b/src/AlgAss/ChangeRing.jl @@ -13,7 +13,7 @@ Given an algebra $A$ over a field $L$ and the prime field $K$ of $L$, this function returns the restriction $B$ of $A$ to $K$ and the morphism $B \to A$. """ -# Top level functions to avoid "type mix-ups" (like StructureConstantAlgebra{fqPolyRepFieldElem} with FlintQQ) +# Top level functions to avoid "type mix-ups" (like StructureConstantAlgebra{fqPolyRepFieldElem} with QQ) function restrict_scalars(A::AbstractAssociativeAlgebra{AbsSimpleNumFieldElem}, Q::QQField) return _restrict_scalars(A, Q) end diff --git a/src/AlgAss/Conversions.jl b/src/AlgAss/Conversions.jl index 5bc4a01868..b4a5efda10 100644 --- a/src/AlgAss/Conversions.jl +++ b/src/AlgAss/Conversions.jl @@ -223,7 +223,7 @@ function StructureConstantAlgebra(I::Union{ AbsNumFieldOrderIdeal, AlgAssAbsOrdI A.is_commutative = 1 end - t = FakeFmpqMat(zero_matrix(FlintZZ, 1, n)) + t = FakeFmpqMat(zero_matrix(ZZ, 1, n)) local _image diff --git a/src/AlgAss/Elem.jl b/src/AlgAss/Elem.jl index a7b164db1f..46e8d75b69 100644 --- a/src/AlgAss/Elem.jl +++ b/src/AlgAss/Elem.jl @@ -916,7 +916,7 @@ function elem_from_mat_row(A::AbstractAssociativeAlgebra{T}, M::MatElem{T}, i::I end function elem_to_mat_row!(x::ZZMatrix, i::Int, d::ZZRingElem, a::AbstractAssociativeAlgebraElem{QQFieldElem}) - z = zero_matrix(FlintQQ, 1, ncols(x)) + z = zero_matrix(QQ, 1, ncols(x)) elem_to_mat_row!(z, 1, a) z_q = FakeFmpqMat(z) diff --git a/src/AlgAss/StructureConstantAlgebra.jl b/src/AlgAss/StructureConstantAlgebra.jl index 1fdeeb9782..d709c0428e 100644 --- a/src/AlgAss/StructureConstantAlgebra.jl +++ b/src/AlgAss/StructureConstantAlgebra.jl @@ -978,7 +978,7 @@ end quaternion_algebra2(K::Field, a::Int, b::Int) = quaternion_algebra2(K, K(a), K(b)) -quaternion_algebra2(a::Int, b::Int) = quaternion_algebra2(FlintQQ, QQFieldElem(a), QQFieldElem(b)) +quaternion_algebra2(a::Int, b::Int) = quaternion_algebra2(QQ, QQFieldElem(a), QQFieldElem(b)) ################################################################################ # diff --git a/src/AlgAss/radical.jl b/src/AlgAss/radical.jl index b6cc2ec2be..0453e9ba99 100644 --- a/src/AlgAss/radical.jl +++ b/src/AlgAss/radical.jl @@ -285,7 +285,7 @@ function _radical_finite_generic(A::AbstractAssociativeAlgebra{T}) where {T <: U end k = flog(ZZRingElem(dim(A)), p) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = Qx(push!(QQFieldElem[ -QQFieldElem(T === FqFieldElem ? Nemo._coeff(absgenF^n, i) : coeff(absgenF^n, i)) for i = 0:(n - 1) ], QQFieldElem(1))) K, a = number_field(f, "a") diff --git a/src/AlgAssAbsOrd/Conjugacy.jl b/src/AlgAssAbsOrd/Conjugacy.jl index 7dc136d2ff..b704790d48 100644 --- a/src/AlgAssAbsOrd/Conjugacy.jl +++ b/src/AlgAssAbsOrd/Conjugacy.jl @@ -5,27 +5,27 @@ include("Conjugacy/Conjugacy.jl") # Element which is failing: -# A = matrix(FlintQQ, 10, 10, [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -49, 0, -42, 14, -9, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1]) +# A = matrix(QQ, 10, 10, [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -49, 0, -42, 14, -9, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1]) # # -# A = matrix(FlintQQ, 10, 10, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 6, 9, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 6, 9, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1, -7, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6]) +# A = matrix(QQ, 10, 10, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 6, 9, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 6, 9, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1, -7, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6]) # # This gives the right_order assertion: # -# A = matrix(FlintQQ, 6, 6, [0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -125, -75, -15, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, -5]) -# B = matrix(FlintQQ, 6, 6, [-22910, 2266, 45832, 2658, 1285, -226465, -16600, 1660, 33621, 17622, 350, -168655, -11375, 1125, 22750, 1080, 625, -112400, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 7, 0, -150, 15, 303, 126, 0, -1520]) +# A = matrix(QQ, 6, 6, [0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -125, -75, -15, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, -5]) +# B = matrix(QQ, 6, 6, [-22910, 2266, 45832, 2658, 1285, -226465, -16600, 1660, 33621, 17622, 350, -168655, -11375, 1125, 22750, 1080, 625, -112400, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 7, 0, -150, 15, 303, 126, 0, -1520]) # -# A = matrix(FlintQQ, 5, 5, [0, 1, 0, 0, 0, -81, -18, 0, 0, 0, 0, 0, -9, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, -9]]) +# A = matrix(QQ, 5, 5, [0, 1, 0, 0, 0, -81, -18, 0, 0, 0, 0, 0, -9, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, -9]]) # -# B = matrix(FlintQQ, 5, 5, 15054, 1, -105441, -149944, -5019, 21417, -15, -149919, -212937, -7151, 1254, 0, -8787, -12480, -418, 627, 0, -4389, -6249, -209, 108, 3, -756, -1179, -39]) +# B = matrix(QQ, 5, 5, 15054, 1, -105441, -149944, -5019, 21417, -15, -149919, -212937, -7151, 1254, 0, -8787, -12480, -418, 627, 0, -4389, -6249, -209, 108, 3, -756, -1179, -39]) # # julia> Hecke._eltseq(A) |> print # ZZRingElem[0, 1, 0, 0, 0, 0, 1, 0, -343, -147, -21, 0, 0, 0, 0, -7] # julia> Hecke._eltseq(B) |> print # ZZRingElem[-39277, -17864, -773376, 225560, -2841374, -1292556, -55957655, 16320401, -405524, -184499, -7988112, 2329751, -1622301, -738076, -31955520, 9319917] # -# A = matrix(FlintQQ, 3, 3, [0, 1, 0, -1, 2, 0, 0, 0, 1]) +# A = matrix(QQ, 3, 3, [0, 1, 0, -1, 2, 0, 0, 0, 1]) # -# B = matrix(FlintQQ, 3, 3, [-2959757959, -15202918, 41804175660, -153800, -789, 2172300, -209552500, -1076375, 2959758751]) +# B = matrix(QQ, 3, 3, [-2959757959, -15202918, 41804175660, -153800, -789, 2172300, -209552500, -1076375, 2959758751]) # -# B = matrix(FlintQQ, 3, 3, [-1, 2, 2, -1, 2, 1, -1, 1, 2]) +# B = matrix(QQ, 3, 3, [-1, 2, 2, -1, 2, 1, -1, 1, 2]) diff --git a/src/AlgAssAbsOrd/Conjugacy/Conjugacy.jl b/src/AlgAssAbsOrd/Conjugacy/Conjugacy.jl index a597663d2d..b3b5e5594b 100644 --- a/src/AlgAssAbsOrd/Conjugacy/Conjugacy.jl +++ b/src/AlgAssAbsOrd/Conjugacy/Conjugacy.jl @@ -312,8 +312,8 @@ true is_GLZ_conjugate(A::Union{ZZMatrix, QQMatrix}, B::Union{ZZMatrix, QQMatrix}) function is_GLZ_conjugate(A::ZZMatrix, B::ZZMatrix) - AQ = change_base_ring(FlintQQ, A) - BQ = change_base_ring(FlintQQ, B) + AQ = change_base_ring(QQ, A) + BQ = change_base_ring(QQ, B) return _isGLZ_conjugate_integral(AQ, BQ) end @@ -324,18 +324,18 @@ end function _isGLZ_conjugate_integral(A::QQMatrix, B::QQMatrix) if nrows(A) != nrows(B) - return false, zero_matrix(FlintZZ, 0, 0) + return false, zero_matrix(ZZ, 0, 0) end if A == B - return true, identity_matrix(FlintZZ, nrows(A)) + return true, identity_matrix(ZZ, nrows(A)) end CA, TA = rational_canonical_form(A) CB, TB = rational_canonical_form(B) if CA != CB - return false, zero_matrix(FlintZZ, 0, 0) + return false, zero_matrix(ZZ, 0, 0) end @vprint :Conjugacy 1 "Computing commutator algebra\n" @@ -396,7 +396,7 @@ function _isGLZ_conjugate_integral(A::QQMatrix, B::QQMatrix) AssociativeAlgebraElem{QQFieldElem,StructureConstantAlgebra{QQFieldElem}}} if !fl - return false, zero_matrix(FlintZZ, 0, 0) + return false, zero_matrix(ZZ, 0, 0) end @hassert :Conjugacy 1 y * OO == OI @@ -406,7 +406,7 @@ function _isGLZ_conjugate_integral(A::QQMatrix, B::QQMatrix) d = denominator(OI, OO) - Y = zero_matrix(FlintZZ, length(idealgens), dim(AA)) + Y = zero_matrix(ZZ, length(idealgens), dim(AA)) for i in 1:length(idealgens) cc = coordinates(OO(d * idealgens[i])) @assert length(cc) == dim(AA) @@ -415,11 +415,11 @@ function _isGLZ_conjugate_integral(A::QQMatrix, B::QQMatrix) end end - YY = matrix(FlintZZ, 1, dim(AA), coordinates(OO(d * y))) + YY = matrix(ZZ, 1, dim(AA), coordinates(OO(d * y))) fl, vv = can_solve_with_solution(Y, YY, side = :left) @assert fl - yy = zero_matrix(FlintQQ, nrows(A), nrows(A)) + yy = zero_matrix(QQ, nrows(A), nrows(A)) for i in 1:length(vv) yy = yy + vv[1, i] * (invC * I[i]) end @@ -434,7 +434,7 @@ function _isGLZ_conjugate_integral(A::QQMatrix, B::QQMatrix) return false, zero_matrix(ZZ, 0, 0) end - return fl, map_entries(FlintZZ, T) + return fl, map_entries(ZZ, T) end ################################################################################ @@ -456,24 +456,24 @@ function _basis_of_integral_commutator_algebra(A::QQMatrix, B::QQMatrix) linind = transpose(LinearIndices((nrows(A), nrows(B)))) n = nrows(A) m = nrows(B) - z = zero_matrix(FlintQQ, n*m, n*m) + z = zero_matrix(QQ, n*m, n*m) for i in 1:m for j in 1:n for k in 1:n - z[linind[i, j], linind[i, k]] += FlintZZ(A[k, j]) + z[linind[i, j], linind[i, k]] += ZZ(A[k, j]) end for k in 1:m - z[linind[i, j], linind[k, j]] -= FlintZZ(B[i, k]) + z[linind[i, j], linind[k, j]] -= ZZ(B[i, k]) end end end K = kernel(z; side = :right) - KK = change_base_ring(FlintZZ, denominator(K) * K) + KK = change_base_ring(ZZ, denominator(K) * K) KK = transpose(saturate(transpose(KK))) res = QQMatrix[] for k in 1:ncols(K) cartind = cartesian_product_iterator([1:x for x in (n, m)], inplace = true) - M = zero_matrix(FlintQQ, m, n) + M = zero_matrix(QQ, m, n) for (l, v) in enumerate(cartind) M[v[2], v[1]] = KK[l, k] end @@ -567,9 +567,9 @@ function _basis_of_integral_commutator_algebra(As::Vector{QQMatrix}, @assert all(x -> isone(denominator(x)), As) @assert all(x -> isone(denominator(x)), Bs) linind = transpose(LinearIndices((n,m))) - zz = zero_matrix(FlintQQ, 0, n*m) + zz = zero_matrix(QQ, 0, n*m) for (A, B) in zip(As, Bs) - z = zero_matrix(FlintQQ, n*m, n*m) + z = zero_matrix(QQ, n*m, n*m) for i in 1:m for j in 1:n for k in 1:n @@ -583,12 +583,12 @@ function _basis_of_integral_commutator_algebra(As::Vector{QQMatrix}, zz = vcat(zz, z) end K = kernel(zz; side = :right) - KK = change_base_ring(FlintZZ, denominator(K) * K) + KK = change_base_ring(ZZ, denominator(K) * K) KK = transpose(saturate(transpose(KK))) res = QQMatrix[] for k in 1:ncols(K) cartind = cartesian_product_iterator([1:x for x in (n, m)], inplace = true) - M = zero_matrix(FlintQQ, m, n) + M = zero_matrix(QQ, m, n) for (l, v) in enumerate(cartind) M[v[2], v[1]] = KK[l, k] end @@ -620,12 +620,12 @@ end # return true, c # end # end -# return false, zero_matrix(FlintQQ, 0, 0) +# return false, zero_matrix(QQ, 0, 0) #end # #function _isGLZ_conjugate(A::Vector{ZZMatrix}, B::Vector{ZZMatrix}) -# return __isGLZ_conjugate(map(x -> change_base_ring(FlintQQ, x), A), -# map(x -> change_base_ring(FlintQQ, x), B)) +# return __isGLZ_conjugate(map(x -> change_base_ring(QQ, x), A), +# map(x -> change_base_ring(QQ, x), B)) #end # #function _isGLZ_conjugate(A::Vector{QQMatrix}, B::Vector{QQMatrix}) @@ -638,17 +638,17 @@ end #function __isGLZ_conjugate(A::Vector{QQMatrix}, B::Vector{QQMatrix}) # # if A == B -# return true, identity_matrix(FlintQQ, nrows(A[1])) +# return true, identity_matrix(QQ, nrows(A[1])) # end # O = _basis_of_integral_commutator_algebra(A, A) # I = _basis_of_integral_commutator_algebra(A, B) -# AA = matrix_algebra(FlintQQ, map(x -> map(FlintQQ, x), O)) +# AA = matrix_algebra(QQ, map(x -> map(QQ, x), O)) # ordergens = elem_type(AA)[] # idealgens = elem_type(AA)[] # # fl, _C = _isconjugated_probabilistic(A, B) # if !fl -# return false, zero_matrix(FlintQQ, 0, 0) +# return false, zero_matrix(QQ, 0, 0) # end # # @assert all(_C * map(QQ, A[i]) == map(QQ, B[i]) * _C for i in 1:length(A)) @@ -707,7 +707,7 @@ end # # I cannot just lift, I need a preimage in OI # d = denominator(OI, OO) # -# Y = zero_matrix(FlintQQ, dim(AA), dim(S)) +# Y = zero_matrix(QQ, dim(AA), dim(S)) # OIbasis = basis(OI) # for i in 1:dim(AA) # cc = coefficients(AtoS(OIbasis[i])) @@ -716,7 +716,7 @@ end # end # end # -# YY = matrix(FlintQQ, 1, dim(S), coefficients(yyy)) +# YY = matrix(QQ, 1, dim(S), coefficients(yyy)) # # I look for a integral solution, but the matrices are rational .. # d = lcm(denominator(Y), denominator(YY)) # fl, vv = can_solve_with_solution(map(ZZ, d*Y), map(ZZ, d*YY), side = :left) @@ -725,7 +725,7 @@ end # end # # if !fl -# return false, zero_matrix(FlintQQ, 0, 0) +# return false, zero_matrix(QQ, 0, 0) # end # # @assert yy * OO == OI @@ -741,7 +741,7 @@ end # # #d = denominator(OI, OO) # -# #Y = zero_matrix(FlintZZ, length(idealgens), dim(AA)) +# #Y = zero_matrix(ZZ, length(idealgens), dim(AA)) # #for i in 1:length(idealgens) # # cc = coordinates(OO(d * idealgens[i])) # # @assert length(cc) == dim(AA) @@ -750,11 +750,11 @@ end # # end # #end # -# #YY = matrix(FlintZZ, 1, dim(AA), coordinates(OO(d * y))) +# #YY = matrix(ZZ, 1, dim(AA), coordinates(OO(d * y))) # # #fl, vv = can_solve_with_solution(Y, YY, side = :left) # #@assert fl -# #yy = zero_matrix(FlintQQ, nrows(A), nrows(A)) +# #yy = zero_matrix(QQ, nrows(A), nrows(A)) # #for i in 1:length(vv) # # yy = yy + vv[1, i] * (invC * I[i]) # #end diff --git a/src/AlgAssAbsOrd/Conjugacy/Husert.jl b/src/AlgAssAbsOrd/Conjugacy/Husert.jl index 169bce06b4..54706e5630 100644 --- a/src/AlgAssAbsOrd/Conjugacy/Husert.jl +++ b/src/AlgAssAbsOrd/Conjugacy/Husert.jl @@ -5,10 +5,10 @@ ################################################################################ function _issimilar_husert(A::ZZMatrix, B::ZZMatrix) - QA = change_base_ring(FlintQQ, A) - QB = change_base_ring(FlintQQ, B) + QA = change_base_ring(QQ, A) + QB = change_base_ring(QQ, B) fl, QC = _issimilar_husert_generic(QA, QB) - return fl, change_base_ring(FlintZZ, QC) + return fl, change_base_ring(ZZ, QC) end # If successful, returns X such that X * A * X^-1 == B @@ -37,7 +37,7 @@ function _issimilar_husert_generic(A, B) EB = eigenspace(change_base_ring(K, B), gen(K), side = :left) push!(Ks, K) if nrows(EA) != nrows(EB) - return false, zero_matrix(FlintQQ, 0, 0) + return false, zero_matrix(QQ, 0, 0) end @assert nrows(EA) == nrows(EB) for j in 1:nrows(EA) @@ -51,8 +51,8 @@ function _issimilar_husert_generic(A, B) absolute_basis_vec_A = Vector{Vector{QQFieldElem}}() absolute_basis_vec_B = Vector{Vector{QQFieldElem}}() - absolute_basis_A = zero_matrix(FlintQQ, m, m) - absolute_basis_B = zero_matrix(FlintQQ, m, m) + absolute_basis_A = zero_matrix(QQ, m, m) + absolute_basis_B = zero_matrix(QQ, m, m) for i in 1:m vA = _to_absolute_basis(view(vecsA, i, :), m, ns, Ks) vB = _to_absolute_basis(view(vecsB, i, :), m, ns, Ks) @@ -88,18 +88,18 @@ function _issimilar_husert_generic(A, B) # I need to construct the block matrix, where M is at block (i1, i2) # and all the other ones are zero # The overall matrix must have size ni * degree(Ks[i]) - Z1 = zero_matrix(FlintQQ, (i1 - 1) * ds[i], ni * ds[i]) - Z2 = zero_matrix(FlintQQ, ds[i], (i2 - 1) * ds[i]) + Z1 = zero_matrix(QQ, (i1 - 1) * ds[i], ni * ds[i]) + Z2 = zero_matrix(QQ, ds[i], (i2 - 1) * ds[i]) Z3 = hcat(Z2, M) - Z3 = hcat(Z3, zero_matrix(FlintQQ, ds[i], (ni - i2) * ds[i])) - Z4 = zero_matrix(FlintQQ, (ni - i1) * ds[i], ni * ds[i]) + Z3 = hcat(Z3, zero_matrix(QQ, ds[i], (ni - i2) * ds[i])) + Z4 = zero_matrix(QQ, (ni - i1) * ds[i], ni * ds[i]) MM = vcat(Z1, Z3, Z4) blocklengthbefore = sum(Int[ns[o] * ds[o] for o in 1:(i - 1)]) blocklengthafter = sum(Int[ns[o] * ds[o] for o in (i + 1):s]) D = diagonal_matrix( - zero_matrix(FlintQQ, blocklengthbefore, blocklengthbefore), + zero_matrix(QQ, blocklengthbefore, blocklengthbefore), MM, - zero_matrix(FlintQQ, blocklengthafter, blocklengthafter)) + zero_matrix(QQ, blocklengthafter, blocklengthafter)) push!(actions, D) end end @@ -115,13 +115,13 @@ function _issimilar_husert_generic(A, B) la = length(actions) - M = zero_matrix(FlintQQ, la, 0) + M = zero_matrix(QQ, la, 0) for a in absolute_basis_vec_A - _M = zero_matrix(FlintQQ, la, m) + _M = zero_matrix(QQ, la, m) for i in 1:length(actions) D = actions[i] - v = matrix(FlintQQ, 1, m, a) * D * absolute_basis_B_inv + v = matrix(QQ, 1, m, a) * D * absolute_basis_B_inv for j in 1:m _M[i, j] = v[1, j] end @@ -134,13 +134,13 @@ function _issimilar_husert_generic(A, B) SS = N - M = zero_matrix(FlintQQ, length(actions), 0) + M = zero_matrix(QQ, length(actions), 0) for a in absolute_basis_vec_B - _M = zero_matrix(FlintQQ, length(actions), m) + _M = zero_matrix(QQ, length(actions), m) for i in 1:length(actions) D = actions[i] - v = matrix(FlintQQ, 1, m, a) * D * absolute_basis_B_inv + v = matrix(QQ, 1, m, a) * D * absolute_basis_B_inv for j in 1:m _M[i, j] = v[j] end @@ -177,7 +177,7 @@ function _issimilar_husert_generic(A, B) for a in absolute_basis_vec_A for i in 1:length(basis_of_colon_ideal) - @assert denominator(matrix(FlintQQ, 1, m, a) * + @assert denominator(matrix(QQ, 1, m, a) * basis_of_colon_ideal[i] * absolute_basis_B_inv) == 1 end end @@ -235,7 +235,7 @@ function _issimilar_husert_generic(A, B) DD = diagonal_matrix(QQMatrix[_explode(D[i]) for i in 1:length(D)]) return fl, transpose(absolute_basis_A * DD * absolute_basis_B_inv) else - return false, zero_matrix(FlintQQ, 0, 0) + return false, zero_matrix(QQ, 0, 0) end end @@ -244,9 +244,9 @@ function _explode(x::Generic.MatSpaceElem{AbsSimpleNumFieldElem}) d = degree(K) n = nrows(x) m = ncols(x) - z = zero_matrix(FlintQQ, 0, n * d) + z = zero_matrix(QQ, 0, n * d) for i in 1:n - zz = zero_matrix(FlintQQ, d, 0) + zz = zero_matrix(QQ, d, 0) for j in 1:m M = representation_matrix(x[i, j]) zz = hcat(zz, M) @@ -294,7 +294,7 @@ function _matrix_algebra(Ks, ns) for i in 1:s A = matrix_algebra(Ks[i], ns[i]) B, BtoA = StructureConstantAlgebra(A) - C, CtoB = restrict_scalars(B, FlintQQ) + C, CtoB = restrict_scalars(B, QQ) C.isomorphic_full_matrix_algebra = (A, CtoB * BtoA) push!(algs, C) end diff --git a/src/AlgAssAbsOrd/Elem.jl b/src/AlgAssAbsOrd/Elem.jl index 35943ae90e..a4e7a441b4 100644 --- a/src/AlgAssAbsOrd/Elem.jl +++ b/src/AlgAssAbsOrd/Elem.jl @@ -32,7 +32,7 @@ end (O::AlgAssAbsOrd{S, T})(arr::Vector{ZZRingElem}) where {S, T} = begin M = basis_matrix(FakeFmpqMat, O, copy = false) - N = matrix(FlintZZ, 1, degree(O), arr) + N = matrix(ZZ, 1, degree(O), arr) NM = N*M x = elem_from_mat_row(algebra(O), NM.num, 1, NM.den) return AlgAssAbsOrdElem{S, T}(O, x, deepcopy(arr)) @@ -412,7 +412,7 @@ end Returns the trace of $x$. """ function tr(x::AlgAssAbsOrdElem) - return FlintZZ(tr(x.elem_in_algebra)) + return ZZ(tr(x.elem_in_algebra)) end @doc raw""" @@ -421,7 +421,7 @@ end Returns the reduced trace of $x$. """ function trred(x::AlgAssAbsOrdElem) - return FlintZZ(trred(x.elem_in_algebra)) + return ZZ(trred(x.elem_in_algebra)) end ################################################################################ @@ -469,7 +469,7 @@ function is_divisible_mod_ideal(x::AlgAssAbsOrdElem, y::AlgAssAbsOrdElem, a::Alg O = parent(x) d = degree(O) - V = zero_matrix(FlintZZ, 2*d + 1, 2*d + 1) + V = zero_matrix(ZZ, 2*d + 1, 2*d + 1) V[1, 1] = ZZRingElem(1) for i = 1:d diff --git a/src/AlgAssAbsOrd/ICM.jl b/src/AlgAssAbsOrd/ICM.jl index d390945a36..b8b2e00fb7 100644 --- a/src/AlgAssAbsOrd/ICM.jl +++ b/src/AlgAssAbsOrd/ICM.jl @@ -293,10 +293,10 @@ matrix exists and `false` and $0$ otherwise. The characteristic polynomial of $M$ is required to be square-free. """ function is_conjugate(M::ZZMatrix, N::ZZMatrix) - Zx, x = FlintZZ["x"] + Zx, x = ZZ["x"] f = charpoly(Zx, M) if f != charpoly(Zx, N) - return false, zero_matrix(FlintZZ, nrows(M), ncols(M)) + return false, zero_matrix(ZZ, nrows(M), ncols(M)) end fac = factor(f) @@ -321,7 +321,7 @@ function _isconjugate(O::Union{ AbsNumFieldOrder, AlgAssAbsOrd }, M::ZZMatrix, N t, a = is_isomorphic_with_map(J, I) @assert J == a*I if !t - return false, zero_matrix(FlintZZ, nrows(M), ncols(M)) + return false, zero_matrix(ZZ, nrows(M), ncols(M)) end aBI = basis_matrix([ a*b for b in basisI ], FakeFmpqMat) diff --git a/src/AlgAssAbsOrd/Ideal.jl b/src/AlgAssAbsOrd/Ideal.jl index 71489f799d..39f08daa2e 100644 --- a/src/AlgAssAbsOrd/Ideal.jl +++ b/src/AlgAssAbsOrd/Ideal.jl @@ -130,7 +130,7 @@ function ideal(O::AlgAssAbsOrd{S, T}, x::T) where {S, T} t1 = A() t2 = A() - M = zero_matrix(FlintQQ, dim(A)^2, dim(A)) + M = zero_matrix(QQ, dim(A)^2, dim(A)) b = basis_alg(O, copy = false) for i = 1:degree(O) t1 = mul!(t1, b[i], x) @@ -203,7 +203,7 @@ Returns the ideal in $A$ generated by the elements of `v` as a $\mathbb Z$-lattice. """ function ideal_from_lattice_gens(A::AbstractAssociativeAlgebra{QQFieldElem}, v::Vector{ <: AbstractAssociativeAlgebraElem{QQFieldElem} }) - M = zero_matrix(FlintQQ, max(length(v), dim(A)), dim(A)) + M = zero_matrix(QQ, max(length(v), dim(A)), dim(A)) for i = 1:length(v) elem_to_mat_row!(M, i, v[i]) end @@ -241,7 +241,7 @@ end ############################################################################### function _zero_ideal(A::AbstractAssociativeAlgebra{QQFieldElem}) - a = ideal(A, FakeFmpqMat(zero_matrix(FlintZZ, dim(A), dim(A)), ZZRingElem(1)); M_in_hnf=true) + a = ideal(A, FakeFmpqMat(zero_matrix(ZZ, dim(A), dim(A)), ZZRingElem(1)); M_in_hnf=true) a.iszero = 1 return a end @@ -521,7 +521,7 @@ function *(a::AlgAssAbsOrdIdl{S, T}, b::AlgAssAbsOrdIdl{S, T}) where {S, T} d2 = d^2 # We do something more clever if the dimensio is too big - M = zero_matrix(FlintQQ, d2, d) + M = zero_matrix(QQ, d2, d) t = one(A) for i = 1:d i1d = (i - 1)*d @@ -574,7 +574,7 @@ Returns $a \cap b$. function intersect(a::AlgAssAbsOrdIdl{S, T}, b::AlgAssAbsOrdIdl{S, T}) where {S, T} d = dim(algebra(a)) M1 = hcat(basis_matrix(a, copy = false), basis_matrix(a, copy = false)) - M2 = hcat(FakeFmpqMat(zero_matrix(FlintZZ, d, d), ZZRingElem(1)), basis_matrix(b, copy = false)) + M2 = hcat(FakeFmpqMat(zero_matrix(ZZ, d, d), ZZRingElem(1)), basis_matrix(b, copy = false)) M = vcat(M1, M2) H = sub(hnf(M, :lowerleft), 1:d, 1:d) c = ideal(algebra(a), H; M_in_hnf=true) @@ -685,7 +685,7 @@ Returns `true` if $x$ is in $a$ and `false` otherwise. function in(x::T, a::AlgAssAbsOrdIdl{S, T}) where { S, T } parent(x) !== algebra(a) && error("Algebra of element and ideal must be equal") A = algebra(a) - t = FakeFmpqMat(matrix(FlintQQ, 1, dim(A), coefficients(x, copy = false))) + t = FakeFmpqMat(matrix(QQ, 1, dim(A), coefficients(x, copy = false))) t = t*basis_mat_inv(a, copy = false) return denominator(t, copy = false) == 1 end @@ -760,7 +760,7 @@ function _ring_of_multipliers_integral_ideal(I::AlgAssAbsOrdIdl, p::ZZRingElem = else B = basis(I, copy = false) end - m = zero_matrix(FlintZZ, degree(O)*length(B), degree(O)) + m = zero_matrix(ZZ, degree(O)*length(B), degree(O)) for i = 1:length(B) M = FakeFmpqMat(representation_matrix(B[i])) M = mul!(M, basis_matrix(FakeFmpqMat, O, copy = false), M) @@ -805,7 +805,7 @@ function _colon_raw(a::AlgAssAbsOrdIdl{S, T}, b::AlgAssAbsOrdIdl{S, T}, side::Sy d = dim(A) bb = basis(b, copy = false) B = QQMatrix(basis_mat_inv(a, copy = false)) - M = zero_matrix(FlintQQ, d^2, d) + M = zero_matrix(QQ, d^2, d) for i = 1:d N = representation_matrix(bb[i], side)*B for s = 1:d @@ -1180,7 +1180,7 @@ function pradical_meataxe(O::AlgAssAbsOrd, p::Int) M1 = view(M1, 1:r, 1:degree(O)) dM = transpose(kernel(M1, side = :right)) g = Vector{elem_type(algebra(O))}(undef, nrows(dM) + 1) - m = zero_matrix(FlintZZ, degree(O), degree(O)) + m = zero_matrix(ZZ, degree(O), degree(O)) for i = 1:nrows(dM) for j = 1:ncols(dM) m[i, j] = lift(ZZ, dM[i, j]) @@ -1220,7 +1220,7 @@ function pradical(O::AlgAssAbsOrd, p::IntegerUnion) end # We have l == 1. In this case, we can output I: it is the standard p-trace # method. - M = zero_matrix(FlintZZ, degree(O), degree(O)) + M = zero_matrix(ZZ, degree(O), degree(O)) for i = 1:ncols(B) for j = 1:degree(O) M[i, j] = lift(ZZ, B[j, i]) @@ -1261,7 +1261,7 @@ end function _from_submodules_to_ideals(M::ModAlgAss, O::AlgAssAbsOrd, I::AlgAssAbsOrdIdl, x::Union{FqMatrix, Zmodn_mat, Generic.Mat{EuclideanRingResidueFieldElem{ZZRingElem}}}, A1::StructureConstantAlgebra, OtoA1::AbsOrdToAlgAssMor) @hassert :AlgAssOrd 1 begin r = rref(x)[1]; closure(x, M.action_of_gens) == sub(rref(x)[2], 1:r, 1:ncols(x)) end - m = zero_matrix(FlintZZ, nrows(x), degree(O)) + m = zero_matrix(ZZ, nrows(x), degree(O)) g = Vector{elem_type(algebra(O))}(undef, nrows(x)) for i = 1:nrows(x) el = OtoA1\(elem_from_mat_row(A1, x, i)) @@ -1590,7 +1590,7 @@ function _as_ideal_of_smaller_algebra(m::AbsAlgAssMor, I::AlgAssAbsOrdIdl) #OA = maximal_order(A) ## Transport OA to B - #M = zero_matrix(FlintQQ, dim(B), dim(B)) + #M = zero_matrix(QQ, dim(B), dim(B)) #for i = 1:dim(A) # t = m(basis_alg(OA, copy = false)[i]) # elem_to_mat_row!(M, i, t) @@ -1599,7 +1599,7 @@ function _as_ideal_of_smaller_algebra(m::AbsAlgAssMor, I::AlgAssAbsOrdIdl) #M = FakeFmpqMat(M) #M1 = hcat(M, M) #IB = basis_matrix(I, copy = false) - #M2 = hcat(FakeFmpqMat(zero_matrix(FlintZZ, nrows(IB), dim(B)), ZZRingElem(1)), IB) + #M2 = hcat(FakeFmpqMat(zero_matrix(ZZ, nrows(IB), dim(B)), ZZRingElem(1)), IB) #H = hnf(vcat(M1, M2), :lowerleft) #k = findfirst(i-> !is_zero_row(H, i), 1:nrows(H)) #N = sub(H, k:nrows(H), 1:dim(B)) @@ -1624,7 +1624,7 @@ function _as_order_of_smaller_algebra(m::AbsAlgAssMor, O::AlgAssAbsOrd, OB::AlgA @assert algebra(O) == B OA = maximal_order(A) # Transport OA to B - M = zero_matrix(FlintZZ, dim(B), dim(B)) + M = zero_matrix(ZZ, dim(B), dim(B)) for i = 1:dim(A) t = OB(m(basis_alg(OA, copy = false)[i])) elem_to_mat_row!(M, i, t) @@ -1663,7 +1663,7 @@ function _as_ideal_of_larger_algebra(m::AbsAlgAssMor, I::AlgAssAbsOrdIdl, O::Alg @assert algebra(I) == A @assert algebra(O) == B - M = zero_matrix(FlintQQ, dim(A)*dim(B), dim(B)) + M = zero_matrix(QQ, dim(A)*dim(B), dim(B)) X = elem_type(B)[ m(b) for b in basis(I, copy = false) ] for i = 1:dim(A) for j = 1:dim(B) @@ -1703,7 +1703,7 @@ function idempotents(a::AlgAssAbsOrdIdl, b::AlgAssAbsOrdIdl) O = order(a) d = degree(O) - V = zero_matrix(FlintZZ, 1 + 2*degree(O), 1 + 2*degree(O)) + V = zero_matrix(ZZ, 1 + 2*degree(O), 1 + 2*degree(O)) V[1, 1] = 1 u = coordinates(one(O)) for i = 1:d @@ -1884,7 +1884,7 @@ is_normal(a::AlgAssAbsOrdIdl) = is_maximal(left_order(a)) @attr ZZRingElem function minimum(P::AlgAssAbsOrdIdl) M = basis_mat_inv(P, copy = false) - v = FakeFmpqMat(matrix(FlintQQ, 1, nrows(M), coefficients(one(algebra(P))))) + v = FakeFmpqMat(matrix(QQ, 1, nrows(M), coefficients(one(algebra(P))))) m = denominator(v * M) return m end @@ -1981,7 +1981,7 @@ function maximal_integral_ideal(O::AlgAssAbsOrd, p::Union{ ZZRingElem, Int }, si end N = QQMatrix(basis_matrix(P)) - t = zero_matrix(FlintQQ, 1, degree(O)) + t = zero_matrix(QQ, 1, degree(O)) # Now we only need to lift a basis for diag(1, ..., 1, 0)*D (side = :left) or # D*diag(1, ..., 1, 0) (side = :right) since these are maximal ideals of D. if side == :left @@ -2077,7 +2077,7 @@ function maximal_integral_ideal_containing(I::AlgAssAbsOrdIdl, p::Union{ ZZRingE end basis_c = basis(c, copy = false) - t = zero_matrix(FlintQQ, length(basis_c), degree(O)) + t = zero_matrix(QQ, length(basis_c), degree(O)) for i = 1:length(basis_c) b = toOP\(BtoOP(toC\(basis_c[i]))) elem_to_mat_row!(t, i, elem_in_algebra(b, copy = false)) diff --git a/src/AlgAssAbsOrd/LocallyFreeClassGroup.jl b/src/AlgAssAbsOrd/LocallyFreeClassGroup.jl index a1bafdf73d..badb8ca420 100644 --- a/src/AlgAssAbsOrd/LocallyFreeClassGroup.jl +++ b/src/AlgAssAbsOrd/LocallyFreeClassGroup.jl @@ -121,7 +121,7 @@ These tests can be disabled by setting `check = false`. """ function locally_free_class_group_with_disc_log(O::AlgAssAbsOrd; check::Bool = true) if check - if !(algebra(O) isa GroupAlgebra) || basis_matrix(FakeFmpqMat, O, copy = false) != FakeFmpqMat(identity_matrix(FlintZZ, dim(algebra(O))), ZZRingElem(1)) + if !(algebra(O) isa GroupAlgebra) || basis_matrix(FakeFmpqMat, O, copy = false) != FakeFmpqMat(identity_matrix(ZZ, dim(algebra(O))), ZZRingElem(1)) error("Only implemented for group rings") end end @@ -141,7 +141,7 @@ end function _reduced_norms(a::AbstractAssociativeAlgebraElem, mR::MapRayClassGroupAlg) A = parent(a) Adec = decompose(A) - r = zero_matrix(FlintZZ, 1, 0) + r = zero_matrix(ZZ, 1, 0) for i = 1:length(Adec) B, BtoA = Adec[i] diff --git a/src/AlgAssAbsOrd/NEQ.jl b/src/AlgAssAbsOrd/NEQ.jl index 5a670318b7..a52f0ecdff 100644 --- a/src/AlgAssAbsOrd/NEQ.jl +++ b/src/AlgAssAbsOrd/NEQ.jl @@ -447,9 +447,9 @@ function __neq_sunit(K::AbsSimpleNumField, primes::Vector{ZZRingElem}, vals::Vec primes_in_K = prime_ideals_over(OK, primes) class_group(K) SK, mSK = sunit_mod_units_group_fac_elem(primes_in_K) - M = zero_matrix(FlintZZ, length(primes), ngens(SK)) - N = zero_matrix(FlintZZ, length(primes_in_K), ngens(SK)) - b = zero_matrix(FlintZZ, length(primes), 1) + M = zero_matrix(ZZ, length(primes), ngens(SK)) + N = zero_matrix(ZZ, length(primes_in_K), ngens(SK)) + b = zero_matrix(ZZ, length(primes), 1) for c = 1:ngens(SK) g = mSK(SK[c]) ng = norm(g) diff --git a/src/AlgAssAbsOrd/Order.jl b/src/AlgAssAbsOrd/Order.jl index 3e7883de02..7d1e125f33 100644 --- a/src/AlgAssAbsOrd/Order.jl +++ b/src/AlgAssAbsOrd/Order.jl @@ -18,7 +18,7 @@ algebra(O::AlgAssAbsOrd) = O.algebra _algebra(O::AlgAssAbsOrd) = algebra(O) -base_ring(O::AlgAssAbsOrd) = FlintZZ +base_ring(O::AlgAssAbsOrd) = ZZ base_ring_type(::Type{AlgAssAbsOrd}) = ZZRing @@ -174,7 +174,7 @@ function index(O::AlgAssAbsOrd) B = basis_mat_inv(FakeFmpqMat, O, copy = false) n = det(B) @assert isinteger(n) - return FlintZZ(n) + return ZZ(n) end function index(O::AlgAssAbsOrd, R::AlgAssAbsOrd) @@ -183,7 +183,7 @@ function index(O::AlgAssAbsOrd, R::AlgAssAbsOrd) B = basis_mat_inv(FakeFmpqMat, R, copy = false) m = det(B) @assert isinteger(m//n) - return FlintZZ(m//n) + return ZZ(m//n) end ################################################################################ @@ -326,7 +326,7 @@ end ################################################################################ function _check_elem_in_order(a::T, O::AlgAssAbsOrd{S, T}, ::Val{short} = Val(false)) where {S, T, short} - t = zero_matrix(FlintQQ, 1, degree(O)) + t = zero_matrix(QQ, 1, degree(O)) elem_to_mat_row!(t, 1, a) t = FakeFmpqMat(t) t = t*basis_mat_inv(FakeFmpqMat, O, copy = false) @@ -366,7 +366,7 @@ end Returns $d\in \mathbb Z$ such that $d \cdot a \in O$. """ function denominator(a::AbstractAssociativeAlgebraElem, O::AlgAssAbsOrd) - t = zero_matrix(FlintQQ, 1, degree(O)) + t = zero_matrix(QQ, 1, degree(O)) elem_to_mat_row!(t, 1, a) t = FakeFmpqMat(t) t = mul!(t, t, basis_mat_inv(FakeFmpqMat, O, copy = false)) @@ -419,13 +419,13 @@ rand(rng::AbstractRNG, O::AlgAssAbsOrd, n::Integer) = rand(rng, make(O, n)) function basis_matrix(A::Vector{S}, ::Type{FakeFmpqMat}) where {S <: AbstractAssociativeAlgebraElem{QQFieldElem}} if length(A) == 0 - return M = FakeFmpqMat(zero_matrix(FlintZZ, 0, 0), ZZ(1)) + return M = FakeFmpqMat(zero_matrix(ZZ, 0, 0), ZZ(1)) end @assert length(A) > 0 n = length(A) d = dim(parent(A[1])) - M = zero_matrix(FlintZZ, n, d) + M = zero_matrix(ZZ, n, d) t = ZZRingElem() @@ -487,7 +487,7 @@ function basis_matrix(A::Vector{AlgAssAbsOrdElem{S, T}}) where S where T @assert length(A) > 0 n = length(A) d = degree(parent(A[1])) - M = zero_matrix(FlintZZ, n, d) + M = zero_matrix(ZZ, n, d) for i in 1:n el = coordinates(A[i]) @@ -567,16 +567,16 @@ function trred_matrix(O::AlgAssAbsOrd) A=algebra(O) x=O.basis_alg m=length(x) - M=zero_matrix(FlintZZ, m, m) + M=zero_matrix(ZZ, m, m) a=A() for i=1:m a = mul!(a, x[i], x[i]) - M[i,i] = FlintZZ(trred(a)) + M[i,i] = ZZ(trred(a)) end for i = 1:m for j = i+1:m a = mul!(a, x[i], x[j]) - b = FlintZZ(trred(a)) + b = ZZ(trred(a)) M[i,j] = b M[j,i] = b end @@ -850,7 +850,7 @@ function any_order(A::AbstractAssociativeAlgebra{QQFieldElem}) return get_attribute!(A, :any_order) do d = _denominator_of_mult_table(A) di = dim(A) - M = vcat(zero_matrix(FlintQQ, 1, di), d*identity_matrix(FlintQQ, di)) + M = vcat(zero_matrix(QQ, 1, di), d*identity_matrix(QQ, di)) oneA = one(A) for i = 1:di M[1, i] = deepcopy(coefficients(oneA, copy = false)[i]) @@ -883,7 +883,7 @@ function maximal_order_via_decomposition(A::AbstractAssociativeAlgebra{QQFieldEl return first(A.maximal_order)::AlgAssAbsOrd{typeof(A), elem_type(A)} end fields_and_maps = __as_number_fields(A, use_maximal_order = false) - M = zero_matrix(FlintQQ, dim(A), dim(A)) + M = zero_matrix(QQ, dim(A), dim(A)) row = 1 for i = 1:length(fields_and_maps) K = fields_and_maps[i][1] @@ -943,7 +943,7 @@ function _simple_maximal_order(O::AlgAssAbsOrd{S1, S2}, ::Val{with_transform} = n = degree(A) # Build a matrix with the first rows of basis elements of O - M = zero_matrix(FlintQQ, dim(A), n) + M = zero_matrix(QQ, dim(A), n) for i = 1:dim(A) for j = 1:n M[i, j] = deepcopy(matrix(elem_in_algebra(basis(O, copy = false)[i], copy = false), copy = false)[1, j]) @@ -963,7 +963,7 @@ function _simple_maximal_order(O::AlgAssAbsOrd{S1, S2}, ::Val{with_transform} = simpleOrder = Order(A, bb) simpleOrder.isnice = true - @assert basis_matrix(FakeFmpqMat, simpleOrder) == FakeFmpqMat(identity_matrix(FlintQQ, n^2)) + @assert basis_matrix(FakeFmpqMat, simpleOrder) == FakeFmpqMat(identity_matrix(QQ, n^2)) if with_transform return simpleOrder, A(M) @@ -1010,7 +1010,7 @@ function conductor(R::AlgAssAbsOrd, S::AlgAssAbsOrd, action::Symbol = :left) t = basis_matrix(FakeFmpqMat, R, copy = false)*basis_mat_inv(FakeFmpqMat, S, copy = false) @assert isone(t.den) basis_mat_R_in_S_inv_num, d = pseudo_inv(t.num) - M = zero_matrix(FlintZZ, n^2, n) + M = zero_matrix(ZZ, n^2, n) B = basis(S, copy = false) NN = transpose(representation_matrix(B[1], action)*basis_mat_R_in_S_inv_num) @@ -1065,7 +1065,7 @@ function enum_units(O::AlgAssAbsOrd{S, T}, g::ZZRingElem) where { S <: MatAlgebr if j == i continue end - E = identity_matrix(FlintQQ, n) + E = identity_matrix(QQ, n) E[i, j] = deepcopy(g) push!(result, L(A(E))) end @@ -1073,19 +1073,19 @@ function enum_units(O::AlgAssAbsOrd{S, T}, g::ZZRingElem) where { S <: MatAlgebr # n \nmid i and n \mid j for i = 1:n1 - E = identity_matrix(FlintQQ, n) + E = identity_matrix(QQ, n) E[i, n] = deepcopy(a) push!(result, L(A(E))) end # n \mid i and n \nmid j for j = 1:n1 - E = identity_matrix(FlintQQ, n) + E = identity_matrix(QQ, n) E[n, j] = deepcopy(ai) push!(result, L(A(E))) end - E = identity_matrix(FlintQQ, n) + E = identity_matrix(QQ, n) E[1, 1] = ZZRingElem(-1) push!(result, L(A(E))) return result diff --git a/src/AlgAssAbsOrd/PIP/bley_hofmann_johnston.jl b/src/AlgAssAbsOrd/PIP/bley_hofmann_johnston.jl index e9c5a0f3ff..a24f18cd67 100644 --- a/src/AlgAssAbsOrd/PIP/bley_hofmann_johnston.jl +++ b/src/AlgAssAbsOrd/PIP/bley_hofmann_johnston.jl @@ -184,11 +184,11 @@ function _solve_norm_equation_over_center_quaternion(M, x) A = algebra(M) !(base_ring(A) isa QQField) && error("Only implemented for rational quaternion algebras") B = basis_alg(M) - G = zero_matrix(FlintQQ, 4, 4) + G = zero_matrix(QQ, 4, 4) f = standard_involution(A) for i in 1:4 for j in 1:4 - G[i, j] = FlintZZ(trred(B[i] * f(B[j])))//2 + G[i, j] = ZZ(trred(B[i] * f(B[j])))//2 end end # TODO: Replace this by short_vectors_gram(M, nrr) once it works @@ -197,7 +197,7 @@ function _solve_norm_equation_over_center_quaternion(M, x) local nrm for i in 1:dim(A) if !iszero(xalg.coeffs[i]) - nrm = FlintZZ(divexact(xalg.coeffs[i], one(A).coeffs[i])) + nrm = ZZ(divexact(xalg.coeffs[i], one(A).coeffs[i])) end end #@show nrm @@ -319,11 +319,11 @@ function _lift_norm_one_unit_quaternion(x, F) B = basis_alg(M) ZA, ZAtoA = center(A) FinZA = _as_ideal_of_smaller_algebra(ZAtoA, F) - G = zero_matrix(FlintQQ, 4, 4) + G = zero_matrix(QQ, 4, 4) f = standard_involution(A) for i in 1:4 for j in 1:4 - G[i, j] = FlintZZ(trred(B[i] * f(B[j])))//2 + G[i, j] = ZZ(trred(B[i] * f(B[j])))//2 end end @@ -435,7 +435,7 @@ function _lift_norm_one_unit_full_rational_matrix_algebra(x, F) @assert n * one(ZB) == bas @assert B(n) * M == F - nn = FlintZZ(n) + nn = ZZ(n) R, c = nice_order(M) @@ -443,13 +443,13 @@ function _lift_norm_one_unit_full_rational_matrix_algebra(x, F) # Now x is in M_n(Z) and I want to lift from M_n(Z/nn) - @assert mod(FlintZZ(det(matrix((xwrtR)))), nn) == 1 + @assert mod(ZZ(det(matrix((xwrtR)))), nn) == 1 - R = residue_ring(FlintZZ, nn, cached = false)[1] - li = _lift2(map_entries(u -> R(FlintZZ(u)), matrix(xwrtR))) - #li = _lift_unimodular_matrix(change_base_ring(FlintZZ, matrix(xwrtR)), nn, residue_ring(FlintZZ, nn)[1]) + R = residue_ring(ZZ, nn, cached = false)[1] + li = _lift2(map_entries(u -> R(ZZ(u)), matrix(xwrtR))) + #li = _lift_unimodular_matrix(change_base_ring(ZZ, matrix(xwrtR)), nn, residue_ring(ZZ, nn)[1]) - return (inv(c) * B(change_base_ring(FlintQQ, li)) * c) + return (inv(c) * B(change_base_ring(QQ, li)) * c) end ################################################################################ @@ -658,7 +658,7 @@ end # ################################################################################ -_base_ring(::Nemo.ZZModRing) = FlintZZ +_base_ring(::Nemo.ZZModRing) = ZZ ################################################################################ # diff --git a/src/AlgAssAbsOrd/PIP/maximal.jl b/src/AlgAssAbsOrd/PIP/maximal.jl index 53037aeedd..5b4d4e423a 100644 --- a/src/AlgAssAbsOrd/PIP/maximal.jl +++ b/src/AlgAssAbsOrd/PIP/maximal.jl @@ -108,7 +108,7 @@ function _is_principal_maximal_quaternion_generic(a, M, side = :right) Babs = absolute_basis(b)::Vector{elem_type(B)} d = length(Babs) - G = zero_matrix(FlintQQ, d, d) + G = zero_matrix(QQ, d, d) #@show reps for z in reps for i in 1:d @@ -174,13 +174,13 @@ function _is_principal_maximal_quaternion(a, M, side = :right) !(base_ring(A) isa QQField) && error("Only implemented for rational quaterion algebras") a.isright = 1 a.order = right_order(a) - nrr = FlintZZ(normred(a)) + nrr = ZZ(normred(a)) B = basis(a) - G = zero_matrix(FlintQQ, 4, 4) + G = zero_matrix(QQ, 4, 4) f = standard_involution(A) for i in 1:4 for j in 1:4 - G[i, j] = FlintZZ(trred(B[i] * f(B[j])))//2 + G[i, j] = ZZ(trred(B[i] * f(B[j])))//2 end end # TODO: Replace this by short_vectors_gram(M, nrr) once it works @@ -205,7 +205,7 @@ function _is_principal_maximal_full_matrix_algebra(a, M, side = :right) A = algebra(M) if degree(A) == 1 # I don't have _as_field_with_isomorphism for algebras over K - AA, AAtoA = restrict_scalars(A, FlintQQ) + AA, AAtoA = restrict_scalars(A, QQ) K, AAtoK = _as_field_with_isomorphism(AA) MK = maximal_order(K) I = sum(fractional_ideal_type(order_type(K))[AAtoK(AAtoA\(b)) * MK for b in absolute_basis(a)]) @@ -307,7 +307,7 @@ end function _isprincipal_maximal_simple_nice(I::AlgAssAbsOrdIdl, M, side = :right) @assert side == :right @assert _test_ideal_sidedness(I, M, :right) - @assert basis_matrix(M) == identity_matrix(FlintZZ, dim(algebra(M))) + @assert basis_matrix(M) == identity_matrix(ZZ, dim(algebra(M))) den = denominator(I, M) a = I * den if !is_full_lattice(a) @@ -319,7 +319,7 @@ function _isprincipal_maximal_simple_nice(I::AlgAssAbsOrdIdl, M, side = :right) d = degree(algebra(M)) e11 = zero(algebra(M)) e11[1, 1] = 1 - z = zero_matrix(FlintQQ, d, d^2) + z = zero_matrix(QQ, d, d^2) B = basis(a) for j in 1:d^2 v = B[j] * e11 @@ -333,9 +333,9 @@ function _isprincipal_maximal_simple_nice(I::AlgAssAbsOrdIdl, M, side = :right) @assert all(i -> is_zero_column(h, i), 1:(d^2 - d)) T = sub(h, 1:d, (d^2 - d + 1:d^2)) #@show T - alpha = zero_matrix(FlintQQ, d, d) - e1i = zero_matrix(FlintQQ, d, d) - z = zero_matrix(FlintQQ, d, d) + alpha = zero_matrix(QQ, d, d) + e1i = zero_matrix(QQ, d, d) + z = zero_matrix(QQ, d, d) for i in 1:d for j in 1:d z[j, 1] = T[j, i] diff --git a/src/AlgAssAbsOrd/PIP/misc.jl b/src/AlgAssAbsOrd/PIP/misc.jl index c8dfbdb778..b4626548c0 100644 --- a/src/AlgAssAbsOrd/PIP/misc.jl +++ b/src/AlgAssAbsOrd/PIP/misc.jl @@ -29,7 +29,7 @@ end function maximal_order_via_absolute(O::AlgAssRelOrd) A = algebra(O) - C, AtoC, CtoA = restrict_scalars(A, FlintQQ) + C, AtoC, CtoA = restrict_scalars(A, QQ) OC = maximal_order(Hecke._get_order_from_gens(C, AtoC.(elem_in_algebra.(absolute_basis(O))))) M = zero_matrix(base_ring(A), degree(OC), dim(A)) for i = 1:degree(OC) diff --git a/src/AlgAssAbsOrd/PicardGroup.jl b/src/AlgAssAbsOrd/PicardGroup.jl index e391eb7558..6304a7a6b1 100644 --- a/src/AlgAssAbsOrd/PicardGroup.jl +++ b/src/AlgAssAbsOrd/PicardGroup.jl @@ -116,7 +116,7 @@ function _picard_group_maximal(O::AlgAssAbsOrd) push!(ideals, _as_ideal_of_number_field(x, fields_and_maps[i][2])) end - p = zero_matrix(FlintZZ, 1, 0) + p = zero_matrix(ZZ, 1, 0) for i = 1:length(ideals) C, CtoIdl = class_groups[i] c = CtoIdl\ideals[i] @@ -155,7 +155,7 @@ function _trivial_picard(O::AlgAssAbsOrd, R::FinGenAbGroup, mR) fac_elem_mon_A = FacElemMon(A) RtoIdl = MapPicardGrp{FinGenAbGroup, typeof(Idl)}() RtoIdl.header = MapHeader(R, Idl, disc_exp_triv, disc_log_triv) - RtoIdl.right_transform = zero_matrix(FlintZZ, 0, 0) + RtoIdl.right_transform = zero_matrix(ZZ, 0, 0) RtoIdl.betas = Vector{elem_type(fac_elem_mon_A)}() RtoIdl.gammas = Vector{elem_type(fac_elem_mon_A)}() RtoIdl.ray_class_group_map = mR @@ -230,7 +230,7 @@ function _picard_group_non_maximal(O::AlgAssAbsOrd, prepare_ref_disc_log::Bool = # Compute the relations of the generators of G in R gens_of_G = Vector{elem_type(fac_elem_mon_A)}() - D = zero_matrix(FlintZZ, ngens(R) + ngens(G), ngens(R)) + D = zero_matrix(ZZ, ngens(R) + ngens(G), ngens(R)) for i = 1:ngens(R) D[i, i] = R.snf[i] end @@ -597,7 +597,7 @@ function ray_class_group(m::AlgAssAbsOrdIdl, inf_plc::Vector{Vector{T}} = Vector push!(ideals, _as_ideal_of_number_field(x, fields_and_maps[i][2])) end - c = zero_matrix(FlintZZ, 1, 0) + c = zero_matrix(ZZ, 1, 0) for i = 1:length(ideals) G, GtoIdl = groups[i] g = GtoIdl\ideals[i] @@ -619,7 +619,7 @@ function ray_class_group(m::AlgAssAbsOrdIdl, inf_plc::Vector{Vector{T}} = Vector push!(ideals, FacElem(base, exp)) end - c = zero_matrix(FlintZZ, 1, 0) + c = zero_matrix(ZZ, 1, 0) for i = 1:length(ideals) G, GtoIdl = groups[i] g = GtoIdl\ideals[i] @@ -735,7 +735,7 @@ function disc_log_generalized_ray_class_grp(I::FacElem{S, T}, mR::MapRayClassGro minus_idems = elem_type(A)[ -one(A)*idem for idem in idems ] bases = Vector{elem_type(A)}() exps = Vector{ZZRingElem}() - p = zero_matrix(FlintZZ, 1, 0) + p = zero_matrix(ZZ, 1, 0) ideal_gens = Vector{elem_type(O)}() for i = 1:length(ideals) K, AtoK = fields_and_maps[i] @@ -776,7 +776,7 @@ function disc_log_generalized_ray_class_grp(I::S, mR::MapRayClassGroupAlg) where minus_idems = elem_type(A)[ -one(A)*idem for idem in idems ] bases = Vector{elem_type(A)}() exps = Vector{ZZRingElem}() - p = zero_matrix(FlintZZ, 1, 0) + p = zero_matrix(ZZ, 1, 0) ideal_gens = Vector{elem_type(O)}() for i = 1:length(ideals) K, AtoK = fields_and_maps[i] @@ -931,11 +931,11 @@ function _intersect_modules(BM::FakeFmpqMat, BN::FakeFmpqMat) dM = denominator(BM) dN = denominator(BN) d = lcm(dM, dN) - BMint = change_base_ring(FlintZZ, numerator(d * BM)) - BNint = change_base_ring(FlintZZ, numerator(d * BN)) + BMint = change_base_ring(ZZ, numerator(d * BM)) + BNint = change_base_ring(ZZ, numerator(d * BN)) H = vcat(BMint, BNint) K = kernel(H, side = :left) - BI = divexact(change_base_ring(FlintQQ, hnf(view(K, 1:nrows(K), 1:nrows(BM)) * BMint)), d) + BI = divexact(change_base_ring(QQ, hnf(view(K, 1:nrows(K), 1:nrows(BM)) * BMint)), d) return BI end @@ -954,7 +954,7 @@ function _coprime_integral_ideal_class_deterministic(a::AlgAssAbsOrdIdl, b::AlgA local c::ZZRingElem for i in 1:ncols(BM) if !iszero(BM[1, i]) - c = FlintZZ(divexact(BI[1, i], BM[1, i])) + c = ZZ(divexact(BI[1, i], BM[1, i])) break end end diff --git a/src/AlgAssAbsOrd/ResidueRingMultGrp.jl b/src/AlgAssAbsOrd/ResidueRingMultGrp.jl index 77a00f764f..a38caa9491 100644 --- a/src/AlgAssAbsOrd/ResidueRingMultGrp.jl +++ b/src/AlgAssAbsOrd/ResidueRingMultGrp.jl @@ -96,7 +96,7 @@ function _multgrp(Q::AbsOrdQuoRing{U, T}) where {U, T} local disc_log let fields_and_maps = fields_and_maps, groups = groups, OtoQ = OtoQ, StoG = StoG, G = G, S = S function disc_log(x::AbsOrdQuoRingElem) - y = zero_matrix(FlintZZ, 1, 0) + y = zero_matrix(ZZ, 1, 0) for i = 1:length(groups) K, AtoK = fields_and_maps[i] H, HtoQK = groups[i] @@ -266,7 +266,7 @@ function _1_plus_p_mod_1_plus_q(p::AlgAssAbsOrdIdl, q::AlgAssAbsOrdIdl) O = order(p) g = Vector{elem_type(O)}() - M = zero_matrix(FlintZZ, 0, 0) + M = zero_matrix(ZZ, 0, 0) dlogs = Vector{Function}() l = 1 @@ -339,7 +339,7 @@ function _expand(g::Vector{T}, M::ZZMatrix, h::Vector{T}, N::ZZMatrix, disc_log: @assert is_snf(N) O = order(q) - Z = zero_matrix(FlintZZ, nrows(M) + nrows(N), ncols(M) + ncols(N)) + Z = zero_matrix(ZZ, nrows(M) + nrows(N), ncols(M) + ncols(N)) for i = 1:nrows(M) for j = 1:ncols(M) Z[i, j] = M[i, j] @@ -394,10 +394,10 @@ function _1_plus_pu_plus_q_mod_1_plus_pv_plus_q(puq::AlgAssAbsOrdIdl, pvq::AlgAs # The first part of Algorithm 4.2.16 in Cohen "Advanced Topics..." M = basis_matrix(FakeFmpqMat, O, copy = false)*basis_mat_inv(puq, copy = false)*StoG.imap - y_fakemat2 = FakeFmpqMat(zero_matrix(FlintZZ, 1, ncols(M)), ZZRingElem(1)) + y_fakemat2 = FakeFmpqMat(zero_matrix(ZZ, 1, ncols(M)), ZZRingElem(1)) function disc_log(x::AlgAssAbsOrdElem) y = mod(x - one(O), pvq) - y_fakemat = FakeFmpqMat(matrix(FlintZZ, 1, degree(O), coordinates(y)), ZZRingElem(1)) + y_fakemat = FakeFmpqMat(matrix(ZZ, 1, degree(O), coordinates(y)), ZZRingElem(1)) mul!(y_fakemat2, y_fakemat, M) #@assert y_fakemat2 == y_fakemat * M denominator(y_fakemat2) != 1 && error("Element is in the ideal") diff --git a/src/AlgAssAbsOrd/Types.jl b/src/AlgAssAbsOrd/Types.jl index 41a917e734..4722b2d122 100644 --- a/src/AlgAssAbsOrd/Types.jl +++ b/src/AlgAssAbsOrd/Types.jl @@ -39,7 +39,7 @@ O = new{S, T}(A, dim(A)) O.is_maximal = 0 O.isnice = false - O.tcontain = FakeFmpqMat(zero_matrix(FlintZZ, 1, dim(A))) + O.tcontain = FakeFmpqMat(zero_matrix(ZZ, 1, dim(A))) return O end diff --git a/src/AlgAssAbsOrd/UnitGroup.jl b/src/AlgAssAbsOrd/UnitGroup.jl index d4c37bf6d3..b452cec017 100644 --- a/src/AlgAssAbsOrd/UnitGroup.jl +++ b/src/AlgAssAbsOrd/UnitGroup.jl @@ -84,7 +84,7 @@ function _unit_group_maximal_fac_elem(O::AlgAssAbsOrd) local disc_log let fields_and_maps = fields_and_maps, unit_groups = unit_groups, StoG = StoG, G = G function disc_log(x::FacElem) - g = zero_matrix(FlintZZ, 1, 0) + g = zero_matrix(ZZ, 1, 0) for i = 1:length(fields_and_maps) K, AtoK = fields_and_maps[i] U, mU = unit_groups[i] @@ -131,7 +131,7 @@ function _unit_group_maximal(O::AlgAssAbsOrd; GRH::Bool = true) local disc_log let fields_and_maps = fields_and_maps, unit_groups = unit_groups, StoG = StoG, G = G function disc_log(x::AlgAssAbsOrdElem) - g = zero_matrix(FlintZZ, 1, 0) + g = zero_matrix(ZZ, 1, 0) for i = 1:length(fields_and_maps) K, AtoK = fields_and_maps[i] U, mU = unit_groups[i] diff --git a/src/AlgAssRelOrd/NEQ.jl b/src/AlgAssRelOrd/NEQ.jl index c439a818ca..fde2092b2e 100644 --- a/src/AlgAssRelOrd/NEQ.jl +++ b/src/AlgAssRelOrd/NEQ.jl @@ -323,9 +323,9 @@ function __neq_sunit(ktoK::NumFieldHom{AbsSimpleNumField, AbsSimpleNumField}, pr end class_group(K) SK, mSK = sunit_mod_units_group_fac_elem(primes_in_K) - M = zero_matrix(FlintZZ, length(primes_in_k), ngens(SK)) - N = zero_matrix(FlintZZ, length(primes_in_K), ngens(SK)) - b = zero_matrix(FlintZZ, length(primes_in_k), 1) + M = zero_matrix(ZZ, length(primes_in_k), ngens(SK)) + N = zero_matrix(ZZ, length(primes_in_K), ngens(SK)) + b = zero_matrix(ZZ, length(primes_in_k), 1) for c = 1:ngens(SK) g = mSK(SK[c]) ng = norm(ktoK, g) @@ -414,7 +414,7 @@ end function _as_subfield(A::AbstractAssociativeAlgebra{QQFieldElem}, x::AbstractAssociativeAlgebraElem{QQFieldElem}, f::PolyRingElem{QQFieldElem}) s = one(A) - M = zero_matrix(FlintQQ, degree(f), dim(A)) + M = zero_matrix(QQ, degree(f), dim(A)) elem_to_mat_row!(M, 1, s) for i = 2:degree(f) s = mul!(s, s, x) @@ -489,9 +489,9 @@ _issubmodule(FO::FieldOracle, OL::AbsNumFieldOrder, LtoA::NfAbsToAbsAlgAssMor) = function small_elements(O::AlgAssRelOrd) A = algebra(O) K = base_ring(A) - B, BtoA = restrict_scalars(A, FlintQQ) + B, BtoA = restrict_scalars(A, QQ) pbO = pseudo_basis(O, copy = false) - M = zero_matrix(FlintQQ, dim(B), dim(B)) + M = zero_matrix(QQ, dim(B), dim(B)) for i = 1:degree(O) for j = 1:degree(K) t = basis(pbO[i][2])[j]*pbO[i][1] diff --git a/src/AlgAssRelOrd/Order.jl b/src/AlgAssRelOrd/Order.jl index 058e948492..ed139225b4 100644 --- a/src/AlgAssRelOrd/Order.jl +++ b/src/AlgAssRelOrd/Order.jl @@ -452,7 +452,7 @@ function maximal_order(A::AbstractAssociativeAlgebra{T}) where { T <: NumFieldEl # So far ..._absolute is usually faster for linear, quadratic and cubic base fields, # but of course there are exceptions. # Feel free to adjust this if-condition. - if base_field(base_ring(A)) == FlintQQ && degree(base_ring(A)) <= 3 + if base_field(base_ring(A)) == QQ && degree(base_ring(A)) <= 3 O = maximal_order_via_absolute(A) else O = maximal_order_via_relative(A) @@ -463,7 +463,7 @@ end function maximal_order_via_absolute(A::AbstractAssociativeAlgebra{T}) where { T <: NumFieldElem } B, BtoA = StructureConstantAlgebra(A) - C, CtoB = restrict_scalars(B, FlintQQ) + C, CtoB = restrict_scalars(B, QQ) OC = maximal_order(C) M = zero_matrix(base_ring(A), degree(OC), dim(A)) for i = 1:degree(OC) diff --git a/src/EllCrv/Finite.jl b/src/EllCrv/Finite.jl index ca3fee6883..7b68ec1bbe 100644 --- a/src/EllCrv/Finite.jl +++ b/src/EllCrv/Finite.jl @@ -107,7 +107,7 @@ $\mathbf Z/p\mathbf Z$ using exhaustive search. """ function order_via_exhaustive_search(E::EllipticCurve{T}) where T<:FinFieldElem R = base_field(E) - order = FlintZZ(1) + order = ZZ(1) a1, a2, a3, a4, a6 = a_invariants(E) Ry, y = polynomial_ring(R,"y") for x = R @@ -139,7 +139,7 @@ function order_via_legendre(E::EllipticCurve{T}) where T<:FinFieldElem R = base_field(E) p = characteristic(R) q = order(R) - grouporder = FlintZZ(0) + grouporder = ZZ(0) p == 0 && error("Base field must be finite") if p != q @@ -150,7 +150,7 @@ function order_via_legendre(E::EllipticCurve{T}) where T<:FinFieldElem E = short_weierstrass_model(E)[1] end _, _, _, a4, a6 = a_invariants(E) - x = FlintZZ(0) + x = ZZ(0) while x < p C = x^3 + a4*x + a6 @@ -227,7 +227,7 @@ function elem_order_bsgs(P::EllipticCurvePoint{T}) where T<:FinFieldElem # step 3 k = -m H = (2*m)*P - M = FlintZZ(0) # initialize M, so that it is known after the while loop + M = ZZ(0) # initialize M, so that it is known after the while loop while k < m + 1 Snew = Q + (k*H) @@ -374,7 +374,7 @@ function order_via_bsgs(E::EllipticCurve{T}) where T<:FinFieldElem E = short_weierstrass_model(E)[1] end - Nposs = FlintZZ(1) + Nposs = ZZ(1) h = hasse_interval(E) l = h[1] b = h[2] @@ -489,7 +489,7 @@ function order_via_schoof(E::EllipticCurve{T}) where T<:FinFieldElem t = 0 for i = 1:L n_i = div(product, S[i]) - B = residue_ring(FlintZZ, S[i], cached = false)[1] + B = residue_ring(ZZ, S[i], cached = false)[1] M_i = inv(B(n_i)) M_i = M_i.data t = t + (M_i * n_i * t_mod_l[i]) @@ -613,9 +613,9 @@ function t_mod_prime(l, E) x_q = powermod(x, q_int, f) ggt = gcd(f, x_q - x) if ggt == 1 - t = FlintZZ(1) + t = ZZ(1) else - t = FlintZZ(0) + t = ZZ(0) end return t @@ -640,8 +640,8 @@ function t_mod_prime(l, E) end if ggT != 1 # case 1 - if jacobi_symbol(FlintZZ(k), FlintZZ(l)) == -1 - return FlintZZ(0) + if jacobi_symbol(ZZ(k), ZZ(l)) == -1 + return ZZ(0) else # need square root of q (mod l) w = is_square_with_sqrt(k_mod)[2] @@ -663,7 +663,7 @@ function t_mod_prime(l, E) end if ggT == 1 - return FlintZZ(0) + return ZZ(0) else fwmz = Fnschoof[w_int] fwpz = Fnschoof[w_int+4] diff --git a/src/EllCrv/Heights.jl b/src/EllCrv/Heights.jl index d2a3709000..5f61f5d8d7 100644 --- a/src/EllCrv/Heights.jl +++ b/src/EllCrv/Heights.jl @@ -154,7 +154,7 @@ function local_height(P::EllipticCurvePoint{QQFieldElem}, p, prec::Int = 100) P = phi(P) - p = FlintZZ(p) + p = ZZ(p) x = P[1] y = P[2] diff --git a/src/EllCrv/LocalData.jl b/src/EllCrv/LocalData.jl index da14b2840d..f8272a0af9 100644 --- a/src/EllCrv/LocalData.jl +++ b/src/EllCrv/LocalData.jl @@ -189,7 +189,7 @@ function __tates_algorithm_generic(E, R, _val, _redmod, _red, _lift, _invmod, pi delta = discriminant(E) vD = _val(delta) if vD == 0 # Good reduction - return (E, KodairaSymbol("I0"), FlintZZ(0), FlintZZ(1), true)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} + return (E, KodairaSymbol("I0"), ZZ(0), ZZ(1), true)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} end # change coords so that p|a3,a4,a6 @@ -231,37 +231,37 @@ function __tates_algorithm_generic(E, R, _val, _redmod, _red, _lift, _invmod, pi if !_pdiv(c4) # Type In split = _hasroot(one(K), a1, -a2) if split - cp = FlintZZ(vD) + cp = ZZ(vD) else if mod(vD, 2) == 0 - cp = FlintZZ(2) + cp = ZZ(2) else - cp = FlintZZ(1) + cp = ZZ(1) end end Kp = KodairaSymbol("I$(vD)") - fp = FlintZZ(1) + fp = ZZ(1) return (E, Kp, fp, cp, split)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} end if _val(a6) < 2 # Type II Kp = KodairaSymbol("II") - fp = FlintZZ(vD) - cp = FlintZZ(1) + fp = ZZ(vD) + cp = ZZ(1) return (E, Kp, fp, cp, true)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} end if _val(b8) < 3 # Type III Kp = KodairaSymbol("III") - fp = FlintZZ(vD - 1) - cp = FlintZZ(2) + fp = ZZ(vD - 1) + cp = ZZ(2) return (E, Kp, fp, cp, true)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} end if _val(b6) < 3 # Type IV cp = _hasroot(one(K), a3//pi, -a6//pi^2) ? ZZ(3) : ZZ(1) Kp = KodairaSymbol("IV") - fp = FlintZZ(vD - 2) + fp = ZZ(vD - 2) return (E, Kp, fp, cp, true)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} end @@ -307,7 +307,7 @@ function __tates_algorithm_generic(E, R, _val, _redmod, _red, _lift, _invmod, pi if sw == 1 # w != 0 mod P # Three distinct roots, so type I*0 Kp = KodairaSymbol("I0*") - fp = FlintZZ(vD - 4) + fp = ZZ(vD - 4) cp = ZZ(1 + _nrootscubic(b, c, d)) return (E, Kp, fp, cp, true)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} elseif sw == 2 @@ -379,7 +379,7 @@ function __tates_algorithm_generic(E, R, _val, _redmod, _red, _lift, _invmod, pi m = ix + iy - 5 fp = vD - m - 4 Kp = KodairaSymbol("I$(m)*") - return (E, Kp, FlintZZ(fp), FlintZZ(cp), true)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} + return (E, Kp, ZZ(fp), ZZ(cp), true)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} elseif sw == 3 # Triple root # Change coordinates so that T = 0 mod p @@ -407,8 +407,8 @@ function __tates_algorithm_generic(E, R, _val, _redmod, _red, _lift, _invmod, pi if !_pdiv(a3t^2 + 4*a6t) cp = _hasroot(one(K), a3t, -a6t) ? 3 : 1 Kp = KodairaSymbol("IV*") - fp = FlintZZ(vD - 6) - return (E, Kp, fp, FlintZZ(cp), true)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} + fp = ZZ(vD - 6) + return (E, Kp, fp, ZZ(cp), true)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} end # Change coordinates so that p^3|a3, p^5|a6 @@ -425,16 +425,16 @@ function __tates_algorithm_generic(E, R, _val, _redmod, _red, _lift, _invmod, pi if _val(a4) < 4 # Type III* Kp = KodairaSymbol("III*") - fp = FlintZZ(vD - 7) - cp = FlintZZ(2) - return (E, Kp, fp, FlintZZ(cp), true)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} + fp = ZZ(vD - 7) + cp = ZZ(2) + return (E, Kp, fp, ZZ(cp), true)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} end if _val(a6) < 6 # Type II* Kp = KodairaSymbol("II*") - fp = FlintZZ(vD - 8) - cp = FlintZZ(1) - return (E, Kp, fp, FlintZZ(cp), true)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} + fp = ZZ(vD - 8) + cp = ZZ(1) + return (E, Kp, fp, ZZ(cp), true)::Tuple{typeof(E), KodairaSymbol, ZZRingElem, ZZRingElem, Bool} end # Non-minimal equation, dividing out @@ -459,7 +459,7 @@ multiplicative reduction. """ function tates_algorithm_local(E::EllipticCurve{QQFieldElem}, p) - p = FlintZZ(p) + p = ZZ(p) a1, a2, a3, a4, a6 = map(numerator,(a_invariants(E))) @@ -472,7 +472,7 @@ function tates_algorithm_local(E::EllipticCurve{QQFieldElem}, p) # test for type I0 if n == 0 - return (E, KodairaSymbol("I0"), FlintZZ(0), FlintZZ(1), true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} + return (E, KodairaSymbol("I0"), ZZ(0), ZZ(1), true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} end # change coordinates so that p | a3, a4, a6 @@ -495,11 +495,11 @@ function tates_algorithm_local(E::EllipticCurve{QQFieldElem}, p) t = smod(a1*r + a3, p) else if mod(c4, p) == 0 - r = - invmod(FlintZZ(12), p)*b2 + r = - invmod(ZZ(12), p)*b2 else - r = - invmod(FlintZZ(12)*c4, p)*(c6 + b2*c4) + r = - invmod(ZZ(12)*c4, p)*(c6 + b2*c4) end - t = - invmod(FlintZZ(2), p)* (a1*r + a3) + t = - invmod(ZZ(2), p)* (a1*r + a3) r = smod(r, p) t = smod(t, p) end @@ -516,44 +516,44 @@ function tates_algorithm_local(E::EllipticCurve{QQFieldElem}, p) # test for types In, II, III, IV if mod(c4, p) != 0 if quadroots(1, a1, -a2, p) - cp = FlintZZ(n) + cp = ZZ(n) elseif mod(n, 2) == 0 - cp = FlintZZ(2) + cp = ZZ(2) split = false else - cp = FlintZZ(1) + cp = ZZ(1) split = false end Kp = KodairaSymbol("I$(n)") - fp = FlintZZ(1) + fp = ZZ(1) return (E, Kp, fp, cp, split)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} end if mod(a6, p^2) != 0 Kp = KodairaSymbol("II") - fp = FlintZZ(n) - cp = FlintZZ(1) + fp = ZZ(n) + cp = ZZ(1) return (E, Kp, fp, cp, true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} end if mod(b8, p^3) != 0 Kp = KodairaSymbol("III") - fp = FlintZZ(n-1) - cp = FlintZZ(2) + fp = ZZ(n-1) + cp = ZZ(2) return (E, Kp, fp, cp, true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} end if mod(b6, p^3) != 0 if quadroots(1, divexact(a3, p), divexact(-a6, p^2), p) - cp = FlintZZ(3) + cp = ZZ(3) else - cp = FlintZZ(1) + cp = ZZ(1) end Kp = KodairaSymbol("IV") fp = n - 2 - return (E, Kp, FlintZZ(fp), cp, true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} + return (E, Kp, ZZ(fp), cp, true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} end # change coordinates so that p | a1, a2; p^2 | a3, a4; p^3 | a6 @@ -561,8 +561,8 @@ function tates_algorithm_local(E::EllipticCurve{QQFieldElem}, p) s = smod(a2, 2) t = 2 * smod(divexact(a6, 4), 2) else - s = -a1 * invmod(FlintZZ(2), p) - t = -a3 * invmod(FlintZZ(2), p) + s = -a1 * invmod(ZZ(2), p) + t = -a3 * invmod(ZZ(2), p) end trans = transform_rstu(E, ZZRingElem[0, s, t, 1]) @@ -582,9 +582,9 @@ function tates_algorithm_local(E::EllipticCurve{QQFieldElem}, p) # test for distinct roots: type I0* if mod(w, p) != 0 Kp = KodairaSymbol("I0*") - fp = FlintZZ(n - 4) + fp = ZZ(n - 4) cp = 1 + nrootscubic(b, c, d, p) - return (E, Kp, fp, FlintZZ(cp), true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} + return (E, Kp, fp, ZZ(cp), true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} # test for double root: type Im* elseif mod(x, p) != 0 @@ -595,7 +595,7 @@ function tates_algorithm_local(E::EllipticCurve{QQFieldElem}, p) elseif p == 3 r = b*c else - r = (b*c - 9*d) * invmod(FlintZZ(2)*x, p) + r = (b*c - 9*d) * invmod(ZZ(2)*x, p) end r = p * smod(r, p) @@ -611,7 +611,7 @@ function tates_algorithm_local(E::EllipticCurve{QQFieldElem}, p) m = 1 mx = p^2 my = p^2 - cp = FlintZZ(0) + cp = ZZ(0) while cp == 0 xa2 = divexact(a2, p) @@ -621,16 +621,16 @@ function tates_algorithm_local(E::EllipticCurve{QQFieldElem}, p) if mod(xa3^2 + 4*xa6, p) != 0 if quadroots(1, xa3, -xa6, p) - cp = FlintZZ(4) + cp = ZZ(4) else - cp = FlintZZ(2) + cp = ZZ(2) end else if p == 2 t = my * xa6 else - t = my * smod(-xa3*invmod(FlintZZ(2), p), p) + t = my * smod(-xa3*invmod(ZZ(2), p), p) end trans = transform_rstu(E, [0, 0, t, 1]) @@ -649,9 +649,9 @@ function tates_algorithm_local(E::EllipticCurve{QQFieldElem}, p) if mod(xa4^2 - 4*xa2*xa6, p) != 0 if quadroots(xa2, xa4, xa6, p) - cp = FlintZZ(4) + cp = ZZ(4) else - cp = FlintZZ(2) + cp = ZZ(2) end else @@ -677,7 +677,7 @@ function tates_algorithm_local(E::EllipticCurve{QQFieldElem}, p) fp = n - m - 4 Kp = KodairaSymbol("I$(m)*") - return (E, Kp, FlintZZ(fp), FlintZZ(cp), true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} + return (E, Kp, ZZ(fp), ZZ(cp), true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} else # Triple root case: types II*, III*, IV* or non-minimal @@ -685,7 +685,7 @@ function tates_algorithm_local(E::EllipticCurve{QQFieldElem}, p) if p == 3 rp = -d else - rp = -b * invmod(FlintZZ(3), p) + rp = -b * invmod(ZZ(3), p) end r = p * smod(rp, p) @@ -703,19 +703,19 @@ function tates_algorithm_local(E::EllipticCurve{QQFieldElem}, p) # Test for type IV* if mod(x3^2 + 4* x6, p) != 0 if quadroots(1, x3, -x6, p) - cp = FlintZZ(3) + cp = ZZ(3) else - cp = FlintZZ(1) + cp = ZZ(1) end Kp = KodairaSymbol("IV*") - fp = FlintZZ(n - 6) + fp = ZZ(n - 6) - return (E, Kp, fp, FlintZZ(cp), true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} + return (E, Kp, fp, ZZ(cp), true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} else if p == 2 t = x6 else - t = x3 * invmod(FlintZZ(2), p) + t = x3 * invmod(ZZ(2), p) end t = -p^2 * smod(t, p) @@ -730,16 +730,16 @@ function tates_algorithm_local(E::EllipticCurve{QQFieldElem}, p) # Test for types III*, II* if mod(a4, p^4) != 0 Kp = KodairaSymbol("III*") - fp = FlintZZ(n - 7) - cp = FlintZZ(2) + fp = ZZ(n - 7) + cp = ZZ(2) - return (E, Kp, fp, FlintZZ(cp), true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} + return (E, Kp, fp, ZZ(cp), true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} elseif mod(a6, p^6) != 0 Kp = KodairaSymbol("II*") - fp = FlintZZ(n - 8) - cp = FlintZZ(1) + fp = ZZ(n - 8) + cp = ZZ(1) - return (E, Kp, fp, FlintZZ(cp), true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} + return (E, Kp, fp, ZZ(cp), true)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} else E = transform_rstu(E, [0, 0, 0, p])[1] return tates_algorithm_local(E, p)::Tuple{EllipticCurve{QQFieldElem}, KodairaSymbol, ZZRingElem, ZZRingElem, Bool} diff --git a/src/EllCrv/Misc.jl b/src/EllCrv/Misc.jl index 1654b12e45..3bbba63aed 100644 --- a/src/EllCrv/Misc.jl +++ b/src/EllCrv/Misc.jl @@ -159,19 +159,19 @@ function nrootscubic(b, c, d, p) if length(fac) == 1 if fac[first(keys(fac.fac))] == 3 - return FlintZZ(3) + return ZZ(3) else - return FlintZZ(0) + return ZZ(0) end elseif length(fac) == 2 if fac[first(keys(fac.fac))]== 1 && fac[first(keys(fac.fac))] == 1 # one linear and one irreducible quadratic factor - return FlintZZ(1) + return ZZ(1) else - return FlintZZ(3) #one double and one single root + return ZZ(3) #one double and one single root end else - return FlintZZ(3) + return ZZ(3) end end @@ -187,19 +187,19 @@ function nrootscubic(b::AbsSimpleNumFieldElem, c::AbsSimpleNumFieldElem, d::AbsS fac = factor(f) if length(fac) == 1 if fac[first(keys(fac.fac))] == 3 - return FlintZZ(3) + return ZZ(3) else - return FlintZZ(0) + return ZZ(0) end elseif length(fac) == 2 if fac[first(keys(fac.fac))]== 1 && fac[first(keys(fac.fac))] == 1 # one linear and one irreducible quadratic factor - return FlintZZ(1) + return ZZ(1) else - return FlintZZ(3) #one double and one single root + return ZZ(3) #one double and one single root end else - return FlintZZ(3) + return ZZ(3) end end diff --git a/src/EllCrv/RationalPointSearch.jl b/src/EllCrv/RationalPointSearch.jl index 3efd7a815f..3e2925419c 100644 --- a/src/EllCrv/RationalPointSearch.jl +++ b/src/EllCrv/RationalPointSearch.jl @@ -752,7 +752,7 @@ end function Hecke.order_via_exhaustive_search(coeff::Array{T}) where T<:FinFieldElem F = parent(coeff[1]) - order = FlintZZ(0) + order = ZZ(0) for x in F ys = points_with_x_coordinate(coeff, x) order += length(ys) diff --git a/src/EllCrv/Torsion.jl b/src/EllCrv/Torsion.jl index 15fb83c2b2..2f5ba49380 100644 --- a/src/EllCrv/Torsion.jl +++ b/src/EllCrv/Torsion.jl @@ -124,7 +124,7 @@ function torsion_points_lutz_nagell(F::EllipticCurve{QQFieldElem}) pcand = Tuple{ZZRingElem, ZZRingElem}[] # candidates for torsion points - Zx, x = polynomial_ring(FlintZZ, "x") + Zx, x = polynomial_ring(ZZ, "x") _, _, _, a4, a6 = a_invariants(E) @@ -197,7 +197,7 @@ function torsion_points_division_poly(F::EllipticCurve{QQFieldElem}) # points of order 2 (point has order 2 iff y-coordinate is zero) # (note: these points are not detected by the division polynomials) - Zx, x = polynomial_ring(FlintZZ, "x") + Zx, x = polynomial_ring(ZZ, "x") s = zeros(x^3 + A*x + B) # solutions of x^3 + Ax + B = 0 if length(s) != 0 diff --git a/src/FieldFactory/ab_exts.jl b/src/FieldFactory/ab_exts.jl index bd47df1cf8..bf3994ad00 100644 --- a/src/FieldFactory/ab_exts.jl +++ b/src/FieldFactory/ab_exts.jl @@ -9,7 +9,7 @@ function abelian_extensions(O::Union{ZZRing, QQField}, only_real::Bool = false, tame::Bool = false) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) K, _ = number_field(x - 1, "a", cached = false) OK = maximal_order(K) l = abelian_extensions(OK, gtype, discriminant_bound, @@ -521,7 +521,7 @@ function _action_on_quo(mq::FinGenAbGroupHom, act::Vector{FinGenAbGroupHom}) q=mq.header.codomain S,mS=snf(q) n=Int(S.snf[end]) - R=residue_field(FlintZZ, n, cached=false)[1] + R=residue_field(ZZ, n, cached=false)[1] quo_action=Vector{zzModMatrix}(undef, length(act)) for s=1:length(act) quo_action[s]= change_base_ring(mS.map*act[i].map*mS.imap, R) @@ -539,7 +539,7 @@ end function quadratic_fields(bound::Int; tame::Bool=false, real::Bool=false, complex::Bool=false, with_autos::Val{unused}=Val(false)) where unused @assert !(real && complex) - Qx,x=polynomial_ring(FlintQQ, "x") + Qx,x=polynomial_ring(QQ, "x") sqf=squarefree_up_to(bound) if real deleteat!(sqf,1) @@ -568,7 +568,7 @@ end function _quad_ext(bound::Int, only_real::Bool = false; unramified_outside::Vector{ZZRingElem} = ZZRingElem[]) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) K = number_field(x-1, cached = false, check = false)[1] sqf = squarefree_up_to(bound, prime_base = unramified_outside) final_list = Int[] @@ -627,7 +627,7 @@ end function C22_extensions(bound::Int) - Qx, x=polynomial_ring(FlintZZ, "x") + Qx, x=polynomial_ring(ZZ, "x") K, _=number_field(x-1, cached = false) Kx,x=polynomial_ring(K,"x", cached=false) b1=ceil(Int,Base.sqrt(bound)) @@ -659,7 +659,7 @@ end function _C22_exts_abexts(bound::Int, only_real::Bool = false; unramified_outside::Vector{ZZRingElem} = ZZRingElem[]) - Qx, x = polynomial_ring(FlintZZ, "x", cached = false) + Qx, x = polynomial_ring(ZZ, "x", cached = false) pairs = _find_pairs(bound, only_real, unramified_outside = unramified_outside) return (_ext_with_autos(Qx, x, i, j) for (i, j) in pairs) end @@ -701,7 +701,7 @@ end function _C22_with_max_ord(l) list = Vector{Tuple{AbsSimpleNumField, Vector{morphism_type(AbsSimpleNumField, AbsSimpleNumField)}, Vector{morphism_type(AbsSimpleNumField, AbsSimpleNumField)}}}() - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) K = number_field(x-1, cached = false)[1] @vprintln :AbExt 1 "Constructing the C2xC2 extension: $(length(l))" for (i, (p1, p2)) in enumerate(l) @@ -1038,7 +1038,7 @@ function discriminant_conductorQQ(O::AbsSimpleNumFieldOrder, C::ClassField, m::I lp=factor(m).fac abs_disc=Dict{ZZRingElem,Int}() - R=residue_ring(FlintZZ, m, cached=false)[1] + R=residue_ring(ZZ, m, cached=false)[1] for (_p,v) in lp p = ZZ(_p) @@ -1128,7 +1128,7 @@ function discriminantQQ(O::AbsSimpleNumFieldOrder, C::ClassField, m::Int) lp=factor(m).fac abs_disc=Dict{ZZRingElem,Int}() - R=residue_ring(FlintZZ, m, cached=false)[1] + R=residue_ring(ZZ, m, cached=false)[1] for (_p,v) in lp p = ZZ(_p) @@ -1284,7 +1284,7 @@ function _is_conductor_minQQ(C::Hecke.ClassField, n::Int) O=order(m) K=nf(O) - R=residue_ring(FlintZZ, mm, cached=false)[1] + R=residue_ring(ZZ, mm, cached=false)[1] for (_p,v) in lp.fac p = ZZ(_p) if isodd(p) diff --git a/src/FieldFactory/rayclassgrp.jl b/src/FieldFactory/rayclassgrp.jl index a04b89f1d5..a2ede0632e 100644 --- a/src/FieldFactory/rayclassgrp.jl +++ b/src/FieldFactory/rayclassgrp.jl @@ -158,7 +158,7 @@ function ray_class_group_quo(m::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimp # We construct the relation matrix and evaluate units and relations with the class group in the quotient by m # Then we compute the discrete logarithms - R = zero_matrix(FlintZZ, 2*(ngens(C)+nG+ngens(H))+nU, ngens(C)+ngens(H)+nG) + R = zero_matrix(ZZ, 2*(ngens(C)+nG+ngens(H))+nU, ngens(C)+ngens(H)+nG) for i = 1:ncols(R) R[i+ngens(C)+nG+ngens(H)+nU, i] = n_quo end @@ -253,7 +253,7 @@ function ray_class_group_quo(m::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimp @vprintln :RayFacElem 1 "J is one" return id(X) end - coeffs = zero_matrix(FlintZZ, 1, ngens(X)) + coeffs = zero_matrix(ZZ, 1, ngens(X)) if J.is_principal == 1 && isdefined(J, :princ_gen) z = FacElem(Dict(J.princ_gen.elem_in_nf => diffC)) else @@ -389,7 +389,7 @@ function ray_class_group_quo(m::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimp mG = groups_and_maps[i][2] for (prim, mprim) in mG.tame new_mprim = GrpAbFinGenToAbsOrdMap(domain(mprim), codomain(mprim), copy(mprim.generators), mprim.discrete_logarithm) - dis = zero_matrix(FlintZZ, 1, ngens(X)) + dis = zero_matrix(ZZ, 1, ngens(X)) to_be_c = mprim.disc_log.coeff for i = 1:length(to_be_c) dis[1, ind-1+i+ngens(C)] = to_be_c[1, i] @@ -402,7 +402,7 @@ function ray_class_group_quo(m::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimp disc_log_inf = Dict{eltype(p), FinGenAbGroupElem}() for i = 1:length(p) - eldi = zero_matrix(FlintZZ, 1, ngens(X)) + eldi = zero_matrix(ZZ, 1, ngens(X)) eldi[1, ngens(X) - length(inf_plc) + i] = 1 disc_log_inf[p[i]] = FinGenAbGroupElem(X, eldi) end @@ -441,7 +441,7 @@ function log_infinite_primes(O::AbsSimpleNumFieldOrder, p::Vector{<: InfPlc}) let S = S, p = p function log(B::T) where T <: Union{AbsSimpleNumFieldElem ,FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}} emb = signs(B, _embedding.(p)) - ar = zero_matrix(FlintZZ, 1, length(p)) + ar = zero_matrix(ZZ, 1, length(p)) for i = 1:length(p) if emb[_embedding(p[i])] == -1 ar[1, i] = 1 diff --git a/src/FieldFactory/read_write.jl b/src/FieldFactory/read_write.jl index 0c24da2de3..3b6aff9726 100644 --- a/src/FieldFactory/read_write.jl +++ b/src/FieldFactory/read_write.jl @@ -41,7 +41,7 @@ function _read_from_file(f::String) end function _read_from_file(f::IOStream) - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") list = Vector{FieldsTower}(undef, countlines(f)) seekstart(f) QQ = number_field(x-1, "b", cached = false, check = false)[1] diff --git a/src/FieldFactory/relative_to_absolute.jl b/src/FieldFactory/relative_to_absolute.jl index 5fe02c60f5..1ac79d89f9 100644 --- a/src/FieldFactory/relative_to_absolute.jl +++ b/src/FieldFactory/relative_to_absolute.jl @@ -15,7 +15,7 @@ function _relative_to_absoluteQQ(L::RelNonSimpleNumField{AbsSimpleNumFieldElem}, embs = Vector{AbsNonSimpleNumFieldElem}(undef, ngens(K)) imgs = image_generators(auts[i]) for j = 1:length(imgs) - embs[j] = K(map_coefficients(FlintQQ, imgs[j].data, parent = Qxy)) + embs[j] = K(map_coefficients(QQ, imgs[j].data, parent = Qxy)) end autsK[i] = hom(K, K, embs, check = false) end diff --git a/src/FunField/HessQR.jl b/src/FunField/HessQR.jl index 360e617d36..b5a0d86eca 100644 --- a/src/FunField/HessQR.jl +++ b/src/FunField/HessQR.jl @@ -54,10 +54,10 @@ mutable struct HessQRElem <: RingElem return r end if parent(f) != P.R - f = map_coefficients(FlintZZ, f, parent = P.R) + f = map_coefficients(ZZ, f, parent = P.R) end if parent(g) != P.R - g = map_coefficients(FlintZZ, g, parent = P.R) + g = map_coefficients(ZZ, g, parent = P.R) end gc = gcd(f, g) f = divexact(f, gc) @@ -81,8 +81,8 @@ mutable struct HessQRElem <: RingElem function HessQRElem(P::HessQR, f::QQPolyRingElem, g::QQPolyRingElem) df = reduce(lcm, map(denominator, coefficients(f)), init = ZZRingElem(1)) dg = reduce(lcm, map(denominator, coefficients(g)), init = ZZRingElem(1)) - ff = map_coefficients(FlintZZ, df*f, parent = P.R) - gg = map_coefficients(FlintZZ, dg*g, parent = P.R) + ff = map_coefficients(ZZ, df*f, parent = P.R) + gg = map_coefficients(ZZ, dg*g, parent = P.R) #ff/df//gg/dg = dg/df * ff/gg return HessQRElem(P, divexact(dg, df), ff, gg) end @@ -330,7 +330,7 @@ function Nemo.residue_field(a::HessQR, b::HessQRElem) end function Nemo.residue_ring(a::HessQR, b::HessQRElem) - F = residue_ring(FlintZZ, b.c)[1] + F = residue_ring(ZZ, b.c)[1] Fx, x = polynomial_ring(F, cached = false) Q = fraction_field(Fx, cached = false) return Q, MapFromFunc( diff --git a/src/GrpAb/Elem.jl b/src/GrpAb/Elem.jl index 29ec93ea13..95b0f088c4 100644 --- a/src/GrpAb/Elem.jl +++ b/src/GrpAb/Elem.jl @@ -314,7 +314,7 @@ this function returns the element of $A$ with components `x`. """ function (A::FinGenAbGroup)(x::Vector{ZZRingElem}) ngens(A) != length(x) && error("Lengths do not coincide") - y = matrix(FlintZZ, 1, ngens(A), x) + y = matrix(ZZ, 1, ngens(A), x) z = FinGenAbGroupElem(A, y) return z end @@ -350,7 +350,7 @@ function (A::FinGenAbGroup)(x::ZZMatrix) end function (A::FinGenAbGroup)() - y = zero_matrix(FlintZZ, 1, ngens(A)) + y = zero_matrix(ZZ, 1, ngens(A)) z = FinGenAbGroupElem(A, y) return z end @@ -366,9 +366,9 @@ where the $1$ is at the $i$-th position. function getindex(A::FinGenAbGroup, i::Int) (i < 0 || i > ngens(A)) && error("Index ($i) out of range (1:$(ngens(A)))") if i==0 - return FinGenAbGroupElem(A, zero_matrix(FlintZZ, 1, ngens(A))) + return FinGenAbGroupElem(A, zero_matrix(ZZ, 1, ngens(A))) end - z = zero_matrix(FlintZZ, 1, ngens(A)) + z = zero_matrix(ZZ, 1, ngens(A)) for j in 1:ngens(A) z[1, j] = ZZRingElem() end diff --git a/src/GrpAb/GrpAbFinGen.jl b/src/GrpAb/GrpAbFinGen.jl index e0431f8627..e2cf98c0ae 100644 --- a/src/GrpAb/GrpAbFinGen.jl +++ b/src/GrpAb/GrpAbFinGen.jl @@ -84,7 +84,7 @@ function abelian_group(M::AbstractMatrix{<:IntegerUnion}) end function abelian_group(::Type{FinGenAbGroup}, M::AbstractMatrix{<:IntegerUnion}) - return abelian_group(matrix(FlintZZ, M)) + return abelian_group(matrix(ZZ, M)) end function _issnf(N::Vector{T}) where T <: IntegerUnion @@ -126,7 +126,7 @@ function abelian_group(::Type{FinGenAbGroup}, M::AbstractVector{<:IntegerUnion}) if _issnf(M) G = FinGenAbGroup(M) else - N = zero_matrix(FlintZZ, length(M), length(M)) + N = zero_matrix(ZZ, length(M), length(M)) for i = 1:length(M) N[i,i] = M[i] end @@ -393,7 +393,7 @@ function rels_gen(A::FinGenAbGroup) end function rels_snf(A::FinGenAbGroup) - M = zero_matrix(FlintZZ, ngens(A), ngens(A)) + M = zero_matrix(ZZ, ngens(A), ngens(A)) for i = 1:ngens(A) M[i,i] = A.snf[i] end @@ -836,7 +836,7 @@ function matrix(M::Map{FinGenAbGroup, FinGenAbGroup}) end function matrix(M::Generic.IdentityMap{FinGenAbGroup}) - return identity_matrix(FlintZZ, ngens(domain(M))) + return identity_matrix(ZZ, ngens(domain(M))) end @doc raw""" @@ -920,7 +920,7 @@ function flat(G::FinGenAbGroup) else H = G end - return hom(G, H, identity_matrix(FlintZZ, ngens(G)), identity_matrix(FlintZZ, ngens(G))) + return hom(G, H, identity_matrix(ZZ, ngens(G)), identity_matrix(ZZ, ngens(G))) end @@ -931,8 +931,8 @@ end function tensor_product2(G::FinGenAbGroup, H::FinGenAbGroup) RG = rels(G) RH = rels(H) - R = vcat(transpose(kronecker_product(transpose(RG), identity_matrix(FlintZZ, ngens(H)))), - transpose(kronecker_product(identity_matrix(FlintZZ, ngens(G)), transpose(RH)))) + R = vcat(transpose(kronecker_product(transpose(RG), identity_matrix(ZZ, ngens(H)))), + transpose(kronecker_product(identity_matrix(ZZ, ngens(G)), transpose(RH)))) G = abelian_group(R) end @@ -1084,7 +1084,7 @@ function sub(G::FinGenAbGroup, s::Vector{FinGenAbGroupElem}, if length(s) == 0 S = FinGenAbGroup(Int[]) - I = zero_matrix(FlintZZ, ngens(S), ngens(G)) + I = zero_matrix(ZZ, ngens(S), ngens(G)) mp = hom(S, G, I, check = false) if add_to_lattice append!(L, mp) @@ -1095,7 +1095,7 @@ function sub(G::FinGenAbGroup, s::Vector{FinGenAbGroupElem}, p = s[1].parent @assert G == p @assert all(x->x.parent == G, s) - m = zero_matrix(FlintZZ, length(s) + nrels(p), ngens(p) + length(s)) + m = zero_matrix(ZZ, length(s) + nrels(p), ngens(p) + length(s)) for i = 1:length(s) for j = 1:ngens(p) m[i + nrels(p), j] = s[i][j] @@ -1164,7 +1164,7 @@ rows of $M$ together with the injection $\iota : H \to G$. """ function sub(G::FinGenAbGroup, M::ZZMatrix, add_to_lattice::Bool = true, L::GrpAbLattice = GroupLattice) - m = zero_matrix(FlintZZ, nrows(M) + nrels(G), ngens(G) + nrows(M)) + m = zero_matrix(ZZ, nrows(M) + nrels(G), ngens(G) + nrows(M)) for i = 1:nrows(M) for j = 1:ngens(G) m[i + nrels(G), j] = M[i,j] @@ -1232,7 +1232,7 @@ function _sub_integer_snf(G::FinGenAbGroup, n::ZZRingElem, add_to_lattice::Bool end end Gnew = abelian_group(invariants) - mat_map = zero_matrix(FlintZZ, length(invariants), ngens(G)) + mat_map = zero_matrix(ZZ, length(invariants), ngens(G)) for i = 1:ngens(Gnew) mat_map[i, ind+i-1] = n end @@ -1257,7 +1257,7 @@ function sub(G::FinGenAbGroup, n::ZZRingElem, if is_snf(G) return _sub_integer_snf(G, n, add_to_lattice, L) end - H, mH = sub(G, scalar_matrix(FlintZZ, ngens(G), deepcopy(n)), add_to_lattice, L) + H, mH = sub(G, scalar_matrix(ZZ, ngens(G), deepcopy(n)), add_to_lattice, L) if isdefined(G, :exponent) res = divexact(G.exponent, gcd(n, G.exponent)) if !iszero(res) @@ -1293,7 +1293,7 @@ $s$, together with the projection $p : G \to H$. function quo(G::FinGenAbGroup, s::Vector{FinGenAbGroupElem}, add_to_lattice::Bool = true, L::GrpAbLattice = GroupLattice) if length(s) == 0 - I = identity_matrix(FlintZZ, ngens(G)) + I = identity_matrix(ZZ, ngens(G)) m = hom(G, G, I, I, check = false) if add_to_lattice append!(L, m) @@ -1303,7 +1303,7 @@ function quo(G::FinGenAbGroup, s::Vector{FinGenAbGroupElem}, p = s[1].parent @assert G == p - m = zero_matrix(FlintZZ, length(s)+nrels(p), ngens(p)) + m = zero_matrix(ZZ, length(s)+nrels(p), ngens(p)) for i = 1:length(s) for j = 1:ngens(p) m[i + nrels(p),j] = s[i][j] @@ -1325,7 +1325,7 @@ function quo(G::FinGenAbGroup, s::Vector{FinGenAbGroupElem}, if isdefined(G, :exponent) Q.exponent = G.exponent end - I = identity_matrix(FlintZZ, ngens(p)) + I = identity_matrix(ZZ, ngens(p)) m = hom(p, Q, I, I, check = false) if add_to_lattice append!(L, m) @@ -1346,7 +1346,7 @@ function quo(G::FinGenAbGroup, M::ZZMatrix, if isdefined(G, :exponent) Q.exponent = G.exponent end - I = identity_matrix(FlintZZ, ngens(G)) + I = identity_matrix(ZZ, ngens(G)) m = hom(G, Q, I, I, check = false) if add_to_lattice append!(L, m) @@ -1378,7 +1378,7 @@ end function quo_snf(G::FinGenAbGroup, n::IntegerUnion, add_to_lattice::Bool = true, L::GrpAbLattice = GroupLattice) r = [gcd(x, n) for x = G.snf] - I = identity_matrix(FlintZZ, ngens(G)) + I = identity_matrix(ZZ, ngens(G)) Q = abelian_group(r) if isdefined(G, :exponent) Q.exponent = gcd(G.exponent, n) @@ -1394,12 +1394,12 @@ end function quo_gen(G::FinGenAbGroup, n::IntegerUnion, add_to_lattice::Bool = true, L::GrpAbLattice = GroupLattice) - m = vcat(G.rels, n*identity_matrix(FlintZZ, ngens(G))) + m = vcat(G.rels, n*identity_matrix(ZZ, ngens(G))) Q = abelian_group(m) if isdefined(G, :exponent) Q.exponent = gcd(n, G.exponent) end - I = identity_matrix(FlintZZ, ngens(G)) + I = identity_matrix(ZZ, ngens(G)) m = hom(G, Q, I, I, check = false) if add_to_lattice append!(L, m) @@ -1425,7 +1425,7 @@ function Base.intersect(mG::FinGenAbGroupHom, mH::FinGenAbGroupHom, G = domain(mG) GH = codomain(mG) @assert GH == codomain(mH) - M = zero_matrix(FlintZZ, nrows(mG.map)+ nrows(mH.map) + nrels(GH), ncols(mG.map)+ nrows(mG.map)) + M = zero_matrix(ZZ, nrows(mG.map)+ nrows(mH.map) + nrels(GH), ncols(mG.map)+ nrows(mG.map)) _copy_matrix_into_matrix(M, 1, 1, mG.map) for i = 1:nrows(mG.map) M[i, i+ncols(mG.map)] = 1 @@ -1437,8 +1437,8 @@ function Base.intersect(mG::FinGenAbGroupHom, mH::FinGenAbGroupHom, _copy_matrix_into_matrix(M, nrows(mG.map)+ nrows(mH.map)+1, 1, rels(GH)) end #= - M2 = hcat(mG.map, identity_matrix(FlintZZ, nrows(mG.map))) - M3 = vcat(vcat(M2, hcat(mH.map, zero_matrix(FlintZZ, nrows(mH.map), nrows(mG.map)))), hcat(rels(GH), zero_matrix(FlintZZ, nrels(GH), nrows(mG.map)))) + M2 = hcat(mG.map, identity_matrix(ZZ, nrows(mG.map))) + M3 = vcat(vcat(M2, hcat(mH.map, zero_matrix(ZZ, nrows(mH.map), nrows(mG.map)))), hcat(rels(GH), zero_matrix(ZZ, nrels(GH), nrows(mG.map)))) @assert M3 == M =# h = hnf!(M) @@ -1469,9 +1469,9 @@ function Base.intersect(G::FinGenAbGroup, H::FinGenAbGroup, L::GrpAbLattice = Gr if !fl error("no common overgroup known") end - #M = [ mG identity_matrix(FlintZZ, nrows(mG)); mH zero_matrix(FlintZZ, nrows(mH), nrows(mG)) ; - #rels(GH) zero_matrix(FlintZZ, nrels(GH), nrows(mG))] - M = vcat(vcat(hcat(mG, identity_matrix(FlintZZ, nrows(mG))), hcat(mH, zero_matrix(FlintZZ, nrows(mH), nrows(mG)))), hcat(rels(GH), zero_matrix(FlintZZ, nrels(GH), nrows(mG)))) + #M = [ mG identity_matrix(ZZ, nrows(mG)); mH zero_matrix(ZZ, nrows(mH), nrows(mG)) ; + #rels(GH) zero_matrix(ZZ, nrels(GH), nrows(mG))] + M = vcat(vcat(hcat(mG, identity_matrix(ZZ, nrows(mG))), hcat(mH, zero_matrix(ZZ, nrows(mH), nrows(mG)))), hcat(rels(GH), zero_matrix(ZZ, nrels(GH), nrows(mG)))) h = hnf(M) i = nrows(h) while i > 0 && iszero(sub(h, i:i, 1:ngens(GH))) @@ -1689,7 +1689,7 @@ function find_isomorphism(G, op, A::GrpAb) @assert is_snf(H) Asnf, AsnftoA = snf(A) s = length(H.snf) - id = identity_matrix(FlintZZ, s) + id = identity_matrix(ZZ, s) AsnftoH = hom(Asnf, H, id, id) GtoA = Dict{eltype(G), FinGenAbGroupElem}() AtoG = Dict{FinGenAbGroupElem, eltype(G)}() @@ -1766,7 +1766,7 @@ function find_isomorphism_with_abelian_group(G::Vector{<:NumFieldHom{AbsSimpleNu end end - rel_mat = zero_matrix(FlintZZ, length(rels), length(S)) + rel_mat = zero_matrix(ZZ, length(rels), length(S)) for i in 1:length(rels) for j in 1:length(S) rel_mat[i, j] = rels[i][j] @@ -1849,7 +1849,7 @@ function find_isomorphism_with_abelian_group(G, op) end end - rel_mat = zero_matrix(FlintZZ, length(rels), length(S)) + rel_mat = zero_matrix(ZZ, length(rels), length(S)) for i in 1:length(rels) for j in 1:length(S) rel_mat[i, j] = rels[i][j] @@ -2188,10 +2188,10 @@ function has_complement(m::FinGenAbGroupHom, to_lattice::Bool = true) return false, sub(G, FinGenAbGroupElem[], false)[2] end el1 = mS1(el) - coeffs = zero_matrix(FlintZZ, 1, ngens(s)) + coeffs = zero_matrix(ZZ, 1, ngens(s)) for j = 1:ngens(s) if !iszero(el1[j]) - R = residue_ring(FlintZZ, s.snf[j], cached = false)[1] + R = residue_ring(ZZ, s.snf[j], cached = false)[1] r1 = R(el1[j]) r2 = R(SH.snf[i]) fl1, r = divides(r1, r2) diff --git a/src/GrpAb/Map.jl b/src/GrpAb/Map.jl index 126287763b..8e98892842 100644 --- a/src/GrpAb/Map.jl +++ b/src/GrpAb/Map.jl @@ -131,7 +131,7 @@ end # ################################################################################ -id_hom(G::FinGenAbGroup) = hom(G, G, identity_matrix(FlintZZ, ngens(G)), identity_matrix(FlintZZ, ngens(G)), check = false) +id_hom(G::FinGenAbGroup) = hom(G, G, identity_matrix(ZZ, ngens(G)), identity_matrix(ZZ, ngens(G)), check = false) @doc raw""" hom(A::Vector{FinGenAbGroupElem}, B::Vector{FinGenAbGroupElem}) -> Map @@ -159,12 +159,12 @@ function hom(A::Vector{FinGenAbGroupElem}, B::Vector{FinGenAbGroupElem}; check:: end =# if ngens(GB) == 0 - return hom(GA, GB, matrix(FlintZZ, ngens(GA), 0, ZZRingElem[]), check = check) + return hom(GA, GB, matrix(ZZ, ngens(GA), 0, ZZRingElem[]), check = check) end M = reduce(vcat, [hcat(A[i].coeff, B[i].coeff) for i = 1:length(A)]) RA = rels(GA) - M = vcat(M, hcat(RA, zero_matrix(FlintZZ, nrows(RA), ncols(B[1].coeff)))) + M = vcat(M, hcat(RA, zero_matrix(ZZ, nrows(RA), ncols(B[1].coeff)))) if isdefined(GB, :exponent) && nrows(M) >= ncols(M) H = hnf_modular_eldiv(M, exponent(GB)) else @@ -197,7 +197,7 @@ function hom(G::FinGenAbGroup, H::FinGenAbGroup, B::Vector{FinGenAbGroupElem}; c M = reduce(vcat, [x.coeff for x = B]) end #= - M = zero_matrix(FlintZZ, ngens(G), ngens(H)) + M = zero_matrix(ZZ, ngens(G), ngens(H)) for i = 1:ngens(G) for j = 1:ngens(H) M[i, j] = B[i][j] @@ -283,7 +283,7 @@ of $h$. function kernel(h::FinGenAbGroupHom, add_to_lattice::Bool = true) G = domain(h) H = codomain(h) - m = zero_matrix(FlintZZ, nrows(h.map)+nrows(rels(H)), + m = zero_matrix(ZZ, nrows(h.map)+nrows(rels(H)), ncols(h.map)) for i=1:nrows(h.map) for j=1:ncols(h.map) @@ -427,13 +427,13 @@ function compose(f::FinGenAbGroupHom, g::FinGenAbGroupHom) C = codomain(g) if isdefined(C, :exponent) if fits(Int, C.exponent) - RR = residue_ring(FlintZZ, Int(C.exponent), cached = false)[1] + RR = residue_ring(ZZ, Int(C.exponent), cached = false)[1] fRR = map_entries(RR, f.map) gRR = map_entries(RR, g.map) MRR = fRR*gRR M = lift(MRR) else - R = residue_ring(FlintZZ, C.exponent, cached = false)[1] + R = residue_ring(ZZ, C.exponent, cached = false)[1] fR = map_entries(R, f.map) gR = map_entries(R, g.map) MR = fR*gR @@ -489,12 +489,12 @@ function Base.:^(f::FinGenAbGroupHom, n::Integer) C = codomain(f) if isdefined(C, :exponent) if fits(Int, C.exponent) - RR = residue_ring(FlintZZ, Int(C.exponent), cached = false)[1] + RR = residue_ring(ZZ, Int(C.exponent), cached = false)[1] fRR = map_entries(RR, f.map) MRR = fRR^n M = lift(MRR) else - R = residue_ring(FlintZZ, C.exponent, cached = false)[1] + R = residue_ring(ZZ, C.exponent, cached = false)[1] fR = map_entries(R, f.map) MR = fR^n M = map_entries(lift, MR) @@ -584,7 +584,7 @@ function hom(G::FinGenAbGroup, H::FinGenAbGroup; task::Symbol = :map) c = [x[2] for x = r] function phi(r::FinGenAbGroupElem) - return FinGenAbGroupHom(inv(mG) * hom(sG, sH, matrix(FlintZZ, n, m, [r[i] * c[i] for i=1:length(c)]), check = true) * mH) + return FinGenAbGroupHom(inv(mG) * hom(sG, sH, matrix(ZZ, n, m, [r[i] * c[i] for i=1:length(c)]), check = true) * mH) end function ihp(r::FinGenAbGroupHom) diff --git a/src/GrpAb/SubgroupEnum.jl b/src/GrpAb/SubgroupEnum.jl index d3d8726449..fa9949c7cf 100644 --- a/src/GrpAb/SubgroupEnum.jl +++ b/src/GrpAb/SubgroupEnum.jl @@ -68,7 +68,7 @@ mutable struct IndexPSubgroups{S, T} end r.st = i r.n = UInt(div(ZZRingElem(p)^(length(s.snf)-i+1) - 1, ZZRingElem(p)-1)) - r.c = zero_matrix(FlintZZ, length(s.snf), length(s.snf)) + r.c = zero_matrix(ZZ, length(s.snf), length(s.snf)) r.mthd = mthd r.c return r diff --git a/src/GrpAb/stable_sub.jl b/src/GrpAb/stable_sub.jl index 882ec357b2..40a2f34449 100644 --- a/src/GrpAb/stable_sub.jl +++ b/src/GrpAb/stable_sub.jl @@ -86,7 +86,7 @@ function action(V::FinGenAbGroup, act::Vector{T}) where T<: Map{FinGenAbGroup, F expon = Int(exponent(V)) @hassert :StabSub 1 length(factor(order(V)).fac)==1 - RR = residue_ring(FlintZZ, expon, cached=false)[1] + RR = residue_ring(ZZ, expon, cached=false)[1] act_mat = Vector{zzModMatrix}(undef, length(act)) for z = 1:length(act) A = zero_matrix(RR, ngens(V), ngens(V)) @@ -242,7 +242,7 @@ function _sub_snf(M::ZpnGModule, n::Int) end Gnew = abelian_group(invariants) action = zzModMatrix[sub(x, ind:ngens(V), ind:ngens(V)) for x in M.G] - mat_map = zero_matrix(FlintZZ, length(invariants), ngens(V)) + mat_map = zero_matrix(ZZ, length(invariants), ngens(V)) for i = 1:ngens(Gnew) mat_map[i, ind+i-1] = n end @@ -770,7 +770,7 @@ function submodules_order(M::ZpnGModule, ord::Int) minlist=minimal_submodules(N,ord, lf) for x in minlist - push!(list, reduce(vcat, [W((mS( S.V(ZZRingElem[FlintZZ(coeff(x[k,i],0))*((M.p)^(v[i]-1)) for i=1:ngens(S.V)]))).coeff) for k=1:nrows(x) ])) + push!(list, reduce(vcat, [W((mS( S.V(ZZRingElem[ZZ(coeff(x[k,i],0))*((M.p)^(v[i]-1)) for i=1:ngens(S.V)]))).coeff) for k=1:nrows(x) ])) end return (x for x in list) @@ -931,7 +931,7 @@ function _stable_subgroup_snf(R::FinGenAbGroup, act::Vector{FinGenAbGroupHom}; q push!(list, it) else - RR = residue_ring(FlintZZ, Int(p)^x1, cached=false)[1] + RR = residue_ring(ZZ, Int(p)^x1, cached=false)[1] act_mat1 = Vector{zzModMatrix}(undef, length(act)) for z=1:length(act) imgs = FinGenAbGroupElem[] diff --git a/src/Hecke.jl b/src/Hecke.jl index 8e90819aec..c451bae7dc 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -163,8 +163,8 @@ end function __init__() # verify some base rings survived serialization/deserialization - @assert base_ring(Hecke.Globals.Zx) === FlintZZ - @assert base_ring(Hecke.Globals.Qx) === FlintQQ + @assert base_ring(Hecke.Globals.Zx) === ZZ + @assert base_ring(Hecke.Globals.Qx) === QQ if AbstractAlgebra.should_show_banner() && get(ENV, "HECKE_PRINT_BANNER", "true") != "false" _print_banner() @@ -290,9 +290,9 @@ end module Globals using Hecke - const Qx, _ = polynomial_ring(FlintQQ, "x", cached = false) - const Zx, _ = polynomial_ring(FlintZZ, "x", cached = false) - const Zxy, _ = polynomial_ring(FlintZZ, ["x", "y"], cached = false) + const Qx, _ = polynomial_ring(QQ, "x", cached = false) + const Zx, _ = polynomial_ring(ZZ, "x", cached = false) + const Zxy, _ = polynomial_ring(ZZ, ["x", "y"], cached = false) end using .Globals diff --git a/src/HeckeTypes.jl b/src/HeckeTypes.jl index 36c2dec7fa..5439a996a6 100644 --- a/src/HeckeTypes.jl +++ b/src/HeckeTypes.jl @@ -495,7 +495,7 @@ mutable struct EnumCtxArb function EnumCtxArb(G::ArbMatrix) z = new() z.G = G - z.x = zero_matrix(FlintZZ, 1, nrows(G)) + z.x = zero_matrix(ZZ, 1, nrows(G)) z.p = precision(base_ring(G)) return z end @@ -562,7 +562,7 @@ mutable struct FakeFmpqMat function FakeFmpqMat(x::ZZMatrix) z = new() z.num = x - z.den = one(FlintZZ) + z.den = one(ZZ) z.rows = nrows(x) z.cols = ncols(x) return z @@ -725,10 +725,10 @@ const AbsNumFieldOrderSetID = AbstractAlgebra.CacheDictType{NumField, AbsNumFiel #r.norm_change_const = (-1.0, -1.0) r.is_equation_order = false r.is_maximal = 0 - r.tcontain = FakeFmpqMat(zero_matrix(FlintZZ, 1, degree(a))) + r.tcontain = FakeFmpqMat(zero_matrix(ZZ, 1, degree(a))) r.tcontain_fmpz = ZZRingElem() r.tcontain_fmpz2 = ZZRingElem() - r.tidempotents = zero_matrix(FlintZZ, 1 + 2*degree(a), 1 + 2*degree(a)) + r.tidempotents = zero_matrix(ZZ, 1 + 2*degree(a), 1 + 2*degree(a)) r.index_div = Dict{ZZRingElem, Vector}() return r end @@ -857,7 +857,7 @@ mutable struct AbsNumFieldOrderElem{S, T} <: NumFieldOrderElem end function AbsNumFieldOrderElem{S, T}(O::AbsNumFieldOrder{S, T}, arr::Vector{U}) where {S, T, U <: Integer} - return AbsNumFieldOrderElem{S, T}(O, map(FlintZZ, arr)) + return AbsNumFieldOrderElem{S, T}(O, map(ZZ, arr)) end function AbsNumFieldOrderElem{S, T}(x::AbsNumFieldOrderElem{S, T}) where {S, T} @@ -1405,14 +1405,14 @@ mutable struct FactorBaseSingleP{T} lf::Vector{T} function FactorBaseSingleP(p::Integer, lp::Vector{Tuple{Int, AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}}}) - Fpx = polynomial_ring(residue_ring(FlintZZ, UInt(p), cached=false)[1], "x", cached=false)[1] + Fpx = polynomial_ring(residue_ring(ZZ, UInt(p), cached=false)[1], "x", cached=false)[1] O = order(lp[1][2]) K = O.nf return FactorBaseSingleP(Fpx(Globals.Zx(K.pol)), lp) end function FactorBaseSingleP(p::ZZRingElem, lp::Vector{Tuple{Int, AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}}}) - Fpx = polynomial_ring(residue_ring(FlintZZ, p, cached=false)[1], "x", cached=false)[1] + Fpx = polynomial_ring(residue_ring(ZZ, p, cached=false)[1], "x", cached=false)[1] O = order(lp[1][2]) K = O.nf return FactorBaseSingleP(Fpx(Globals.Zx(K.pol)), lp) @@ -1532,7 +1532,7 @@ mutable struct ModuleCtxNmod function ModuleCtxNmod(p::Int, dim::Int) M = new() - M.R = residue_ring(FlintZZ, p, cached=false)[1] + M.R = residue_ring(ZZ, p, cached=false)[1] M.basis = sparse_matrix(M.R) M.basis.c = dim M.gens = sparse_matrix(M.R) @@ -1556,13 +1556,13 @@ mutable struct ModuleCtx_fmpz function ModuleCtx_fmpz(dim::Int, p::Int = next_prime(2^20)) M = new() - M.max_indep = sparse_matrix(FlintZZ) + M.max_indep = sparse_matrix(ZZ) M.max_indep.c = dim - M.bas_gens = sparse_matrix(FlintZZ) + M.bas_gens = sparse_matrix(ZZ) M.bas_gens.c = dim - M.rel_gens = sparse_matrix(FlintZZ) + M.rel_gens = sparse_matrix(ZZ) M.rel_gens.c = dim - R = residue_ring(FlintZZ, p, cached=false)[1] + R = residue_ring(ZZ, p, cached=false)[1] M.rel_reps_p = sparse_matrix(R) M.new = false M.Mp = ModuleCtxNmod(R, dim) @@ -1689,7 +1689,7 @@ mutable struct IdealRelationsCtx{Tx, TU, TC} function IdealRelationsCtx{Tx, TU, TC}(clg::ClassGrpCtx, A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}; prec::Int = 100, val::Int=0, limit::Int = 0) where {Tx, TU, TC} - v = matrix(FlintZZ, Base.rand(-val:val, 1, + v = matrix(ZZ, Base.rand(-val:val, 1, nrows(clg.val_base)))*clg.val_base E = enum_ctx_from_ideal(A, v, prec = prec, limit = limit, Tx = Tx, TU = TU, TC = TC)::enum_ctx{Tx, TU, TC} @@ -1702,7 +1702,7 @@ mutable struct IdealRelationsCtx{Tx, TU, TC} I.restart = 0 I.vl = 0 I.rr = 1:0 - I.M = zero_matrix(FlintZZ, 1, I.E.n) + I.M = zero_matrix(ZZ, 1, I.E.n) return I end end @@ -1740,10 +1740,10 @@ end z.basis_mat_array = Array(z.basis_matrix) z.preinvn = [ fmpz_preinvn_struct(z.basis_matrix[i, i]) for i in 1:degree(O)] d = degree(O) - z.tmp_div = zero_matrix(FlintZZ, 2*d + 1, 2*d + 1) - z.tmp_gcdxx = zero_matrix(FlintZZ, 3*d + 1, 3*d + 1) - z.tmp_ann = zero_matrix(FlintZZ, 2*d, d) - z.tmp_euc = zero_matrix(FlintZZ, 2*d, d) + z.tmp_div = zero_matrix(ZZ, 2*d + 1, 2*d + 1) + z.tmp_gcdxx = zero_matrix(ZZ, 3*d + 1, 3*d + 1) + z.tmp_ann = zero_matrix(ZZ, 2*d, d) + z.tmp_euc = zero_matrix(ZZ, 2*d, d) z.one = simplify!(one(z)) return z end @@ -1864,7 +1864,7 @@ mutable struct QuadBin{T} end function QuadBin(a::Integer, b::Integer, c::Integer) - return QuadBin(FlintZZ, a, b, c) + return QuadBin(ZZ, a, b, c) end function QuadBin(R, a, b, c) @@ -2056,7 +2056,7 @@ function GrpAbLatticeCreate() r = GrpAbLattice() r.zero = ZZMatrix(0,0) r.mult = * - r.make_id = G::FinGenAbGroup -> identity_matrix(FlintZZ, ngens(G)) + r.make_id = G::FinGenAbGroup -> identity_matrix(ZZ, ngens(G)) return r end @@ -2192,7 +2192,7 @@ mutable struct HenselCtx a = new() a.f = f a.p = UInt(p) - Zx,x = polynomial_ring(FlintZZ, "x", cached=false) + Zx,x = polynomial_ring(ZZ, "x", cached=false) Rx,x = polynomial_ring(Native.GF(UInt(p), cached=false), "x", cached=false) a.lf = Nemo.nmod_poly_factor(UInt(p)) ccall((:nmod_poly_factor, libflint), UInt, diff --git a/src/LargeField/basis.jl b/src/LargeField/basis.jl index 4406ec063e..392f81561f 100644 --- a/src/LargeField/basis.jl +++ b/src/LargeField/basis.jl @@ -24,7 +24,7 @@ function lll_basis_profile(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimple end #function short_elem(c::roots_ctx, A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}, -# v::ZZMatrix = matrix_space(FlintZZ, 1,1)(); prec::Int = 100) +# v::ZZMatrix = matrix_space(ZZ, 1,1)(); prec::Int = 100) # l, t = lll(c, A, v, prec = prec) # w = window(t, 1,1, 1, ncols(t)) # c = w*b @@ -33,7 +33,7 @@ end #end function bkz_basis(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}, bs::Int; - v::ZZMatrix = zero_matrix(FlintZZ, 1, 1), + v::ZZMatrix = zero_matrix(ZZ, 1, 1), prec::Int = 100) @@ -66,7 +66,7 @@ function bkz_basis(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumField end function fplll_basis(rt_c::Hecke.roots_ctx, A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}, bs::Int; - v::ZZMatrix = zero_matrix(FlintZZ, 1,1), + v::ZZMatrix = zero_matrix(ZZ, 1,1), prec::Int = 100) K = nf(order(A)) diff --git a/src/LargeField/misc2.jl b/src/LargeField/misc2.jl index 934d03f62b..f68119fd24 100644 --- a/src/LargeField/misc2.jl +++ b/src/LargeField/misc2.jl @@ -387,7 +387,7 @@ end #= -Qx,x = polynomial_ring(FlintQQ, "a") +Qx,x = polynomial_ring(QQ, "a") K, a = cyclotomic_real_subfield(1024, "a"); @time fb_int = Hecke.int_fb_max_real(1024, 2^20); h = Hecke.auto_of_maximal_real(K, 3); @@ -397,7 +397,7 @@ fb_int = FactorBase(ZZRingElem[x for x = vcat(fb_int[1], fb_int[2], fb_int[3])]) @time Hecke.basis_rels_4(b, 600, 10, 5, fb_int) @time Hecke.basis_rels_5(b, 600, 10, 5, fb_int) -Qx,x = polynomial_ring(FlintQQ, "a") +Qx,x = polynomial_ring(QQ, "a") K, a = cyclotomic_real_subfield(512, "a"); @time fb_int = Hecke.int_fb_max_real(512, 2^18); h = Hecke.auto_of_maximal_real(K, 3); diff --git a/src/LinearAlgebra/FakeFmpqMat.jl b/src/LinearAlgebra/FakeFmpqMat.jl index df23873410..96ab5cd4e2 100644 --- a/src/LinearAlgebra/FakeFmpqMat.jl +++ b/src/LinearAlgebra/FakeFmpqMat.jl @@ -205,7 +205,7 @@ isequal(x::FakeFmpqMat, y::FakeFmpqMat) = (x.num == y.num) && (x.den == y.den) function FakeFmpqMat(x::Vector{QQFieldElem}) dens = ZZRingElem[denominator(x[i]) for i=1:length(x)] den = lcm(dens) - M = zero_matrix(FlintZZ, 1, length(x)) + M = zero_matrix(ZZ, 1, length(x)) for i in 1:length(x) M[1,i] = numerator(x[i])*divexact(den, dens[i]) end @@ -218,7 +218,7 @@ function QQMatrix(x::FakeFmpqMat) end function _fmpq_mat_to_fmpz_mat_den(x::QQMatrix) - z = zero_matrix(FlintZZ, nrows(x), ncols(x)) + z = zero_matrix(ZZ, nrows(x), ncols(x)) d = ZZRingElem() ccall((:fmpq_mat_get_fmpz_mat_matwise, libflint), Nothing, (Ref{ZZMatrix}, Ref{ZZRingElem}, Ref{QQMatrix}), z, d, x) return z, d @@ -250,7 +250,7 @@ end function hnf(x::FakeFmpqMat, shape = :lowerleft; triangular_top::Bool = false, compute_det::Bool = false) if triangular_top @assert ncols(x) <= nrows(x) - z = one(FlintZZ) + z = one(ZZ) for i in 1:(ncols(x) - 1) for j in (i + 1):ncols(x) @assert iszero(x.num[i, j]) @@ -388,7 +388,7 @@ function reduce(::typeof(vcat), A::Vector{FakeFmpqMat}) end d = reduce(lcm, (denominator(a) for a in A), init = ZZRingElem(1)) - res = zero_matrix(FlintZZ, sum(nrows, A), ncols(A[1])) + res = zero_matrix(ZZ, sum(nrows, A), ncols(A[1])) k = 1 for i in 1:length(A) _copy_matrix_into_matrix(res, k, 1, divexact(d, denominator(A[i])) * numerator(A[i], copy = false)) diff --git a/src/LinearAlgebra/Howell.jl b/src/LinearAlgebra/Howell.jl index d90dd21507..7a2302983e 100644 --- a/src/LinearAlgebra/Howell.jl +++ b/src/LinearAlgebra/Howell.jl @@ -12,7 +12,7 @@ end function howell_form(A::Generic.Mat{Nemo.ZZModRingElem}) local B::ZZMatrix if nrows(A) < ncols(A) - B = vcat(lift(A), zero_matrix(FlintZZ, ncols(A)-nrows(A), ncols(A))) + B = vcat(lift(A), zero_matrix(ZZ, ncols(A)-nrows(A), ncols(A))) else B = lift(A) end diff --git a/src/LinearAlgebra/LatEnum.jl b/src/LinearAlgebra/LatEnum.jl index a48683a838..5d953e80cb 100644 --- a/src/LinearAlgebra/LatEnum.jl +++ b/src/LinearAlgebra/LatEnum.jl @@ -114,7 +114,7 @@ function enum_ctx_from_gram(G::ZZMatrix, den = 1; Tx = BigInt, TC = Rational{Big E.limit = limit E.d = den E.C = pseudo_cholesky(E.G, den, TC = TC, limit = limit) - E.x = zero_matrix(FlintZZ, 1, n) + E.x = zero_matrix(ZZ, 1, n) #coeffs limit+1:n are going to be zero, always E.L = Vector{TU}(undef, limit) #lower and E.U = Vector{TU}(undef, limit) #upper bounds for the coordinates @@ -367,7 +367,7 @@ function enum_ctx_short_elements(E::enum_ctx{A,B,C}, c::T, limit=-1) where {A,B, if enum_ctx_next(E) l = deepcopy(E.x) # else the 1st element is not returned.... else - l = matrix(FlintZZ, 0, E.n, ZZRingElem[]) + l = matrix(ZZ, 0, E.n, ZZRingElem[]) end while enum_ctx_next(E) && (limit == -1 || limit >= Base.size(l, 1)) l = vcat(l, E.x) @@ -419,7 +419,7 @@ end function enumerate_using_gram(G::ArbMatrix, c::ArbFieldElem) E = EnumCtxArb(pseudo_cholesky(G)) - return _enumerate(E, c, nrows(G), zero_matrix(FlintZZ, 1, nrows(G))) + return _enumerate(E, c, nrows(G), zero_matrix(ZZ, 1, nrows(G))) end function _enumerate(E::EnumCtxArb, c::ArbFieldElem, i::Int, x::ZZMatrix) diff --git a/src/LinearAlgebra/Solve.jl b/src/LinearAlgebra/Solve.jl index 3adb10feb0..f9150d1854 100644 --- a/src/LinearAlgebra/Solve.jl +++ b/src/LinearAlgebra/Solve.jl @@ -125,7 +125,7 @@ end function algebraic_reconstruction(a::AbsSimpleNumFieldElem, M::ZZRingElem) K = parent(a) n = degree(K) - Znn = matrix_space(FlintZZ, n, n) + Znn = matrix_space(ZZ, n, n) # L = [ Znn(1) representation_matrix_q(a)[1] ; Znn(0) Znn(M)] L = vcat(hcat(Znn(1), representation_matrix_q(a)[1]), hcat(Znn(0),Znn(M))) lll!(L) @@ -138,7 +138,7 @@ end function algebraic_reconstruction(a::AbsSimpleNumFieldElem, M::AbsNumFieldOrderIdeal) K = parent(a) n = degree(K) - Znn = matrix_space(FlintZZ, n, n) + Znn = matrix_space(ZZ, n, n) L = [ Znn(1) representation_matrix_q(a)[1] ; Znn(0) basis_matrix(M, copy = false)] lll!(L) d = Nemo.elem_from_mat_row(K, sub(L, 1:1, 1:n), 1, ZZRingElem(1)) @@ -161,7 +161,7 @@ function algebraic_split(a::AbsSimpleNumFieldElem) #actually find the kernel and then look for small elements #a = be/ga <=> M_a * ga - I * be = 0 (this is the kernel) #furthermore, I want be and ga to be "small" - the LLL - M = [M*dd identity_matrix(FlintZZ, n); -d^2*identity_matrix(FlintZZ, n) zero_matrix(FlintZZ, n, n)] + M = [M*dd identity_matrix(ZZ, n); -d^2*identity_matrix(ZZ, n) zero_matrix(ZZ, n, n)] L = lll(M) @assert iszero(L[1, 1:n]) L = L[1, n+1:2*n] diff --git a/src/LocalField/Completions.jl b/src/LocalField/Completions.jl index 801f3015da..f7fa43d039 100644 --- a/src/LocalField/Completions.jl +++ b/src/LocalField/Completions.jl @@ -199,7 +199,7 @@ function completion(K::AbsSimpleNumField, P::AbsNumFieldOrderIdeal{AbsSimpleNumF mp = find_morphism(q, F) g = gen(q) gq_in_K = (mF\(mp(g))).elem_in_nf - Zx = polynomial_ring(FlintZZ, "x", cached = false)[1] + Zx = polynomial_ring(ZZ, "x", cached = false)[1] pol_gq = map_coefficients(x -> lift(ZZ, x), defining_polynomial(Qq), cached = false) gq_in_K = _lift(gq_in_K, pol_gq, precision, P) #@assert mF(OK(gq_in_K)) == mp(g) @@ -331,7 +331,7 @@ function setprecision!(f::CompletionMap{LocalField{QadicFieldElem, EisensteinLoc @assert !(new_prec in keys(Kp.def_poly_cache)) gq, u = f.inv_img ex = div(new_prec+e-1, e) - Zx = polynomial_ring(FlintZZ, "x", cached = false)[1] + Zx = polynomial_ring(ZZ, "x", cached = false)[1] pol_gq = map_coefficients(x -> lift(ZZ, x), defining_polynomial(base_field(Kp)), cached = false) gq = _increase_precision(gq, pol_gq, div(f.precision+e-1, e), ex, P) f.inv_img = (gq, f.inv_img[2]) @@ -386,7 +386,7 @@ function totally_ramified_completion(K::AbsSimpleNumField, P::AbsNumFieldOrderId e = ramification_index(P) Qp = padic_field(minimum(P), precision = precision) Zp = maximal_order(Qp) - Zx = FlintZZ["x"][1] + Zx = ZZ["x"][1] Qpx = polynomial_ring(Qp, "x")[1] u = uniformizer(P).elem_in_nf pows_u = powers(u, e-1) @@ -503,7 +503,7 @@ function unramified_completion(K::AbsSimpleNumField, P::AbsNumFieldOrderIdeal{Ab mp = find_morphism(q, F) g = gen(q) gq_in_K = (mF\(mp(g))).elem_in_nf - Zx = polynomial_ring(FlintZZ, "x")[1] + Zx = polynomial_ring(ZZ, "x")[1] pol_gq = lift(Zx, defining_polynomial(q)) gq_in_K = _lift(gq_in_K, pol_gq, precision, P) #To compute the image of the primitive element, we use linear algebra if p is an index divisor @@ -545,7 +545,7 @@ function setprecision!(f::CompletionMap{QadicField, QadicFieldElem}, new_prec::I else P = prime(f) gq, u = f.inv_img - Zx = polynomial_ring(FlintZZ, "x")[1] + Zx = polynomial_ring(ZZ, "x")[1] q, mq = residue_field(Kp) pol_gq = lift(Zx, defining_polynomial(q)) gq = _increase_precision(gq, pol_gq, f.precision, new_prec, P) diff --git a/src/LocalField/Conjugates.jl b/src/LocalField/Conjugates.jl index 379984d332..a734eecf06 100644 --- a/src/LocalField/Conjugates.jl +++ b/src/LocalField/Conjugates.jl @@ -132,7 +132,7 @@ mutable struct qAdicConj is_ramified(maximal_order(K), p) && error("cannot deal with ramification yet") =# if splitting_field - Zx = polynomial_ring(FlintZZ, cached = false)[1] + Zx = polynomial_ring(ZZ, cached = false)[1] C = qAdicRootCtx(Zx(K.pol), p, splitting_field = true) r = new() r.C = C @@ -144,7 +144,7 @@ mutable struct qAdicConj return Dict{Int, Tuple{qAdicRootCtx, Dict{AbsSimpleNumFieldElem, Any}}}() end::Dict{Int, Tuple{qAdicRootCtx, Dict{AbsSimpleNumFieldElem, Any}}} Dp = get!(D, p) do - Zx = polynomial_ring(FlintZZ, cached = false)[1] + Zx = polynomial_ring(ZZ, cached = false)[1] d = lcm(map(denominator, coefficients(K.pol))) C = qAdicRootCtx(Zx(K.pol*d), p) return (C, Dict{AbsSimpleNumFieldElem, Any}()) @@ -222,7 +222,7 @@ end function _conjugates(a::AbsSimpleNumFieldElem, C::qAdicConj, n::Int, op::Function) R = roots(C.C, n) @assert parent(a) == C.K - Zx = polynomial_ring(FlintZZ, cached = false)[1] + Zx = polynomial_ring(ZZ, cached = false)[1] d = denominator(a) f = Zx(d*a) res = QadicFieldElem[] @@ -537,7 +537,7 @@ function completion(K::AbsSimpleNumField, ca::QadicFieldElem) C = qAdicConj(K, Int(p)) r = roots(C.C, precision(ca)) i = findfirst(x->parent(r[x]) == parent(ca) && r[x] == ca, 1:length(r)) - Zx = polynomial_ring(FlintZZ, cached = false)[1] + Zx = polynomial_ring(ZZ, cached = false)[1] function inj(a::AbsSimpleNumFieldElem) d = denominator(a) pr = precision(parent(ca)) @@ -564,7 +564,7 @@ function completion(K::AbsSimpleNumField, ca::QadicFieldElem) for i=1:d _num_setcoeff!(a, i-1, lift(ZZ, s[i, 1])) end - f = defining_polynomial(parent(ca), FlintZZ) + f = defining_polynomial(parent(ca), ZZ) fso = inv(derivative(f)(gen(R))) o = matrix(GF(p), d, 1, [lift(ZZ, coeff(fso, j-1)) for j=1:d]) s = solve(m, o; side = :right) diff --git a/src/LocalField/LocalField.jl b/src/LocalField/LocalField.jl index c38ef7f6a7..20ccf69de5 100644 --- a/src/LocalField/LocalField.jl +++ b/src/LocalField/LocalField.jl @@ -302,7 +302,7 @@ absolute_basis(K::PadicField) = PadicFieldElem[one(K)] #= function find_irreducible_polynomial(K, n::Int) - Zx, x = polynomial_ring(FlintZZ, "x", cached = false) + Zx, x = polynomial_ring(ZZ, "x", cached = false) f = cyclotomic(ppio(degree(K), n)*n, x) lf = factor(K, f) return first(keys(lf[1])) diff --git a/src/LocalField/Poly.jl b/src/LocalField/Poly.jl index 8de0aae7d9..178176bdb7 100644 --- a/src/LocalField/Poly.jl +++ b/src/LocalField/Poly.jl @@ -164,7 +164,7 @@ function fun_factor(g::Generic.Poly{PadicFieldElem}) Kt = parent(g) v = precision(g) pv = prime(K)^v - R = residue_ring(FlintZZ, pv, cached = false)[1] + R = residue_ring(ZZ, pv, cached = false)[1] Rt = polynomial_ring(R, "t", cached = false)[1] fR = Rt([R(Hecke.lift(ZZ, coeff(g, i))) for i = 0:degree(g)]) u, g1 = Hecke.fun_factor(fR) @@ -317,7 +317,7 @@ function invmod(u::Generic.Poly{PadicFieldElem}, f::Generic.Poly{PadicFieldElem} =# while true pv = prime(K)^v - R = residue_ring(FlintZZ, pv, cached = false)[1] + R = residue_ring(ZZ, pv, cached = false)[1] Rt = polynomial_ring(R, "t", cached = false)[1] fR = Rt(elem_type(R)[R(Hecke.lift(ZZ, coeff(f, i))) for i = 0:degree(f)]) uR = Rt(elem_type(R)[R(Hecke.lift(ZZ, coeff(u, i))) for i = 0:degree(u)]) @@ -519,7 +519,7 @@ function redcued_resultant(f::Generic.Poly{PadicFieldElem}, g::Generic.Poly{Padi K = base_ring(Kt) p = prime(K) v = min(precision(f), precision(g)) - R = residue_ring(FlintZZ, p^v, cached = false)[1] + R = residue_ring(ZZ, p^v, cached = false)[1] cf = Vector{elem_type(R)}(undef, degree(f)+1) for i = 1:length(cf) cf[i] = R(Hecke.lift(ZZ, coeff(f, i-1))) diff --git a/src/LocalField/qAdic.jl b/src/LocalField/qAdic.jl index d8dad62c43..4543e4b632 100644 --- a/src/LocalField/qAdic.jl +++ b/src/LocalField/qAdic.jl @@ -67,7 +67,7 @@ function lift_reco(::QQField, a::PadicFieldElem; reco::Bool = false) fl, c, d = rational_reconstruction(u, prime(R, N-v)) !fl && return nothing - x = FlintQQ(c, d) + x = QQ(c, d) if v < 0 return x//prime(R, -v) else diff --git a/src/Map/GrpAb.jl b/src/Map/GrpAb.jl index 8d37fd2aa6..e3d5e9efa0 100644 --- a/src/Map/GrpAb.jl +++ b/src/Map/GrpAb.jl @@ -50,8 +50,8 @@ mutable struct FinGenAbGroupHom <: Map{FinGenAbGroup, FinGenAbGroup, function FinGenAbGroupHom(G::FinGenAbGroup) r = new() r.header = MapHeader(G, G) - r.map = identity_matrix(FlintZZ, ngens(G)) - r.imap = identity_matrix(FlintZZ, ngens(G)) + r.map = identity_matrix(ZZ, ngens(G)) + r.imap = identity_matrix(ZZ, ngens(G)) return r end @@ -75,7 +75,7 @@ mutable struct FinGenAbGroupHom <: Map{FinGenAbGroup, FinGenAbGroup, D = domain(M) r.header = MapHeader(D, codomain(M)) if ngens(D) == 0 - r.map = matrix(FlintZZ, 0, ngens(codomain(M)), ZZRingElem[]) + r.map = matrix(ZZ, 0, ngens(codomain(M)), ZZRingElem[]) else r.map = reduce(vcat, [M(D[i]).coeff for i=1:ngens(D)]) end diff --git a/src/Map/NumField.jl b/src/Map/NumField.jl index 1727aabaf1..24275814cb 100644 --- a/src/Map/NumField.jl +++ b/src/Map/NumField.jl @@ -743,7 +743,7 @@ function _assert_has_preimage_data(f::NumFieldHom) b = absolute_basis(K) d = absolute_degree(K) n = absolute_degree(L) - M = zero_matrix(FlintQQ, n, d) + M = zero_matrix(QQ, n, d) for i in 1:d c = f(b[i]) cc = absolute_coordinates(c) diff --git a/src/Map/NumberField.jl b/src/Map/NumberField.jl index 6f4647c8ef..4bb356a380 100644 --- a/src/Map/NumberField.jl +++ b/src/Map/NumberField.jl @@ -208,7 +208,7 @@ function is_cm_field_easy(K::AbsSimpleNumField) E = maximal_order(K) end n = degree(E) - g = zero_matrix(FlintZZ, n, n) + g = zero_matrix(ZZ, n, n) B = basis(E, nf(E)) prec = 32 imgs = Vector{Vector{ArbFieldElem}}(undef, n) @@ -343,7 +343,7 @@ function induce_image(f::NumFieldHom{AbsSimpleNumField, AbsSimpleNumField}, x::A bb[i] = OK(f(K(B[i]))) end I.basis = bb - M = zero_matrix(FlintZZ, degree(K), degree(K)) + M = zero_matrix(ZZ, degree(K), degree(K)) for i = 1:degree(K) el = coordinates(I.basis[i]) for j = 1:degree(K) @@ -358,7 +358,7 @@ end function induce_image_easy(f::NumFieldHom{AbsSimpleNumField, AbsSimpleNumField}, P::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}) OK = order(P) K = nf(OK) - R = residue_ring(FlintZZ, Int(minimum(P, copy = false))^2, cached = false)[1] + R = residue_ring(ZZ, Int(minimum(P, copy = false))^2, cached = false)[1] Rx = polynomial_ring(R, "t", cached = false)[1] fmod = Rx(K.pol) prim_img = Rx(image_primitive_element(f)) @@ -396,7 +396,7 @@ mutable struct NfAbsToAbsAlgAssMor{S} <: Map{AbsSimpleNumField, S, HeckeMap, NfA function NfAbsToAbsAlgAssMor{S}(K::AbsSimpleNumField, A::S, M::QQMatrix) where { S <: AbstractAssociativeAlgebra{QQFieldElem} } z = new{S}() z.mat = M - z.t = zero_matrix(FlintQQ, 1, degree(K)) + z.t = zero_matrix(QQ, 1, degree(K)) function _image(x::AbsSimpleNumFieldElem) for i = 1:degree(K) @@ -417,7 +417,7 @@ end function has_preimage_with_preimage(m::NfAbsToAbsAlgAssMor, a::AbstractAssociativeAlgebraElem) A = parent(a) - t = matrix(FlintQQ, 1, dim(A), coefficients(a)) + t = matrix(QQ, 1, dim(A), coefficients(a)) b, p = can_solve_with_solution(m.mat, t, side = :left) if b return true, domain(m)([ p[1, i] for i = 1:nrows(m.mat) ]) @@ -443,12 +443,12 @@ function is_involution(f::NumFieldHom{AbsSimpleNumField, AbsSimpleNumField}) return false end p = 2 - R = residue_ring(FlintZZ, p, cached = false)[1] + R = residue_ring(ZZ, p, cached = false)[1] Rt = polynomial_ring(R, "t", cached = false)[1] fmod = Rt(K.pol) while iszero(discriminant(fmod)) p = next_prime(p) - R = residue_ring(FlintZZ, p, cached = false)[1] + R = residue_ring(ZZ, p, cached = false)[1] Rt = polynomial_ring(R, "t", cached = false)[1] fmod = Rt(K.pol) end @@ -470,12 +470,12 @@ function _order(f::NumFieldHom{AbsSimpleNumField, AbsSimpleNumField}) return 1 end p = 2 - R = residue_ring(FlintZZ, p, cached = false)[1] + R = residue_ring(ZZ, p, cached = false)[1] Rt = polynomial_ring(R, "t", cached = false)[1] fmod = Rt(K.pol) while iszero(discriminant(fmod)) p = next_prime(p) - R = residue_ring(FlintZZ, p, cached = false)[1] + R = residue_ring(ZZ, p, cached = false)[1] Rt = polynomial_ring(R, "t", cached = false)[1] fmod = Rt(K.pol) end diff --git a/src/Map/automorphisms.jl b/src/Map/automorphisms.jl index d4631227ae..debde7534a 100644 --- a/src/Map/automorphisms.jl +++ b/src/Map/automorphisms.jl @@ -29,7 +29,7 @@ function _automorphisms(K::AbsSimpleNumField; is_abelian::Bool = false) if Nemo.is_cyclo_type(K) f = get_attribute(K, :cyclo)::Int a = gen(K) - A, mA = unit_group(residue_ring(FlintZZ, f, cached = false)[1]) + A, mA = unit_group(residue_ring(ZZ, f, cached = false)[1]) auts = automorphism_type(K)[ hom(K, K, a^lift(mA(g)), check = false) for g in A] return auts end @@ -94,7 +94,7 @@ end function _auts_cyclo(K::AbsSimpleNumField) f = get_attribute(K, :cyclo)::Int a = gen(K) - A, mA = unit_group(residue_ring(FlintZZ, f, cached = false)[1]) + A, mA = unit_group(residue_ring(ZZ, f, cached = false)[1]) auts = automorphism_type(K)[ hom(K, K, a^lift(mA(g)), check = false) for g in gens(A)] return auts end @@ -198,7 +198,7 @@ end function _automorphism_group_cyclo(K) f = get_attribute(K, :cyclo)::Int a = gen(K) - A, mA = unit_group(residue_ring(FlintZZ, f)[1]) + A, mA = unit_group(residue_ring(ZZ, f)[1]) G, AtoG, GtoA = generic_group(collect(A), +) aut = automorphism_type(K)[ hom(K, K, a^lift(mA(GtoA[g])), check = false) for g in G] set_automorphisms(K, aut) @@ -442,7 +442,7 @@ end function lift_root(K::AbsSimpleNumField, b, bound::Int) Fx = parent(b) fF = Fx(K.pol) - Zx = polynomial_ring(FlintZZ, "x")[1] + Zx = polynomial_ring(ZZ, "x")[1] p = modulus(Fx) test = 2^10 dfF = derivative(fF) @@ -454,7 +454,7 @@ function lift_root(K::AbsSimpleNumField, b, bound::Int) #Now, the lifting r_old = one(K) modu = ZZRingElem(p)^2 - R = residue_ring(FlintZZ, modu, cached = false)[1] + R = residue_ring(ZZ, modu, cached = false)[1] Rx = polynomial_ring(R, "x", cached = false)[1] fR = map_coefficients(R, Zx(K.pol), parent = Rx) Rb_0 = Rx(b_0) @@ -471,7 +471,7 @@ function lift_root(K::AbsSimpleNumField, b, bound::Int) while i < bound && r != r_old && !check_root(K, test, r) i += 1 modu = modu^2 - R = residue_ring(FlintZZ, modu, cached = false)[1] + R = residue_ring(ZZ, modu, cached = false)[1] Rx = polynomial_ring(R, "x", cached = false)[1] fR = Rx(K.pol) Rb_0 = Rx(b_0) @@ -503,8 +503,8 @@ end function _frobenius_at(K::AbsSimpleNumField, p::Int, auts::Vector{<:NumFieldHom{AbsSimpleNumField, AbsSimpleNumField}} = automorphism_type(K)[]; bound::Int = 100) - Zx = FlintZZ["x"][1] - F = residue_ring(FlintZZ, p, cached = false)[1] + Zx = ZZ["x"][1] + F = residue_ring(ZZ, p, cached = false)[1] Fx, gFx = polynomial_ring(F, "x", cached = false) fF = map_coefficients(F, Zx(K.pol), parent = Fx) b = powermod(gFx, p, fF) @@ -669,7 +669,7 @@ function automorphism_list(K::NumField, L::NumField) end function absolute_automorphism_list(K::NumField) - return _automorphisms(K, K, FlintQQ) + return _automorphisms(K, K, QQ) end function _automorphisms(K::NumField{QQFieldElem}, F::NumField, L::QQField) diff --git a/src/Misc/CRT.jl b/src/Misc/CRT.jl index 5a11ff495d..ba55a5965b 100644 --- a/src/Misc/CRT.jl +++ b/src/Misc/CRT.jl @@ -50,7 +50,7 @@ end @doc raw""" crt_env(p::Vector{T}) -> crt_env{T} -Given coprime moduli in some euclidean ring (FlintZZ, zzModRingElem\_poly, +Given coprime moduli in some euclidean ring (ZZ, zzModRingElem\_poly, ZZRingElem\_mod\_poly), prepare data for fast application of the chinese remainder theorem for those moduli. """ @@ -456,7 +456,7 @@ Given ZZRingElem\_poly polynomials $L[i]$ and a `crt\_env`, apply the `crt` function to each coefficient resulting in a polynomial $f = L[i] \bmod p[i]$. """ function induce_crt(L::Vector{T}, c::crt_env{ZZRingElem}) where {T <: PolyRingElem} - Zx, x = FlintZZ["x"] + Zx, x = ZZ["x"] res = Zx() m = maximum(degree(x) for x = L) @@ -518,7 +518,7 @@ Given matrices $L[i]$ and a `crt\_env`, apply the `crt` function to each coefficient resulting in a matrix $M = L[i] \bmod p[i]$. """ function induce_crt(L::Vector{T}, c::crt_env{ZZRingElem}, signed::Bool = false) where {T <: MatElem} - res = zero_matrix(FlintZZ, nrows(L[1]), ncols(L[1])) + res = zero_matrix(ZZ, nrows(L[1]), ncols(L[1])) if signed cr = crt_signed @@ -582,7 +582,7 @@ function modular_init(K::AbsSimpleNumField, p::ZZRingElem; lazy::Bool = false, d @hassert :AbsNumFieldOrder 1 is_prime(p) me = modular_env() pp = Int(p) - me.Fpx = polynomial_ring(residue_ring(FlintZZ, Int(p), cached = false)[1], "_x", cached=false)[1] + me.Fpx = polynomial_ring(residue_ring(ZZ, Int(p), cached = false)[1], "_x", cached=false)[1] fp = me.Fpx(K.pol) if lazy if !is_squarefree(fp) diff --git a/src/Misc/Fields.jl b/src/Misc/Fields.jl index 26aaf72d0e..30c07e22a6 100644 --- a/src/Misc/Fields.jl +++ b/src/Misc/Fields.jl @@ -51,7 +51,7 @@ function _field_as_vector_space(f) ad = absolute_degree(L) - absbasismat = zero_matrix(FlintQQ, ad, ad) + absbasismat = zero_matrix(QQ, ad, ad) for i in 1:ad c = absolute_coordinates(absB[i]) diff --git a/src/Misc/IJulia.jl b/src/Misc/IJulia.jl index 942b2a349b..a7256b7993 100644 --- a/src/Misc/IJulia.jl +++ b/src/Misc/IJulia.jl @@ -268,7 +268,7 @@ math_html(io::IO, a::Rational) = math_html(io, QQFieldElem(a)) function Base.show(io::IO, ::MIME"text/html", ::QQField) print(io, "\$") - math_html(io, FlintQQ) + math_html(io, QQ) print(io, "\$") end @@ -278,7 +278,7 @@ end function Base.show(io::IO, ::MIME"text/html", ::ZZRing) print(io, "\$") - math_html(io, FlintQQ) + math_html(io, QQ) print(io, "\$") end diff --git a/src/Misc/Integer.jl b/src/Misc/Integer.jl index b15e2b0c79..4b8ae1b77d 100644 --- a/src/Misc/Integer.jl +++ b/src/Misc/Integer.jl @@ -101,7 +101,7 @@ function sunit_group_fac_elem(S::Vector{ZZRingElem}) return FacElem(Sq, ZZRingElem[a.coeff[1, i] for i = 1:length(S)]) end - mp.header = MapHeader(G, FacElemMon(FlintQQ), dexp) + mp.header = MapHeader(G, FacElemMon(QQ), dexp) return G, mp end @@ -152,7 +152,7 @@ function sunit_group(S::Vector{ZZRingElem}) return evaluate(image(mu, a)) end - mp.header = MapHeader(u, FlintQQ, dexp, y->preimage(mu, y)) + mp.header = MapHeader(u, QQ, dexp, y->preimage(mu, y)) return u, mp end @@ -321,7 +321,7 @@ function unit_group(::ZZRing) log = function (z::ZZRingElem) return z == -1 ? G[1] : G[0] end - return G, MapFromFunc(G, FlintZZ, exp, log) + return G, MapFromFunc(G, ZZ, exp, log) end @doc raw""" @@ -576,12 +576,12 @@ function radical(a::T) where {T<:Integer} end function quo(::ZZRing, a::ZZRingElem) - R, f = residue_ring(FlintZZ, a) + R, f = residue_ring(ZZ, a) return R, f end function quo(::ZZRing, a::Integer) - R, f = residue_ring(FlintZZ, a) + R, f = residue_ring(ZZ, a) return R, f end diff --git a/src/Misc/Matrix.jl b/src/Misc/Matrix.jl index e921eae7f8..52c3779661 100644 --- a/src/Misc/Matrix.jl +++ b/src/Misc/Matrix.jl @@ -297,21 +297,21 @@ end ################################################################################ function lift_nonsymmetric(a::zzModMatrix) - z = zero_matrix(FlintZZ, nrows(a), ncols(a)) + z = zero_matrix(ZZ, nrows(a), ncols(a)) ccall((:fmpz_mat_set_nmod_mat_unsigned, Hecke.libflint), Nothing, (Ref{ZZMatrix}, Ref{zzModMatrix}), z, a) return z end function lift_nonsymmetric(a::fpMatrix) - z = zero_matrix(FlintZZ, nrows(a), ncols(a)) + z = zero_matrix(ZZ, nrows(a), ncols(a)) ccall((:fmpz_mat_set_nmod_mat_unsigned, Hecke.libflint), Nothing, (Ref{ZZMatrix}, Ref{fpMatrix}), z, a) return z end function lift_unsigned(a::zzModMatrix) - z = zero_matrix(FlintZZ, nrows(a), ncols(a)) + z = zero_matrix(ZZ, nrows(a), ncols(a)) ccall((:fmpz_mat_set_nmod_mat_unsigned, libflint), Nothing, (Ref{ZZMatrix}, Ref{zzModMatrix}), z, a) return z @@ -396,7 +396,7 @@ end #converts BigFloat -> ZZRingElem via round(a*2^l), in a clever(?) way function round_scale(a::Matrix{BigFloat}, l::Int) s = size(a) - b = zero_matrix(FlintZZ, s[1], s[2]) + b = zero_matrix(ZZ, s[1], s[2]) return round_scale!(b, a, l) end @@ -453,12 +453,12 @@ end ################################################################################ function snf_for_groups(A::ZZMatrix, mod::ZZRingElem) - R = identity_matrix(FlintZZ, ncols(A)) + R = identity_matrix(ZZ, ncols(A)) S = deepcopy(A) if !is_diagonal(S) - T = zero_matrix(FlintZZ, ncols(A), ncols(A)) + T = zero_matrix(ZZ, ncols(A), ncols(A)) GC.@preserve S R T begin while true hnf_modular_eldiv!(S, mod) @@ -966,7 +966,7 @@ end function invmod(M::ZZMatrix, d::ZZRingElem) if fits(Int, d) - RR = residue_ring(FlintZZ, Int(d), cached = false)[1] + RR = residue_ring(ZZ, Int(d), cached = false)[1] MRR = map_entries(RR, M) SR = zero_matrix(RR, 2*nrows(M), 2*nrows(M)) _copy_matrix_into_matrix(SR, 1, 1, MRR) @@ -979,7 +979,7 @@ function invmod(M::ZZMatrix, d::ZZRingElem) #@assert iMR*MRR == identity_matrix(RR, nrows(M)) return lift(iMR) else - R = residue_ring(FlintZZ, d, cached = false)[1] + R = residue_ring(ZZ, d, cached = false)[1] MR = map_entries(R, M) S = zero_matrix(R, 2*nrows(M), 2*nrows(M)) _copy_matrix_into_matrix(S, 1, 1, MR) diff --git a/src/Misc/Plesken.jl b/src/Misc/Plesken.jl index 5c2b7a02e7..97605795d7 100644 --- a/src/Misc/Plesken.jl +++ b/src/Misc/Plesken.jl @@ -169,7 +169,7 @@ end function _find_exponent(f::Int, p::ZZRingElem, r::ZZRingElem, n::Int) xZx = ZZ["x"][2] phi = cyclotomic(f, xZx) - R = residue_ring(FlintZZ, r^(n+1), cached = false)[1] + R = residue_ring(ZZ, r^(n+1), cached = false)[1] Rx = polynomial_ring(R, "x", cached = false)[1] phiR = Rx(phi) phiR1 = derivative(phiR) diff --git a/src/Misc/Poly.jl b/src/Misc/Poly.jl index 90f1b4a286..4398eeb38c 100644 --- a/src/Misc/Poly.jl +++ b/src/Misc/Poly.jl @@ -9,7 +9,7 @@ Apply `rational_reconstruction` to each coefficient of $a$, resulting in either a fail (return (false, s.th.)) or (true, g) for some rational polynomial $g$ s.th. $g \equiv a \bmod M$. """ -function induce_rational_reconstruction(a::ZZPolyRingElem, M::ZZRingElem; parent=polynomial_ring(FlintQQ, parent(a).S, cached = false)[1]) +function induce_rational_reconstruction(a::ZZPolyRingElem, M::ZZRingElem; parent=polynomial_ring(QQ, parent(a).S, cached = false)[1]) b = parent() for i=0:degree(a) fl, x,y = rational_reconstruction(coeff(a, i), M) @@ -56,7 +56,7 @@ end function precomp_compose_mod(y::ZZModPolyRingElem, z::ZZModPolyRingElem) zinv = _inv_compose_mod(z) nr = Int(iroot(degree(z), 2)) + 1 - A = zero_matrix(FlintZZ, nr, degree(z)) + A = zero_matrix(ZZ, nr, degree(z)) ccall((:fmpz_mod_poly_precompute_matrix, libflint), Nothing, (Ref{ZZMatrix}, Ref{ZZModPolyRingElem}, Ref{ZZModPolyRingElem}, Ref{ZZModPolyRingElem}, Ref{fmpz_mod_ctx_struct}), A, y, z, zinv, y.parent.base_ring.ninv) return A, zinv @@ -104,7 +104,7 @@ end ################################################################################ function factor_to_dict(a::fmpz_poly_factor) res = Dict{ZZPolyRingElem,Int}() - Zx,x = polynomial_ring(FlintZZ, "x", cached = false) + Zx,x = polynomial_ring(ZZ, "x", cached = false) for i in 1:a._num f = Zx() ccall((:fmpz_poly_set, libflint), Nothing, (Ref{ZZPolyRingElem}, Ref{fmpz_poly_raw}), f, a.poly+(i-1)*sizeof(fmpz_poly_raw)) @@ -113,7 +113,7 @@ function factor_to_dict(a::fmpz_poly_factor) return res end -function factor_to_array(a::fmpz_poly_factor; parent::ZZPolyRing = polynomial_ring(FlintZZ, "x", cached = false)[1]) +function factor_to_array(a::fmpz_poly_factor; parent::ZZPolyRing = polynomial_ring(ZZ, "x", cached = false)[1]) res = Vector{Tuple{ZZPolyRingElem, Int}}() Zx = parent for i in 1:a._num @@ -336,7 +336,7 @@ end function rres_bez(f::ZZPolyRingElem, g::ZZPolyRingElem) Nemo.check_parent(f, g) - Qx = polynomial_ring(FlintQQ, "x", cached = false)[1] + Qx = polynomial_ring(QQ, "x", cached = false)[1] f1 = Qx(f) g1 = Qx(g) d, q, w = gcdx(f1, g1) @@ -378,7 +378,7 @@ $\deg u < \deg g$ and $\deg v < \deg f$. function rresx(f::ZZPolyRingElem, g::ZZPolyRingElem) Nemo.check_parent(f, g) @assert typeof(f) == typeof(g) - Qx = polynomial_ring(FlintQQ, "x", cached = false)[1] + Qx = polynomial_ring(QQ, "x", cached = false)[1] g, q, w = gcdx(Qx(f), Qx(g)) l = lcm(denominator(q), denominator(w)) Zx = parent(f) @@ -705,14 +705,14 @@ function roots(::QQField, f::ZZPolyRingElem; max_roots::Int=degree(f)) end function roots(f::ZZPolyRingElem; max_roots::Int=degree(f)) - r = roots(FlintQQ, f, max_roots=max_roots) - return ZZRingElem[FlintZZ(x) for x = r if denominator(x) == 1] + r = roots(QQ, f, max_roots=max_roots) + return ZZRingElem[ZZ(x) for x = r if denominator(x) == 1] end function roots(f::QQPolyRingElem; max_roots::Int=degree(f)) - Zx, x = polynomial_ring(FlintZZ, cached = false) + Zx, x = polynomial_ring(ZZ, cached = false) g = Zx(denominator(f)*f) - return roots(FlintQQ, g) + return roots(QQ, g) end function roots(R::AcbField, f::Union{ZZPolyRingElem, QQPolyRingElem}, abs_tol::Int=R.prec, initial_prec::Int...) diff --git a/src/Misc/PseudoPolynomial.jl b/src/Misc/PseudoPolynomial.jl index 00213d2c06..db4f191872 100644 --- a/src/Misc/PseudoPolynomial.jl +++ b/src/Misc/PseudoPolynomial.jl @@ -82,7 +82,7 @@ function _contains(a::AbsSimpleNumFieldElem, I) OK = maximal_order(parent(a)) dena = denominator(a, OK) d = lcm(dena, lcm([denominator(id) for id in I])) - v = matrix(FlintZZ, 1, degree(OK), coordinates(OK(d * a))) + v = matrix(ZZ, 1, degree(OK), coordinates(OK(d * a))) @assert all(isone(denominator(basis_matrix(d * id))) for id in I) M = reduce(vcat, [numerator(basis_matrix(d * id)) for id in I ]) w = solve(M', v', side = :right) diff --git a/src/Misc/RatRecon.jl b/src/Misc/RatRecon.jl index ffd559aef7..de5217c465 100644 --- a/src/Misc/RatRecon.jl +++ b/src/Misc/RatRecon.jl @@ -258,7 +258,7 @@ function rational_reconstruction_mod(g::QQPolyRingElem, f::QQPolyRingElem, bnd:: # bound n and a starting p kp = 10 L =[] - pp = FlintZZ(1) + pp = ZZ(1) j = 0 local N, D while true @@ -272,9 +272,9 @@ function rational_reconstruction_mod(g::QQPolyRingElem, f::QQPolyRingElem, bnd:: N,_ = induce_crt(N, pp, L[1], L[3]) D,pp = induce_crt(D, pp, L[2], L[3]) end - fl, nu_rat_f = induce_rational_reconstruction(N, FlintZZ(pp), parent = parent(g)) + fl, nu_rat_f = induce_rational_reconstruction(N, ZZ(pp), parent = parent(g)) if fl - fl, de_rat_f = induce_rational_reconstruction(D, FlintZZ(pp), parent = parent(g)) + fl, de_rat_f = induce_rational_reconstruction(D, ZZ(pp), parent = parent(g)) if fl t = de_rat_f *g - nu_rat_f if ErrorTolerant @@ -319,7 +319,7 @@ function _inner_modp_results(g::QQPolyRingElem,f::QQPolyRingElem, p::ZZRingElem, while true np += 1 if testPrime_jl(f,p) == true && testPrime_jl(g,p) == true - Rp, t = polynomial_ring(residue_ring(FlintZZ, p, cached=false)[1], cached=false) + Rp, t = polynomial_ring(residue_ring(ZZ, p, cached=false)[1], cached=false) gp = Rp(g) fp = Rp(f) fl, nu_p, de_p = rational_reconstruction_subres(gp, fp, bnd, ErrorTolerant = ErrorTolerant) @@ -390,7 +390,7 @@ function berlekamp_massey_mod(L::Vector{QQFieldElem}; parent = Globals.Qx) end p = next_prime(ZZRingElem(p_start)) kp = 10 - pp = FlintZZ(1) + pp = ZZ(1) j = 0 local N while true @@ -403,7 +403,7 @@ function berlekamp_massey_mod(L::Vector{QQFieldElem}; parent = Globals.Qx) N, pp = induce_crt(N, pp, L[1], L[2]) j=1 end - fl, nu_rat_f = induce_rational_reconstruction(N, FlintZZ(pp), parent = Rc) + fl, nu_rat_f = induce_rational_reconstruction(N, ZZ(pp), parent = Rc) if fl return true, nu_rat_f #the check for roots is ONLY useful in multivariate interpolation @@ -422,7 +422,7 @@ function _modpResults(f, p::ZZRingElem, M::Int) Rc = f.parent l1 = fpPolyRingElem[]; l3 = ZZRingElem[] Np = listprimes([f], p, M) - Zx, Y = polynomial_ring(FlintZZ, "Y", cached=false) + Zx, Y = polynomial_ring(ZZ, "Y", cached=false) for j in 1:length(Np) RNp = Native.GF(Int(Np[j]), cached=false) Rp, t = polynomial_ring(RNp, "t", cached=false) diff --git a/src/Misc/UnitsModM.jl b/src/Misc/UnitsModM.jl index 7e5af4678f..0854c9b1b3 100644 --- a/src/Misc/UnitsModM.jl +++ b/src/Misc/UnitsModM.jl @@ -57,8 +57,8 @@ function gen_mod_pk(p::ZZRingElem, mod::ZZRingElem=ZZRingElem(0)) gc = gcd(p-1, mod) mi = divexact(p-1, gc) fp = factor(gc) - Rp = residue_ring(FlintZZ, p, cached=false)[1] - Rpp = residue_ring(FlintZZ, p*p, cached=false)[1] + Rp = residue_ring(ZZ, p, cached=false)[1] + Rpp = residue_ring(ZZ, p*p, cached=false)[1] g = ZZRingElem(2) if is_primitive_root(Rp(g)^mi, gc, fp) @@ -486,7 +486,7 @@ function _unit_pk_mod_n(p::Int, v::Int, n::Int) if v>=2 && n % p==0 #We know that (1+p)^(p-1) generates the p-Sylow of Z/p^vZ #We only need the quotient by p^valuation(n,p) - R = residue_ring(FlintZZ, p^v, cached=false)[1] + R = residue_ring(ZZ, p^v, cached=false)[1] gen = R(1+p)^(p-1) ord1 = gcd(p^(v-1), n) aux1 = div(p^(v-1), ord1) @@ -548,7 +548,7 @@ function _unit_pk_mod_n(p::Int, v::Int, n::Int) return Int[], Int[], disclog4 end if v==2 - R = residue_ring(FlintZZ, 4, cached=false)[1] + R = residue_ring(ZZ, 4, cached=false)[1] local disclog5 let R = R function disclog5(x::Int) @@ -562,7 +562,7 @@ function _unit_pk_mod_n(p::Int, v::Int, n::Int) end return Int[-1], Int[2], disclog5 else - R = residue_ring(FlintZZ, 2^v, cached=false)[1] + R = residue_ring(ZZ, 2^v, cached=false)[1] ord = gcd(2^(v-2), n) gens = Int[-1,5] exps = divexact(2^(v-2), ord) diff --git a/src/Misc/nmod_poly.jl b/src/Misc/nmod_poly.jl index b457bb618b..510d979da6 100644 --- a/src/Misc/nmod_poly.jl +++ b/src/Misc/nmod_poly.jl @@ -99,7 +99,7 @@ function resultant_ideal(f::PolyRingElem{T}, g::PolyRingElem{T}) where T <: ResE for p = cp lg = p^valuation(m, p) push!(pg, lg) - R1 = residue_ring(FlintZZ, S(lg), cached = false)[1] + R1 = residue_ring(ZZ, S(lg), cached = false)[1] R1t = polynomial_ring(R1, cached = false)[1] #g is bad in R1, so factor it gR1 = R1t(T[R1(lift(coeff(g, i))) for i = 0:degree(g)]) @@ -199,7 +199,7 @@ function resultant_ideal_pp(f::PolyRingElem{T}, g::PolyRingElem{T}) where T <: R s = gcd(lift(res), pn) if !isone(s) new_pn = divexact(pn, s) - R1 = residue_ring(FlintZZ, S(new_pn), cached = false)[1] + R1 = residue_ring(ZZ, S(new_pn), cached = false)[1] R1t = polynomial_ring(R1, "y", cached = false)[1] f2 = R1t(T[R1(lift(coeff(f, i))) for i = 0:degree(f)]) g2 = R1t(T[R1(lift(coeff(g, i))) for i = 0:degree(g)]) @@ -245,7 +245,7 @@ function rres_hnf(f::PolyRingElem{T}, g::PolyRingElem{T}) where T <: ResElem{S} Nemo.check_parent(f, g) @assert typeof(f) == typeof(g) R = base_ring(f) - Zx = polynomial_ring(FlintZZ, "x", cached = false)[1] + Zx = polynomial_ring(ZZ, "x", cached = false)[1] s = Nemo.Generic.sylvester_matrix(lift(Zx, f), lift(Zx, g)) h = hnf(s) return gcd(R(0), R(h[nrows(h), ncols(h)])) @@ -255,8 +255,8 @@ function rres_bez(f::PolyRingElem{T}, g::PolyRingElem{T}) where T <: ResElem{S} Nemo.check_parent(f, g) @assert typeof(f) == typeof(g) R = base_ring(f) - Zx = polynomial_ring(FlintZZ, "x", cached = false)[1] - Qx = polynomial_ring(FlintQQ, "x", cached = false)[1] + Zx = polynomial_ring(ZZ, "x", cached = false)[1] + Qx = polynomial_ring(QQ, "x", cached = false)[1] g, q, w = gcdx(Qx(lift(Zx, f)), Qx(lift(Zx, g))) return gcd(R(0), R(lcm(denominator(q), denominator(w)))) end @@ -275,7 +275,7 @@ function prs_sircana(f::PolyRingElem{T}, g::PolyRingElem{T}) where T <: ResElem{ easy = is_prime(p) @assert easy - Zx = polynomial_ring(FlintZZ, cached = false)[1] + Zx = polynomial_ring(ZZ, cached = false)[1] rs = [] @@ -389,7 +389,7 @@ function rres_sircana(f1::PolyRingElem{T}, g1::PolyRingElem{T}) where T <: ResEl f = deepcopy(f1) g = deepcopy(g1) - Zx = polynomial_ring(FlintZZ, cached = false)[1] + Zx = polynomial_ring(ZZ, cached = false)[1] res = R(1) while true @@ -456,7 +456,7 @@ function rres_sircana(f1::PolyRingElem{T}, g1::PolyRingElem{T}) where T <: ResEl for p = cp lg = p^valuation(m, p) push!(pg, lg) - R1 = residue_ring(FlintZZ, S(lg), cached=false)[1] + R1 = residue_ring(ZZ, S(lg), cached=false)[1] R1t = polynomial_ring(R1, cached=false)[1] #g is bad in R1, so factor it gR1 = R1t(lift(Zx, g)) @@ -554,7 +554,7 @@ function _rresx_sircana(f::PolyRingElem{T}, g::PolyRingElem{T}) where T <: ResEl Rt = parent(f) R = base_ring(Rt) - Zx = polynomial_ring(FlintZZ, "x", cached = false)[1] + Zx = polynomial_ring(ZZ, "x", cached = false)[1] m = ZZRingElem(modulus(R)) #easy = is_prime_power(m) #if easy @@ -620,7 +620,7 @@ function _rresx_sircana(f::PolyRingElem{T}, g::PolyRingElem{T}) where T <: ResEl for p = cp lg = p^valuation(m, p) push!(pg, lg) - R1 = residue_ring(FlintZZ, S(lg), cached=false)[1] + R1 = residue_ring(ZZ, S(lg), cached=false)[1] R1t = polynomial_ring(R1, cached=false)[1] #g is bad in R1, so factor it gR1 = R1t(lift(Zx, g)) @@ -668,7 +668,7 @@ function _rresx_sircana_pp(f1::PolyRingElem{T}, g1::PolyRingElem{T}) where T <: Rt = parent(f1) R = base_ring(Rt) - Zx = polynomial_ring(FlintZZ, "x", cached = false)[1] + Zx = polynomial_ring(ZZ, "x", cached = false)[1] m = ZZRingElem(modulus(R)) f = f1 g = g1 @@ -882,7 +882,7 @@ function resultant_sircana(f::PolyRingElem{T}, g::PolyRingElem{T}) where T <: Re e, p = is_perfect_power_with_data(m) easy = is_prime(p) - Zx = polynomial_ring(FlintZZ, cached = false)[1] + Zx = polynomial_ring(ZZ, cached = false)[1] res = R(1) @@ -962,7 +962,7 @@ function resultant_sircana(f::PolyRingElem{T}, g::PolyRingElem{T}) where T <: Re push!(pg, lg) if lg != m - R1 = residue_ring(FlintZZ, S(lg), cached=false)[1] + R1 = residue_ring(ZZ, S(lg), cached=false)[1] R1t = polynomial_ring(R1, cached=false)[1] #g is bad in R1, so factor it gR1 = R1t(lift(Zx, g)) @@ -1060,11 +1060,11 @@ function fun_factor(f::T) where T <: Union{ZZModPolyRingElem, zzModPolyRingElem} end setcoeff!(g0, ind, one(R)) - Zy, y = polynomial_ring(FlintZZ, "y", cached = false) + Zy, y = polynomial_ring(ZZ, "y", cached = false) f2 = lift(Zy, f) mod = ZZRingElem(gcd(smod, ZZRingElem(modulus(Rx)))) #We have the equality modulo mod mod = gcd(mod*mod, ZZRingElem(modulus(Rx))) - R1 = residue_ring(FlintZZ, mod, cached = false)[1] + R1 = residue_ring(ZZ, mod, cached = false)[1] R1x, x = polynomial_ring(R1, "x", cached = false) s = R1x(lift(inv(coeff(u0, 0)))) t = zero(R1x) @@ -1082,7 +1082,7 @@ function fun_factor(f::T) where T <: Union{ZZModPolyRingElem, zzModPolyRingElem} if mod > modRx mod = modRx end - R1 = residue_ring(FlintZZ, mod, cached = false)[1] + R1 = residue_ring(ZZ, mod, cached = false)[1] R1x, x = polynomial_ring(R1, "x", cached = false) u = R1x(lift(Zy, u)) g = R1x(lift(Zy, g)) @@ -1237,7 +1237,7 @@ function unit_group_1_part(f::fqPolyRepPolyRingElem, k::Int) b = basis(K) gens = [1+f*x^i*c for i=0:degree(f)-1 for c = b] - rels = identity_matrix(FlintZZ, length(gens))*p + rels = identity_matrix(ZZ, length(gens))*p for i=length(pr)-1:-1:2 p1 = pr[i] @@ -1251,14 +1251,14 @@ function unit_group_1_part(f::fqPolyRepPolyRingElem, k::Int) # new gens: # 1+f^p1/1+f^p2 = f^p1/f^p2 = f^(p2-p1), latter additively ngens = [1+(x^i)*f1*c for i=0:(degree(f)*(p2-p1)-1) for c = b] - nr = matrix(FlintZZ, 0, length(ngens), []) + nr = matrix(ZZ, 0, length(ngens), []) for j=1:nrows(rels) g = rem(prod(powermod(gens[k], rels[j, k], f2) for k=1:ncols(rels)), f2) - 1 q,r = divrem(g, f1) @assert iszero(r) - nr = vcat(nr, matrix(FlintZZ, 1, ncols(nr), [(coeff(coeff(q, k), l)) for k = 0:degree(f)*(p2-p1)-1 for l = 0:degree(K)-1])) + nr = vcat(nr, matrix(ZZ, 1, ncols(nr), [(coeff(coeff(q, k), l)) for k = 0:degree(f)*(p2-p1)-1 for l = 0:degree(K)-1])) end - rels = [rels -nr; zero_matrix(FlintZZ, length(ngens), ncols(rels)) identity_matrix(FlintZZ, length(ngens))*p] + rels = [rels -nr; zero_matrix(ZZ, length(ngens), ncols(rels)) identity_matrix(ZZ, length(ngens))*p] append!(gens, ngens) end return gens, rels @@ -1377,7 +1377,7 @@ function _coprimality_test(f::T, g::T, h::T) where T <: Union{zzModPolyRingElem, return _coprimality_test(f, h, g) end #Now, we start. - Zx = polynomial_ring(FlintZZ, "x", cached = false)[1] + Zx = polynomial_ring(ZZ, "x", cached = false)[1] while true if is_constant(f) if is_unit(coeff(f, 0)) @@ -1492,7 +1492,7 @@ function _coprimality_test(f::T, g::T, h::T) where T <: Union{zzModPolyRingElem, if isone(p) || !is_divisible_by(ZZRingElem(m), p) continue end - R = residue_ring(FlintZZ, Int(p), cached = false)[1] + R = residue_ring(ZZ, Int(p), cached = false)[1] Rx = polynomial_ring(R, "x", cached = false)[1] f1 = Rx(lift(Zx, c*f)) g1 = Rx(lift(Zx, c1*g)) diff --git a/src/Misc/psibound.jl b/src/Misc/psibound.jl index ff2667b391..4ec1cf9d17 100644 --- a/src/Misc/psibound.jl +++ b/src/Misc/psibound.jl @@ -4,7 +4,7 @@ import Nemo.setcoeff!, Nemo.lift, Hecke.lift, Nemo.rem # setcoeff!(g, i, lift(a)) #end -function bernstein(h::Int, it::Any, Q = FlintQQ, cl = ceil, a::Int = 776) +function bernstein(h::Int, it::Any, Q = QQ, cl = ceil, a::Int = 776) #use 771 and cl = floor to get decent upper bounds # more on the choice of 776 and 771 in Dan's paper @@ -80,7 +80,7 @@ end function _exp(a::ZZModAbsPowerSeriesRingElem) R = base_ring(parent(a)) - R = residue_ring(FlintZZ, Int(modulus(R)), cached = false)[1] + R = residue_ring(ZZ, Int(modulus(R)), cached = false)[1] Rx = polynomial_ring(R, cached = false)[1] A = Rx() for i=0:length(a) @@ -99,14 +99,14 @@ function _psi_lower(N::ZZRingElem, pr, a::Int=776, cl = ceil) p = ZZRingElem(next_prime(2^60)) n = nbits(N) # println("precision of $n") - f = _exp(bernstein(n, pr, residue_ring(FlintZZ, p, cached = false)[1], cl, a)) - Rt, t = power_series_ring(FlintZZ, n*a+1, "t", model = :capped_absolute) + f = _exp(bernstein(n, pr, residue_ring(ZZ, p, cached = false)[1], cl, a)) + Rt, t = power_series_ring(ZZ, n*a+1, "t", model = :capped_absolute) f = lift(Rt, f) pp = p while pp < N p = next_prime(p) # println("p: $p, pp: $pp N:$N") - g = _exp(bernstein(n, pr, residue_ring(FlintZZ, p, cached = false)[1], cl, a)) + g = _exp(bernstein(n, pr, residue_ring(ZZ, p, cached = false)[1], cl, a)) @assert length(g) == length(f) for i=0:length(f) setcoeff!(f, i, crt(coeff(f, i), pp, lift(coeff(g, i)), p)) diff --git a/src/Misc/toHecke.jl b/src/Misc/toHecke.jl index 397333f7ab..1bec2b99ce 100644 --- a/src/Misc/toHecke.jl +++ b/src/Misc/toHecke.jl @@ -40,7 +40,7 @@ end # use as include(...) ################################################################################ function to_hecke(io::IOStream, A::ZZMatrix; name = "A") - println(io, name, " = matrix(FlintZZ, ", nrows(A), ", ", ncols(A), "ZZRingElem[") + println(io, name, " = matrix(ZZ, ", nrows(A), ", ", ncols(A), "ZZRingElem[") for i = 1:nrows(A) for j = 1:ncols(A) print(io, A[i,j]) diff --git a/src/Misc/toPari.jl b/src/Misc/toPari.jl index 5a282abd2e..3cb0dd5e53 100644 --- a/src/Misc/toPari.jl +++ b/src/Misc/toPari.jl @@ -1,5 +1,5 @@ function to_pari(io::IO, f::Generic.Poly{AbsSimpleNumFieldElem}) - Zy, y = polynomial_ring(FlintQQ, "y", cached = false) + Zy, y = polynomial_ring(QQ, "y", cached = false) k = base_ring(f) kt = parent(f) s_k = k.S @@ -51,7 +51,7 @@ from https://www.math.u-bordeaux.fr/~kbelabas/research/vanhoeij.pdf p 26, polys h_1, ..., h_10 (so far) -Zx, x = polynomial_ring(FlintZZ) +Zx, x = polynomial_ring(ZZ) l = [x-1, x^2-19, x^3-x^2+6, diff --git a/src/ModAlgAss/Lattices/Basics.jl b/src/ModAlgAss/Lattices/Basics.jl index 2c12967409..29a153504a 100644 --- a/src/ModAlgAss/Lattices/Basics.jl +++ b/src/ModAlgAss/Lattices/Basics.jl @@ -181,11 +181,11 @@ function intersect(L::T, M::T) where {T <: ModAlgAssLat} dM = denominator(BM) dN = denominator(BN) d = lcm(dM, dN) - BMint = change_base_ring(FlintZZ, d * BM) - BNint = change_base_ring(FlintZZ, d * BN) + BMint = change_base_ring(ZZ, d * BM) + BNint = change_base_ring(ZZ, d * BN) H = vcat(BMint, BNint) K = kernel(H, side = :left) - BI = divexact(change_base_ring(FlintQQ, hnf(view(K, 1:nrows(K), 1:nrows(BM)) * BMint)), d) + BI = divexact(change_base_ring(QQ, hnf(view(K, 1:nrows(K), 1:nrows(BM)) * BMint)), d) return lattice(L.V, L.base_ring, BI) end diff --git a/src/ModAlgAss/ModAlgAss.jl b/src/ModAlgAss/ModAlgAss.jl index b9d4241662..a4b043089f 100644 --- a/src/ModAlgAss/ModAlgAss.jl +++ b/src/ModAlgAss/ModAlgAss.jl @@ -568,7 +568,7 @@ automorphism_map(f::NfToModAlgAssMor) = f.mG function galois_module(K::AbsSimpleNumField, aut::Map = automorphism_group(K)[2]; normal_basis_generator = normal_basis(K)) G = domain(aut) - A = FlintQQ[G] + A = QQ[G] return _galois_module(K, A, aut, normal_basis_generator = normal_basis_generator) end diff --git a/src/NumField/Elem.jl b/src/NumField/Elem.jl index 928d9e792b..2f02c45971 100644 --- a/src/NumField/Elem.jl +++ b/src/NumField/Elem.jl @@ -357,7 +357,7 @@ function tr(a::NumFieldElem, k::NumField) return _elem_tr_to(a, k) end -tr(a::NumFieldElem, ::QQField) = _elem_tr_to(a, FlintQQ) +tr(a::NumFieldElem, ::QQField) = _elem_tr_to(a, QQ) @doc doc""" norm(a::NumFieldElem, k::NumField) -> NumFieldElem @@ -369,7 +369,7 @@ function norm(a::NumFieldElem, k::NumField) _elem_norm_to(a, k) end -norm(a::NumFieldElem, ::QQField) = _elem_norm_to(a, FlintQQ) +norm(a::NumFieldElem, ::QQField) = _elem_norm_to(a, QQ) @doc doc""" absolute_tr(a::NumFieldElem) -> QQFieldElem @@ -654,7 +654,7 @@ absolute_minpoly(a::AbsSimpleNumFieldElem) = minpoly(a) absolute_minpoly(a::AbsNonSimpleNumField) = minpoly(a) -absolute_minpoly(a::T) where T <: Union{RelNonSimpleNumFieldElem, RelSimpleNumFieldElem} = minpoly(a, FlintQQ) +absolute_minpoly(a::T) where T <: Union{RelNonSimpleNumFieldElem, RelSimpleNumFieldElem} = minpoly(a, QQ) absolute_minpoly(a::QQFieldElem) = Hecke.Globals.Qx([-a, 1]) diff --git a/src/NumField/Embedded.jl b/src/NumField/Embedded.jl index 9b34f2618b..9612a79154 100644 --- a/src/NumField/Embedded.jl +++ b/src/NumField/Embedded.jl @@ -59,7 +59,7 @@ elem_type(::Type{EmbeddedNumField{S, E}}) where {S, E} = EmbeddedNumFieldElem{el parent_type(::Type{EmbeddedNumFieldElem{T}}) where {T} = EmbeddedNumField{parent_type(T), embedding_type(parent_type(T))} -base_ring(::EmbeddedNumField) = FlintQQ +base_ring(::EmbeddedNumField) = QQ base_ring_type(::Type{<:EmbeddedNumField}) = QQField diff --git a/src/NumField/Field.jl b/src/NumField/Field.jl index 7d51672deb..625099139a 100644 --- a/src/NumField/Field.jl +++ b/src/NumField/Field.jl @@ -14,7 +14,7 @@ base_field(::NumField) _base_ring(K::NumField) = base_field(K) -_base_ring(::QQField) = FlintQQ +_base_ring(::QQField) = QQ ################################################################################ # diff --git a/src/NumField/Hilbert.jl b/src/NumField/Hilbert.jl index b3ebf5a2bf..d7efea02a3 100644 --- a/src/NumField/Hilbert.jl +++ b/src/NumField/Hilbert.jl @@ -380,7 +380,7 @@ end Returns the local Hilbert symbol $(a,b)_p$. """ function hilbert_symbol(a::QQFieldElem, b::QQFieldElem, p::ZZRingElem) - a = FlintQQ(a) - b = FlintQQ(b) + a = QQ(a) + b = QQ(b) hilbert_symbol(numerator(a) * denominator(a), numerator(b) * denominator(b), p) end diff --git a/src/NumField/NfAbs/CompactRepresentation.jl b/src/NumField/NfAbs/CompactRepresentation.jl index edfe5d2460..793cf73626 100644 --- a/src/NumField/NfAbs/CompactRepresentation.jl +++ b/src/NumField/NfAbs/CompactRepresentation.jl @@ -38,7 +38,7 @@ function compact_presentation(a::FacElem{AbsSimpleNumFieldElem, AbsSimpleNumFiel v = conjugates_arb_log_normalise(a, arb_prec) if length(de) == 0 - _v = FlintZZ(1) + _v = ZZ(1) else _v = maximum(abs, values(de))+1 end @@ -93,7 +93,7 @@ function compact_presentation(a::FacElem{AbsSimpleNumFieldElem, AbsSimpleNumFiel r1, r2 = signature(K) if length(de) == 0 - m = FlintZZ(1) + m = ZZ(1) else m = maximum(abs, values(de)) end @@ -158,7 +158,7 @@ function compact_presentation(a::FacElem{AbsSimpleNumFieldElem, AbsSimpleNumFiel @vtime :CompactPresentation 1 id = inv(eA) local b while true - @vtime :CompactPresentation 1 b = short_elem(id, matrix(FlintZZ, 1, length(vvv), vvv), prec = short_prec) # the precision needs to be done properly... + @vtime :CompactPresentation 1 b = short_elem(id, matrix(ZZ, 1, length(vvv), vvv), prec = short_prec) # the precision needs to be done properly... if abs(norm(b)//norm(id))> ZZRingElem(2)^abs(sum(vvv))*ZZRingElem(2)^degree(K)*abs(discriminant(ZK)) # the trivial case short_prec *= 2 continue diff --git a/src/NumField/NfAbs/Elem.jl b/src/NumField/NfAbs/Elem.jl index f60751944e..89ff2c5fc2 100644 --- a/src/NumField/NfAbs/Elem.jl +++ b/src/NumField/NfAbs/Elem.jl @@ -9,10 +9,10 @@ function basis_matrix(A::Vector{AbsSimpleNumFieldElem}, ::Type{FakeFmpqMat}) n = length(A) d = degree(parent(A[1])) - M = zero_matrix(FlintZZ, n, d) + M = zero_matrix(ZZ, n, d) - deno = one(FlintZZ) - dummy = one(FlintZZ) + deno = one(ZZ) + dummy = one(ZZ) for i in 1:n deno = lcm(deno, denominator(A[i])) @@ -33,7 +33,7 @@ function basis_matrix(A::Vector{AbsSimpleNumFieldElem}) n = length(A) d = degree(parent(A[1])) - M = zero_matrix(FlintQQ, n, d) + M = zero_matrix(QQ, n, d) for i in 1:n for j in 1:d @@ -144,12 +144,12 @@ function is_norm_divisible(a::AbsSimpleNumFieldElem, n::ZZRingElem) m = n end if fits(Int, m) - R1 = residue_ring(FlintZZ, Int(m), cached = false)[1] + R1 = residue_ring(ZZ, Int(m), cached = false)[1] R1x = polynomial_ring(R1, "x", cached = false)[1] el = resultant_ideal(R1x(numerator(a)), R1x(K.pol)) return iszero(el) end - R = residue_ring(FlintZZ, m, cached = false)[1] + R = residue_ring(ZZ, m, cached = false)[1] Rx = polynomial_ring(R, "x", cached = false)[1] el = resultant_ideal(Rx(numerator(a)), Rx(K.pol)) return iszero(el) @@ -170,12 +170,12 @@ function is_norm_divisible_pp(a::AbsSimpleNumFieldElem, n::ZZRingElem) m = n end if fits(Int, m) - R1 = residue_ring(FlintZZ, Int(m), cached = false)[1] + R1 = residue_ring(ZZ, Int(m), cached = false)[1] R1x = polynomial_ring(R1, "x", cached = false)[1] el = resultant_ideal_pp(R1x(numerator(a)), R1x(K.pol)) return iszero(el) end - R = residue_ring(FlintZZ, m, cached = false)[1] + R = residue_ring(ZZ, m, cached = false)[1] Rx = polynomial_ring(R, "x", cached = false)[1] el = resultant_ideal_pp(Rx(numerator(a)), Rx(K.pol)) return iszero(el) @@ -256,7 +256,7 @@ function norm(f::PolyRingElem{AbsSimpleNumFieldElem}) PQ = QQFieldElem[tr(x) for x in P] N = power_sums_to_polynomial(PQ)*norm(leading_coefficient(f)) else - Qx = polynomial_ring(FlintQQ, "x", cached = false)[1] + Qx = polynomial_ring(QQ, "x", cached = false)[1] Qxy = polynomial_ring(Qx, "y", cached = false)[1] T = change_base_ring(Qx, K.pol, parent = Qxy) diff --git a/src/NumField/NfAbs/MPolyAbsFact.jl b/src/NumField/NfAbs/MPolyAbsFact.jl index b9ffb9569a..064f908887 100644 --- a/src/NumField/NfAbs/MPolyAbsFact.jl +++ b/src/NumField/NfAbs/MPolyAbsFact.jl @@ -1524,7 +1524,7 @@ function factor(C::AcbField, f::Union{QQMPolyRingElem, ZZMPolyRingElem}) Cx, x = polynomial_ring(C, map(String, symbols(parent(f))), cached = false) for i=2:length(fa) K = base_ring(fa[i][1][1]) - if K == FlintQQ + if K == QQ D[map_coefficients(C, fa[i][1][1], parent = Cx)] = fa[i][2] continue end @@ -1551,7 +1551,7 @@ function factor(R::ArbField, f::Union{QQMPolyRingElem, ZZMPolyRingElem}) for i=2:length(fa) K = base_ring(fa[i][1][1]) - if K == FlintQQ + if K == QQ D[map_coefficients(R, fa[i][1][1], parent = Rx)] = fa[i][2] continue end diff --git a/src/NumField/NfAbs/MPolyGcd.jl b/src/NumField/NfAbs/MPolyGcd.jl index fc7a7119d2..11586accdc 100644 --- a/src/NumField/NfAbs/MPolyGcd.jl +++ b/src/NumField/NfAbs/MPolyGcd.jl @@ -27,7 +27,7 @@ function basis_matrix(d::ZZRingElem, f::ZZPolyRingElem, k::AbsSimpleNumField) #assumes deg f < deg k, d coprime to the conductor/ index/ everything de = [] g = d - N = zero_matrix(FlintZZ, degree(k), degree(k)) + N = zero_matrix(ZZ, degree(k), degree(k)) dN = ZZRingElem(1) res = [] f_orig = f @@ -45,9 +45,9 @@ function basis_matrix(d::ZZRingElem, f::ZZPolyRingElem, k::AbsSimpleNumField) @assert is_monic(fn) @assert degree(fn) == i if degree(f) == degree(k) - M = matrix_space(FlintZZ, degree(k), degree(k))(n) + M = matrix_space(ZZ, degree(k), degree(k))(n) else - M = zero_matrix(FlintZZ, degree(k), degree(k)) + M = zero_matrix(ZZ, degree(k), degree(k)) for j=1:i M[j,j] = n end @@ -103,7 +103,7 @@ mutable struct RecoCtx end function RecoCtx(k::AbsSimpleNumField) r = new() - r.L = identity_matrix(FlintZZ, degree(k)) + r.L = identity_matrix(ZZ, degree(k)) r.p1 = ZZRingElem(1) r.k = k r.new_data = false @@ -184,7 +184,7 @@ function Hecke.rational_reconstruction(a::AbsSimpleNumFieldElem, R::RecoCtx; int if !isdefined(R, :LI) R.LI, R.d = pseudo_inv(R.L) end - t = zero_matrix(FlintZZ, 1, degree(R.k)) + t = zero_matrix(ZZ, 1, degree(R.k)) z = ZZRingElem() for i=1:degree(R.k) Nemo.num_coeff!(z, a, i-1) @@ -204,7 +204,7 @@ function Hecke.rational_reconstruction(a::AbsSimpleNumFieldElem, R::RecoCtx; int return nb >= 0, b end n = degree(parent(a)) - Znn = matrix_space(FlintZZ, n, n) + Znn = matrix_space(ZZ, n, n) L = [ Znn(1) representation_matrix_q(a)[1] ; Znn(0) R.L] lll!(L) K = parent(a) diff --git a/src/NumField/NfAbs/NfAbs.jl b/src/NumField/NfAbs/NfAbs.jl index bffbadb3e7..1655767c62 100644 --- a/src/NumField/NfAbs/NfAbs.jl +++ b/src/NumField/NfAbs/NfAbs.jl @@ -339,7 +339,7 @@ function normal_basis(K::AbsSimpleNumField) # length(Aut) != n && error("The field is not normal over the rationals!") - # A = zero_matrix(FlintQQ, n, n) + # A = zero_matrix(QQ, n, n) # _B = basis(lll(maximal_order(K))) # for i in 1:n # r = elem_in_nf(_B[i]) @@ -385,7 +385,7 @@ function _normal_basis_generator(K, p) f = Rx(K.pol) fac = factor(f) g = divexact(f, first(keys(fac.fac))) - Zy, y = polynomial_ring(FlintZZ, "y", cached = false) + Zy, y = polynomial_ring(ZZ, "y", cached = false) g1 = lift(Zy, g) return K(g1) end @@ -661,7 +661,7 @@ all elements have parent $K$. **Example** - julia> Qx, x = FlintQQ["x"] + julia> Qx, x = QQ["x"] julia> K, a = number_field(x^3 + 2, "a") julia> write("interesting_elements", [1, a, a^2]) julia> A = read("interesting_elements", K, Hecke.AbsSimpleNumFieldElem) @@ -701,7 +701,7 @@ all elements have parent $K$. **Example** - julia> Qx, x = FlintQQ["x"] + julia> Qx, x = QQ["x"] julia> K, a = number_field(x^3 + 2, "a") julia> write("interesting_elements", [1, a, a^2]) julia> A = read("interesting_elements", K, Hecke.AbsSimpleNumFieldElem) @@ -721,7 +721,7 @@ end Computes the splitting field of $f$ as an absolute field. """ function splitting_field(f::ZZPolyRingElem; do_roots::Bool = false) - Qx = polynomial_ring(FlintQQ, parent(f).S, cached = false)[1] + Qx = polynomial_ring(QQ, parent(f).S, cached = false)[1] return splitting_field(Qx(f), do_roots = do_roots) end @@ -730,7 +730,7 @@ function splitting_field(f::QQPolyRingElem; do_roots::Bool = false) end function splitting_field(fl::Vector{ZZPolyRingElem}; coprime::Bool = false, do_roots::Bool = false) - Qx = polynomial_ring(FlintQQ, parent(fl[1]).S, cached = false)[1] + Qx = polynomial_ring(QQ, parent(fl[1]).S, cached = false)[1] return splitting_field([Qx(x) for x = fl], coprime = coprime, do_roots = do_roots) end @@ -750,9 +750,9 @@ function splitting_field(fl::Vector{QQPolyRingElem}; coprime::Bool = false, do_r fl = fl[findall(x->degree(x) > 1, fl)] if length(fl) == 0 if do_roots - return FlintQQ, r + return QQ, r else - return FlintQQ + return QQ end end K, a = number_field(fl[1])#, check = false, cached = false) @@ -1251,7 +1251,7 @@ function force_coerce_cyclo(a::AbsSimpleNumField, b::AbsSimpleNumFieldElem, ::Va return end end - setcoeff!(g, i, FlintQQ(c)) + setcoeff!(g, i, QQ(c)) end ff = g diff --git a/src/NumField/NfAbs/NonSimple.jl b/src/NumField/NfAbs/NonSimple.jl index 1748690b4c..7487573733 100644 --- a/src/NumField/NfAbs/NonSimple.jl +++ b/src/NumField/NfAbs/NonSimple.jl @@ -32,11 +32,11 @@ # ################################################################################ -@inline base_ring(K::AbsNonSimpleNumField) = FlintQQ +@inline base_ring(K::AbsNonSimpleNumField) = QQ @inline base_ring_type(K::AbsNonSimpleNumField) = QQField -@inline base_field(K::AbsNonSimpleNumField) = FlintQQ +@inline base_field(K::AbsNonSimpleNumField) = QQ @inline degree(K::AbsNonSimpleNumField) = K.degree @@ -135,7 +135,7 @@ function basis_matrix(A::Array{AbsNonSimpleNumFieldElem}) n = length(A) d = degree(parent(A[1])) - MM = zero_matrix(FlintQQ, n, d) + MM = zero_matrix(QQ, n, d) for i in 1:n elem_to_mat_row!(MM, i, A[i]) end @@ -395,7 +395,7 @@ function elem_to_mat_row!(M::ZZMatrix, i::Int, d::ZZRingElem, a::AbsNonSimpleNum # QQMPolyRingElem for j in 1:ncols(M) - M[i, j] = zero(FlintZZ) + M[i, j] = zero(ZZ) end one!(d) @@ -404,7 +404,7 @@ function elem_to_mat_row!(M::ZZMatrix, i::Int, d::ZZRingElem, a::AbsNonSimpleNum return nothing end - z = zero_matrix(FlintQQ, 1, ncols(M)) + z = zero_matrix(QQ, 1, ncols(M)) elem_to_mat_row!(z, 1, a) z_q = FakeFmpqMat(z) @@ -420,7 +420,7 @@ end function elem_to_mat_row!(M::QQMatrix, i::Int, a::AbsNonSimpleNumFieldElem) K = parent(a) for j in 1:ncols(M) - M[i, j] = zero(FlintQQ) + M[i, j] = zero(QQ) end adata = data(a) for j in 1:length(adata) @@ -454,7 +454,7 @@ function elem_from_mat_row(K::AbsNonSimpleNumField, M::ZZMatrix, i::Int, d::ZZRi end function SRow(a::AbsNonSimpleNumFieldElem) - sr = SRow(FlintQQ) + sr = SRow(QQ) adata = data(a) for i=1:length(adata) # TODO: Do this inplace with preallocated exps array @@ -475,7 +475,7 @@ end ################################################################################ function discriminant(K::AbsNonSimpleNumField) - Qx = FlintQQ["x"][1] + Qx = QQ["x"][1] d = QQFieldElem(1) for i = 1:length(K.pol) d *= discriminant(to_univariate(Qx,K.pol[i]))^(div(degree(K), total_degree(K.pol[i]))) @@ -493,13 +493,13 @@ end function minpoly_dense(a::AbsNonSimpleNumFieldElem) K = parent(a) n = degree(K) - M = zero_matrix(FlintQQ, degree(K)+1, degree(K)) + M = zero_matrix(QQ, degree(K)+1, degree(K)) z = a^0 elem_to_mat_row!(M, 1, z) z *= a elem_to_mat_row!(M, 2, z) i = 2 - Qt, _ = polynomial_ring(FlintQQ,"t", cached=false) + Qt, _ = polynomial_ring(QQ,"t", cached=false) while true if n % (i-1) == 0 && rank(M) < i N = kernel(transpose(sub(M, 1:i, 1:ncols(M))), side = :right) @@ -521,14 +521,14 @@ end function minpoly_sparse(a::AbsNonSimpleNumFieldElem) K = parent(a) n = degree(K) - M = sparse_matrix(FlintQQ) + M = sparse_matrix(QQ) z = a^0 push!(M, SRow(z)) z *= a sz = SRow(z) i = 1 local so::typeof(sz) - Qt, t = polynomial_ring(FlintQQ, "x", cached = false) + Qt, t = polynomial_ring(QQ, "x", cached = false) while true if n % i == 0 fl, _so = can_solve_with_solution(M, sz) @@ -647,7 +647,7 @@ end function representation_matrix(a::AbsNonSimpleNumFieldElem) K = parent(a) b = basis(K, copy = false) - M = zero_matrix(FlintQQ, degree(K), degree(K)) + M = zero_matrix(QQ, degree(K), degree(K)) for i=1:degree(K) elem_to_mat_row!(M, i, a*b[i]) end @@ -712,7 +712,7 @@ end # end # end # -# Qx = polynomial_ring(FlintQQ, "x")[1] +# Qx = polynomial_ring(QQ, "x")[1] # coeffs = Vector{QQFieldElem}(undef, deg+1) # if iszero(deg) # if iszero(f) @@ -923,7 +923,7 @@ function number_field(f::Vector{QQPolyRingElem}, S::Vector{Symbol}; cached::Bool length(S) == length(f) || error("number of names must match the number of polynomials") n = length(S) s = var(parent(f[1])) - Qx, x = polynomial_ring(FlintQQ, ["$s$i" for i=1:n], cached = false) + Qx, x = polynomial_ring(QQ, ["$s$i" for i=1:n], cached = false) K = AbsNonSimpleNumField(f, QQMPolyRingElem[f[i](x[i]) for i=1:n], S, cached) K.degrees = [degree(f[i]) for i in 1:n] K.degree = prod(K.degrees) @@ -936,12 +936,12 @@ function number_field(f::Vector{QQPolyRingElem}, S::Vector{Symbol}; cached::Bool end function number_field(f::Vector{ZZPolyRingElem}, s::VarName="_\$"; cached::Bool = false, check::Bool = true) - Qx, _ = polynomial_ring(FlintQQ, var(parent(f[1])), cached = false) + Qx, _ = polynomial_ring(QQ, var(parent(f[1])), cached = false) return number_field(QQPolyRingElem[Qx(x) for x = f], s, cached = cached, check = check) end function number_field(f::Vector{ZZPolyRingElem}, s::Vector{<:VarName}; cached::Bool = false, check::Bool = true) - Qx, _ = polynomial_ring(FlintQQ, var(parent(f[1])), cached = false) + Qx, _ = polynomial_ring(QQ, var(parent(f[1])), cached = false) return number_field(QQPolyRingElem[Qx(x) for x = f], s, cached = cached, check = check) end @@ -1033,7 +1033,7 @@ function trace_assure(K::AbsNonSimpleNumField) if isdefined(K, :traces) return end - Qx, x = polynomial_ring(FlintQQ, cached = false) + Qx, x = polynomial_ring(QQ, cached = false) K.traces = Vector{QQFieldElem}[total_degree(f) == 1 ? QQFieldElem[] : polynomial_to_power_sums(to_univariate(Qx, f), total_degree(f)-1) for f = K.pol] end diff --git a/src/NumField/NfAbs/NormRelation/SUnits.jl b/src/NumField/NfAbs/NormRelation/SUnits.jl index 9420a1410f..b8ce3a9522 100644 --- a/src/NumField/NfAbs/NormRelation/SUnits.jl +++ b/src/NumField/NfAbs/NormRelation/SUnits.jl @@ -234,7 +234,7 @@ function _add_sunits_from_brauer_relation!(c, UZK, N; invariant::Bool = false, c push!(deb_rr, (deepcopy(c.M.basis), deepcopy(valofnewelement))) rr = Hecke.reduce_right!(c.M.basis, deepcopy(valofnewelement)) MM = matrix(c.M.basis) - vv = zero_matrix(FlintZZ, 1, ncols(MM)) + vv = zero_matrix(ZZ, 1, ncols(MM)) for (jj, vvv) in valofnewelement vv[1, jj] = vvv end @@ -251,7 +251,7 @@ function _add_sunits_from_brauer_relation!(c, UZK, N; invariant::Bool = false, c @vtime :NormRelation 4 u = Hecke.compact_presentation(u, compact, decom = sup) end @vtime :NormRelation 4 img_u = FacElem(Dict{AbsSimpleNumFieldElem, ZZRingElem}((_embed(N, i, x), v) for (x, v) = u.fac if !iszero(v))) - @hassert :NormRelation 1 sparse_row(FlintZZ, [ (j, valuation(img_u, p)) for (j, p) in enumerate(c.FB.ideals) if valuation(img_u, p) != 0]) == valofnewelement + @hassert :NormRelation 1 sparse_row(ZZ, [ (j, valuation(img_u, p)) for (j, p) in enumerate(c.FB.ideals) if valuation(img_u, p) != 0]) == valofnewelement @vtime :NormRelation 4 Hecke.class_group_add_relation(c, img_u, valofnewelement) #= if rank(c.M) == length(c.FB.ideals) @@ -278,7 +278,7 @@ function induce_action_just_from_subfield(N::NormRelation, i, s, FB, invariant = S = FB.ideals ZK = order(S[1]) - z = zero_matrix(SMat, FlintZZ, 0, length(S)) + z = zero_matrix(SMat, ZZ, 0, length(S)) mk = embedding(N, i) zk = order(s[1]) @@ -320,7 +320,7 @@ function induce_action_just_from_subfield(N::NormRelation, i, s, FB, invariant = end end sort!(v, by = x -> x[1]) - push!(z, sparse_row(FlintZZ, v)) + push!(z, sparse_row(ZZ, v)) end return z end @@ -475,7 +475,7 @@ function __sunit_group_fac_elem_quo_via_brauer(N::NormRelation, S::Vector{AbsNum for i = 1:length(sunitsmodunits) r = Tuple{Int, ZZRingElem}[(perm_ideals[j], v) for (j, v) in c.M.bas_gens[i]] sort!(r, lt = (a,b) -> a[1] < b[1]) - valuations_sunitsmodunits[i] = sparse_row(FlintZZ, r) + valuations_sunitsmodunits[i] = sparse_row(ZZ, r) end else # I need to extract the S-units from the Sclosed-units @@ -495,7 +495,7 @@ function __sunit_group_fac_elem_quo_via_brauer(N::NormRelation, S::Vector{AbsNum # ind = indices of S inside c.FB.ideals @assert length(Sclosed) == length(c.FB.ideals) @assert length(ind) == length(S) - z = zero_matrix(FlintZZ, length(c.R_gen), length(Sclosed) - length(S)) + z = zero_matrix(ZZ, length(c.R_gen), length(Sclosed) - length(S)) for i in 1:length(c.R_gen) k = 1 for j in 1:length(Sclosed) @@ -517,7 +517,7 @@ function __sunit_group_fac_elem_quo_via_brauer(N::NormRelation, S::Vector{AbsNum v_c = sum(SRow{ZZRingElem}[K[i, j]*c.M.bas_gens[j] for j = 1:ncols(K)]) r = Tuple{Int, ZZRingElem}[(perm_ideals[j], v) for (j, v) in v_c] sort!(r, lt = (a,b) -> a[1] < b[1]) - push!(valuations_sunitsmodunits, sparse_row(FlintZZ, r)) + push!(valuations_sunitsmodunits, sparse_row(ZZ, r)) end end @@ -565,7 +565,7 @@ function __sunit_group_fac_elem_quo_via_brauer(N::NormRelation, S::Vector{AbsNum r = Hecke.MapSUnitGrpFacElem() r.valuations = Vector{SRow{ZZRingElem}}(undef, ngens(res_group)) for i = 1:length(units) - r.valuations[i] = sparse_row(FlintZZ) + r.valuations[i] = sparse_row(ZZ) end for i = 1:length(sunitsmodunits) r.valuations[i+length(units)] = valuations_sunitsmodunits[i] @@ -586,7 +586,7 @@ function __sunit_group_fac_elem_quo_via_brauer(N::NormRelation, S::Vector{AbsNum fl = true for i = 1:ngens(res_group) el = r(res_group[i]) - if sparse_row(FlintZZ, [ (j, valuation(el, S[j])) for j = 1:length(S) if valuation(el, S[j]) != 0]) != r.valuations[i] + if sparse_row(ZZ, [ (j, valuation(el, S[j])) for j = 1:length(S) if valuation(el, S[j]) != 0]) != r.valuations[i] fl = false break end diff --git a/src/NumField/NfAbs/NormRelation/Setup.jl b/src/NumField/NfAbs/NormRelation/Setup.jl index 576914dc77..d096ed3c1d 100644 --- a/src/NumField/NfAbs/NormRelation/Setup.jl +++ b/src/NumField/NfAbs/NormRelation/Setup.jl @@ -344,7 +344,7 @@ function induce_action_from_subfield(N::NormRelation, i, s, FB, cache) S = FB.ideals ZK = order(S[1]) - z = sparse_matrix_type(ZZ)[zero_matrix(SMat, FlintZZ, 0, length(S)) for i in 1:degree(field(N))] + z = sparse_matrix_type(ZZ)[zero_matrix(SMat, ZZ, 0, length(S)) for i in 1:degree(field(N))] mk = embedding(N, i) zk = order(s[1]) @@ -412,7 +412,7 @@ function induce_action_from_subfield(N::NormRelation, i, s, FB, cache) r = [(p[i], e) for (i, e) in v] sort!(r, lt = (a,b)->a[1]a[1] x[1]) - push!(z, N.pure_coefficients[i] * sparse_row(FlintZZ, v, sort = false)) + push!(z, N.pure_coefficients[i] * sparse_row(ZZ, v, sort = false)) end return z end @@ -561,7 +561,7 @@ function Hecke.simplify(c::Hecke.ClassGrpCtx) end end for i=1:length(U.units) - Hecke.class_group_add_relation(d, U.units[i], SRow(FlintZZ)) + Hecke.class_group_add_relation(d, U.units[i], SRow(ZZ)) end return d, U end @@ -656,7 +656,7 @@ function _has_norm_relation_abstract(G::MultTableGroup, H::Vector{Tuple{MultTabl reverse!(H) end - QG = GroupAlgebra(FlintQQ, G) + QG = GroupAlgebra(QQ, G) norms_rev = Dict{elem_type(QG), Int}() norms = Vector{elem_type(QG)}(undef, length(H)) for i in 1:length(H) @@ -668,32 +668,32 @@ function _has_norm_relation_abstract(G::MultTableGroup, H::Vector{Tuple{MultTabl if pure if iszero(target_den) - m = zero_matrix(FlintQQ, length(H), n) + m = zero_matrix(QQ, length(H), n) for i in 1:length(H) for j in 1:n m[i, j] = norms[i].coeffs[j] end end - onee = matrix(FlintQQ, 1, n, coefficients(one(QG))) + onee = matrix(QQ, 1, n, coefficients(one(QG))) b, v, K = can_solve_with_solution_and_kernel(m, onee, side = :left) else - m = zero_matrix(FlintZZ, length(H), n) + m = zero_matrix(ZZ, length(H), n) for i in 1:length(H) for j in 1:n - m[i, j] = FlintZZ(norms[i].coeffs[j]) + m[i, j] = ZZ(norms[i].coeffs[j]) end end - onee = matrix(FlintZZ, 1, n, coefficients(one(QG))) + onee = matrix(ZZ, 1, n, coefficients(one(QG))) b, w, K = can_solve_with_solution_and_kernel(m, target_den * onee, side = :left) - v = 1//target_den * change_base_ring(FlintQQ, w) + v = 1//target_den * change_base_ring(QQ, w) end if !b - return false, zero(FlintZZ), Vector{Tuple{Vector{Tuple{ZZRingElem, FinGenAbGroupElem}}, Vector{FinGenAbGroupElem}}}() + return false, zero(ZZ), Vector{Tuple{Vector{Tuple{ZZRingElem, FinGenAbGroupElem}}, Vector{FinGenAbGroupElem}}}() end @assert b @@ -752,7 +752,7 @@ function _has_norm_relation_abstract(G::MultTableGroup, H::Vector{Tuple{MultTabl subgroups_needed = Int[] if any(isempty, nonannihilating) - return false, zero(FlintZZ), Vector{Tuple{Vector{Tuple{ZZRingElem, FinGenAbGroupElem}}, Vector{FinGenAbGroupElem}}}() + return false, zero(ZZ), Vector{Tuple{Vector{Tuple{ZZRingElem, FinGenAbGroupElem}}, Vector{FinGenAbGroupElem}}}() end subgroups_needed = Int[] @@ -812,9 +812,9 @@ function _has_norm_relation_abstract(G::MultTableGroup, H::Vector{Tuple{MultTabl end if iszero(target_den) - onee = matrix(FlintQQ, 1, n, coefficients(one(QG))) + onee = matrix(QQ, 1, n, coefficients(one(QG))) - m = zero_matrix(FlintQQ, dot(length.(left_cosets_for_sub), length.(right_cosets_for_normalizer)), n) + m = zero_matrix(QQ, dot(length.(left_cosets_for_sub), length.(right_cosets_for_normalizer)), n) B = basis(QG) @@ -837,9 +837,9 @@ function _has_norm_relation_abstract(G::MultTableGroup, H::Vector{Tuple{MultTabl b, w, K = can_solve_with_solution_and_kernel(m, onee, side = :left) v = w elseif true - onee = matrix(FlintZZ, 1, n, coefficients(target_den * one(QG))) + onee = matrix(ZZ, 1, n, coefficients(target_den * one(QG))) - m = zero_matrix(FlintZZ, dot(length.(left_cosets_for_sub), length.(right_cosets_for_normalizer)), n) + m = zero_matrix(ZZ, dot(length.(left_cosets_for_sub), length.(right_cosets_for_normalizer)), n) help_with_indicies = Vector{Tuple{Int, Int, Int}}(undef, nrows(m)) cc = 1 @@ -847,7 +847,7 @@ function _has_norm_relation_abstract(G::MultTableGroup, H::Vector{Tuple{MultTabl for (k, g) in enumerate(left_cosets_for_sub[i]) for (l, h) in enumerate(right_cosets_for_normalizer[i]) for j in 1:n - m[cc, j] = FlintZZ((QG(g) * norms[subgroups_needed[i]] * QG(h)).coeffs[j]) + m[cc, j] = ZZ((QG(g) * norms[subgroups_needed[i]] * QG(h)).coeffs[j]) end help_with_indicies[cc] = (i, k, l) cc += 1 @@ -857,7 +857,7 @@ function _has_norm_relation_abstract(G::MultTableGroup, H::Vector{Tuple{MultTabl b, w, K = can_solve_with_solution_and_kernel(m, onee, side = :left) - v = 1//target_den * change_base_ring(FlintQQ, w) + v = 1//target_den * change_base_ring(QQ, w) end @assert b @@ -874,7 +874,7 @@ function _has_norm_relation_abstract(G::MultTableGroup, H::Vector{Tuple{MultTabl @assert isone(z) - den = one(FlintZZ) + den = one(ZZ) for i in 1:ncols(v) den = lcm(den, denominator(v[1, i])) @@ -892,7 +892,7 @@ function _has_norm_relation_abstract(G::MultTableGroup, H::Vector{Tuple{MultTabl continue else i, k, l = help_with_indicies[cc] - push!(vvv[i], (FlintZZ(den * v[1, cc]), left_cosets_for_sub[i][k], right_cosets_for_normalizer[i][l])) + push!(vvv[i], (ZZ(den * v[1, cc]), left_cosets_for_sub[i][k], right_cosets_for_normalizer[i][l])) end end @@ -989,7 +989,7 @@ function _smallest_scalar_norm_relation_coprime(G::MultTableGroup, m::ZZRingElem primes = ZZRingElem[ p for (p, _) in factor(m)] - S = localization(FlintZZ, primes) + S = localization(ZZ, primes) all_non_trivial_subs = [ (H, mH) for (H, mH) in subgroups(G) if order(H) > 1] @@ -997,7 +997,7 @@ function _smallest_scalar_norm_relation_coprime(G::MultTableGroup, m::ZZRingElem reverse!(all_non_trivial_subs) - QG = GroupAlgebra(FlintQQ, G, cached = false) + QG = GroupAlgebra(QQ, G, cached = false) norms_rev = Dict{elem_type(QG), Int}() norms = Vector{elem_type(QG)}(undef, length(all_non_trivial_subs)) for i in 1:length(all_non_trivial_subs) diff --git a/src/NumField/NfAbs/Poly.jl b/src/NumField/NfAbs/Poly.jl index ed8b8e745b..c202734aaa 100644 --- a/src/NumField/NfAbs/Poly.jl +++ b/src/NumField/NfAbs/Poly.jl @@ -504,7 +504,7 @@ end function landau_mignotte_bound(f::PolyRingElem{AbsSimpleNumFieldElem}) - Zx, x = polynomial_ring(FlintZZ, cached = false) + Zx, x = polynomial_ring(ZZ, cached = false) g = Zx() for i=0:degree(f) setcoeff!(g, i, Hecke.upper_bound(ZZRingElem, sqrt(t2(coeff(f, i))))) @@ -518,7 +518,7 @@ end function cld_bound(f::PolyRingElem{AbsSimpleNumFieldElem}, k::Vector{Int}) @assert all(kk -> 0 <= kk < degree(f), k) - Zx, x = polynomial_ring(FlintZZ, cached = false) + Zx, x = polynomial_ring(ZZ, cached = false) g = Zx() n = degree(base_ring(f)) for i=0:degree(f) @@ -529,7 +529,7 @@ function cld_bound(f::PolyRingElem{AbsSimpleNumFieldElem}, k::Vector{Int}) end bb = ZZRingElem[] for kk = k - b = FlintZZ() + b = ZZ() ccall((:fmpz_poly_CLD_bound, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZPolyRingElem}, Int64), b, g, kk) push!(bb, b) end @@ -539,7 +539,7 @@ cld_bound(f::PolyRingElem{AbsSimpleNumFieldElem}, k::Int) = cld_bound(f, [k])[1] function cld_bound(f::ZZPolyRingElem, k::Int) @assert 0 <= k < degree(f) - b = FlintZZ() + b = ZZ() ccall((:fmpz_poly_CLD_bound, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZPolyRingElem}, Int64), b, f, k) return b end diff --git a/src/NumField/NfAbs/PolyFact.jl b/src/NumField/NfAbs/PolyFact.jl index 2b080d9b38..cb147c540f 100644 --- a/src/NumField/NfAbs/PolyFact.jl +++ b/src/NumField/NfAbs/PolyFact.jl @@ -117,7 +117,7 @@ mutable struct HenselCtxPadic <: Hensel function HenselCtxPadic(f::PolyRingElem{PadicFieldElem}) r = new() r.f = f - Zx = polynomial_ring(FlintZZ, cached = false)[1] + Zx = polynomial_ring(ZZ, cached = false)[1] ff = Zx() for i=0:degree(f) setcoeff!(ff, i, lift(ZZ, coeff(f, i))) @@ -137,7 +137,7 @@ end function factor(C::HenselCtxPadic) res = typeof(C.f)[] - Zx = polynomial_ring(FlintZZ, cached = false)[1] + Zx = polynomial_ring(ZZ, cached = false)[1] h = Zx() Qp = base_ring(C.f) for i = 1:C.X.LF._num #from factor_to_dict @@ -200,7 +200,7 @@ function reco(a::ZZRingElem, M, pM::Tuple{ZZMatrix, ZZRingElem}, O) end function reco(a::AbsNumFieldOrderElem, M, pM) - m = matrix(FlintZZ, 1, degree(parent(a)), coordinates(a)) + m = matrix(ZZ, 1, degree(parent(a)), coordinates(a)) m = m - map(x -> round(ZZRingElem, x, pM[2]), m*pM[1])*M return parent(a)(m) end @@ -432,15 +432,15 @@ function cld_data(H::Hensel, up_to::Int, from::Int, mC, Mi, sc::AbsSimpleNumFiel @assert 0<= from <= N #from : div by x^from # @assert up_to <= from - M = zero_matrix(FlintZZ, length(lf), (1+up_to + N - from) * degree(k)) + M = zero_matrix(ZZ, length(lf), (1+up_to + N - from) * degree(k)) #last_lf[] = (lf, H.f, up_to) lf = [divexact_low(mullow(derivative(x), H.f, up_to+1), x, up_to+1) for x = lf] # lf = [divexact(derivative(x)*H.f, x) for x = lf] # @show llf .- lf - NN = zero_matrix(FlintZZ, 1, degree(k)) - d = FlintZZ() + NN = zero_matrix(ZZ, 1, degree(k)) + d = ZZ() for i=0:up_to for j=1:length(lf) @@ -513,7 +513,7 @@ function gradual_feed_lll(M::ZZMatrix, sm::ZZRingElem, B::ZZMatrix, d::ZZRingEle while false && sc > 0 BB = tdivpow2(B, sc) dd = tdivpow2(d, sc) - MM = [M BB; zero_matrix(FlintZZ, ncols(B), ncols(M)) dd*identity_matrix(FlintZZ, ncols(B))] + MM = [M BB; zero_matrix(ZZ, ncols(B), ncols(M)) dd*identity_matrix(ZZ, ncols(B))] @show maximum(nbits, MM) @time MM, T = lll_with_transform(MM, LLLContext(0.75, 0.51)) @time l, _ = lll_with_removal(MM, bnd, LLLContext(0.75, 0.51)) @@ -524,7 +524,7 @@ function gradual_feed_lll(M::ZZMatrix, sm::ZZRingElem, B::ZZMatrix, d::ZZRingEle @show maximum(nbits, B) @show sc = max(0, sc-55) end - M = [M B; zero_matrix(FlintZZ, ncols(B), ncols(M)) d*identity_matrix(FlintZZ, ncols(B))] + M = [M B; zero_matrix(ZZ, ncols(B), ncols(M)) d*identity_matrix(ZZ, ncols(B))] return lll_with_removal(M, bnd) end @@ -559,7 +559,7 @@ function van_hoeij(f::PolyRingElem{AbsSimpleNumFieldElem}, P::AbsNumFieldOrderId mK = extend(mK, K) r = length(factor(map_coefficients(mK, f, cached = false))) prec_scale = max(nbits(r), prec_scale) - + N = degree(f) @vprintln :PolyFactor 1 "Having $r local factors for degree $N" @@ -611,7 +611,7 @@ function van_hoeij(f::PolyRingElem{AbsSimpleNumFieldElem}, P::AbsNumFieldOrderId used = [] really_used = [] - M = identity_matrix(FlintZZ, r)*ZZRingElem(2)^prec_scale + M = identity_matrix(ZZ, r)*ZZRingElem(2)^prec_scale while true #the main loop #find some prec diff --git a/src/NumField/NfAbs/Simplify.jl b/src/NumField/NfAbs/Simplify.jl index 9e1783f969..d304087061 100644 --- a/src/NumField/NfAbs/Simplify.jl +++ b/src/NumField/NfAbs/Simplify.jl @@ -12,7 +12,7 @@ http://beta.lmfdb.org/knowledge/show/nf.polredabs. Both versions require a LLL reduced basis for the maximal order. """ function simplify(K::AbsSimpleNumField; canonical::Bool = false, cached::Bool = true, save_LLL_basis::Bool = true) - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") if degree(K) == 1 L = number_field(x - 1, cached = cached, check = false)[1] @@ -132,7 +132,7 @@ end function _sieve_primitive_elements(B::Vector{AbsNonSimpleNumFieldElem}) K = parent(B[1]) - Zx = polynomial_ring(FlintZZ, "x", cached = false)[1] + Zx = polynomial_ring(ZZ, "x", cached = false)[1] pols = [Zx(to_univariate(Globals.Qx, x)) for x in K.pol] p, d = _find_prime(pols) F = Native.finite_field(p, d, "w", cached = false)[1] @@ -205,7 +205,7 @@ end function _sieve_primitive_elements(B::Vector{AbsSimpleNumFieldElem}) K = parent(B[1]) - Zx = polynomial_ring(FlintZZ, "x", cached = false)[1] + Zx = polynomial_ring(ZZ, "x", cached = false)[1] f = Zx(K.pol*denominator(K.pol)) a = gen(K)*denominator(K.pol) @@ -346,7 +346,7 @@ function polredabs(K::AbsSimpleNumField) I = index(ZK)^2 D = discriminant(ZK) B = basis(ZK, copy = false) - Zx = FlintZZ["x"][1] + Zx = ZZ["x"][1] f = Zx(K.pol) p, d = _find_prime(ZZPolyRingElem[f]) @@ -373,7 +373,7 @@ function polredabs(K::AbsSimpleNumField) while true try setprecision(BigFloat, pr) - E = enum_ctx_from_ideal(ideal(ZK, 1), zero_matrix(FlintZZ, 1, 1), prec = pr, TU = BigFloat, TC = BigFloat) + E = enum_ctx_from_ideal(ideal(ZK, 1), zero_matrix(ZZ, 1, 1), prec = pr, TU = BigFloat, TC = BigFloat) if E.C[end] + 0.0001 == E.C[end] # very very crude... pr *= 2 diff --git a/src/NumField/NfRel/NfRel.jl b/src/NumField/NfRel/NfRel.jl index c1b469a216..aba51530bf 100644 --- a/src/NumField/NfRel/NfRel.jl +++ b/src/NumField/NfRel/NfRel.jl @@ -192,7 +192,7 @@ end #Conversion to absolute non simple function number_field(::Type{AbsSimpleNumField}, L::RelSimpleNumField{AbsSimpleNumFieldElem}; check::Bool = true, cached::Bool = true) @assert degree(base_field(L)) == 1 - pol = to_univariate(Globals.Qx, map_coefficients(FlintQQ, L.pol, cached = false)) + pol = to_univariate(Globals.Qx, map_coefficients(QQ, L.pol, cached = false)) return number_field(pol, check = false, cached = cached) end @@ -641,7 +641,7 @@ function charpoly(a::RelSimpleNumFieldElem, k::Union{RelSimpleNumField, AbsSimpl end function absolute_charpoly(a::RelSimpleNumFieldElem) - return charpoly(a, FlintQQ) + return charpoly(a, QQ) end function (R::Generic.PolyRing{AbsSimpleNumFieldElem})(a::RelSimpleNumFieldElem{AbsSimpleNumFieldElem}) diff --git a/src/NumField/NfRel/NfRelNS.jl b/src/NumField/NfRel/NfRelNS.jl index 951cfc65e6..1fb1f0efcb 100644 --- a/src/NumField/NfRel/NfRelNS.jl +++ b/src/NumField/NfRel/NfRelNS.jl @@ -33,7 +33,7 @@ ################################################################################ #= trivial example -Qx, x = polynomial_ring(FlintQQ) +Qx, x = polynomial_ring(QQ) QQ = number_field(x-1)[1] QQt, t = QQ["t"] K, gK = number_field([t^2-2, t^2-3, t^2-5, t^2-7]) @@ -186,7 +186,7 @@ function number_field(::Type{AbsNonSimpleNumField}, L::RelNonSimpleNumField{AbsS @assert degree(base_field(L)) == 1 K = base_field(L) Kx, _ = polynomial_ring(K, "x", cached = false) - pols = QQPolyRingElem[map_coefficients(FlintQQ, to_univariate(Kx, x), parent = Hecke.Globals.Qx) for x in L.pol] + pols = QQPolyRingElem[map_coefficients(QQ, to_univariate(Kx, x), parent = Hecke.Globals.Qx) for x in L.pol] return number_field(pols, cached = false, check = false) end @@ -786,7 +786,7 @@ function Nemo.discriminant(K::RelNonSimpleNumField, ::QQField) return d end -absolute_discriminant(K::RelNonSimpleNumField) = discriminant(K, FlintQQ) +absolute_discriminant(K::RelNonSimpleNumField) = discriminant(K, QQ) ################################################################################ # diff --git a/src/NumField/NfRel/NfRelNSMor.jl b/src/NumField/NfRel/NfRelNSMor.jl index 12bbb7aac5..38bef84c1e 100644 --- a/src/NumField/NfRel/NfRelNSMor.jl +++ b/src/NumField/NfRel/NfRelNSMor.jl @@ -91,15 +91,15 @@ function permutation_group1(G::Vector{<:NumFieldHom{RelNonSimpleNumField{AbsSimp L = domain(G[1]) K = base_field(L) dK = absolute_degree(L) - d1 = numerator(discriminant(L, FlintQQ)) + d1 = numerator(discriminant(L, QQ)) p = 2 while is_divisible_by(d1, p) p = next_prime(p) end - R = residue_ring(FlintZZ, p, cached = false)[1] + R = residue_ring(ZZ, p, cached = false)[1] Rm, gRm = polynomial_ring(R, ngens(L)+1, cached = false) fmod = Vector{zzModMPolyRingElem}(undef, ngens(L)+1) - RQm, gRQm = polynomial_ring(FlintQQ, ngens(L)+1, cached = false) + RQm, gRQm = polynomial_ring(QQ, ngens(L)+1, cached = false) p1 = K.pol p1Q = evaluate(p1, gRQm[end]) fmod[1] = Rm(p1Q) diff --git a/src/NumField/NfRel/Simplify.jl b/src/NumField/NfRel/Simplify.jl index 40b8fb7088..dc7857d517 100644 --- a/src/NumField/NfRel/Simplify.jl +++ b/src/NumField/NfRel/Simplify.jl @@ -180,7 +180,7 @@ function _find_prime(L::RelNonSimpleNumField{AbsSimpleNumFieldElem}) K = base_field(L) OK = maximal_order(K) OL = maximal_order(L) - dL = numerator(discriminant(L, FlintQQ)) + dL = numerator(discriminant(L, QQ)) n_attempts = min(degree(L), 10) candidates = Vector{Tuple{AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}, Int}}(undef, n_attempts) diff --git a/src/NumField/QQ.jl b/src/NumField/QQ.jl index 94ad078a30..a6d80a2f02 100644 --- a/src/NumField/QQ.jl +++ b/src/NumField/QQ.jl @@ -34,9 +34,9 @@ end Base.hash(x::ZZIdl, h::UInt) = hash(gen(x), h) -order(::ZZIdl) = FlintZZ +order(::ZZIdl) = ZZ -order(::ZZFracIdl) = FlintZZ +order(::ZZFracIdl) = ZZ # constructors *(::ZZRing, x::IntegerUnion) = ideal(ZZ, x) @@ -177,9 +177,9 @@ place_type(::Type{QQField}) = PosInf fractional_ideal_type(::QQField) = ZZFracIdl -elem_in_nf(x::ZZRingElem) = FlintQQ(x) +elem_in_nf(x::ZZRingElem) = QQ(x) -nf(::ZZRing) = FlintQQ +nf(::ZZRing) = QQ # Infinite places diff --git a/src/NumField/Subfields.jl b/src/NumField/Subfields.jl index 45806c4ccc..5a5524291a 100644 --- a/src/NumField/Subfields.jl +++ b/src/NumField/Subfields.jl @@ -55,7 +55,7 @@ function _improve_subfield_basis(K, bas) deno = lcm(deno, denominator(basinOK[i, j])) end end - S = saturate(map_entries(FlintZZ, basinOK * deno)) + S = saturate(map_entries(ZZ, basinOK * deno)) SS = S * basis_matrix(FakeFmpqMat, OK, copy = false) lllOK = lll(OK) N = (SS * basis_mat_inv(FakeFmpqMat, lllOK)).num @@ -74,7 +74,7 @@ function _improve_subfield_basis_no_lll(K, bas) deno = lcm(deno, denominator(basinOK[i, j])) end end - S = saturate(map_entries(FlintZZ, basinOK * deno)) + S = saturate(map_entries(ZZ, basinOK * deno)) SS = S * basis_matrix(FakeFmpqMat, OK, copy = false) return SS end @@ -133,7 +133,7 @@ function _subfield_primitive_element_from_basis(K::AbsSimpleNumField, as::Vector # First check basis elements @vprintln :Subfields 1 "Sieving for primitive elements" # First check basis elements - Zx = polynomial_ring(FlintZZ, "x", cached = false)[1] + Zx = polynomial_ring(ZZ, "x", cached = false)[1] f = Zx(K.pol*denominator(K.pol)) p, d = _find_prime(ZZPolyRingElem[f]) #First, we search for elements that are primitive using block systems @@ -169,7 +169,7 @@ function _subfield_primitive_element_from_basis(K::AbsSimpleNumField, as::Vector @vprintln :Subfields 1 "Trying combinations of elements in the basis" # Notation: cs the coefficients in a linear combination of the as, ca the dot # product of these vectors. - cs = ZZRingElem[rand(FlintZZ, -2:2) for n in 1:dsubfield] + cs = ZZRingElem[rand(ZZ, -2:2) for n in 1:dsubfield] k = 0 s = 1 first = true @@ -199,7 +199,7 @@ function _subfield_primitive_element_from_basis(K::AbsSimpleNumField, as::Vector # increment the components of cs bb = div(s, 10)+1 for n = 1:dsubfield - cs[n] = rand(FlintZZ, -bb:bb) + cs[n] = rand(ZZ, -bb:bb) end end end @@ -445,7 +445,7 @@ function fixed_field1(K::AbsSimpleNumField, auts::Vector{<:NumFieldHom{AbsSimple if isdefined(OK, :lllO) || degree(K) >= 50 OK = lll(OK) end - M = zero_matrix(FlintZZ, degree(K), degree(K)*length(auts_new)) + M = zero_matrix(ZZ, degree(K), degree(K)*length(auts_new)) v = Vector{AbsSimpleNumFieldElem}(undef, degree(K)) MOK = basis_matrix(FakeFmpqMat, OK, copy = false) MOKinv = basis_mat_inv(FakeFmpqMat, OK, copy = false) diff --git a/src/NumFieldOrd/NfOrd/Clgp/Ctx.jl b/src/NumFieldOrd/NfOrd/Clgp/Ctx.jl index e52a7919ec..3c08572883 100644 --- a/src/NumFieldOrd/NfOrd/Clgp/Ctx.jl +++ b/src/NumFieldOrd/NfOrd/Clgp/Ctx.jl @@ -75,7 +75,7 @@ function class_group_init(FB::NfFactorBase, T::DataType = sparse_matrix_type(ZZ) end end - l = zero_matrix(FlintZZ, n, 1+clg.c.r2) + l = zero_matrix(ZZ, n, 1+clg.c.r2) for i = 1:n l[i,1] = 1 end @@ -88,7 +88,7 @@ function class_group_init(FB::NfFactorBase, T::DataType = sparse_matrix_type(ZZ) # however, there is nullspace - which is strange... l, t = hnf_with_transform(l) if 1 + clg.c.r2 + 1 > nrows(l) - t = zero_matrix(FlintZZ, 0, 0) + t = zero_matrix(ZZ, 0, 0) else t = view(t, (1+clg.c.r2+1):nrows(l), 1:nrows(l)) end diff --git a/src/NumFieldOrd/NfOrd/Clgp/FacBase_Idl.jl b/src/NumFieldOrd/NfOrd/Clgp/FacBase_Idl.jl index 566dcab3fe..a718532da2 100644 --- a/src/NumFieldOrd/NfOrd/Clgp/FacBase_Idl.jl +++ b/src/NumFieldOrd/NfOrd/Clgp/FacBase_Idl.jl @@ -97,7 +97,7 @@ function _factor!(FB::NfFactorBase, a::AbsSimpleNumFieldElem, df = numerator(n)*denominator(a, O) end if isone(df) - return true, sparse_row(FlintZZ) + return true, sparse_row(ZZ) end d = factor(FB.fb_int, df, error) #careful: if df is non-int-smooth, then error is ignored @@ -126,11 +126,11 @@ function _factor!(FB::NfFactorBase, a::AbsSimpleNumFieldElem, @hassert :ClassGroup 9000 ideal(O, a) == prod([FB.ideals[i]^j for (i, j) in r]) end @hassert :ClassGroup 1 length(r) > 0 - return ret, sparse_row(FlintZZ, r) + return ret, sparse_row(ZZ, r) else # factor failed or I have a unit. # sparse rel mat must not have zero-rows. - return false, sparse_row(FlintZZ) + return false, sparse_row(ZZ) end end @@ -148,7 +148,7 @@ function _factor!(FB::Hecke.NfFactorBase, A::Hecke.AbsNumFieldOrderIdeal{AbsSimp # If the ideal is the trivial ideal, return true, and the zero row # Otherwise factor will choke if isone(n) - return true, sparse_row(FlintZZ) + return true, sparse_row(ZZ) end d = factor(FB.fb_int, n) # as above: fails - even if error is false - @@ -173,7 +173,7 @@ function _factor!(FB::Hecke.NfFactorBase, A::Hecke.AbsNumFieldOrderIdeal{AbsSimp if error @assert vp == 0 end - return false, sparse_row(FlintZZ) + return false, sparse_row(ZZ) end r = vcat(r, s) end @@ -183,14 +183,14 @@ function _factor!(FB::Hecke.NfFactorBase, A::Hecke.AbsNumFieldOrderIdeal{AbsSimp FB.mx = length(rw) end sort!(r, lt = (a,b) -> a[1] < b[1]) - res = sparse_row(FlintZZ, r) + res = sparse_row(ZZ, r) @hassert :ClassGroup 9000 A == prod([FB.ideals[i]^j for (i, j) in r]) @hassert :ClassGroup 1 length(r) > 0 return true, res else # factor failed or I have a unit. # sparse rel mat must not have zero-rows. - return false, sparse_row(FlintZZ) + return false, sparse_row(ZZ) end end diff --git a/src/NumFieldOrd/NfOrd/Clgp/Map.jl b/src/NumFieldOrd/NfOrd/Clgp/Map.jl index 9f486569de..128ac6a111 100644 --- a/src/NumFieldOrd/NfOrd/Clgp/Map.jl +++ b/src/NumFieldOrd/NfOrd/Clgp/Map.jl @@ -93,7 +93,7 @@ function class_group_disc_log(r::SRow{ZZRingElem}, c::ClassGrpCtx) release_tmp(c.M.basis, tmp) # println("reduced to $r") - rr = zero_matrix(FlintZZ, 1, nrows(T)) + rr = zero_matrix(ZZ, 1, nrows(T)) for (p,v) = r rr[1, p-s+1] = v end @@ -178,7 +178,7 @@ function class_group_ideal_relation(I::AbsNumFieldOrderIdeal{AbsSimpleNumField, continue end na = norm(E.A)*abs(na) - n = FlintZZ(norm(iI)*na) + n = ZZ(norm(iI)*na) if is_smooth(c.FB.fb_int, n) a = K(O(ZZRingElem[aa[1, i] for i=1:degree(K)])) Ia = simplify(a*iI) @@ -187,7 +187,7 @@ function class_group_ideal_relation(I::AbsNumFieldOrderIdeal{AbsSimpleNumField, local r::SRow{ZZRingElem} if isone(n) @assert isone(Ia.num) - r = sparse_row(FlintZZ) + r = sparse_row(ZZ) else fl, r = _factor!(c.FB, Ia.num, false) if !fl @@ -286,7 +286,7 @@ function class_group_grp(c::ClassGrpCtx; redo::Bool = false) if isone(h) # group is trivial... C = abelian_group(ZZRingElem[]) #mC = x -> 1*O, inv x-> [1] - c.dl_data = (1, identity_matrix(FlintZZ, 1), C) + c.dl_data = (1, identity_matrix(ZZ, 1), C) return C end @@ -468,7 +468,7 @@ function _isprincipal_fac_elem(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSi if !support return true, e else - prime_exponents = sparse_row(FlintZZ, collect(1:length(base)), rs) * vcat(c.M.bas_gens, c.M.rel_gens) + prime_exponents = sparse_row(ZZ, collect(1:length(base)), rs) * vcat(c.M.bas_gens, c.M.rel_gens) prime_exp = [ prime_exponents[i] for i in 1:length(c.FB.ideals)] invx = inv(x) dinvx = denominator(invx) @@ -561,7 +561,7 @@ end function unique_fmpz_mat(C::Nemo.ArbMatrix) half = parent(C[1,1])(QQFieldElem(1//2)) #TODO: does not work half = parent(C[1,1])(1)//2 - v = zero_matrix(FlintZZ, nrows(C), ncols(C)) + v = zero_matrix(ZZ, nrows(C), ncols(C)) for i=1:nrows(C) for j=1:ncols(C) @@ -575,7 +575,7 @@ function unique_fmpz_mat(C::Nemo.ArbMatrix) end function round_approx(::Type{ZZMatrix}, C::Nemo.ArbMatrix) - v = zero_matrix(FlintZZ, nrows(C), ncols(C)) + v = zero_matrix(ZZ, nrows(C), ncols(C)) for i=1:nrows(C) for j=1:ncols(C) @@ -607,7 +607,7 @@ function reduce_mod_units(a::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleNumF b = deepcopy(a) cnt = 10 - V = zero_matrix(FlintZZ, 1, 1) + V = zero_matrix(ZZ, 1, 1) local B::ArbMatrix @@ -814,7 +814,7 @@ function probabilistic_coprime(a::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSi error("Something wrong in short_elem") end try - l, t = lll(J.num, zero_matrix(FlintZZ, 1,1), prec = prec) + l, t = lll(J.num, zero_matrix(ZZ, 1,1), prec = prec) break catch e if !(e isa LowPrecisionLLL || e isa InexactError) @@ -823,7 +823,7 @@ function probabilistic_coprime(a::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSi end prec = 2 * prec end - rr = matrix(FlintZZ, 1, nrows(t), ZZRingElem[rand(1:((minimum(a)^2)*minimum(m))) for i = 1:nrows(t)]) + rr = matrix(ZZ, 1, nrows(t), ZZRingElem[rand(1:((minimum(a)^2)*minimum(m))) for i = 1:nrows(t)]) b1 = t*b c = rr*b1 s = divexact(elem_from_mat_row(K, c, 1, b_den), J.den) @@ -831,7 +831,7 @@ function probabilistic_coprime(a::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSi I = simplify(I) I1 = I.num while !is_coprime(I1, m) - rr = matrix(FlintZZ, 1, nrows(t), ZZRingElem[rand(1:((minimum(a)^2)*minimum(m))) for i = 1:nrows(t)]) + rr = matrix(ZZ, 1, nrows(t), ZZRingElem[rand(1:((minimum(a)^2)*minimum(m))) for i = 1:nrows(t)]) c = rr*b1 s = divexact(elem_from_mat_row(K, c, 1, b_den), J.den) I = s*a diff --git a/src/NumFieldOrd/NfOrd/Clgp/Rel_LLL.jl b/src/NumFieldOrd/NfOrd/Clgp/Rel_LLL.jl index 2095938c95..74e0ed30ad 100644 --- a/src/NumFieldOrd/NfOrd/Clgp/Rel_LLL.jl +++ b/src/NumFieldOrd/NfOrd/Clgp/Rel_LLL.jl @@ -82,7 +82,7 @@ function class_group_small_lll_elements_relation_start(clg::ClassGrpCtx{T}, O = order(A) n = degree(O) L, Tr = lll(A, prec = prec) - I = SmallLLLRelationsCtx(zero_matrix(FlintZZ, 1, 1)) + I = SmallLLLRelationsCtx(zero_matrix(ZZ, 1, 1)) S = Tr*basis_matrix(A, copy = false) bd = abs(discriminant(O))*norm(A)^2 bd = root(bd, n, check = false) @@ -104,7 +104,7 @@ function class_group_small_lll_elements_relation_start(clg::ClassGrpCtx{T}, #now select a subset that can yield "small" relations, where #small means of effective norm <= sqrt(disc) I.A = A - I.elt = zero_matrix(FlintZZ, 1, n) + I.elt = zero_matrix(ZZ, 1, n) return I end diff --git a/src/NumFieldOrd/NfOrd/Clgp/Rel_add.jl b/src/NumFieldOrd/NfOrd/Clgp/Rel_add.jl index f164c3faf9..cb17ceaa02 100644 --- a/src/NumFieldOrd/NfOrd/Clgp/Rel_add.jl +++ b/src/NumFieldOrd/NfOrd/Clgp/Rel_add.jl @@ -14,7 +14,7 @@ function special_prime_ideal(p::ZZRingElem, a::AbsSimpleNumFieldElem) K = parent(a) f = K.pol R = parent(f) - Zx = polynomial_ring(FlintZZ)[1] + Zx = polynomial_ring(ZZ)[1] Zpx = polynomial_ring(Native.GF(UInt(p), cached=false), "\$x_p", cached=false)[1] g = Zpx(a) ff = Zpx(f) @@ -149,7 +149,7 @@ end function class_group_add_relation(clg::ClassGrpCtx{<:SMat{ZZRingElem}}, a::FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}) - R = sparse_row(FlintZZ) + R = sparse_row(ZZ) for i = 1:length(clg.FB.ideals) p = clg.FB.ideals[i] v = valuation(a, p) diff --git a/src/NumFieldOrd/NfOrd/Clgp/Saturate.jl b/src/NumFieldOrd/NfOrd/Clgp/Saturate.jl index 2ede5227c4..4018a9d519 100644 --- a/src/NumFieldOrd/NfOrd/Clgp/Saturate.jl +++ b/src/NumFieldOrd/NfOrd/Clgp/Saturate.jl @@ -175,7 +175,7 @@ function compute_candidates_for_saturate(v::Vector{FacElem{AbsSimpleNumFieldElem z = z*A z = kernel(z, side = :right) if iszero(ncols(z)) - return zero_matrix(FlintZZ, 0, length(v1)) + return zero_matrix(ZZ, 0, length(v1)) end A = A*z if cA == ncols(A) @@ -324,7 +324,7 @@ function compute_candidates_for_saturate1(c::Hecke.ClassGrpCtx, p::Int, stable:: z = z*A z = kernel(z, side = :right) if iszero(ncols(z)) - return zero_matrix(FlintZZ, 0, length(R)) + return zero_matrix(ZZ, 0, length(R)) end A = A*z if cA == ncols(A) @@ -347,7 +347,7 @@ end function _get_element(e, R, R_mat, zeta, i) K = parent(zeta) a = FacElem(K(1)) - fac_a = sparse_row(FlintZZ) + fac_a = sparse_row(ZZ) for j = 1:length(R) if !iszero(e[j, i]) mul!(a, a, R[j]^e[j, i]) @@ -438,7 +438,7 @@ function saturate!(d::Hecke.ClassGrpCtx, U::Hecke.UnitGrpCtx, n::Int, stable::Fl zeta = Hecke.torsion_units_generator(K) @vprintln :Saturate 1 "(Hopefully) enlarging by $(ncols(e)) elements" - rels_added = sparse_matrix(FlintZZ) + rels_added = sparse_matrix(ZZ) R_mat = relations_matrix(c) wasted = false for i = ncols(e):-1:1 @@ -539,7 +539,7 @@ function simplify(c::Hecke.ClassGrpCtx, U::Hecke.UnitGrpCtx, cp::Int = 0; use_LL push!(vals_new_rels, deepcopy(c.M.basis.rows[i])) end if use_LLL && !isempty(new_rels) - M = sparse_matrix(FlintZZ) + M = sparse_matrix(ZZ) for x in vals_new_rels push!(M, x) end @@ -560,7 +560,7 @@ function simplify(c::Hecke.ClassGrpCtx, U::Hecke.UnitGrpCtx, cp::Int = 0; use_LL end end for i=1:length(U.units) - Hecke.class_group_add_relation(d, U.units[i], sparse_row(FlintZZ)) + Hecke.class_group_add_relation(d, U.units[i], sparse_row(ZZ)) end return d end diff --git a/src/NumFieldOrd/NfOrd/Clgp/Sunits.jl b/src/NumFieldOrd/NfOrd/Clgp/Sunits.jl index 029bd69786..5c41ab75be 100644 --- a/src/NumFieldOrd/NfOrd/Clgp/Sunits.jl +++ b/src/NumFieldOrd/NfOrd/Clgp/Sunits.jl @@ -41,7 +41,7 @@ function sunit_mod_units_group_fac_elem(I::Vector{AbsNumFieldOrderIdeal{AbsSimpl X = Vector{AbsSimpleNumFieldElem}() - rr = sparse_matrix(FlintZZ) + rr = sparse_matrix(ZZ) # To track the valuation of the S-units vals_of_rels = SRow{ZZRingElem}[] @@ -54,18 +54,18 @@ function sunit_mod_units_group_fac_elem(I::Vector{AbsNumFieldOrderIdeal{AbsSimpl # @assert prod([c.FB.ideals[p]^Int(v) for (p,v) = r]) == x*A push!(X, x) push!(rr, r) - v = sparse_row(FlintZZ) + v = sparse_row(ZZ) # We only track the valuation of the prime ideals in S. # Even though S might intersect the class group factor base # non-trivially, this should still be correct. - push!(vals_of_rels, sparse_row(FlintZZ, [(i, ZZRingElem(-1))], sort = false)) + push!(vals_of_rels, sparse_row(ZZ, [(i, ZZRingElem(-1))], sort = false)) end @vprintln :ClassGroup 1 "... done" @vprintln :ClassGroup 1 "solving..." @vtime :ClassGroup 1 R, d = _solve_ut(H, rr) - Rd = hcat(d*identity_matrix(SMat, FlintZZ, nrows(R)), ZZRingElem(-1)*R) + Rd = hcat(d*identity_matrix(SMat, ZZ, nrows(R)), ZZRingElem(-1)*R) @vprintln :ClassGroup 1 ".. done, now saturating ..." @vtime :ClassGroup 1 S = hnf(saturate(Rd)) @vprintln :ClassGroup 1 " done" @@ -87,7 +87,7 @@ function sunit_mod_units_group_fac_elem(I::Vector{AbsNumFieldOrderIdeal{AbsSimpl apply_right!(rs, T[i]) end - _val_vec = sparse_row(FlintZZ) + _val_vec = sparse_row(ZZ) e = FacElem(g, rs) for (p, v) = S1[s] @@ -135,7 +135,7 @@ function sunit_mod_units_group_fac_elem(I::Vector{AbsNumFieldOrderIdeal{AbsSimpl let I = I, S1 = S1, C = C function log(a::FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}) - b = sparse_row(FlintZZ) + b = sparse_row(ZZ) for i=1:length(I) v = valuation(a, I[i]) if v != 0 @@ -190,7 +190,7 @@ function sunit_group_fac_elem(I::Vector{AbsNumFieldOrderIdeal{AbsSimpleNumField, r = MapSUnitGrpFacElem() r.valuations = Vector{SRow{ZZRingElem}}(undef, ngens(G)) for i = 1:ngens(U) - r.valuations[i] = sparse_row(FlintZZ) + r.valuations[i] = sparse_row(ZZ) end for i = 1:ngens(S) r.valuations[i+ngens(U)] = mS.valuations[i] diff --git a/src/NumFieldOrd/NfOrd/Clgp/cm_field.jl b/src/NumFieldOrd/NfOrd/Clgp/cm_field.jl index 7347536d11..165f653f8f 100644 --- a/src/NumFieldOrd/NfOrd/Clgp/cm_field.jl +++ b/src/NumFieldOrd/NfOrd/Clgp/cm_field.jl @@ -55,7 +55,7 @@ function val_from_subfield(FB, mk, s) S = FB.ideals ZK = order(S[1]) - z = zero_matrix(SMat, FlintZZ, 0, length(S)) + z = zero_matrix(SMat, ZZ, 0, length(S)) zk = order(s[1]) @@ -85,7 +85,7 @@ function val_from_subfield(FB, mk, s) end end sort!(v, by = x -> x[1]) - push!(z, sparse_row(FlintZZ, v)) + push!(z, sparse_row(ZZ, v)) end return z end diff --git a/src/NumFieldOrd/NfOrd/Elem.jl b/src/NumFieldOrd/NfOrd/Elem.jl index ea62af20a0..463bada6b5 100644 --- a/src/NumFieldOrd/NfOrd/Elem.jl +++ b/src/NumFieldOrd/NfOrd/Elem.jl @@ -204,11 +204,11 @@ end @doc raw""" charpoly(a::AbsNumFieldOrderElem) -> ZZPolyRingElem - charpoly(a::AbsNumFieldOrderElem, FlintZZ) -> ZZPolyRingElem + charpoly(a::AbsNumFieldOrderElem, ZZ) -> ZZPolyRingElem The characteristic polynomial of $a$. """ -function charpoly(a::AbsNumFieldOrderElem, Zx::ZZPolyRing = ZZPolyRing(FlintZZ, :x, false)) +function charpoly(a::AbsNumFieldOrderElem, Zx::ZZPolyRing = ZZPolyRing(ZZ, :x, false)) return Zx(charpoly(elem_in_nf(a))) end @@ -217,7 +217,7 @@ end The minimal polynomial of $a$. """ -function minpoly(a::AbsNumFieldOrderElem, Zx::ZZPolyRing = ZZPolyRing(FlintZZ, :x, false)) +function minpoly(a::AbsNumFieldOrderElem, Zx::ZZPolyRing = ZZPolyRing(ZZ, :x, false)) return Zx(minpoly(elem_in_nf(a))) end @@ -461,7 +461,7 @@ function representation_matrix_mod(a::AbsNumFieldOrderElem, d::ZZRingElem) d2c, d2nc = ppio(d2, d) d1 = d * d2c if fits(Int, d1) - R = residue_ring(FlintZZ, Int(d1), cached = false)[1] + R = residue_ring(ZZ, Int(d1), cached = false)[1] AR = map_entries(R, A) BMR = map_entries(R, BM.num) BMinvR = map_entries(R, BMinv.num) @@ -481,7 +481,7 @@ function representation_matrix_mod(a::AbsNumFieldOrderElem, d::ZZRingElem) mod!(res, d) return res else - RR = residue_ring(FlintZZ, d1, cached = false)[1] + RR = residue_ring(ZZ, d1, cached = false)[1] ARR = map_entries(RR, A) BMRR = map_entries(RR, BM.num) mul!(ARR, BMRR, ARR) diff --git a/src/NumFieldOrd/NfOrd/FacElem.jl b/src/NumFieldOrd/NfOrd/FacElem.jl index 061e359a6e..24a440473d 100644 --- a/src/NumFieldOrd/NfOrd/FacElem.jl +++ b/src/NumFieldOrd/NfOrd/FacElem.jl @@ -357,7 +357,7 @@ function _get_support(a::FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}, I::A i += 1 @vprint :CompactPresentation 3 "Element $i / $(length(a.fac))" if isinteger(e) - Id1 = ideal(Zk, FlintZZ(e)) + Id1 = ideal(Zk, ZZ(e)) push!(A, (Id1, v)) continue end diff --git a/src/NumFieldOrd/NfOrd/FactorBaseBound.jl b/src/NumFieldOrd/NfOrd/FactorBaseBound.jl index f5de861a8d..e13306c7e4 100644 --- a/src/NumFieldOrd/NfOrd/FactorBaseBound.jl +++ b/src/NumFieldOrd/NfOrd/FactorBaseBound.jl @@ -71,7 +71,7 @@ function _factorbase_bound_bdf_right_side(O::AbsSimpleNumFieldOrder, x0::Float64 function comp_summand(p::ZZRingElem, m::Int) logp = log(R(p)) - pm2 = R(p)^(R(FlintZZ(m)//FlintZZ(2))) + pm2 = R(p)^(R(ZZ(m)//ZZ(2))) secondterm = R(1) - m*logp//logcurval diff --git a/src/NumFieldOrd/NfOrd/FracIdeal.jl b/src/NumFieldOrd/NfOrd/FracIdeal.jl index 56f12fc06e..351ed59b55 100644 --- a/src/NumFieldOrd/NfOrd/FracIdeal.jl +++ b/src/NumFieldOrd/NfOrd/FracIdeal.jl @@ -791,7 +791,7 @@ end function in(x::AbsSimpleNumFieldElem, y::AbsSimpleNumFieldOrderFractionalIdeal) B = inv(basis_matrix(FakeFmpqMat, y)) O = order(y) - M = zero_matrix(FlintZZ, 1, degree(O)) + M = zero_matrix(ZZ, 1, degree(O)) t = FakeFmpqMat(M) elem_to_mat_row!(t.num, 1, t.den, x) v = t*basis_mat_inv(FakeFmpqMat, O, copy = false) diff --git a/src/NumFieldOrd/NfOrd/Hensel.jl b/src/NumFieldOrd/NfOrd/Hensel.jl index 335943dd81..7be0d13b62 100644 --- a/src/NumFieldOrd/NfOrd/Hensel.jl +++ b/src/NumFieldOrd/NfOrd/Hensel.jl @@ -269,7 +269,7 @@ end #this is (or should be) the HNF basis for P^?? function _get_basis(pp::ZZRingElem, n::Int, pgg::ZZModPolyRingElem, Qt::ZZModPolyRing) - M = zero_matrix(FlintZZ, n, n) + M = zero_matrix(ZZ, n, n) Q = base_ring(Qt) #the lattice for reco: #zero!(M) @@ -299,7 +299,7 @@ function _get_LLL_basis(Mold, Miold, dold, p, pr, i, gg) modu = ZZRingElem(p)^25 for j = (pr[i-1]+25):25:pr[i] pp = ZZRingElem(p)^j - Q = residue_ring(FlintZZ, pp, cached=false)[1] + Q = residue_ring(ZZ, pp, cached=false)[1] Qt, t = polynomial_ring(Q, "t", cached=false) pgg = Qt(gg) M = _get_basis(pp, n, pgg, Qt) @@ -319,7 +319,7 @@ function _get_LLL_basis(Mold, Miold, dold, p, pr, i, gg) if !iszero(mod(pr[i]-pr[i-1], 25)) modu = ZZRingElem(p)^mod(pr[i]-pr[i-1], 25) pp = ZZRingElem(p)^pr[i] - Q = residue_ring(FlintZZ, pp, cached=false)[1] + Q = residue_ring(ZZ, pp, cached=false)[1] Qt, t = polynomial_ring(Q, "t", cached=false) pgg = Qt(gg) M = _get_basis(pp, n, pgg, Qt) @@ -400,7 +400,7 @@ function _hensel(f::Generic.Poly{AbsSimpleNumFieldElem}, #assumes f squarefree #assumes constant_coefficient(f) != 0 - ZX, X = polynomial_ring(FlintZZ, "X", cached = false) + ZX, X = polynomial_ring(ZZ, "X", cached = false) #to avoid embarrassment... @@ -492,7 +492,7 @@ function _hensel(f::Generic.Poly{AbsSimpleNumFieldElem}, roots_to_lift = trues(length(rt)) n = degree(K) - M = zero_matrix(FlintZZ, n, n) + M = zero_matrix(ZZ, n, n) local Mi::ZZMatrix local d::ZZRingElem @@ -500,7 +500,7 @@ function _hensel(f::Generic.Poly{AbsSimpleNumFieldElem}, for i=2:length(pr) @vprintln :Saturate 1 "Step number $i" pp = ZZRingElem(p)^pr[i] - Q = residue_ring(FlintZZ, pp, cached=false)[1] + Q = residue_ring(ZZ, pp, cached=false)[1] Qt, t = polynomial_ring(Q, "t", cached=false) #possibly this should be done with max precision and then adjusted down @@ -524,7 +524,7 @@ function _hensel(f::Generic.Poly{AbsSimpleNumFieldElem}, dold = d pr_intermediate = pr[i-1] + div(pr[i] - pr[i-1], 2) ppint = ZZRingElem(p)^pr_intermediate - Qint = residue_ring(FlintZZ, ppint, cached = false)[1] + Qint = residue_ring(ZZ, ppint, cached = false)[1] Qintt = polynomial_ring(Qint, "t", cached = false)[1] pggQint = Qintt(gg) Mint = _get_basis(ppint, n, pggQint, Qintt) @@ -635,9 +635,9 @@ function _hensel(f::Generic.Poly{AbsSimpleNumFieldElem}, cf = lift(ZX, (Qt(RT[j]*den) % pgg)*ap % pgg) end - ve = matrix(FlintZZ, 1, n, [coeff(cf, k) for k=0:n-1]) + ve = matrix(ZZ, 1, n, [coeff(cf, k) for k=0:n-1]) _ve = ve*Mi - mu = matrix(FlintZZ, 1, n, [ round(ZZRingElem, _ve[1, k], d) for k=1:n]) + mu = matrix(ZZ, 1, n, [ round(ZZRingElem, _ve[1, k], d) for k=1:n]) ve = ve - mu*M z = ZX() for kk=1:n diff --git a/src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl b/src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl index 42a0f89085..8c10252ad9 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl @@ -149,22 +149,22 @@ function +(x::AbsNumFieldOrderIdeal, y::AbsNumFieldOrderIdeal) if is_simple(nf(OK)) && is_defining_polynomial_nice(nf(OK)) && contains_equation_order(OK) && is_prime(g) && !is_index_divisor(OK, g) && has_2_elem(x) && has_2_elem(y) #I can use polynomial arithmetic if fits(Int, g) - R1 = residue_ring(FlintZZ, Int(g), cached = false)[1] + R1 = residue_ring(ZZ, Int(g), cached = false)[1] R1x = polynomial_ring(R1, "x", cached = false)[1] ggp_small = gcd(R1x(x.gen_two.elem_in_nf), R1x(y.gen_two.elem_in_nf)) if isone(ggp_small) return ideal(OK, 1) end - Zx = polynomial_ring(FlintZZ, "x", cached = false)[1] + Zx = polynomial_ring(ZZ, "x", cached = false)[1] ggZ = lift(Zx, ggp_small) else - R = residue_ring(FlintZZ, g, cached = false)[1] + R = residue_ring(ZZ, g, cached = false)[1] Rx = polynomial_ring(R, "x", cached = false)[1] ggp_large = gcd(Rx(x.gen_two.elem_in_nf), Rx(y.gen_two.elem_in_nf)) if isone(ggp_large) return ideal(OK, 1) end - Zx = polynomial_ring(FlintZZ, "x", cached = false)[1] + Zx = polynomial_ring(ZZ, "x", cached = false)[1] ggZ = lift(Zx, ggp_large) end gen_2 = OK(nf(OK)(ggZ)) @@ -256,8 +256,8 @@ function mul_gen(x::S, y::S) where S <: AbsNumFieldOrderIdeal end return J end - z = zero_matrix(FlintZZ, 2*degree(O), degree(O)) - z1 = zero_matrix(FlintZZ, 2*degree(O), degree(O)) + z = zero_matrix(ZZ, 2*degree(O), degree(O)) + z1 = zero_matrix(ZZ, 2*degree(O), degree(O)) X = basis(x, copy = false) Y = basis_matrix(y, copy = false) for i in 1:d @@ -416,7 +416,7 @@ function prod_via_2_elem_weakly(a::S, b::S) where S <: AbsNumFieldOrderIdeal add!(gen, u, gen) # Nemo.add_into!(u, gen, gen) # gen2 += (r1*K(a.gen_two) + r2*a.gen_one) * # (r3*K(b.gen_two) + r4*b.gen_one) - gen = mod(gen, mod_c^2) # = element_reduce_mod(gen, O, FlintZZ(mod_c)^2) + gen = mod(gen, mod_c^2) # = element_reduce_mod(gen, O, ZZ(mod_c)^2) if gcd(norm(gen), norm_int_c^2) == norm_int_c # should be ^n, but for # the test ^2 is sufficient @@ -707,7 +707,7 @@ end function mul_gen(x::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}, y::ZZRingElem) if y == 0 - z = ideal(order(x), zero_matrix(FlintZZ, degree(order(x)), degree(order(x)))) + z = ideal(order(x), zero_matrix(ZZ, degree(order(x)), degree(order(x)))) z.iszero = 1 return z end @@ -918,7 +918,7 @@ function divexact(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldE t_2_elem = 0.0 if norm(A, copy = false) == norm(B, copy = false) - return ideal(order(A), one(FlintZZ), order(A)(1)) + return ideal(order(A), one(ZZ), order(A)(1)) else t_prod += @elapsed I = A*inv(B) t_simpl += @elapsed simplify_exact!(I) @@ -952,13 +952,13 @@ function extend(A::AbsNumFieldOrderIdeal, O::AbsNumFieldOrder) # Assumes order(A) \subseteq O if iszero(A) - B = ideal(O, zero_matrix(FlintZZ, degree(O), degree(O))) + B = ideal(O, zero_matrix(ZZ, degree(O), degree(O))) B.iszero = 1 return B end d = degree(O) - M = zero_matrix(FlintZZ, d^2, d) + M = zero_matrix(ZZ, d^2, d) X = basis(O, copy = false) Y = map(O, basis(A, copy = false)) t = O() @@ -984,7 +984,7 @@ function contract(A::AbsNumFieldOrderIdeal, O::AbsNumFieldOrder) # Assumes O \subseteq order(A) if iszero(A) - B = ideal(O, zero_matrix(FlintZZ, degree(O), degree(O))) + B = ideal(O, zero_matrix(ZZ, degree(O), degree(O))) B.iszero = 1 return B end diff --git a/src/NumFieldOrd/NfOrd/Ideal/FacElem.jl b/src/NumFieldOrd/NfOrd/Ideal/FacElem.jl index a1702ef5d9..6ea43b1b84 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/FacElem.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/FacElem.jl @@ -9,7 +9,7 @@ function factored_norm(A::FacElem{AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSi # b[n] = k #end end - bb = FacElem(FlintQQ, b) + bb = FacElem(QQ, b) simplify!(bb) return bb end @@ -45,7 +45,7 @@ function factored_norm(A::FacElem{AbsSimpleNumFieldOrderFractionalIdeal, AbsNumF # b[v] = -k #end end - bb = FacElem(FlintQQ, b) + bb = FacElem(QQ, b) simplify!(bb) return bb end diff --git a/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl b/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl index 3ada9ff390..2399da4d0d 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl @@ -210,7 +210,7 @@ function ideal(O::AbsNumFieldOrder, v::Vector{<:AbsNumFieldOrderElem}) for i = 1:length(v) @assert O === parent(v[i]) end - M = zero_matrix(FlintZZ, 2*degree(O), degree(O)) + M = zero_matrix(ZZ, 2*degree(O), degree(O)) M1 = representation_matrix(v[1]) _hnf!(M1, :lowerleft) _copy_matrix_into_matrix(M, degree(O)+1, 1, M1) @@ -310,7 +310,7 @@ function ideal_from_z_gens(O::AbsSimpleNumFieldOrder, b::Vector{AbsSimpleNumFiel d = degree(O) @assert length(b) >= d - M = zero_matrix(FlintZZ, length(b), d) + M = zero_matrix(ZZ, length(b), d) for i = 1:length(b) el = coordinates(b[i]) for j = 1:d @@ -447,7 +447,7 @@ function assure_has_basis_matrix(A::AbsNumFieldOrderIdeal) if is_zero(princ_gen_special(A)) A.basis_matrix = zero_matrix(ZZ, 0, n) else - A.basis_matrix = scalar_matrix(FlintZZ, n, princ_gen_special(A)) + A.basis_matrix = scalar_matrix(ZZ, n, princ_gen_special(A)) end return nothing end @@ -495,7 +495,7 @@ function basis_mat_prime_deg_1(A::AbsNumFieldOrderIdeal) @assert A.minimum == A.norm O = order(A) n = degree(O) - b = identity_matrix(FlintZZ, n) + b = identity_matrix(ZZ, n) K, mK = residue_field(O, A) assure_has_basis(O) @@ -555,7 +555,7 @@ function assure_has_basis_mat_inv(A::AbsNumFieldOrderIdeal) else if degree(order(A)) == 1 # This will be fixed in flint 2.7 - A.basis_mat_inv = FakeFmpqMat(identity_matrix(FlintZZ, 1), basis_matrix(A, copy = false)[1, 1]) + A.basis_mat_inv = FakeFmpqMat(identity_matrix(ZZ, 1), basis_matrix(A, copy = false)[1, 1]) else A.basis_mat_inv = FakeFmpqMat(pseudo_inv(basis_matrix(A, copy = false))) end @@ -654,7 +654,7 @@ function assure_has_minimum(A::AbsNumFieldOrderIdeal) if has_weakly_normal(A) d = denominator(inv(K(A.gen_two)), order(A)) - d = gcd(d, FlintZZ(A.gen_one)) + d = gcd(d, ZZ(A.gen_one)) A.minimum = d return nothing end @@ -664,7 +664,7 @@ function assure_has_minimum(A::AbsNumFieldOrderIdeal) else M = basis_matrix(A, copy = false) d = prod(ZZRingElem[M[i, i] for i = 1:nrows(M)]) - v = matrix(FlintZZ, 1, nrows(M), coordinates(order(A)(d))) + v = matrix(ZZ, 1, nrows(M), coordinates(order(A)(d))) fl, s = can_solve_with_solution(M, v, side = :left) @assert fl den = denominator(s[1]//d) @@ -899,7 +899,7 @@ function in(x::AbsNumFieldOrderElem, y::AbsNumFieldOrderIdeal) end function containment_by_matrices(x::AbsNumFieldOrderElem, y::AbsNumFieldOrderIdeal) - R = residue_ring(FlintZZ, basis_mat_inv(FakeFmpqMat, y, copy = false).den, cached = false)[1] + R = residue_ring(ZZ, basis_mat_inv(FakeFmpqMat, y, copy = false).den, cached = false)[1] M = map_entries(R, basis_mat_inv(FakeFmpqMat, y, copy = false).num) v = matrix(R, 1, degree(parent(x)), coordinates(x, copy = false)) mul!(v, v, M) @@ -1036,14 +1036,14 @@ function _minmod_easy(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) Zk = parent(b) k = number_field(Zk) if fits(Int, a) - S = residue_ring(FlintZZ, Int(a), cached = false)[1] + S = residue_ring(ZZ, Int(a), cached = false)[1] St = polynomial_ring(S, cached=false)[1] B = St(b.elem_in_nf) F = St(k.pol) m = data(reduced_resultant(B, F)) return gcd(a, m) else - S1 = residue_ring(FlintZZ, a, cached = false)[1] + S1 = residue_ring(ZZ, a, cached = false)[1] St1 = polynomial_ring(S1, cached=false)[1] B1 = St1(b.elem_in_nf) F1 = St1(k.pol) @@ -1056,14 +1056,14 @@ function _minmod_easy_pp(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) Zk = parent(b) k = number_field(Zk) if fits(Int, a) - S = residue_ring(FlintZZ, Int(a), cached = false)[1] + S = residue_ring(ZZ, Int(a), cached = false)[1] St = polynomial_ring(S, cached=false)[1] B = St(b.elem_in_nf) F = St(k.pol) m = lift(rres_sircana_pp(B, F)) return gcd(a, m) else - S1 = residue_ring(FlintZZ, a, cached = false)[1] + S1 = residue_ring(ZZ, a, cached = false)[1] St1 = polynomial_ring(S1, cached=false)[1] B1 = St1(b.elem_in_nf) F1 = St1(k.pol) @@ -1112,12 +1112,12 @@ function _minmod_comp_pp(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) d, _ = ppio(d, acom) mod = acom*d*e if fits(Int, mod) - S1 = residue_ring(FlintZZ, Int(mod), cached = false)[1] + S1 = residue_ring(ZZ, Int(mod), cached = false)[1] St1 = polynomial_ring(S1, cached=false)[1] B1 = St1(d*b.elem_in_nf) F1 = St1(k.pol) m1, u1, v1 = rresx_sircana_pp(B1, F1) # u*B + v*F = m mod modulus(S) - U1 = lift(FlintZZ["x"][1], u1) + U1 = lift(ZZ["x"][1], u1) # m can be zero... m2 = lift(m1) if iszero(m2) @@ -1127,12 +1127,12 @@ function _minmod_comp_pp(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) d = denominator(bi, Zk) return min_uncom*gcd(d, acom) else - S = residue_ring(FlintZZ, mod, cached = false)[1] + S = residue_ring(ZZ, mod, cached = false)[1] St = polynomial_ring(S, cached=false)[1] B = St(d*b.elem_in_nf) F = St(k.pol) m, u, v = rresx_sircana_pp(B, F) # u*B + v*F = m mod modulus(S) - U = lift(FlintZZ["x"][1], u) + U = lift(ZZ["x"][1], u) # m can be zero... m3 = lift(m) if iszero(m3) @@ -1160,12 +1160,12 @@ function _minmod_comp(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) d, _ = ppio(d, acom) mod = acom*d*e if fits(Int, mod) - S1 = residue_ring(FlintZZ, Int(mod), cached = false)[1] + S1 = residue_ring(ZZ, Int(mod), cached = false)[1] St1 = polynomial_ring(S1, cached=false)[1] B1 = St1(d*b.elem_in_nf) F1 = St1(k.pol) m1, u1, v1 = rresx(B1, F1) # u*B + v*F = m mod modulus(S) - U1 = lift(FlintZZ["x"][1], u1) + U1 = lift(ZZ["x"][1], u1) # m can be zero... m2 = lift(m1) if iszero(m2) @@ -1175,12 +1175,12 @@ function _minmod_comp(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) d = denominator(bi, Zk) return min_uncom*gcd(d, acom) else - S = residue_ring(FlintZZ, mod, cached = false)[1] + S = residue_ring(ZZ, mod, cached = false)[1] St = polynomial_ring(S, cached=false)[1] B = St(d*b.elem_in_nf) F = St(k.pol) m, u, v = rresx(B, F) # u*B + v*F = m mod modulus(S) - U = lift(FlintZZ["x"][1], u) + U = lift(ZZ["x"][1], u) # m can be zero... m3 = lift(m) if iszero(m3) @@ -1225,7 +1225,7 @@ function __invmod(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) e, _ = ppio(basis_matrix(FakeFmpqMat, Zk, copy = false).den, a) mod_r = a^2*d*e if fits(Int, mod_r) - S1 = residue_ring(FlintZZ, Int(mod_r), cached=false)[1] + S1 = residue_ring(ZZ, Int(mod_r), cached=false)[1] S1t = polynomial_ring(S1, cached=false)[1] B1 = S1t(d*b.elem_in_nf) F1 = S1t(k.pol) @@ -1237,11 +1237,11 @@ function __invmod(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) c1 = inv(canonical_unit(m1)) m1 = lift(m1*c1) end - U1 = lift(polynomial_ring(FlintZZ, "x", cached = false)[1], u1*c1) + U1 = lift(polynomial_ring(ZZ, "x", cached = false)[1], u1*c1) bi1 = k(U1)//m1*d # at this point, bi*d*b = m mod a*d*idx return bi1 else - S = residue_ring(FlintZZ, mod_r, cached=false)[1] + S = residue_ring(ZZ, mod_r, cached=false)[1] St = polynomial_ring(S, cached=false)[1] B = St(d*b.elem_in_nf) F = St(k.pol) @@ -1254,7 +1254,7 @@ function __invmod(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) c = inv(canonical_unit(m)) m = lift(m*c) end - U = lift(polynomial_ring(FlintZZ, "x", cached = false)[1], u*c) + U = lift(polynomial_ring(ZZ, "x", cached = false)[1], u*c) bi = k(U)//m*d # at this point, bi*d*b = m mod a*d*idx return bi end @@ -1321,7 +1321,7 @@ function _normmod_comp(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) com, uncom = ppio(d, a) mod = a*com^degree(k) if fits(Int, mod) - R = residue_ring(FlintZZ, Int(mod), cached=false)[1] + R = residue_ring(ZZ, Int(mod), cached=false)[1] Rt = polynomial_ring(R, cached=false)[1] B1 = Rt(d*b.elem_in_nf) F1 = Rt(k.pol) @@ -1329,7 +1329,7 @@ function _normmod_comp(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) m3 = gcd(modulus(R), lift(m2)) return divexact(m3, com^degree(parent(b))) else - S = residue_ring(FlintZZ, mod, cached=false)[1] + S = residue_ring(ZZ, mod, cached=false)[1] St = polynomial_ring(S, cached=false)[1] B = St(d*b.elem_in_nf) F = St(k.pol) @@ -1374,9 +1374,9 @@ function simplify(A::AbsNumFieldOrderIdeal) #TODO: improve the odds further: currently, the 2nd gen has small coeffs in the # order basis. For this it would better be small in the field basis.... n = _normmod(A.gen_one^degree(order(A)), A.gen_two) - @hassert :Rres 1 n == gcd(A.gen_one^degree(order(A)), FlintZZ(norm(A.gen_two))) + @hassert :Rres 1 n == gcd(A.gen_one^degree(order(A)), ZZ(norm(A.gen_two))) else - n = gcd(A.gen_one^degree(order(A)), FlintZZ(norm(A.gen_two))) + n = gcd(A.gen_one^degree(order(A)), ZZ(norm(A.gen_two))) end A.norm = n end @@ -2043,10 +2043,10 @@ function pradical_trace(O::AbsNumFieldOrder, p::IntegerUnion) if iszero(ncols(B)) return ideal(O, p) end - M2 = zero_matrix(FlintZZ, d, d) + M2 = zero_matrix(ZZ, d, d) for i = 1:ncols(B) for j = 1:d - M2[i, j] = FlintZZ(lift(ZZ, B[j, i])) + M2[i, j] = ZZ(lift(ZZ, B[j, i])) end end gens = elem_type(O)[O(p)] @@ -2100,7 +2100,7 @@ function pradical_frobenius(O::AbsNumFieldOrder, p::IntegerUnion) push!(gens, O(coords)) end #Then, construct the basis matrix of the ideal - m = zero_matrix(FlintZZ, d, d) + m = zero_matrix(ZZ, d, d) for i = 1:ncols(X) for j = 1:d m[i, j] = lift(ZZ, X[j, i]) @@ -2160,13 +2160,13 @@ function colon(a::AbsNumFieldOrderIdeal, b::AbsNumFieldOrderIdeal, contains::Boo bmatinv = basis_mat_inv(FakeFmpqMat, a, copy = false) if contains - m = zero_matrix(FlintZZ, n*length(B), n) - id_gen = zero_matrix(FlintZZ, 2*n, n) + m = zero_matrix(ZZ, n*length(B), n) + id_gen = zero_matrix(ZZ, 2*n, n) ind = 1 modu = minimum(a)*bmatinv.den for i = 1:length(B) if i != 1 - c = matrix(FlintZZ, 1, n, coordinates(B[i])) + c = matrix(ZZ, 1, n, coordinates(B[i])) reduce_mod_hnf_ll!(c, id_gen) if iszero(c) continue @@ -2401,14 +2401,14 @@ function is_coprime(I::AbsNumFieldOrderIdeal, J::AbsNumFieldOrderIdeal) K = nf(order(I)) if gcd(m, index(order(I))) == 1 if fits(Int, m) - RI = residue_ring(FlintZZ, Int(m), cached = false)[1] + RI = residue_ring(ZZ, Int(m), cached = false)[1] RIx = polynomial_ring(RI, "x", cached = false)[1] fI1 = RIx(I.gen_two.elem_in_nf) fI2 = RIx(J.gen_two.elem_in_nf) fI3 = RIx(K.pol) fl = _coprimality_test(fI1, fI2, fI3) else - R = residue_ring(FlintZZ, m, cached = false)[1] + R = residue_ring(ZZ, m, cached = false)[1] Rx = polynomial_ring(R, "x", cached = false)[1] f1 = Rx(I.gen_two.elem_in_nf) f2 = Rx(J.gen_two.elem_in_nf) diff --git a/src/NumFieldOrd/NfOrd/Ideal/Prime.jl b/src/NumFieldOrd/NfOrd/Ideal/Prime.jl index 335b2cd12e..685604c4a5 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/Prime.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/Prime.jl @@ -153,8 +153,8 @@ function ideal_from_poly(O::AbsSimpleNumFieldOrder, p::Int, fi::Zmodn_poly, ei:: idl = ideal(O, ZZRingElem(p), O(b, false)) idl.is_prime = 1 idl.splitting_type = ei, degree(fi) - idl.norm = FlintZZ(p)^degree(fi) - idl.minimum = FlintZZ(p) + idl.norm = ZZ(p)^degree(fi) + idl.minimum = ZZ(p) # We have to do something to get 2-normal presentation: # if ramified or valuation val(b,P) == 1, (p,b) @@ -350,7 +350,7 @@ function prime_dec_nonindex(O::AbsSimpleNumFieldOrder, p::IntegerUnion, degree_l K = nf(O) f = K.pol R = parent(f) - Zx, x = polynomial_ring(FlintZZ, "x", cached = false) + Zx, x = polynomial_ring(ZZ, "x", cached = false) Zf = Zx(f) if degree_limit == 0 @@ -372,8 +372,8 @@ function prime_dec_nonindex(O::AbsSimpleNumFieldOrder, p::IntegerUnion, degree_l I.gen_two = O(b, false) I.is_prime = 1 I.splitting_type = ei, degree(fi) - I.norm = FlintZZ(p)^degree(fi) - I.minimum = FlintZZ(p) + I.norm = ZZ(p)^degree(fi) + I.minimum = ZZ(p) # We have to do something to get 2-normal presentation: # if ramified or valuation val(b,P) == 1, (p,b) @@ -427,7 +427,7 @@ function anti_uniformizer(P::AbsNumFieldOrderIdeal) end p = minimum(P) M = representation_matrix(uniformizer(P)) - #Mp = matrix_space(residue_field(FlintZZ, p)[1], nrows(M), ncols(M), false)(M) + #Mp = matrix_space(residue_field(ZZ, p)[1], nrows(M), ncols(M), false)(M) Mp = change_base_ring(GF(p, cached = false), M) K = kernel(Mp, side = :left) @assert nrows(K) > 0 @@ -498,7 +498,7 @@ function prime_decomposition_type(O::AbsSimpleNumFieldOrder, p::T) where T <: In K = nf(O) f = K.pol R = parent(f) - Zx, x = polynomial_ring(FlintZZ,"x", cached = false) + Zx, x = polynomial_ring(ZZ,"x", cached = false) Zf = Zx(f) fmodp = polynomial_ring(Native.GF(p, cached = false), "y", cached = false)[1](Zf) return _prime_decomposition_type(fmodp) @@ -649,7 +649,7 @@ function divides(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldEl K = nf(order(A)) Qx = parent(K.pol) if !fits(Int, minimum(B)) - R = residue_ring(FlintZZ, minimum(B), cached = false)[1] + R = residue_ring(ZZ, minimum(B), cached = false)[1] Rx = polynomial_ring(R, "t", cached = false)[1] f1 = Rx(Qx(A.gen_two.elem_in_nf)) f2 = Rx(Qx(B.gen_two.elem_in_nf)) @@ -659,7 +659,7 @@ function divides(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldEl res = iszero(mod(f1, f2)) end else - R1 = residue_ring(FlintZZ, Int(minimum(B)), cached = false)[1] + R1 = residue_ring(ZZ, Int(minimum(B)), cached = false)[1] R1x = polynomial_ring(R1, "t", cached = false)[1] f11 = R1x(Qx(A.gen_two.elem_in_nf)) f21 = R1x(Qx(B.gen_two.elem_in_nf)) @@ -910,7 +910,7 @@ function _prefactorization(I::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimple end K = nf(I) el = I.gen_two.elem_in_nf - Zx = polynomial_ring(FlintZZ, "x")[1] + Zx = polynomial_ring(ZZ, "x")[1] f = Zx(K.pol) f1 = Zx(denominator(el)*el) return prefactorization(f, n, f1) @@ -1325,7 +1325,7 @@ end function _fac_and_lift(f::QQMPolyRingElem, p, degree_limit, lower_limit) - Zx, x = polynomial_ring(FlintZZ, cached = false) + Zx, x = polynomial_ring(ZZ, cached = false) Zmodpx = polynomial_ring(Native.GF(p, cached = false), "y", cached = false)[1] fmodp = Zmodpx(to_univariate(Globals.Qx, f)) fac = factor(fmodp) @@ -1366,9 +1366,9 @@ function prime_dec_nonindex(O::AbsNumFieldOrder{AbsNonSimpleNumField,AbsNonSimpl end Fpx = polynomial_ring(Native.GF(p, cached = false), cached = false)[1] - R = residue_ring(FlintZZ, p^2, cached = false)[1] + R = residue_ring(ZZ, p^2, cached = false)[1] Rx = polynomial_ring(R, cached = false)[1] - Zx = polynomial_ring(FlintZZ, cached = false)[1] + Zx = polynomial_ring(ZZ, cached = false)[1] fac = [_fac_and_lift(f, p, degree_limit, lower_limit) for f in all_f] all_c = [1 for f = all_f] @@ -1448,8 +1448,8 @@ function prime_dec_nonindex(O::AbsNumFieldOrder{AbsNonSimpleNumField,AbsNonSimpl ideal.gen_two = O(b, false) ideal.is_prime = 1 ideal.splitting_type = ei, degree(fi) - ideal.norm = FlintZZ(p)^degree(fi) - ideal.minimum = FlintZZ(p) + ideal.norm = ZZ(p)^degree(fi) + ideal.minimum = ZZ(p) # We have to do something to get 2-normal presentation: # if ramified or valuation val(b,P) == 1, (p,b) @@ -1647,12 +1647,12 @@ function decomposition_group(P::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimp end if is_index_divisor(OK, minimum(P, copy = false)) q = 2 - R = residue_ring(FlintZZ, q, cached = false)[1] + R = residue_ring(ZZ, q, cached = false)[1] Rx = polynomial_ring(R, "x", cached = false)[1] fmod = Rx(K.pol) while iszero(discriminant(fmod)) q = next_prime(q) - R = residue_ring(FlintZZ, q, cached = false)[1] + R = residue_ring(ZZ, q, cached = false)[1] Rx = polynomial_ring(R, "x", cached = false)[1] fmod = Rx(K.pol) end @@ -1693,7 +1693,7 @@ end function decomposition_group_easy(G, P) O = order(P) K = nf(O) - R = residue_ring(FlintZZ, Int(minimum(P, copy = false)), cached = false)[1] + R = residue_ring(ZZ, Int(minimum(P, copy = false)), cached = false)[1] Rt, t = polynomial_ring(R, "t", cached = false) fmod = Rt(K.pol) pols = zzModPolyRingElem[Rt(image_primitive_element(x)) for x in G] @@ -1757,12 +1757,12 @@ function inertia_subgroup(P::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleN igF = K(mF\gF) inertia_grp = morphism_type(AbsSimpleNumField, AbsSimpleNumField)[] q = 2 - R = residue_ring(FlintZZ, q, cached = false)[1] + R = residue_ring(ZZ, q, cached = false)[1] Rx = polynomial_ring(R, "x", cached = false)[1] fmod = Rx(K.pol) while iszero(discriminant(fmod)) q = next_prime(q) - R = residue_ring(FlintZZ, q, cached = false)[1] + R = residue_ring(ZZ, q, cached = false)[1] Rx = polynomial_ring(R, "x", cached = false)[1] fmod = Rx(K.pol) end @@ -1799,7 +1799,7 @@ function inertia_subgroup_easy(F, mF, G::Vector{<:NumFieldHom{AbsSimpleNumField, OK = order(P) K = nf(OK) p = minimum(P, copy = false) - R = residue_ring(FlintZZ, Int(p), cached = false)[1] + R = residue_ring(ZZ, Int(p), cached = false)[1] Rt = polynomial_ring(R, "t", cached = false)[1] fmod = Rt(K.pol) gF = gen(F) diff --git a/src/NumFieldOrd/NfOrd/Ideal/Relative.jl b/src/NumFieldOrd/NfOrd/Ideal/Relative.jl index 8c06a8c031..0243400a4a 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/Relative.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/Relative.jl @@ -54,10 +54,10 @@ function minimum(m::T, I::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumF bk = map(m, basis(maximal_order(k), k)) bK = map(K, basis(I)) d = lcm(lcm(map(denominator, bk)), lcm(map(denominator, bK))) - F = free_module(FlintZZ, degree(K)) + F = free_module(ZZ, degree(K)) - hsk = ModuleHomomorphism(free_module(FlintZZ, degree(k)), F, elem_type(F)[F(matrix(FlintZZ, 1, degree(K), coefficients(d*x))) for x = bk]) - hsK = ModuleHomomorphism(F, F, elem_type(F)[F(matrix(FlintZZ, 1, degree(K), coefficients(d*x))) for x = bK]) + hsk = ModuleHomomorphism(free_module(ZZ, degree(k)), F, elem_type(F)[F(matrix(ZZ, 1, degree(K), coefficients(d*x))) for x = bk]) + hsK = ModuleHomomorphism(F, F, elem_type(F)[F(matrix(ZZ, 1, degree(K), coefficients(d*x))) for x = bK]) sk = image(hsk) imhsK = image(hsK) mm = intersect(sk[1], imhsK[1]) @@ -70,8 +70,8 @@ function minimum(m::T, I::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumF # bK = map(K, basis(I)) # d = lcm(lcm(map(denominator, bk)), lcm(map(denominator, bK))) # F = abelian_group([0 for i in 1:degree(K)]) - # hsk = hom(abelian_group[0 for i in 1:degree(k)], F, elem_type(F)[F(matrix(FlintZZ, 1, degree(K), coefficients(d*x))) for x = bk]) - # hsK = hom(F, F, elem_type(F)[F(matrix(FlintZZ, 1, degree(K), coefficients(d*x))) for x = bK]) + # hsk = hom(abelian_group[0 for i in 1:degree(k)], F, elem_type(F)[F(matrix(ZZ, 1, degree(K), coefficients(d*x))) for x = bk]) + # hsK = hom(F, F, elem_type(F)[F(matrix(ZZ, 1, degree(K), coefficients(d*x))) for x = bK]) # sk = image(hsk) # imhsK = image(hsK) # mm = intersect(sk[1], imhsK[1], false) diff --git a/src/NumFieldOrd/NfOrd/Ideal/TwoElement.jl b/src/NumFieldOrd/NfOrd/Ideal/TwoElement.jl index e527268c86..affcc6a828 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/TwoElement.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/TwoElement.jl @@ -117,7 +117,7 @@ function _assure_weakly_normal_presentation(A::AbsNumFieldOrderIdeal) A.norm = abs(_normmod(A.gen_one^degree(order(A)), order(A)(b))) end @hassert :AbsNumFieldOrder 1 gcd(A.gen_one^degree(order(A)), - FlintZZ(norm(A.gen_two))) == A.norm + ZZ(norm(A.gen_two))) == A.norm if A.gen_one == 1 A.gens_normal = 2*A.gen_one @@ -172,7 +172,7 @@ function _assure_weakly_normal_presentation(A::AbsNumFieldOrderIdeal) r = -Amin2:Amin2 - m = zero_matrix(FlintZZ, 1, degree(O)) + m = zero_matrix(ZZ, 1, degree(O)) cnt = 0 while true diff --git a/src/NumFieldOrd/NfOrd/Ideal/Valuation.jl b/src/NumFieldOrd/NfOrd/Ideal/Valuation.jl index 8302ac8268..d9c572be68 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/Valuation.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/Valuation.jl @@ -16,14 +16,14 @@ function val_func_no_index_small(p::AbsNumFieldOrderIdeal{AbsSimpleNumField, Abs @assert P <= typemax(UInt) K = nf(order(p)) Rx = polynomial_ring(Native.GF(UInt(P), cached=false), cached=false)[1] - Zx = polynomial_ring(FlintZZ, cached = false)[1] + Zx = polynomial_ring(ZZ, cached = false)[1] gR = Rx(p.gen_two.elem_in_nf) f = Rx(K.pol) gR = gcd!(gR, gR, f) g = lift(Zx, gR) k = flog(ZZRingElem(typemax(UInt)), P) g = hensel_lift(Zx(K.pol), g, P, k) - Sx = polynomial_ring(residue_ring(FlintZZ, UInt(P)^k, cached=false)[1], cached=false)[1] + Sx = polynomial_ring(residue_ring(ZZ, UInt(P)^k, cached=false)[1], cached=false)[1] g = Sx(g) h = Sx() uP = UInt(P) @@ -50,13 +50,13 @@ function val_func_no_index(p::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimple K = nf(order(p)) # TODO (GF): Change to proper GF to use nmod if possible Rx, g = polynomial_ring(Native.GF(P, cached=false), cached=false) - Zx = polynomial_ring(FlintZZ, cached = false)[1] + Zx = polynomial_ring(ZZ, cached = false)[1] Nemo.nf_elem_to_gfp_fmpz_poly!(g, p.gen_two.elem_in_nf, false) f = Rx(K.pol) g = gcd(g, f) g = lift(Zx, g) g = hensel_lift(Zx(K.pol), g, P, 10) - Sx = polynomial_ring(residue_ring(FlintZZ, P^5, cached=false)[1], cached=false)[1] + Sx = polynomial_ring(residue_ring(ZZ, P^5, cached=false)[1], cached=false)[1] g = Sx(g) h = Sx() c = ZZRingElem() @@ -383,7 +383,7 @@ function valuation(a::AbsSimpleNumFieldElem, p::AbsNumFieldOrderIdeal{AbsSimpleN #valuation for integers is much easier. O = order(p) K = nf(O) - Zx = polynomial_ring(FlintZZ, "x")[1] + Zx = polynomial_ring(ZZ, "x")[1] pol_a = Zx(denominator(a)*a) c = content(pol_a) valnum = Int(valuation(c, p)) diff --git a/src/NumFieldOrd/NfOrd/LLL.jl b/src/NumFieldOrd/NfOrd/LLL.jl index 285d088ea1..3c702de5eb 100644 --- a/src/NumFieldOrd/NfOrd/LLL.jl +++ b/src/NumFieldOrd/NfOrd/LLL.jl @@ -21,7 +21,7 @@ function _lll_quad(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumField a1 = 2*numerator(norm(b[1])) a2 = 2*numerator(norm(b[2])) a12 = numerator(trace(b[1] * conjugate_quad(K(b[2])))) - g = matrix(FlintZZ, 2, 2, [a1, a12, a12, a2]) + g = matrix(ZZ, 2, 2, [a1, a12, a12, a2]) @hassert :LLL 1 is_positive_definite(g) l, t = lll_gram_with_transform(g) return FakeFmpqMat(l, ZZRingElem(1)), t::ZZMatrix @@ -44,7 +44,7 @@ end # ################################################################################ -function lll(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}, v::ZZMatrix = zero_matrix(FlintZZ, 1, 1); prec::Int = 100) +function lll(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}, v::ZZMatrix = zero_matrix(ZZ, 1, 1); prec::Int = 100) K = nf(order(A)) @@ -86,7 +86,7 @@ function lll(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}, end -function _lll(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}, v::ZZMatrix = zero_matrix(FlintZZ, 1, 1); prec::Int = 100) +function _lll(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}, v::ZZMatrix = zero_matrix(ZZ, 1, 1); prec::Int = 100) K = nf(order(A)) n = degree(order(A)) prec = max(prec, 4*n) @@ -98,7 +98,7 @@ function _lll(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem} d = minkowski_gram_mat_scaled(order(A), prec) ccall((:fmpz_mat_mul, libflint), Nothing, (Ref{ZZMatrix}, Ref{ZZMatrix}, Ref{ZZMatrix}), d, d, transpose(l)) ccall((:fmpz_mat_mul, libflint), Nothing, (Ref{ZZMatrix}, Ref{ZZMatrix}, Ref{ZZMatrix}), d, l, d) - g = zero_matrix(FlintZZ, n, n) + g = zero_matrix(ZZ, n, n) den = ZZRingElem(1) sv = ZZRingElem(0) else @@ -109,8 +109,8 @@ function _lll(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem} rt_c = roots_ctx(K) if !isdefined(rt_c, :cache_z1) - rt_c.cache_z1 = zero_matrix(FlintZZ, n, n) - rt_c.cache_z2 = zero_matrix(FlintZZ, n, n) + rt_c.cache_z1 = zero_matrix(ZZ, n, n) + rt_c.cache_z2 = zero_matrix(ZZ, n, n) end d::ZZMatrix = rt_c.cache_z1 @@ -266,7 +266,7 @@ end function _minkowski_via_approximation(B::Vector{T}) where T <: NumFieldElem K = parent(B[1]) n = length(B) - g = zero_matrix(FlintZZ, n, n) + g = zero_matrix(ZZ, n, n) prec = 16 imgs = Vector{Vector{ArbFieldElem}}(undef, n) for i = 1:n @@ -302,7 +302,7 @@ end function trace_matrix(b::Vector{T}) where T <: NumFieldElem K = parent(b[1]) n = absolute_degree(K) - g = zero_matrix(FlintZZ, n, n) + g = zero_matrix(ZZ, n, n) aux = K() for i = 1:n mul!(aux, b[i], b[i]) @@ -348,7 +348,7 @@ function _lll_quad(M::AbsNumFieldOrder) a1 = 2*numerator(norm(b[1])) a2 = 2*numerator(norm(b[2])) a12 = numerator(trace(b[1] * conjugate_quad(K(b[2])))) - g = matrix(FlintZZ, 2, 2, ZZRingElem[a1, a12, a12, a2]) + g = matrix(ZZ, 2, 2, ZZRingElem[a1, a12, a12, a2]) @hassert :ClassGroup 1 is_positive_definite(g) w = lll_gram_with_transform(g)[2] On = AbsNumFieldOrder(K, w*basis_matrix(FakeFmpqMat, M, copy = false)) @@ -497,7 +497,7 @@ function lll_precomputation(M::AbsNumFieldOrder, prec::Int, nblocks::Int = 4) end int = (dimension_blocks*(nblocks-1)+1):n push!(blocks, collect(int)) - g = identity_matrix(FlintZZ, n) + g = identity_matrix(ZZ, n) new_prec = prec to_do = subsets(blocks, 2) done = falses(length(to_do)) @@ -521,7 +521,7 @@ function lll_precomputation(M::AbsNumFieldOrder, prec::Int, nblocks::Int = 4) On.gen_index = M.gen_index end M = On - g = identity_matrix(FlintZZ, n) + g = identity_matrix(ZZ, n) continue end indices = vcat(to_do[block][1], to_do[block][2]) @@ -562,7 +562,7 @@ function _lll_sublattice(M::AbsNumFieldOrder, u::Vector{Int}; prec = 100) end end @vprintln :LLL 3 "Minkowski matrix computed" - g = identity_matrix(FlintZZ, l) + g = identity_matrix(ZZ, l) d1 = sub(d, u, u) prec = div(prec, 2) shift!(d1, -prec) #TODO: remove? @@ -589,7 +589,7 @@ function _lll_sublattice(M::AbsNumFieldOrder, u::Vector{Int}; prec = 100) return prec, g else @vprintln :LLL 3 "Output the same basis :(" - return prec, identity_matrix(FlintZZ, l) + return prec, identity_matrix(ZZ, l) end end @@ -628,7 +628,7 @@ function _lll_with_parameters(M::AbsNumFieldOrder, parameters::Tuple{Float64, Fl @vprintln :LLL 3 "Minkowski matrix computed" diag_d = prod_diagonal(d) - g = identity_matrix(FlintZZ, n) + g = identity_matrix(ZZ, n) prec = div(prec, 2) shift!(d, -prec) #TODO: remove? @@ -717,7 +717,7 @@ end A basis for $I$ that is reduced using the LLL algorithm for the Minkowski metric. """ -function lll_basis(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}, v::ZZMatrix = zero_matrix(FlintZZ, 1, 1); prec::Int = 100) +function lll_basis(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}, v::ZZMatrix = zero_matrix(ZZ, 1, 1); prec::Int = 100) L, T = lll(A, v, prec=prec) S = FakeFmpqMat(T)*basis_matrix(FakeFmpqMat, A, copy = false)*basis_matrix(FakeFmpqMat, order(A), copy = false) K = nf(order(A)) @@ -727,7 +727,7 @@ function lll_basis(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumField return q end -function lll_basis(A::AbsSimpleNumFieldOrderFractionalIdeal, v::ZZMatrix = zero_matrix(FlintZZ, 1, 1); prec::Int = 100) +function lll_basis(A::AbsSimpleNumFieldOrderFractionalIdeal, v::ZZMatrix = zero_matrix(ZZ, 1, 1); prec::Int = 100) assure_has_numerator_and_denominator(A) L, T = lll(A.num, v, prec=prec) S = FakeFmpqMat(T)*basis_matrix(A.num)*basis_matrix(FakeFmpqMat, order(A)) @@ -745,13 +745,13 @@ end ################################################################################ function short_elem(A::AbsSimpleNumFieldOrderFractionalIdeal, - v::ZZMatrix=zero_matrix(FlintZZ, 1,1); prec::Int = 100) + v::ZZMatrix=zero_matrix(ZZ, 1,1); prec::Int = 100) assure_has_numerator_and_denominator(A) return divexact(short_elem(A.num, v, prec = prec), A.den) end function short_elem(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}, - v::ZZMatrix = zero_matrix(FlintZZ, 1,1); prec::Int = 100) + v::ZZMatrix = zero_matrix(ZZ, 1,1); prec::Int = 100) # If A == 1 and v is trivial, we cache the short element on the order and # retrieve (as ong as the precision fits) if is_one(A) && size(v) == (1, 1) && is_zero(v) @@ -769,7 +769,7 @@ function short_elem(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFiel end function _short_elem(A::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}, - v::ZZMatrix = zero_matrix(FlintZZ, 1,1); prec::Int = 100) + v::ZZMatrix = zero_matrix(ZZ, 1,1); prec::Int = 100) K = nf(order(A)) t = lll(A, v, prec = prec)[2] w = view(t, 1:1, 1:ncols(t)) diff --git a/src/NumFieldOrd/NfOrd/LLLctx.jl b/src/NumFieldOrd/NfOrd/LLLctx.jl index 265210b4ed..8c98d47b3b 100644 --- a/src/NumFieldOrd/NfOrd/LLLctx.jl +++ b/src/NumFieldOrd/NfOrd/LLLctx.jl @@ -70,8 +70,8 @@ function minkowski_gram_mat_scaled(L::NfLat, p::Int) else c = minkowski_matrix(L, p) B = basis(L) - d = zero_matrix(FlintZZ, length(B), absolute_degree(K)) - A = zero_matrix(FlintZZ, length(B), length(B)) + d = zero_matrix(ZZ, length(B), absolute_degree(K)) + A = zero_matrix(ZZ, length(B), length(B)) round_scale!(d, c, p) ccall((:fmpz_mat_gram, libflint), Nothing, (Ref{ZZMatrix}, Ref{ZZMatrix}), A, d) shift!(A, -p) @@ -86,9 +86,9 @@ end function weighted_minkowski_gram_scaled(L::NfLat, v::ZZMatrix, prec::Int) c = deepcopy(minkowski_matrix(L, prec)) mult_by_2pow_diag!(c, v) - d = zero_matrix(FlintZZ, nrows(c), ncols(c)) + d = zero_matrix(ZZ, nrows(c), ncols(c)) round_scale!(d, c, prec) - g = zero_matrix(FlintZZ, nrows(c), nrows(c)) + g = zero_matrix(ZZ, nrows(c), nrows(c)) ccall((:fmpz_mat_gram, libflint), Nothing, (Ref{ZZMatrix}, Ref{ZZMatrix}), g, d) shift!(g, -prec) for i=1:n @@ -97,7 +97,7 @@ function weighted_minkowski_gram_scaled(L::NfLat, v::ZZMatrix, prec::Int) return g end -function lll(L::NfLat, weights::ZZMatrix = zero_matrix(FlintZZ, 1, 1); starting_prec::Int = 100 + 25*div(dim(L), 3) + Int(round(log(abs(discriminant(L)))))) +function lll(L::NfLat, weights::ZZMatrix = zero_matrix(ZZ, 1, 1); starting_prec::Int = 100 + 25*div(dim(L), 3) + Int(round(log(abs(discriminant(L)))))) if L.is_minkowski_exact M = _exact_minkowski_matrix(basis(L)) l, v = lll_gram_with_transform(M) @@ -152,8 +152,8 @@ function _lll(L::NfLat, weights::ZZMatrix, prec::Int) end end n = dim(L) - g = identity_matrix(FlintZZ, n) - g1 = identity_matrix(FlintZZ, n) + g = identity_matrix(ZZ, n) + g1 = identity_matrix(ZZ, n) ctx1 = Nemo.LLLContext(0.4, 0.51, :gram) ctx2 = Nemo.LLLContext(0.99, 0.51, :gram) @vtime :LLL 1 ccall((:fmpz_lll, libflint), Nothing, (Ref{ZZMatrix}, Ref{ZZMatrix}, Ref{Nemo.LLLContext}), d, g, ctx1) diff --git a/src/NumFieldOrd/NfOrd/LinearAlgebra.jl b/src/NumFieldOrd/NfOrd/LinearAlgebra.jl index 7699b01937..e9a595bed7 100644 --- a/src/NumFieldOrd/NfOrd/LinearAlgebra.jl +++ b/src/NumFieldOrd/NfOrd/LinearAlgebra.jl @@ -10,7 +10,7 @@ function _det_bound(M::Generic.Mat{AbsSimpleNumFieldOrderElem}) end function _max_max(M::Generic.Mat{AbsSimpleNumFieldOrderElem}) - d = FlintZZ(1) + d = ZZ(1) for i in 1:nrows(M) for j in 1:ncols(M) if !iszero(M[i, j]) @@ -120,7 +120,7 @@ function det(M::Generic.Mat{AbsSimpleNumFieldOrderElem}) @assert length(used_primes) == length(tmp_polys) - tmp_fmpz_poly = polynomial_ring(FlintZZ)[1]() + tmp_fmpz_poly = polynomial_ring(ZZ)[1]() for i in 0:degree(O) for j=1:length(used_primes) @@ -631,7 +631,7 @@ end function _make_integral!(P::PMat{T, S}) where {T, S} K = parent(P.matrix[1, 1]) O = order(P.coeffs[1]) - integralizer = one(FlintZZ) + integralizer = one(ZZ) for i = 1:nrows(P) divide_row!(P.matrix, i, K(denominator(P.coeffs[i]))) @@ -639,7 +639,7 @@ function _make_integral!(P::PMat{T, S}) where {T, S} simplify(P.coeffs[i]) end - z = one(FlintZZ) + z = one(ZZ) for i in 1:nrows(P) for j in 1:ncols(P) z = lcm(z, denominator(P.matrix[i, j], O)) @@ -1772,39 +1772,39 @@ function is_pseudo_hnf(M, shape::Symbol = :lowerleft) end function test_triangular() - M = zero_matrix(FlintZZ, 3, 3) + M = zero_matrix(ZZ, 3, 3) - M = FlintZZ[1 0 0; + M = ZZ[1 0 0; 0 1 0; 0 0 1] @assert is_triangular(M) - M = FlintZZ[0 0 0; + M = ZZ[0 0 0; 0 1 0; 0 0 1] @assert is_triangular(M) - M = FlintZZ[1 0 0; + M = ZZ[1 0 0; 0 0 0; 0 0 1] @assert !is_triangular(M) - M = FlintZZ[0 1 0; + M = ZZ[0 1 0; 0 0 1; 0 0 0] @assert !is_triangular(M) - M = FlintZZ[1 0 0; + M = ZZ[1 0 0; 0 1 0; 0 0 0] @assert !is_triangular(M) - M = FlintZZ[0 1 0; + M = ZZ[0 1 0; 1 0 0; 0 0 1] diff --git a/src/NumFieldOrd/NfOrd/MaxOrd/DedekindCriterion.jl b/src/NumFieldOrd/NfOrd/MaxOrd/DedekindCriterion.jl index 2c4a422b32..c2e9426a79 100644 --- a/src/NumFieldOrd/NfOrd/MaxOrd/DedekindCriterion.jl +++ b/src/NumFieldOrd/NfOrd/MaxOrd/DedekindCriterion.jl @@ -43,7 +43,7 @@ function dedekind_test(O::AbsSimpleNumFieldOrder, p::ZZRingElem, ::Val{compute_o end end - Zy, y = polynomial_ring(FlintZZ, "y") + Zy, y = polynomial_ring(ZZ, "y") Kx, x = polynomial_ring(GF(p, cached=false), "x", cached=false) f = nf(O).pol @@ -113,15 +113,15 @@ end -dedekind_test(O::AbsSimpleNumFieldOrder, p::Integer) = dedekind_test(O, FlintZZ(p)) +dedekind_test(O::AbsSimpleNumFieldOrder, p::Integer) = dedekind_test(O, ZZ(p)) dedekind_ispmaximal(O::AbsSimpleNumFieldOrder, p::ZZRingElem) = dedekind_test(O, p, Val(false)) -dedekind_ispmaximal(O::AbsSimpleNumFieldOrder, p::Integer) = dedekind_ispmaximal(O, FlintZZ(p)) +dedekind_ispmaximal(O::AbsSimpleNumFieldOrder, p::Integer) = dedekind_ispmaximal(O, ZZ(p)) dedekind_poverorder(O::AbsSimpleNumFieldOrder, p::ZZRingElem) = dedekind_test(O, p)[2] -dedekind_poverorder(O::AbsSimpleNumFieldOrder, p::Integer) = dedekind_poverorder(O, FlintZZ(p)) +dedekind_poverorder(O::AbsSimpleNumFieldOrder, p::Integer) = dedekind_poverorder(O, ZZ(p)) ############################################################################### @@ -133,8 +133,8 @@ dedekind_poverorder(O::AbsSimpleNumFieldOrder, p::Integer) = dedekind_poverorder function dedekind_test_composite(O::AbsSimpleNumFieldOrder, p::ZZRingElem) @assert is_equation_order(O) - Zy = polynomial_ring(FlintZZ, "y")[1] - R = residue_ring(FlintZZ, p, cached = false)[1] + Zy = polynomial_ring(ZZ, "y")[1] + R = residue_ring(ZZ, p, cached = false)[1] Rx = polynomial_ring(R, "x", cached=false)[1] f = Zy(nf(O).pol) diff --git a/src/NumFieldOrd/NfOrd/MaxOrd/MaxOrd.jl b/src/NumFieldOrd/NfOrd/MaxOrd/MaxOrd.jl index 2da539c09e..676a2b7610 100644 --- a/src/NumFieldOrd/NfOrd/MaxOrd/MaxOrd.jl +++ b/src/NumFieldOrd/NfOrd/MaxOrd/MaxOrd.jl @@ -33,7 +33,7 @@ or the discriminant of the maximal order. # Example ```julia-repl -julia> Qx, x = FlintQQ["x"]; +julia> Qx, x = QQ["x"]; julia> K, a = number_field(x^3 + 2, "a"); julia> O = MaximalOrder(K); ``` @@ -104,8 +104,8 @@ function pmaximal_overorder_at(O::AbsSimpleNumFieldOrder, primes::Vector{ZZRingE ind = index(O) K = nf(O) EO = EquationOrder(K) - M = zero_matrix(FlintZZ, 2 * degree(O), degree(O)) - Zx = polynomial_ring(FlintZZ, "x", cached = false)[1] + M = zero_matrix(ZZ, 2 * degree(O), degree(O)) + Zx = polynomial_ring(ZZ, "x", cached = false)[1] f = Zx(K.pol) for i in 1:length(primes1) p = primes1[i] @@ -152,7 +152,7 @@ function new_maximal_order(O::AbsSimpleNumFieldOrder; index_divisors::Vector{ZZR end if is_defining_polynomial_nice(K) && (is_equation_order(O) || contains_equation_order(O)) - Zx, x = polynomial_ring(FlintZZ, "x", cached = false) + Zx, x = polynomial_ring(ZZ, "x", cached = false) f1 = Zx(K.pol) ds = gcd(reduced_resultant(f1, derivative(f1)), discriminant(O)) l = prefactorization(f1, ds) @@ -181,7 +181,7 @@ function new_maximal_order(O::AbsSimpleNumFieldOrder; index_divisors::Vector{ZZR l1 = ZZRingElem[] OO = O @vprintln :AbsNumFieldOrder 1 "Trial division of the discriminant\n " - auxmat = zero_matrix(FlintZZ, 2*degree(K), degree(K)) + auxmat = zero_matrix(ZZ, 2*degree(K), degree(K)) first = true for d in l if disc != -1 @@ -305,7 +305,7 @@ end function _radical_by_poly(O::AbsSimpleNumFieldOrder, q::ZZRingElem) d = degree(O) K = nf(O) - R = residue_ring(FlintZZ, q, cached=false)[1] + R = residue_ring(ZZ, q, cached=false)[1] Rx = polynomial_ring(R, "x", cached = false)[1] f = Rx(K.pol) f1 = derivative(f) @@ -322,7 +322,7 @@ function _radical_by_poly(O::AbsSimpleNumFieldOrder, q::ZZRingElem) if !isone(fd) return fd, ideal(O, q) end - Zx = polynomial_ring(FlintZZ, "x")[1] + Zx = polynomial_ring(ZZ, "x")[1] qq, rr = divrem(p1, p2) @assert iszero(rr) gen2 = O(K(lift(Zx, qq))) @@ -344,9 +344,9 @@ end function _radical_by_trace(O::AbsSimpleNumFieldOrder, q::ZZRingElem) d = degree(O) K = nf(O) - R = residue_ring(FlintZZ, q, cached=false)[1] + R = residue_ring(ZZ, q, cached=false)[1] B = kernel(change_base_ring(R, trace_matrix(O)); side = :right) - M2 = zero_matrix(FlintZZ, d, d) + M2 = zero_matrix(ZZ, d, d) for i = 1:ncols(B) for j = 1:d na = lift(B[j, i]) @@ -638,13 +638,13 @@ function ring_of_multipliers(a::AbsNumFieldOrderIdeal) B = basis(a, copy = false) end @assert length(B) > 0 - id_gen = zero_matrix(FlintZZ, 2*n, n) - m = zero_matrix(FlintZZ, n*length(B), n) + id_gen = zero_matrix(ZZ, 2*n, n) + m = zero_matrix(ZZ, n*length(B), n) ind = 1 modu = minimum(a, copy = false)*bmatinv.den for i = 1:length(B) if i != 1 - c = matrix(FlintZZ, 1, n, coordinates(B[i])) + c = matrix(ZZ, 1, n, coordinates(B[i])) reduce_mod_hnf_ll!(c, id_gen) if iszero(c) continue @@ -800,7 +800,7 @@ function new_pradical_frobenius1(O::AbsSimpleNumFieldOrder, p::Int) #First, find the generators new_gens = Vector{AbsSimpleNumFieldOrderElem}() for i = 1:ncols(X) - coords = zeros(FlintZZ, d) + coords = zeros(ZZ, d) for j=1:nr coords[indices[j]] = lift(X[j, i]) end @@ -817,7 +817,7 @@ function new_pradical_frobenius1(O::AbsSimpleNumFieldOrder, p::Int) return I end #Then, construct the basis matrix of the ideal - m1 = zero_matrix(FlintZZ, length(new_gens) + d, d) + m1 = zero_matrix(ZZ, length(new_gens) + d, d) for i = 1:length(new_gens) el = coordinates(new_gens[i], copy = true) for j = 1:nr @@ -895,7 +895,7 @@ function pradical_frobenius1(O::AbsSimpleNumFieldOrder, p::Int) end #First, find the generators for i = 1:ncols(X) - coords = zeros(FlintZZ, d) + coords = zeros(ZZ, d) for j=1:nr coords[indices[j]] = lift(X[j, i]) end @@ -904,7 +904,7 @@ function pradical_frobenius1(O::AbsSimpleNumFieldOrder, p::Int) end end #Then, construct the basis matrix of the ideal - m1 = zero_matrix(FlintZZ, length(gens) - 2 + d, d) + m1 = zero_matrix(ZZ, length(gens) - 2 + d, d) for i = 3:length(gens) el = coordinates(gens[i], copy = false) for j = 1:nr @@ -956,13 +956,13 @@ function pradical_trace1(O::AbsSimpleNumFieldOrder, p::IntegerUnion) for j = 1:d coords[j] = lift(B[j, i]) end - c = matrix(FlintZZ, 1, d, coords) + c = matrix(ZZ, 1, d, coords) reduce_mod_hnf_ll!(c, M1) if !iszero(c) push!(gens, O(coords)) end end - M2 = zero_matrix(FlintZZ, length(gens) -2 + d, d) + M2 = zero_matrix(ZZ, length(gens) -2 + d, d) for i = 3:length(gens) c = coordinates(gens[i], copy = false) for j = 1:d @@ -1022,7 +1022,7 @@ function prefactorization(f::ZZPolyRingElem, d::ZZRingElem, f1::ZZPolyRingElem = continue end - R = residue_ring(FlintZZ, d1, cached = false)[1] + R = residue_ring(ZZ, d1, cached = false)[1] Rx = polynomial_ring(R, "x", cached = false)[1] ff = Rx(f) ff1 = Rx(f1) diff --git a/src/NumFieldOrd/NfOrd/MaxOrd/MaxOrdNS.jl b/src/NumFieldOrd/NfOrd/MaxOrd/MaxOrdNS.jl index 95afb48615..63bb9eaf37 100644 --- a/src/NumFieldOrd/NfOrd/MaxOrd/MaxOrdNS.jl +++ b/src/NumFieldOrd/NfOrd/MaxOrd/MaxOrdNS.jl @@ -145,7 +145,7 @@ function product_basis(l1::Vector{T}, l2::Vector{T}) where T <: Union{AbsNumFiel end function _maximal_order_of_components(L::AbsNonSimpleNumField) - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") fields = Vector{Tuple{AbsSimpleNumField, NumFieldHom{AbsSimpleNumField, AbsNonSimpleNumField}}}(undef, length(L.pol)) for i = 1:length(L.pol) fields[i] = component(L, i) @@ -181,10 +181,10 @@ function new_pradical_frobenius1(O::AbsNumFieldOrder{AbsNonSimpleNumField, AbsNo d = degree(O) K = nf(O) Rx = polynomial_ring(R, "x", cached = false)[1] - Zx = polynomial_ring(FlintZZ, "x")[1] + Zx = polynomial_ring(ZZ, "x")[1] j = clog(ZZRingElem(d), p) els_in_pradical = elem_type(O)[] - M1 = zero_matrix(FlintZZ, 2*d, d) + M1 = zero_matrix(ZZ, 2*d, d) gens = elem_type(O)[O(p)] for i = 1:ngens(K) g = to_univariate(Globals.Qx, K.pol[i]) @@ -261,7 +261,7 @@ function new_pradical_frobenius1(O::AbsNumFieldOrder{AbsNonSimpleNumField, AbsNo #First, find the generators new_gens = Vector{elem_type(O)}() for i = 1:ncols(X) - coords = zeros(FlintZZ, d) + coords = zeros(ZZ, d) for j=1:nr coords[indices[j]] = lift(X[j, i]) end @@ -278,7 +278,7 @@ function new_pradical_frobenius1(O::AbsNumFieldOrder{AbsNonSimpleNumField, AbsNo return I end #Then, construct the basis matrix of the ideal - m1 = zero_matrix(FlintZZ, length(new_gens) + d, d) + m1 = zero_matrix(ZZ, length(new_gens) + d, d) for i = 1:length(new_gens) el = coordinates(new_gens[i], copy = true) for j = 1:nr diff --git a/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl b/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl index 96780ddc64..222cfefdd6 100644 --- a/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl +++ b/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl @@ -393,7 +393,7 @@ function gens_overorder_polygons(O::AbsSimpleNumFieldOrder, p::ZZRingElem) K = nf(O) f = K.pol Qx = parent(f) - Zx, x = polynomial_ring(FlintZZ, "x", cached = false) + Zx, x = polynomial_ring(ZZ, "x", cached = false) R = Native.GF(p, cached = false) Rx, y = polynomial_ring(R, "y", cached = false) f1 = Rx(K.pol) @@ -455,7 +455,7 @@ end function polygons_overorder(O::AbsSimpleNumFieldOrder, p::ZZRingElem) #First, Dedekind criterion. If the Dedekind criterion says that we are p-maximal, # or it can produce an order which is p-maximal, we are done. - Zy, y = polynomial_ring(FlintZZ, "y", cached = false) + Zy, y = polynomial_ring(ZZ, "y", cached = false) Kx, x = polynomial_ring(Native.GF(p, cached=false), "x", cached=false) f = nf(O).pol @@ -599,7 +599,7 @@ function _from_algs_to_ideals(A::StructureConstantAlgebra{T}, OtoA::Map, AtoO::M #we need the kernel of the projection map from A to B. #This is given by the basis of all the other components. f = dim(B) - N1 = vcat(N, zero_matrix(FlintZZ, dim(A) - f, n)) + N1 = vcat(N, zero_matrix(ZZ, dim(A) - f, n)) t = 1 for j = 1:length(AA) if j == i @@ -850,7 +850,7 @@ function find_random_second_gen(A::AbsNumFieldOrderIdeal{S, T}) where {S, T} r = -Amin2:Amin2 - m = zero_matrix(FlintZZ, 1, degree(O)) + m = zero_matrix(ZZ, 1, degree(O)) cnt = 0 dBmat = denominator(basis_matrix(FakeFmpqMat, O, copy = false)) @@ -904,7 +904,7 @@ end function decomposition_type_polygon(O::AbsSimpleNumFieldOrder, p::Union{ZZRingElem, Int}) K = nf(O) - Zx, x = polynomial_ring(FlintZZ, "x", cached = false) + Zx, x = polynomial_ring(ZZ, "x", cached = false) f = Zx(K.pol) R = Native.GF(p, cached = false) Rx, y = polynomial_ring(R, "y", cached = false) @@ -985,7 +985,7 @@ function prime_decomposition_polygons(O::AbsSimpleNumFieldOrder, p::Union{ZZRing end K = nf(O) f = K.pol - Zx = polynomial_ring(FlintZZ, "x", cached = false)[1] + Zx = polynomial_ring(ZZ, "x", cached = false)[1] R = Native.GF(p, cached = false) Rx, y = polynomial_ring(R, "y", cached = false) f1 = Rx(K.pol) @@ -1008,8 +1008,8 @@ function prime_decomposition_polygons(O::AbsSimpleNumFieldOrder, p::Union{ZZRing J.gen_two = O(b, false) J.is_prime = 1 J.splitting_type = ei, degree(phi) - J.norm = FlintZZ(p)^degree(phi) - J.minimum = FlintZZ(p) + J.norm = ZZ(p)^degree(phi) + J.minimum = ZZ(p) # We have to do something to get 2-normal presentation: # if ramified or valuation val(b,P) == 1, (p,b) diff --git a/src/NumFieldOrd/NfOrd/NarrowPicardGroup.jl b/src/NumFieldOrd/NfOrd/NarrowPicardGroup.jl index 8051763c7d..97008f01a2 100644 --- a/src/NumFieldOrd/NfOrd/NarrowPicardGroup.jl +++ b/src/NumFieldOrd/NfOrd/NarrowPicardGroup.jl @@ -42,7 +42,7 @@ function narrow_picard_group(O::AbsSimpleNumFieldOrder) new_ngens = ngens(Q) + ngens(C) - R = zero_matrix(FlintZZ, new_ngens, new_ngens) + R = zero_matrix(ZZ, new_ngens, new_ngens) for i in 1:ngens(Q) R[i, i] = 2 end diff --git a/src/NumFieldOrd/NfOrd/NfOrd.jl b/src/NumFieldOrd/NfOrd/NfOrd.jl index 31ee45741e..745f62e7b1 100644 --- a/src/NumFieldOrd/NfOrd/NfOrd.jl +++ b/src/NumFieldOrd/NfOrd/NfOrd.jl @@ -50,7 +50,7 @@ fractional_ideal_type(::AbsNumFieldOrder{S, T}) where {S, T} = AbsSimpleNumField fractional_ideal_type(::Type{AbsNumFieldOrder{S, T}}) where {S, T} = AbsSimpleNumFieldOrderFractionalIdeal -base_ring(::AbsNumFieldOrder) = FlintZZ +base_ring(::AbsNumFieldOrder) = ZZ base_ring_type(::Type{<:AbsNumFieldOrder}) = ZZRing @@ -121,7 +121,7 @@ function assure_has_basis_mat_inv(O::AbsNumFieldOrder) #The order contains the equation order and the matrix is lower triangular #The inverse is lower triangular and it has denominator 1 #to exploit this, I call can_solve - I = _solve_lt(M.num, scalar_matrix(FlintZZ, nrows(M), M.den)) + I = _solve_lt(M.num, scalar_matrix(ZZ, nrows(M), M.den)) O.basis_mat_inv = FakeFmpqMat(I) return nothing end @@ -297,7 +297,7 @@ the trace matrix of $\mathcal O$. """ function reduced_discriminant(O::AbsSimpleNumFieldOrder) if is_equation_order(O) - Zx = polynomial_ring(FlintZZ, cached = false)[1] + Zx = polynomial_ring(ZZ, cached = false)[1] f = Zx(nf(O).pol) return reduced_resultant(f, derivative(f)) end @@ -457,8 +457,8 @@ function minkowski_gram_mat_scaled(O::AbsNumFieldOrder, prec::Int = 64) shift!(A, prec - O.minkowski_gram_mat_scaled[2]) else c = minkowski_matrix(O, prec+2) - d = zero_matrix(FlintZZ, degree(O), degree(O)) - A = zero_matrix(FlintZZ, degree(O), degree(O)) + d = zero_matrix(ZZ, degree(O), degree(O)) + A = zero_matrix(ZZ, degree(O), degree(O)) round_scale!(d, c, prec) ccall((:fmpz_mat_gram, libflint), Nothing, (Ref{ZZMatrix}, Ref{ZZMatrix}), A, d) shift!(A, -prec) @@ -475,8 +475,8 @@ end function minkowski_gram_mat_scaled(B::Vector{T}, prec::Int = 64) where T <: NumFieldElem K = parent(B[1]) c = minkowski_matrix(B, prec+2) - d = zero_matrix(FlintZZ, length(B), absolute_degree(K)) - A = zero_matrix(FlintZZ, length(B), length(B)) + d = zero_matrix(ZZ, length(B), absolute_degree(K)) + A = zero_matrix(ZZ, length(B), length(B)) round_scale!(d, c, prec) ccall((:fmpz_mat_gram, libflint), Nothing, (Ref{ZZMatrix}, Ref{ZZMatrix}), A, d) shift!(A, -prec) @@ -541,10 +541,10 @@ function in(a::AbsSimpleNumFieldElem, O::AbsSimpleNumFieldOrder) elem_to_mat_row!(t.num, 1, t.den, a) d = mul!(d, d, d2) if fits(Int, d) - R = residue_ring(FlintZZ, Int(d), cached = false)[1] + R = residue_ring(ZZ, Int(d), cached = false)[1] return _check_containment(R, M.num, t.num) else - R1 = residue_ring(FlintZZ, d, cached = false)[1] + R1 = residue_ring(ZZ, d, cached = false)[1] return _check_containment(R1, M.num, t.num) end end @@ -868,7 +868,7 @@ function any_order(K::AbsSimpleNumField) return equation_order(K) else d = degree(g) - M = zero_matrix(FlintZZ, d, d) + M = zero_matrix(ZZ, d, d) M[1, 1] = 1 for i in 2:d for j in i:-1:2 @@ -934,8 +934,8 @@ end function __equation_order(K::AbsSimpleNumField) f = K.pol if isone(denominator(f) * leading_coefficient(f)) - M = FakeFmpqMat(identity_matrix(FlintZZ, degree(K))) - Minv = FakeFmpqMat(identity_matrix(FlintZZ, degree(K))) + M = FakeFmpqMat(identity_matrix(ZZ, degree(K))) + Minv = FakeFmpqMat(identity_matrix(ZZ, degree(K))) z = AbsSimpleNumFieldOrder(K, M, Minv, basis(K), false) z.is_equation_order = true return z @@ -951,8 +951,8 @@ function __equation_order(K::AbsNonSimpleNumField) end end - M = FakeFmpqMat(identity_matrix(FlintZZ, degree(K))) - Minv = FakeFmpqMat(identity_matrix(FlintZZ, degree(K))) + M = FakeFmpqMat(identity_matrix(ZZ, degree(K))) + Minv = FakeFmpqMat(identity_matrix(ZZ, degree(K))) z = AbsNumFieldOrder{AbsNonSimpleNumField, AbsNonSimpleNumFieldElem}(K, M, Minv, basis(K), false) z.is_equation_order = true return z @@ -1025,7 +1025,7 @@ function _order(K::S, elt::Vector{T}; cached::Bool = true, check::Bool = true, e bas = elem_type(K)[one(K)] B = basis_matrix(bas, FakeFmpqMat) # trivially in lower-left HNF full_rank = false - m = FlintQQ() + m = QQ() end dummy_vector = elem_type(K)[K()] @@ -1203,7 +1203,7 @@ function trace_matrix(O::AbsNumFieldOrder; copy::Bool = true) K = nf(O) b = O.basis_nf n = degree(K) - g = zero_matrix(FlintZZ, n, n) + g = zero_matrix(ZZ, n, n) aux = K() for i = 1:n mul!(aux, b[i], b[i]) @@ -1256,7 +1256,7 @@ end # ################################################################################ -function sum_as_Z_modules(O1, O2, z::ZZMatrix = zero_matrix(FlintZZ, 2 * degree(O1), degree(O1))) +function sum_as_Z_modules(O1, O2, z::ZZMatrix = zero_matrix(ZZ, 2 * degree(O1), degree(O1))) if contains_equation_order(O1) && contains_equation_order(O2) return sum_as_Z_modules_fast(O1, O2, z) else @@ -1264,7 +1264,7 @@ function sum_as_Z_modules(O1, O2, z::ZZMatrix = zero_matrix(FlintZZ, 2 * degree( end end -function sum_as_Z_modules_fast(O1, O2, z::ZZMatrix = zero_matrix(FlintZZ, 2 * degree(O1), degree(O1))) +function sum_as_Z_modules_fast(O1, O2, z::ZZMatrix = zero_matrix(ZZ, 2 * degree(O1), degree(O1))) @hassert :AbsNumFieldOrder 1 contains_equation_order(O1) @hassert :AbsNumFieldOrder 1 contains_equation_order(O2) K = _algebra(O1) @@ -1331,7 +1331,7 @@ function defines_order(K::S, x::FakeFmpqMat) where {S} end Ml = basis_matrix(l, FakeFmpqMat) dd = Ml.den*xinv.den - R = residue_ring(FlintZZ, dd, cached = false)[1] + R = residue_ring(ZZ, dd, cached = false)[1] #if !isone((Ml * xinv).den) if !iszero(map_entries(R, Ml.num)*map_entries(R, xinv.num)) return false, x, Vector{elem_type(K)}() @@ -1473,7 +1473,7 @@ function conductor(R::AbsSimpleNumFieldOrder, S::AbsSimpleNumFieldOrder) error("The first order is not contained in the second!") end basis_mat_R_in_S_inv_num, d = pseudo_inv(t.num) - M = zero_matrix(FlintZZ, n^2, n) + M = zero_matrix(ZZ, n^2, n) B = basis(S, copy = false) for k in 1:n a = B[k] diff --git a/src/NumFieldOrd/NfOrd/Overorders.jl b/src/NumFieldOrd/NfOrd/Overorders.jl index 947c3f340c..50c6e6e7ed 100644 --- a/src/NumFieldOrd/NfOrd/Overorders.jl +++ b/src/NumFieldOrd/NfOrd/Overorders.jl @@ -17,7 +17,7 @@ function defines_minimal_overorder(B::Vector, l::Vector) if denominator(x) != 1 return false, M end - m = zero_matrix(FlintZZ, 1, ncols(M)) + m = zero_matrix(ZZ, 1, ncols(M)) for i = 1:ncols(M) m[1, i] = numerator(x.coeffs[i]) end @@ -32,7 +32,7 @@ function defines_minimal_overorder(B::Vector{AbsSimpleNumFieldElem}, l::Vector{A if denominator(x) != 1 return false, M end - m = zero_matrix(FlintZZ, 1, ncols(M)) + m = zero_matrix(ZZ, 1, ncols(M)) for i = 1:ncols(M) m[1, i] = numerator(coeff(x, i - 1)) end @@ -64,7 +64,7 @@ mutable struct GrpAbFinGenToNfOrdQuoNfOrd{T1, T2, S, U} <: Map{FinGenAbGroup, T2 z = new{T1, T2, TT, elem_type(T1)}() d = degree(M) K = _algebra(M) - B = zero_matrix(FlintZZ, d, d) + B = zero_matrix(ZZ, d, d) for i in 1:d v = coordinates(M(_elem_in_algebra(basis(N)[i])), copy = false) for j in 1:d @@ -172,7 +172,7 @@ function induce(f::GrpAbFinGenToNfOrdQuoNfOrd, g) G = domain(f) imgs = Vector{FinGenAbGroupElem}(undef, ngens(G)) d = degree(codomain(f)) - m = zero_matrix(FlintZZ, d, d) + m = zero_matrix(ZZ, d, d) for i in 1:ngens(G) imgs[i] = f\(g(f(G[i]))) end @@ -569,7 +569,7 @@ function poverorders_etale(O, p::ZZRingElem) lP = prime_ideals_over(O, p) res = typeof(O)[O] K = _algebra(O) - tz = zero_matrix(FlintZZ, 2 * degree(O), degree(O)) + tz = zero_matrix(ZZ, 2 * degree(O), degree(O)) for P in lP nres = typeof(O)[] Pprim = pprimary_overorders(O, P) @@ -616,7 +616,7 @@ function _overorders_with_local_property(O, pred) append!(orders, bassP) else orders1 = Vector{typeof(O)}(undef, length(orders) * length(bassP)) - z = zero_matrix(FlintZZ, 2*degree(O), degree(O)) + z = zero_matrix(ZZ, 2*degree(O), degree(O)) kk = 1 for O1 in orders for O2 in bassP @@ -653,7 +653,7 @@ function overorders_etale(O) else orders1 = Vector{typeof(O)}(undef, length(orders) * length(new_p)) sizehint!(orders1, length(orders) * length(new_p)) - z = zero_matrix(FlintZZ, 2*degree(O), degree(O)) + z = zero_matrix(ZZ, 2*degree(O), degree(O)) kk = 1 for O1 in orders for O2 in new_p @@ -1169,7 +1169,7 @@ function ideals_with_norm(O::AbsSimpleNumFieldOrder, p::ZZRingElem, n::Int) subs = stable_subgroups(A, autos, quotype=[pInt^y for y in ppar], op = (G, z) -> sub(G, z, false)) for s in subs - new_basis_matrix = zero_matrix(FlintZZ, d, d) + new_basis_matrix = zero_matrix(ZZ, d, d) T = image(s[2], false) G = domain(T[2]) for i in 1:d @@ -1193,7 +1193,7 @@ function index(R::AbsSimpleNumFieldOrder, S::AbsSimpleNumFieldOrder) s = gen_index(S) i = r^-1 * s @assert isinteger(i) - return FlintZZ(i) + return ZZ(i) end function poverorders_goursat(O1::AbsSimpleNumFieldOrder, O2::AbsSimpleNumFieldOrder, p::ZZRingElem) diff --git a/src/NumFieldOrd/NfOrd/PicardGroup.jl b/src/NumFieldOrd/NfOrd/PicardGroup.jl index 6c52ca2c43..0d0ec11b14 100644 --- a/src/NumFieldOrd/NfOrd/PicardGroup.jl +++ b/src/NumFieldOrd/NfOrd/PicardGroup.jl @@ -148,7 +148,7 @@ function _unit_group_non_maximal(O::Union{AbsNumFieldOrder, AlgAssAbsOrd}, OK, G # that is 0 --> O^\times --> G --> H. # So, O^\times is the kernel of a map from G to H # (we really want a FinGenAbGroupHom, so we can't use compose to build this map) - M = zero_matrix(FlintZZ, ngens(G), ngens(H)) + M = zero_matrix(ZZ, ngens(G), ngens(H)) for i = 1:ngens(G) q = OKtoQ(GtoOK(G[i])) h = HtoQ\q @@ -237,7 +237,7 @@ function _picard_group(O::AbsSimpleNumFieldOrder) append!(generators, [ contract(GtoQ(G[i]).elem*OK, O) for i = 1:ngens(G) ]) # Build the relation matrix - P = zero_matrix(FlintZZ, length(Z), ngens(G)) + P = zero_matrix(ZZ, length(Z), ngens(G)) for i = 1:length(Z) t = Z[i].coeff for j = 1:ngens(G) @@ -246,7 +246,7 @@ function _picard_group(O::AbsSimpleNumFieldOrder) end UtoG = compose(UtoOK, compose(OKtoQ, pseudo_inv(GtoQ))) - Q = zero_matrix(FlintZZ, ngens(U), ngens(G)) + Q = zero_matrix(ZZ, ngens(U), ngens(G)) for i = 1:ngens(U) t = UtoG(U[i]).coeff for j = 1:ngens(G) @@ -255,8 +255,8 @@ function _picard_group(O::AbsSimpleNumFieldOrder) end M = hcat(rels(Cl), -P) - M = vcat(M, hcat(zero_matrix(FlintZZ, ngens(G), ngens(Cl)), rels(G))) - M = vcat(M, hcat(zero_matrix(FlintZZ, nrows(Q), ngens(Cl)), Q)) + M = vcat(M, hcat(zero_matrix(ZZ, ngens(G), ngens(Cl)), rels(G))) + M = vcat(M, hcat(zero_matrix(ZZ, nrows(Q), ngens(Cl)), Q)) P = abelian_group(M) diff --git a/src/NumFieldOrd/NfOrd/RayClassGrp.jl b/src/NumFieldOrd/NfOrd/RayClassGrp.jl index f1636df559..ce7662d99c 100644 --- a/src/NumFieldOrd/NfOrd/RayClassGrp.jl +++ b/src/NumFieldOrd/NfOrd/RayClassGrp.jl @@ -74,7 +74,7 @@ function __assure_princ_gen(c::Hecke.ClassGrpCtx{sparse_matrix_type(ZZ)}, nquo:: push!(els_r, (j+s-1, ex*el[1, j])) end end - r = sparse_row(FlintZZ, els_r, sort = false) + r = sparse_row(ZZ, els_r, sort = false) sol, d = _solve_ut(RelHnf, r) @assert isone(d) rs = zeros(ZZRingElem, c.M.bas_gens.r + c.M.rel_gens.r) @@ -506,7 +506,7 @@ function n_part_class_group(mC::Hecke.MapClassGrp, n::Integer) let O = O, G = G function exp2(a::FinGenAbGroupElem) @assert parent(a) === G - new_coeff = zero_matrix(FlintZZ, 1, ngens(C)) + new_coeff = zero_matrix(ZZ, 1, ngens(C)) for i = 1:ngens(G) new_coeff[1, i+ind-1] = a[i]*diff end @@ -523,7 +523,7 @@ function n_part_class_group(mC::Hecke.MapClassGrp, n::Integer) return id(G) end x=idiff*(mC\I) - y = zero_matrix(FlintZZ, 1, ngens(G)) + y = zero_matrix(ZZ, 1, ngens(G)) for i=ind:ngens(C) y[1,i-ind+1]=x.coeff[1,i] end @@ -702,9 +702,9 @@ function ray_class_group(m::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNu # Then we compute the discrete logarithms if n_quo == -1 - R = zero_matrix(FlintZZ, ngens(C)+nG+ngens(H)+ngens(U), ngens(H)+ngens(C)+nG) + R = zero_matrix(ZZ, ngens(C)+nG+ngens(H)+ngens(U), ngens(H)+ngens(C)+nG) else - R = zero_matrix(FlintZZ, 2*(ngens(C)+nG+ngens(H))+ngens(U), ngens(C)+ngens(H)+nG) + R = zero_matrix(ZZ, 2*(ngens(C)+nG+ngens(H))+ngens(U), ngens(C)+ngens(H)+nG) for i = 1:ncols(R) R[i+ngens(C)+nG+ngens(H)+ngens(U), i] = n_quo end @@ -796,7 +796,7 @@ function ray_class_group(m::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNu @vprintln :RayFacElem 1 "J is one" return id(X) end - coeffs = zero_matrix(FlintZZ, 1, ngens(X)) + coeffs = zero_matrix(ZZ, 1, ngens(X)) if J.is_principal == 1 && isdefined(J, :princ_gen) z = FacElem(Dict(J.princ_gen.elem_in_nf => diffC)) else @@ -929,7 +929,7 @@ function ray_class_group(m::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNu for i = 1:length(powers) mG = groups_and_maps[i][2] for (prim, mprim) in mG.tame - dis = zero_matrix(FlintZZ, 1, ngens(X)) + dis = zero_matrix(ZZ, 1, ngens(X)) to_be_c = mprim.disc_log.coeff for i = 1:length(to_be_c) dis[1, ind-1+i+ngens(C)] = to_be_c[1, i] @@ -941,7 +941,7 @@ function ray_class_group(m::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNu disc_log_inf = Dict{InfPlc, FinGenAbGroupElem}() for i = 1:length(p) - eldi = zero_matrix(FlintZZ, 1, ngens(X)) + eldi = zero_matrix(ZZ, 1, ngens(X)) eldi[1, ngens(X) - length(p) + i] = 1 disc_log_inf[p[i]] = FinGenAbGroupElem(X, eldi) end @@ -967,7 +967,7 @@ end function ray_class_groupQQ(O::AbsSimpleNumFieldOrder, modulus::Int, inf_plc::Bool, n_quo::Int) - R=residue_ring(FlintZZ, modulus, cached=false)[1] + R=residue_ring(ZZ, modulus, cached=false)[1] U, mU = unit_group_mod(R, n_quo) U.exponent = n_quo if inf_plc @@ -1390,7 +1390,7 @@ function has_principal_generator_1_mod_m(I::Union{AbsNumFieldOrderIdeal{AbsSimpl tobeeval = _preproc(m, tobeeval1, expo) coeffs = Vector{ZZMatrix}(undef, length(tobeeval)) for i = 1:length(coeffs) - coeffs[i] = zero_matrix(FlintZZ, 1, ngens(G)) + coeffs[i] = zero_matrix(ZZ, 1, ngens(G)) end ii = 1 for i = 1:length(powers) diff --git a/src/NumFieldOrd/NfOrd/ResidueField.jl b/src/NumFieldOrd/NfOrd/ResidueField.jl index fd59b32795..9396be79f0 100644 --- a/src/NumFieldOrd/NfOrd/ResidueField.jl +++ b/src/NumFieldOrd/NfOrd/ResidueField.jl @@ -94,7 +94,7 @@ end function _residue_field_nonindex_divisor_helper(f::QQPolyRingElem, g::QQPolyRingElem, p, ::Val{degree_one} = Val(false)) where degree_one R = Native.GF(p, cached = false, check = false) - Zy, y = polynomial_ring(FlintZZ, "y", cached = false) + Zy, y = polynomial_ring(ZZ, "y", cached = false) Rx, x = polynomial_ring(R, "x", cached = false) gmodp = Rx(g) diff --git a/src/NumFieldOrd/NfOrd/ResidueRing.jl b/src/NumFieldOrd/NfOrd/ResidueRing.jl index 95fa452def..3c1c402989 100644 --- a/src/NumFieldOrd/NfOrd/ResidueRing.jl +++ b/src/NumFieldOrd/NfOrd/ResidueRing.jl @@ -429,7 +429,7 @@ function is_divisible2(x::AbsOrdQuoRingElem, y::AbsOrdQuoRingElem) V = hcat(A', B') a = coordinates(x.elem, copy = false) - rhs = matrix(FlintZZ, d, 1, a) + rhs = matrix(ZZ, d, 1, a) fl, sol = can_solve_with_solution(V, rhs, side = :right) if !fl diff --git a/src/NumFieldOrd/NfOrd/ResidueRingMultGrp.jl b/src/NumFieldOrd/NfOrd/ResidueRingMultGrp.jl index b097317cf8..37f41e3be4 100644 --- a/src/NumFieldOrd/NfOrd/ResidueRingMultGrp.jl +++ b/src/NumFieldOrd/NfOrd/ResidueRingMultGrp.jl @@ -272,7 +272,7 @@ function _iterative_method(p::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimple k0 = 1 + Int(div(ZZRingElem(e),(pnum-1)))::Int end g = Vector{AbsSimpleNumFieldOrderElem}() - M = zero_matrix(FlintZZ, 0, 0) + M = zero_matrix(ZZ, 0, 0) dlogs = Vector{Function}() l = u @@ -331,7 +331,7 @@ end # function _expand(g::Vector{AbsSimpleNumFieldOrderElem}, M::ZZMatrix, h::Vector{AbsSimpleNumFieldOrderElem}, N::Vector{ZZRingElem}, disc_log::Function, pl::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}) if isempty(g) - M1 = zero_matrix(FlintZZ, length(N), length(N)) + M1 = zero_matrix(ZZ, length(N), length(N)) for i = 1:length(N) M1[i, i] = N[i] end @@ -340,7 +340,7 @@ function _expand(g::Vector{AbsSimpleNumFieldOrderElem}, M::ZZMatrix, h::Vector{A isempty(h) && return g,M O = order(pl) Q , mQ = quo(O, pl) - Z = zero_matrix(FlintZZ,nrows(M)+length(N),ncols(M)+length(N)) + Z = zero_matrix(ZZ,nrows(M)+length(N),ncols(M)+length(N)) for i = 1:nrows(M) for j = i:ncols(M) Z[i, j] = M[i, j] @@ -392,11 +392,11 @@ function _pu_mod_pv(pu::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFie #Disclog M = basis_mat_inv(FakeFmpqMat, pu, copy = false)*mS.imap - x_fakemat2 = FakeFmpqMat(zero_matrix(FlintZZ, 1, ncols(M)), ZZRingElem(1)) + x_fakemat2 = FakeFmpqMat(zero_matrix(ZZ, 1, ncols(M)), ZZRingElem(1)) local disclog let M = M, O = O, S = S, x_fakemat2 = x_fakemat2 function disclog(x::AbsSimpleNumFieldOrderElem) - x_fakemat = FakeFmpqMat(matrix(FlintZZ, 1, degree(O), coordinates(x, copy = false))) + x_fakemat = FakeFmpqMat(matrix(ZZ, 1, degree(O), coordinates(x, copy = false))) mul!(x_fakemat2, x_fakemat, M) #@assert x_fakemat2 == x_fakemat * M denominator(x_fakemat2) != 1 && error("Element is in the ideal") @@ -1118,7 +1118,7 @@ function _multgrp_Op_aOp(Q::AbsSimpleNumFieldOrderQuoRing, P::AbsNumFieldOrderId OtoQQ = NfOrdQuoMap(O, QQ) H, GtoH = quo(G, [ GtoQQ\OtoQQ(g) for g in gens]) - @assert GtoH.map == identity_matrix(FlintZZ, ngens(G)) + @assert GtoH.map == identity_matrix(ZZ, ngens(G)) HtoQQ = GrpAbFinGenToAbsOrdQuoRingMultMap(H, QQ, GtoQQ.generators, GtoQQ.discrete_logarithm) return H, HtoQQ diff --git a/src/NumFieldOrd/NfOrd/StrongEchelonForm.jl b/src/NumFieldOrd/NfOrd/StrongEchelonForm.jl index c8dbf2d822..89ba2d0fa1 100644 --- a/src/NumFieldOrd/NfOrd/StrongEchelonForm.jl +++ b/src/NumFieldOrd/NfOrd/StrongEchelonForm.jl @@ -115,7 +115,7 @@ function z_split(I::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldEl val[i] = valuation(nI, c[i]) end if n == 1 - nz = one(FlintZZ) + nz = one(ZZ) else nz = prod(b[i, i] for i in 2:n) end @@ -147,7 +147,7 @@ end function map_into_integer_quotient(Q::AbsSimpleNumFieldOrderQuoRing) B = basis_matrix(ideal(Q), copy = false) m = B[1, 1] - R = residue_ring(FlintZZ, m, cached = false)[1] + R = residue_ring(ZZ, m, cached = false)[1] local f let R = R, Q = Q function f(x::AbsSimpleNumFieldOrderQuoRingElem) @@ -176,14 +176,14 @@ function can_make_small(Q::Nemo.ZZModRing) end function make_small(Q::EuclideanRingResidueRing{ZZRingElem}) - R = residue_ring(FlintZZ, Int(modulus(Q)), cached = false)[1] + R = residue_ring(ZZ, Int(modulus(Q)), cached = false)[1] f = (x -> R(x.data)::zzModRingElem) g = (x -> Q(x.data)::EuclideanRingResidueRingElem{ZZRingElem}) return R, f, g end function make_small(Q::Nemo.ZZModRing) - R = residue_ring(FlintZZ, Int(modulus(Q)), cached = false)[1] + R = residue_ring(ZZ, Int(modulus(Q)), cached = false)[1] f = (x -> R(data(x))::zzModRingElem) g = (x -> Q(x.data)::Nemo.ZZModRingElem) return R, f, g @@ -375,7 +375,7 @@ function _strong_echelon_form_nonsplit!(M) end end else - forflint = zero_matrix(FlintZZ, n, m) + forflint = zero_matrix(ZZ, n, m) for i in 1:n for j in 1:m forflint[i, j] = f(M[i, j]).data @@ -430,7 +430,7 @@ function _strong_echelon_form_nonsplit(M) end end else - forflint = zero_matrix(FlintZZ, n, m) + forflint = zero_matrix(ZZ, n, m) for i in 1:n for j in 1:m forflint[i, j] = f(M[i, j]).data @@ -452,7 +452,7 @@ function _strong_echelon_form_nonsplit(M) end function test_pseudohnf() - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] for i in 2:15 K, a = number_field(x^i - 10, "a") O = maximal_order(K) diff --git a/src/NumFieldOrd/NfOrd/TorsionUnits.jl b/src/NumFieldOrd/NfOrd/TorsionUnits.jl index 8ff5f0aef3..8ad44ddf79 100644 --- a/src/NumFieldOrd/NfOrd/TorsionUnits.jl +++ b/src/NumFieldOrd/NfOrd/TorsionUnits.jl @@ -440,7 +440,7 @@ function _torsion_units_gen(K::AbsSimpleNumField) fac = factor(m).fac gen = K(1) ord = 1 - Zx, x = polynomial_ring(FlintZZ, "x") + Zx, x = polynomial_ring(ZZ, "x") for (p, v) in fac if p == 2 && v == 1 mul!(gen, gen, K(-1)) @@ -474,7 +474,7 @@ function _torsion_units_gen(K::NumField) fac = factor(m).fac gen = one(K) ord = 1 - Zx, x = polynomial_ring(FlintZZ, "x") + Zx, x = polynomial_ring(ZZ, "x") for (p, v) in fac if p == 2 && v == 1 mul!(gen, gen, K(-1)) diff --git a/src/NumFieldOrd/NfOrd/Unit/FindUnits.jl b/src/NumFieldOrd/NfOrd/Unit/FindUnits.jl index 014fb37ce5..0efd0f62e8 100644 --- a/src/NumFieldOrd/NfOrd/Unit/FindUnits.jl +++ b/src/NumFieldOrd/NfOrd/Unit/FindUnits.jl @@ -52,7 +52,7 @@ function find_candidates(x::ClassGrpCtx, u::UnitGrpCtx, add::Int = 0) end time_kernel += @elapsed k, d = solve_dixon_sf(x.M.bas_gens, rel) @vprintln :UnitGroup 1 "Saturating the kernel" - @vtime_add_elapsed :UnitGroup 1 x :saturate_time s = saturate(hcat(k, (-d)*identity_matrix(SMat, FlintZZ, k.r))) + @vtime_add_elapsed :UnitGroup 1 x :saturate_time s = saturate(hcat(k, (-d)*identity_matrix(SMat, ZZ, k.r))) @vprintln :UnitGroup 1 "Done" s1 = matrix(s) lll!(s1) diff --git a/src/NumFieldOrd/NfOrd/Unit/Reduction.jl b/src/NumFieldOrd/NfOrd/Unit/Reduction.jl index 865faaa028..eed3d59d1f 100644 --- a/src/NumFieldOrd/NfOrd/Unit/Reduction.jl +++ b/src/NumFieldOrd/NfOrd/Unit/Reduction.jl @@ -19,7 +19,7 @@ function _reduce_size(x::Vector{T}, prec::Int = 64) where T A = zero_matrix(parent(conlog[1]), length(x), rr) - B = zero_matrix(FlintZZ, nrows(A), ncols(A)) + B = zero_matrix(ZZ, nrows(A), ncols(A)) for i in 1:rr A[1, i] = conlog[i] @@ -49,7 +49,7 @@ end function scaled_log_matrix(u::Vector{T}, pr::Int = 32) where T r,s = signature(_base_ring(u[1])) - A = zero_matrix(FlintZZ, length(u), r + s) + A = zero_matrix(ZZ, length(u), r + s) @vprintln :UnitGroup 1 "starting prec in scaled_log_matrix: $pr" for i in 1:length(u) diff --git a/src/NumFieldOrd/NfOrd/Unit/Relation.jl b/src/NumFieldOrd/NfOrd/Unit/Relation.jl index 26c5380700..5ae1cc94ff 100644 --- a/src/NumFieldOrd/NfOrd/Unit/Relation.jl +++ b/src/NumFieldOrd/NfOrd/Unit/Relation.jl @@ -159,7 +159,7 @@ function _find_relation(x::Vector{S}, y::T, p::Int = 64) where {S, T} rel = Array{ZZRingElem}(undef, r + 1) for i in 1:r+1 - rel[i] = zero(FlintZZ) + rel[i] = zero(ZZ) end while !inv_succesful || !_find_rational_relation!(rel, v, bound) diff --git a/src/NumFieldOrd/NfOrd/Unit/UnitGrpCtx.jl b/src/NumFieldOrd/NfOrd/Unit/UnitGrpCtx.jl index 9ffccd0349..900b6c0b96 100644 --- a/src/NumFieldOrd/NfOrd/Unit/UnitGrpCtx.jl +++ b/src/NumFieldOrd/NfOrd/Unit/UnitGrpCtx.jl @@ -50,7 +50,7 @@ function _search_rational_relation(U::UnitGrpCtx{S}, y::S, bound::ZZRingElem) wh @vprintln :UnitGroup 3 "For $p the vector v: $v" rel = Array{ZZRingElem}(undef, r + 1) for i in 1:r+1 - rel[i] = zero(FlintZZ) + rel[i] = zero(ZZ) end @vprintln :UnitGroup 2 "First iteration to find a rational relation ..." @@ -346,7 +346,7 @@ end function _find_new_basis(rel) r = length(rel) - m = matrix(FlintZZ, reshape(rel, r, 1)) + m = matrix(ZZ, reshape(rel, r, 1)) h, u = hnf_with_transform(m) @@ -361,8 +361,8 @@ end function _find_new_basis2(rel) r = length(rel) - m = zero_matrix(FlintZZ, r, r) - #m = matrix(FlintZZ, reshape(rel, r + 1, 1)) + m = zero_matrix(ZZ, r, r) + #m = matrix(ZZ, reshape(rel, r + 1, 1)) for i in 1:r m[i, 1] = rel[i] end diff --git a/src/NumFieldOrd/NfOrd/Zeta.jl b/src/NumFieldOrd/NfOrd/Zeta.jl index f508480489..c75083960a 100644 --- a/src/NumFieldOrd/NfOrd/Zeta.jl +++ b/src/NumFieldOrd/NfOrd/Zeta.jl @@ -106,10 +106,10 @@ function _approx_error_bf(disc::ZZRingElem, degree::Int, Tc = BigFloat) n = BigFloat(degree) - C1 = @with_round_down(Tc(FlintQQ(2324)//FlintQQ(1000)),Tc) - C2 = @with_round_down(Tc(FlintQQ(388)//FlintQQ(100)),Tc) + C1 = @with_round_down(Tc(QQ(2324)//QQ(1000)),Tc) + C2 = @with_round_down(Tc(QQ(388)//QQ(100)),Tc) C3 = Tc(2) - C4 = @with_round_down(Tc(FlintQQ(426)//FlintQQ(100)),Tc) + C4 = @with_round_down(Tc(QQ(426)//QQ(100)),Tc) function F(X)#(X::Tc) A1 = @with_round_down(C1*logd_down/(@with_round_up(sqrt(X)*log(3*X),Tc)),Tc) @@ -157,7 +157,7 @@ end function _comp_summand(R, p::ZZRingElem, m::Int, aa::ArbFieldElem) logp = log(R(p)) - pm2 = R(p)^(R(FlintZZ(m)//FlintZZ(2))) + pm2 = R(p)^(R(ZZ(m)//ZZ(2))) pm2inv = inv(pm2) diff --git a/src/NumFieldOrd/NfOrd/norm_eqn.jl b/src/NumFieldOrd/NfOrd/norm_eqn.jl index 4f3d9c2c8b..59c3f4399d 100644 --- a/src/NumFieldOrd/NfOrd/norm_eqn.jl +++ b/src/NumFieldOrd/NfOrd/norm_eqn.jl @@ -4,7 +4,7 @@ function norm_1_generators(A::Vector{AbsNumFieldOrderIdeal{AbsSimpleNumField, Ab @assert all(is_prime, A) @assert all(x->x.gen_one == A[1].gen_one, A) - f = matrix(FlintZZ, 1, length(A), [degree(x) for x = A]) + f = matrix(ZZ, 1, length(A), [degree(x) for x = A]) k = kernel(f, side = :right) id = [FacElem(A, [k[i,j] for i=1:length(A)]) for j=1:ncols(k)] diff --git a/src/NumFieldOrd/NfRelOrd/FracIdeal.jl b/src/NumFieldOrd/NfRelOrd/FracIdeal.jl index 62f72914a2..b0d62ecbcc 100644 --- a/src/NumFieldOrd/NfRelOrd/FracIdeal.jl +++ b/src/NumFieldOrd/NfRelOrd/FracIdeal.jl @@ -296,7 +296,7 @@ function norm(a::RelNumFieldOrderFractionalIdeal, k::QQField) end function absolute_norm(a::RelNumFieldOrderFractionalIdeal) - return norm(a, FlintQQ) + return norm(a, QQ) end ################################################################################ diff --git a/src/NumFieldOrd/NumFieldOrdIdl.jl b/src/NumFieldOrd/NumFieldOrdIdl.jl index d82b59499e..effe51e707 100644 --- a/src/NumFieldOrd/NumFieldOrdIdl.jl +++ b/src/NumFieldOrd/NumFieldOrdIdl.jl @@ -111,7 +111,7 @@ function absolute_norm(x::AbsNumFieldOrderIdeal) end function absolute_norm(a::RelNumFieldOrderIdeal) - return norm(a, FlintQQ) + return norm(a, QQ) end function norm(I::NumFieldOrderIdeal, K::NumField) @@ -263,7 +263,7 @@ function absolute_anti_uniformizer(P::RelNumFieldOrderIdeal) L = nf(OL) A = absolute_basis(OL) d = absolute_degree(nf(OL)) - OLmat = zero_matrix(FlintQQ, d, d) + OLmat = zero_matrix(QQ, d, d) Lbas = absolute_basis(L) for i in 1:d c = elem_in_nf(A[i], copy = false) @@ -279,7 +279,7 @@ function absolute_anti_uniformizer(P::RelNumFieldOrderIdeal) @show is_integral(u) - umat = zero_matrix(FlintQQ, d, d) + umat = zero_matrix(QQ, d, d) for i in 1:d c = u * Lbas[i] @@ -297,7 +297,7 @@ function absolute_anti_uniformizer(P::RelNumFieldOrderIdeal) for i in 1:d for j in 1:d - z[i, j] = FlintZZ(N[i, j]) + z[i, j] = ZZ(N[i, j]) end end @@ -419,13 +419,13 @@ function small_generating_set(I::AbsNumFieldOrderIdeal) return elem_type(OK)[OK(I.gen_one), OK(I.gen_two)] end n = degree(order(I)) - id_gen = zero_matrix(FlintZZ, 2*n, n) + id_gen = zero_matrix(ZZ, 2*n, n) m = minimum(I, copy = false) B = basis(I, copy = false) gens = AbsSimpleNumFieldOrderElem[] for i = 1:length(B) if i != 1 - c = matrix(FlintZZ, 1, n, coordinates(B[i])) + c = matrix(ZZ, 1, n, coordinates(B[i])) reduce_mod_hnf_ll!(c, id_gen) if iszero(c) continue diff --git a/src/QuadForm/Database.jl b/src/QuadForm/Database.jl index 66dabe9512..0b862c6dd2 100644 --- a/src/QuadForm/Database.jl +++ b/src/QuadForm/Database.jl @@ -126,8 +126,8 @@ end function lattice(L::LatDB, r::Int, i::Int) _check_range(L, r, i) d = L.db[r][i].deg - A = matrix(FlintQQ, d, d, L.db[r][i].amb) - B = matrix(FlintQQ, r, d, L.db[r][i].basis_mat) + A = matrix(QQ, d, d, L.db[r][i].amb) + B = matrix(QQ, r, d, L.db[r][i].basis_mat) return integer_lattice(B, gram = A) end diff --git a/src/QuadForm/Enumeration.jl b/src/QuadForm/Enumeration.jl index da2105dab8..b8c751d976 100644 --- a/src/QuadForm/Enumeration.jl +++ b/src/QuadForm/Enumeration.jl @@ -23,7 +23,7 @@ end function _pseudo_cholesky(G::ZZMatrix, ::Type{QQMatrix}) n = ncols(G) - C = zero_matrix(FlintQQ, n, n) + C = zero_matrix(QQ, n, n) return __pseudo_cholesky!(C, G) end @@ -454,19 +454,19 @@ function ___enumerate_cholesky(::Type{Vector}, Q::Matrix{QQFieldElem}, l::Union{ #while (Q[i, i] * (xc + U[i])^2 <= T[i]) # xc -= 1 #end - #x[i] = Int(FlintZZ(floor(xc))) + #x[i] = Int(ZZ(floor(xc))) #upperbound_can = -U[i] #while (Q[i, i] * (upperbound_can + U[i])^2 <= T[i]) # upperbound_can += 1 #end - #L[i] = Int(FlintZZ(ceil(upperbound_can))) + #L[i] = Int(ZZ(ceil(upperbound_can))) # For debugging purposes: Fast, but allocating # - #_t = isqrt(FlintZZ(floor(divexact(T[i], Q[i, i])))) - #_new_upp = Int(FlintZZ(ceil(_t + 2 - U[i]))) - #_new_low = Int(FlintZZ(floor(-(_t + 2) - U[i]))) - 1 + #_t = isqrt(ZZ(floor(divexact(T[i], Q[i, i])))) + #_new_upp = Int(ZZ(ceil(_t + 2 - U[i]))) + #_new_low = Int(ZZ(floor(-(_t + 2) - U[i]))) - 1 @inbounds _new_upp, _new_low = _compute_bounds(T[i], Qd[i], U[i], t1, t2, t3, t4, t5) @@ -569,19 +569,19 @@ function ___enumerate_cholesky(::Type{Vector}, Q::Matrix{S}, l::Union{Int, Nothi #while (Q[i, i] * (xc + U[i])^2 <= T[i]) # xc -= 1 #end - #x[i] = Int(FlintZZ(floor(xc))) + #x[i] = Int(ZZ(floor(xc))) #upperbound_can = -U[i] #while (Q[i, i] * (upperbound_can + U[i])^2 <= T[i]) # upperbound_can += 1 #end - #L[i] = Int(FlintZZ(ceil(upperbound_can))) + #L[i] = Int(ZZ(ceil(upperbound_can))) # For debugging purposes: Fast, but allocating # - #_t = isqrt(FlintZZ(floor(divexact(T[i], Q[i, i])))) - #_new_upp = Int(FlintZZ(ceil(_t + 2 - U[i]))) - #_new_low = Int(FlintZZ(floor(-(_t + 2) - U[i]))) - 1 + #_t = isqrt(ZZ(floor(divexact(T[i], Q[i, i])))) + #_new_upp = Int(ZZ(ceil(_t + 2 - U[i]))) + #_new_low = Int(ZZ(floor(-(_t + 2) - U[i]))) - 1 _new_upp, _new_low = @inbounds _compute_bounds(T[i], Qd[i], U[i]) @@ -866,9 +866,9 @@ function __assemble_result!(W, V::T, transform, n) where {T} end if positive - push!(W, (m, FlintQQ(l))) + push!(W, (m, QQ(l))) else - push!(W, (-m, FlintQQ(l))) + push!(W, (-m, QQ(l))) end k += 1 end @@ -883,7 +883,7 @@ end function _short_vectors_gram(::Type{S}, _G, lb, ub, elem_type::Type{U} = ZZRingElem; hard::Bool = false) where {S, U} d = denominator(_G) - G = change_base_ring(FlintZZ, d * _G) + G = change_base_ring(ZZ, d * _G) if isempty(G) Glll = G T = G @@ -932,7 +932,7 @@ end # No assumption on _G, algorithm applies LLL function _shortest_vectors_gram(::Type{S}, _G) where {S} d = denominator(_G) - G = change_base_ring(FlintZZ, d * _G) + G = change_base_ring(ZZ, d * _G) Glll, T = lll_gram_with_transform(G) ub = minimum([Glll[i, i] for i in 1:nrows(G)]) @assert ub > 0 @@ -947,7 +947,7 @@ end function _shortest_vectors_gram(_G, elem_type::Type{S} = ZZRingElem) where {S} d = denominator(_G) - G = change_base_ring(FlintZZ, d * _G) + G = change_base_ring(ZZ, d * _G) Glll, T = lll_gram_with_transform(G) ub = minimum([Glll[i, i] for i in 1:nrows(G)]) V = _short_vectors_gram_nolll_integral(LatEnumCtx, Glll, 0, ub, T, ZZRingElem(1), S) diff --git a/src/QuadForm/Herm/Mass.jl b/src/QuadForm/Herm/Mass.jl index 797ab8bcf6..0b3f514a53 100644 --- a/src/QuadForm/Herm/Mass.jl +++ b/src/QuadForm/Herm/Mass.jl @@ -267,7 +267,7 @@ function local_factor(L::HermLat, p) N = N + div(m ,2) end - return QQFieldElem(q)^(Int(FlintZZ(N))) * f + return QQFieldElem(q)^(Int(ZZ(N))) * f end function _standard_mass(L::HermLat, prec::Int = 10) diff --git a/src/QuadForm/IO.jl b/src/QuadForm/IO.jl index f3cafb1ee5..596543a678 100644 --- a/src/QuadForm/IO.jl +++ b/src/QuadForm/IO.jl @@ -22,7 +22,7 @@ end function to_hecke(io::IO, L::QuadLat; target = "L", skip_field = false) K = nf(base_ring(L)) if !skip_field - println(io, "Qx, x = polynomial_ring(FlintQQ, :x, cached = false)") + println(io, "Qx, x = polynomial_ring(QQ, :x, cached = false)") f = absolute_minpoly(gen(K)) pol = string(f) pol = replace(pol, string(var(parent(f))) => "x") @@ -51,7 +51,7 @@ end function to_hecke(io::IO, L::HermLat; target = "L", skip_field = false) E = nf(base_ring(L)) K = base_field(E) - println(io, "Qx, x = polynomial_ring(FlintQQ, :x)") + println(io, "Qx, x = polynomial_ring(QQ, :x)") f = defining_polynomial(K) pol = replace(string(f), string(var(parent(f))) => "x") println(io, "f = ", pol) @@ -90,7 +90,7 @@ end function to_hecke(io::IO, G::HermGenus; target = "G") E = base_field(G) K = base_field(E) - println(io, "Qx, x = polynomial_ring(FlintQQ, :x)") + println(io, "Qx, x = polynomial_ring(QQ, :x)") f = defining_polynomial(K) pol = replace(string(f), string(var(parent(f))) => "x") println(io, "f = ", pol) @@ -234,8 +234,8 @@ function to_hecke(io::IO, L::ZZLat; target = "L", skip_field = false) G = gram_matrix(ambient_space(L)) Bst = "[" * split(string([B[i, j] for i in 1:nrows(B) for j in 1:ncols(B)]), '[')[2] Gst = "[" * split(string([G[i, j] for i in 1:nrows(G) for j in 1:ncols(G)]), '[')[2] - println(io, "B = matrix(FlintQQ, ", nrows(B), ", ", ncols(B), " ,", Bst, ");") - println(io, "G = matrix(FlintQQ, ", nrows(G), ", ", ncols(G), " ,", Gst, ");") + println(io, "B = matrix(QQ, ", nrows(B), ", ", ncols(B), " ,", Bst, ");") + println(io, "G = matrix(QQ, ", nrows(G), ", ", ncols(G), " ,", Gst, ");") println(io, target, " = ", "integer_lattice(B, gram = G);") end diff --git a/src/QuadForm/Lattices.jl b/src/QuadForm/Lattices.jl index 253e26ff4e..ae13551b85 100644 --- a/src/QuadForm/Lattices.jl +++ b/src/QuadForm/Lattices.jl @@ -589,7 +589,7 @@ function _intersect_via_restriction_of_scalars(L::AbstractLat, M::AbstractLat) @assert has_ambient_space(L) && has_ambient_space(M) @assert ambient_space(L) === ambient_space(M) @assert !(L isa ZZLat) - Lres, f = restrict_scalars_with_map(L, FlintQQ) + Lres, f = restrict_scalars_with_map(L, QQ) Mres = restrict_scalars(M, f) Nres = intersect(Lres, Mres) Bres = basis_matrix(Nres) @@ -953,7 +953,7 @@ function restrict_scalars(L::AbstractLat, K::QQField, V = ambient_space(L) Vabs, f = restrict_scalars(V, K, alpha) Babs = absolute_basis(L) - Mabs = zero_matrix(FlintQQ, length(Babs), rank(Vabs)) + Mabs = zero_matrix(QQ, length(Babs), rank(Vabs)) for i in 1:length(Babs) v = f\(Babs[i]) for j in 1:length(v) @@ -980,7 +980,7 @@ function restrict_scalars_with_map(L::AbstractLat, K::QQField, V = ambient_space(L) Vabs, f = restrict_scalars(V, K, alpha) Babs = absolute_basis(L) - Mabs = zero_matrix(FlintQQ, length(Babs), rank(Vabs)) + Mabs = zero_matrix(QQ, length(Babs), rank(Vabs)) for i in 1:length(Babs) v = f\(Babs[i]) for j in 1:length(v) @@ -1004,7 +1004,7 @@ function restrict_scalars(L::AbstractLat, f::AbstractSpaceRes) @req ambient_space(L) === codomain(f) "Incompatible arguments: ambient space of L must be the same as the codomain of f" Vabs = domain(f) Babs = absolute_basis(L) - Mabs = zero_matrix(FlintQQ, length(Babs), rank(Vabs)) + Mabs = zero_matrix(QQ, length(Babs), rank(Vabs)) for i in 1:length(Babs) v = f\(Babs[i]) for j in 1:length(v) @@ -1396,10 +1396,10 @@ function _Zforms(L::AbstractLat{<: NumField}, generators::Vector) forms = ZZMatrix[] scalars = QQFieldElem[] for b in generators - Vres, VresToV = restrict_scalars(V, FlintQQ, b) + Vres, VresToV = restrict_scalars(V, QQ, b) G = gram_matrix(Vres, map(t -> preimage(VresToV, t), Babs)) d = denominator(G) - Gint = change_base_ring(FlintZZ, d * G) + Gint = change_base_ring(ZZ, d * G) c = content(Gint) G = divexact(Gint, c) push!(forms, G) @@ -1678,14 +1678,14 @@ function is_isometric_with_isometry(L::AbstractLat{<: NumField}, M::AbstractLat{ fl, CLsmall, CMsmall = _try_iso_setup_small(ZgramLsmall, ZgramMsmall, depth = depth, bacher_depth = bacher_depth) if fl b, _T = isometry(CLsmall, CMsmall) - T = matrix(FlintZZ, _T) + T = matrix(ZZ, _T) else CL, CM = _iso_setup(ZgramLsmall, ZgramMsmall, depth = depth, bacher_depth = bacher_depth) b, T = isometry(CL, CM) end if b - T = change_base_ring(FlintQQ, inv(TL)*T*TM) + T = change_base_ring(QQ, inv(TL)*T*TM) fl, s1 = can_solve_with_solution(BabsmatL, basis_matrix_of_rational_span(L); side = :left) fl, s2 = can_solve_with_solution(basis_matrix_of_rational_span(M), BabsmatM; side = :left) T = s1 * change_base_ring(E, T) * s2 @@ -2053,7 +2053,7 @@ One can also use the alias `saturate(L, M)`. function primitive_closure(M::AbstractLat, N::AbstractLat) @assert has_ambient_space(N) && has_ambient_space(M) @req ambient_space(N) === ambient_space(M) "Lattices must be in the same ambient space" - Mres, f = restrict_scalars_with_map(M, FlintQQ) + Mres, f = restrict_scalars_with_map(M, QQ) Nres = restrict_scalars(N, f) Lres = primitive_closure(Mres, Nres) B = basis_matrix(Lres) diff --git a/src/QuadForm/MassQuad.jl b/src/QuadForm/MassQuad.jl index e577e17b1f..7ee9f3d75d 100644 --- a/src/QuadForm/MassQuad.jl +++ b/src/QuadForm/MassQuad.jl @@ -292,7 +292,7 @@ function _local_factor_cho(L, p) @assert is_integral(exp) - return QQFieldElem(q)^Int(FlintZZ(exp)) * H//2 * QQFieldElem(1)//beta + return QQFieldElem(q)^Int(ZZ(exp)) * H//2 * QQFieldElem(1)//beta end ################################################################################ @@ -410,7 +410,7 @@ function local_factor(L::QuadLat, p) @assert is_integral(N) - return q^Int(FlintZZ(N)) * f + return q^Int(ZZ(N)) * f end ################################################################################ @@ -457,7 +457,7 @@ function _exact_standard_mass(L::QuadLat) fl = true - standard_mass = FlintQQ(2)^(-absolute_degree(K) * r) + standard_mass = QQ(2)^(-absolute_degree(K) * r) if isodd(m) #standard_mass *= prod(dedekind_zeta_exact(K, -i) for i in 1:2:(m-2)) if _exact_dedekind_zeta_cheap(K) @@ -519,7 +519,7 @@ function _standard_mass(L::QuadLat, prec::Int = 10) K = nf(R) r = div(m, 2) - __standard_mass = FlintQQ(2)^(-absolute_degree(K) * r) + __standard_mass = QQ(2)^(-absolute_degree(K) * r) if isodd(m) standard_mass = __standard_mass * prod(dedekind_zeta(K, -i, prec) for i in 1:2:(m-2)) else @@ -562,7 +562,7 @@ function _mass(L::QuadLat, standard_mass = 0, prec::Int = 10) r = div(m, 2) if standard_mass == 0 - standard_mass = FlintQQ(2)^(-absolute_degree(K) * r) + standard_mass = QQ(2)^(-absolute_degree(K) * r) if isodd(m) standard_mass *= prod(dedekind_zeta(K, -i, prec) for i in 1:2:(m-2)) else @@ -1216,7 +1216,7 @@ function _bernoulli_kronecker(z::Int, D) @assert z >= 0 D1 = fundamental_discriminant(D) f = abs(D1) - K = FlintQQ + K = QQ Rt, t = power_series_ring(K, z + 3, "t", cached = false, model = :capped_absolute) denom = exp(f*t) - 1 #@show [_kronecker_as_dirichlet(a, N) for a in 1:Int(f)] @@ -1360,7 +1360,7 @@ function _compute_an(Z::ZetaFunction, n::Int, h::Int) p, f = Z.dec_types[h] P = p^f v, = remove(n, P) - z = zero(FlintZZ) + z = zero(ZZ) for k in 0:v z = z + _compute_an(Z, divexact(n, P^k), h - 1) end diff --git a/src/QuadForm/Misc.jl b/src/QuadForm/Misc.jl index ccb3a94372..32e47155d1 100644 --- a/src/QuadForm/Misc.jl +++ b/src/QuadForm/Misc.jl @@ -391,7 +391,7 @@ function _idempotents(x::Vector) # ( 0 | M_x | I ) # ( 0 | M_y | 0 ) - V = zero_matrix(FlintZZ, d * k + 1, d * k + 1) + V = zero_matrix(ZZ, d * k + 1, d * k + 1) u = coordinates(one(O)) @@ -631,15 +631,15 @@ function is_local_norm(K::AbsSimpleNumField, a::QQFieldElem, P::AbsNumFieldOrder end function is_local_norm(K::AbsSimpleNumField, a::RingElement, P::AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}) - return is_local_norm(K, FlintQQ(a), P) + return is_local_norm(K, QQ(a), P) end function is_local_norm(K::AbsSimpleNumField, a::RingElement, p::ZZRingElem) - return is_local_norm(K, FlintQQ(a), p) + return is_local_norm(K, QQ(a), p) end function is_local_norm(K::AbsSimpleNumField, a::RingElement, p::Integer) - return is_local_norm(K, FlintQQ(a), ZZRingElem(p)) + return is_local_norm(K, QQ(a), ZZRingElem(p)) end function is_local_norm(K::RelSimpleNumField{T}, a::T, P) where {T} # ideal of parent(a) @@ -677,7 +677,7 @@ function _special_unit(P, p::ZZRingElem) end k = GF(p, cached = false) hex(x) = k(numerator(x)) * inv(k(denominator(x))) - hexinv(x) = FlintQQ(lift(x)) + hexinv(x) = QQ(lift(x)) t = hexinv(sqrt(hex(a))) a = a//t^2 x = x//t @@ -780,7 +780,7 @@ end ################################################################################ # -# Treat FlintQQ as a number field +# Treat QQ as a number field # ################################################################################ diff --git a/src/QuadForm/Morphism.jl b/src/QuadForm/Morphism.jl index f236031698..20b8056494 100644 --- a/src/QuadForm/Morphism.jl +++ b/src/QuadForm/Morphism.jl @@ -163,7 +163,7 @@ function init(C::ZLatAutoCtx, auto::Bool = true, bound::ZZRingElem = ZZRingElem( lengths = Vector{Vector{ZZRingElem}}(undef, length(V)) - tmp = zero_matrix(FlintZZ, 1, n) + tmp = zero_matrix(ZZ, 1, n) for i in 1:length(V) # First canonicalize them @@ -177,7 +177,7 @@ function init(C::ZLatAutoCtx, auto::Bool = true, bound::ZZRingElem = ZZRingElem( v .*= -1 end - vfmpz = matrix(FlintZZ, 1, n, v) + vfmpz = matrix(ZZ, 1, n, v) w = Vector{ZZRingElem}(undef, r) w[1] = numerator(cand[2]) @@ -209,7 +209,7 @@ function init(C::ZLatAutoCtx, auto::Bool = true, bound::ZZRingElem = ZZRingElem( if auto # Find the standard basis vectors C.std_basis = Vector{Int}(undef, dim(C)) - z = zero_matrix(FlintZZ, 1, dim(C)) + z = zero_matrix(ZZ, 1, dim(C)) for i in 1:dim(C) z[1, C.per[i]] = 1 k = find_point(z, C.V) @@ -223,7 +223,7 @@ function init(C::ZLatAutoCtx, auto::Bool = true, bound::ZZRingElem = ZZRingElem( for i in 1:length(C.G) A = Vector{ZZMatrix}(undef, length(C.V)) for j in 1:length(C.V) - A[j] = zero_matrix(FlintZZ, dim(C), 1) + A[j] = zero_matrix(ZZ, dim(C), 1) for k in 1:dim(C) A[j][k, 1] = _dot_product_with_row(C.V[j], C.G[i], k) end @@ -249,7 +249,7 @@ function init(C::ZLatAutoCtx, auto::Bool = true, bound::ZZRingElem = ZZRingElem( C.orders = Vector{Int}(undef, dim(C)) # -Id is always an automorphism - C.g[1] = ZZMatrix[-identity_matrix(FlintZZ, dim(C))] + C.g[1] = ZZMatrix[-identity_matrix(ZZ, dim(C))] # Calculate orbit lengths @@ -492,7 +492,7 @@ end # ################################################################################ -_zero_vector(::Type{ZZRingElem}, len::Int) = zero_matrix(FlintZZ, 1, len) +_zero_vector(::Type{ZZRingElem}, len::Int) = zero_matrix(ZZ, 1, len) _zero_vector(::Type{Int}, len::Int) = zeros(Int, len) function vs_scalar_products(C::ZLatAutoCtx{S, T, V}, dep::Int) where {S, T, V} @@ -609,7 +609,7 @@ function init_vector_sums(C::ZLatAutoCtx{S1, S2, S3}, depth::Int) where {S1, S2, M = reduce(vcat, vector_sums[i]) else # We need to convert to ZZRingElem since we don't have LLL for Ints - M = zero_matrix(FlintZZ, length(vector_sums[i]), length(vector_sums[i][1])) + M = zero_matrix(ZZ, length(vector_sums[i]), length(vector_sums[i][1])) for r in 1:nrows(M) for c in 1:ncols(M) M[r, c] = vector_sums[i][r][c] @@ -638,11 +638,11 @@ function init_vector_sums(C::ZLatAutoCtx{S1, S2, S3}, depth::Int) where {S1, S2, transpB = transpose(B) C.scpcomb[i].F = [ B*G*transpB for G in C.GZZ ] - C.scpcomb[i].xvectmp = zero_matrix(FlintZZ, length(C.scpcomb[i].scpcombs.vectors), C.dim) - C.scpcomb[i].xbasetmp = zero_matrix(FlintZZ, nrows(C.scpcomb[i].trans), C.dim) - C.scpcomb[i].multmp1 = zero_matrix(FlintZZ, nrows(C.scpcomb[i].trans), C.dim) - C.scpcomb[i].multmp2 = zero_matrix(FlintZZ, nrows(C.scpcomb[i].trans), nrows(C.scpcomb[i].trans)) - C.scpcomb[i].multmp3 = zero_matrix(FlintZZ, length(C.scpcomb[i].scpcombs.vectors), C.dim) + C.scpcomb[i].xvectmp = zero_matrix(ZZ, length(C.scpcomb[i].scpcombs.vectors), C.dim) + C.scpcomb[i].xbasetmp = zero_matrix(ZZ, nrows(C.scpcomb[i].trans), C.dim) + C.scpcomb[i].multmp1 = zero_matrix(ZZ, nrows(C.scpcomb[i].trans), C.dim) + C.scpcomb[i].multmp2 = zero_matrix(ZZ, nrows(C.scpcomb[i].trans), nrows(C.scpcomb[i].trans)) + C.scpcomb[i].multmp3 = zero_matrix(ZZ, length(C.scpcomb[i].scpcombs.vectors), C.dim) end return nothing end @@ -828,7 +828,7 @@ function compute_short_vectors(C::ZLatAutoCtx, max::ZZRingElem = ZZRingElem(-1)) for i in 1:length(V) z = Vector{ZZRingElem}(undef, length(C.G)) z[1] = V[i][2] - m = matrix(FlintZZ, 1, n, V[i][1]) + m = matrix(ZZ, 1, n, V[i][1]) mt = transpose(m) for k in 2:length(C.G) z[k] = (m * C.G[k] * mt)[1, 1] @@ -1082,7 +1082,7 @@ function _operate(point, A::Matrix{Int}, V) end function _operate(point, A::ZZMatrix, V) - return _operate(point, A, V, zero_matrix(FlintZZ, 1, ncols(A))) + return _operate(point, A, V, zero_matrix(ZZ, 1, ncols(A))) end @@ -1812,8 +1812,8 @@ end # stabilizes e *****/ function stabil(x1, x2, per, G, V, C) dim = length(x1) - XG = zero_matrix(FlintZZ, dim, dim) - X2 = zero_matrix(FlintZZ, dim, dim) + XG = zero_matrix(ZZ, dim, dim) + X2 = zero_matrix(ZZ, dim, dim) x = Vector{Int}(undef, dim) for i in 1:dim x[i] = _operate(x1[i], G, V, C.operate_tmp) # ZZRingElem case @@ -1853,11 +1853,11 @@ function _one(::Type{Matrix{Int}}, n::Int) return z end -_one(::Type{ZZMatrix}, n::Int) = identity_matrix(FlintZZ, n) +_one(::Type{ZZMatrix}, n::Int) = identity_matrix(ZZ, n) _zero(::Type{Matrix{Int}}, n::Int, m::Int) = zeros(Int, n, m) -_zero(::Type{ZZMatrix}, n::Int, m::Int) = zero_matrix(FlintZZ, n, m) +_zero(::Type{ZZMatrix}, n::Int, m::Int) = zero_matrix(ZZ, n, m) function matgen(x, dim, per, v) #/***** generates the matrix X which has as row @@ -2035,8 +2035,8 @@ function isostab(pt, G, C::ZLatAutoCtx{S, T, U}, Maxfail) where {S, T, U} len = 1 fail = 0 #/* fail is the number of successive failures */ - #A = zero_matrix(FlintZZ, d, d) - #B = zero_matrix(FlintZZ, d, d) + #A = zero_matrix(ZZ, d, d) + #B = zero_matrix(ZZ, d, d) while (cnd <= len && fail < Maxfail) for i in 1:nG if fail >= Maxfail @@ -2118,7 +2118,7 @@ end # ################################################################################ -function _dot_product_with_column!(t::ZZRingElem, v::ZZMatrix, A::ZZMatrix, k::Int, tmp1::ZZRingElem, tmp2::ZZRingElem = FlintZZ(), tmp3::ZZRingElem = FlintZZ()) +function _dot_product_with_column!(t::ZZRingElem, v::ZZMatrix, A::ZZMatrix, k::Int, tmp1::ZZRingElem, tmp2::ZZRingElem = ZZ(), tmp3::ZZRingElem = ZZ()) getindex!(tmp2, v, 1, 1) getindex!(tmp3, A, 1, k) mul!(t, tmp2, tmp3) @@ -2131,8 +2131,8 @@ function _dot_product_with_column!(t::ZZRingElem, v::ZZMatrix, A::ZZMatrix, k::I return t end -function _dot_product_with_column(v::ZZMatrix, A::ZZMatrix, k::Int, tmp::ZZRingElem = zero(FlintZZ)) - t = zero(FlintZZ) +function _dot_product_with_column(v::ZZMatrix, A::ZZMatrix, k::Int, tmp::ZZRingElem = zero(ZZ)) + t = zero(ZZ) t = _dot_product_with_column!(t, v, A, k, tmp) return t end @@ -2143,7 +2143,7 @@ function _dot_product_with_entry!(t::ZZRingElem, v::ZZMatrix, A::Vector{ZZMatrix return t end -function _dot_product_with_row!(t::ZZRingElem, v::ZZMatrix, A::ZZMatrix, k::Int, tmp1::ZZRingElem, tmp2::ZZRingElem = FlintZZ(), tmp3::ZZRingElem = FlintZZ()) +function _dot_product_with_row!(t::ZZRingElem, v::ZZMatrix, A::ZZMatrix, k::Int, tmp1::ZZRingElem, tmp2::ZZRingElem = ZZ(), tmp3::ZZRingElem = ZZ()) getindex!(tmp2, v, 1, 1) getindex!(tmp3, A, k, 1) mul!(t, tmp2, tmp3) @@ -2156,8 +2156,8 @@ function _dot_product_with_row!(t::ZZRingElem, v::ZZMatrix, A::ZZMatrix, k::Int, return t end -function _dot_product_with_row(v::ZZMatrix, A::ZZMatrix, k::Int, tmp::ZZRingElem = zero(FlintZZ)) - t = zero(FlintZZ) +function _dot_product_with_row(v::ZZMatrix, A::ZZMatrix, k::Int, tmp::ZZRingElem = zero(ZZ)) + t = zero(ZZ) t = _dot_product_with_row!(t, v, A, k, tmp) return t end @@ -2231,7 +2231,7 @@ function _norm(v::Vector{Int}, M::Matrix{Int}, tmp::Vector{Int} = Vector{Int}(un return dot(v, tmp) end -function _norm(v::ZZMatrix, M::ZZMatrix, tmp::ZZMatrix = zero_matrix(FlintZZ, 1, ncols(v))) +function _norm(v::ZZMatrix, M::ZZMatrix, tmp::ZZMatrix = zero_matrix(ZZ, 1, ncols(v))) mul!(tmp, v, M) return (v * transpose(tmp))[1, 1] end @@ -2311,7 +2311,7 @@ function add_to_row!(A::Matrix{Int}, r::Vector{Int}, i::Int, sign::Bool = false, return A end -function add_to_row!(A::ZZMatrix, r::ZZMatrix, i::Int, sign::Bool = false, tmp1::ZZRingElem = FlintZZ(), tmp2::ZZRingElem = FlintZZ(), tmp3::ZZRingElem = FlintZZ()) +function add_to_row!(A::ZZMatrix, r::ZZMatrix, i::Int, sign::Bool = false, tmp1::ZZRingElem = ZZ(), tmp2::ZZRingElem = ZZ(), tmp3::ZZRingElem = ZZ()) @assert ncols(A) == length(r) @assert 1 <= i && i <= nrows(A) @inbounds for j in 1:ncols(A) @@ -2348,7 +2348,7 @@ end # Some tests that I need to add: # -# G = matrix(FlintZZ, 8, 8, [4, -2, 0, 0, 0, 0, 0, 1, -2, 2, -1, 0, 0, 0, 0, 0, 0, -1, 2, -1, 0, 0, 0, 0, 0, 0, -1, 2, -1, 0, 0, 0, 0, 0, 0, -1, 2, -1, 0, 0, 0, 0, 0, 0, -1, 2, -1, 0, 0, 0, 0, 0, 0, -1, 2, 0, 1, 0, 0, 0, 0, 0, 0, 2]) +# G = matrix(ZZ, 8, 8, [4, -2, 0, 0, 0, 0, 0, 1, -2, 2, -1, 0, 0, 0, 0, 0, 0, -1, 2, -1, 0, 0, 0, 0, 0, 0, -1, 2, -1, 0, 0, 0, 0, 0, 0, -1, 2, -1, 0, 0, 0, 0, 0, 0, -1, 2, -1, 0, 0, 0, 0, 0, 0, -1, 2, 0, 1, 0, 0, 0, 0, 0, 0, 2]) # # C = Hecke.ZLatAutoCtx([G]); Hecke.compute_short_vectors(C); # @@ -2395,7 +2395,7 @@ function _int_matrix_with_overflow(a::ZZMatrix, tmp::ZZRingElem) end function _make_small(V::VectorList{ZZMatrix, ZZRingElem}) - tmp = FlintZZ() + tmp = ZZ() W = VectorList{Vector{Int}, Int}() W.vectors = [ _int_vector_with_overflow(v, tmp) for v in V.vectors ] if isdefined(V, :lengths) @@ -2419,7 +2419,7 @@ _make_small(C::ZLatAutoCtx{Int}) = C # Forces the entries of C in Ints. Only the fields relevant for `cand` are filled. function _make_small(C::ZLatAutoCtx{ZZRingElem}) - tmp = FlintZZ() + tmp = ZZ() D = ZLatAutoCtx{Int, Matrix{Int}, Vector{Int}}() D.G = [ _int_matrix_with_overflow(M, tmp) for M in C.G ] diff --git a/src/QuadForm/Quad/GenusRep.jl b/src/QuadForm/Quad/GenusRep.jl index ac5f34e35a..af5fe0ba17 100644 --- a/src/QuadForm/Quad/GenusRep.jl +++ b/src/QuadForm/Quad/GenusRep.jl @@ -106,7 +106,7 @@ function genus_representatives(L::QuadLat; max = inf, use_auto = true, use_mass _mass = mass(L) @vprintln :GenRep 1 "... $(_mass)" else - _mass = -one(FlintQQ) + _mass = -one(QQ) end @vprintln :GenRep 1 "Found $(length(spinor_genera)) many spinor genera in genus" @@ -1059,7 +1059,7 @@ function neighbours(L::QuadLat, p; call = stdcallback, use_auto = true, max = in return result end -function iterated_neighbours(L::QuadLat, p; use_auto = true, max = inf, mass = -one(FlintQQ)) +function iterated_neighbours(L::QuadLat, p; use_auto = true, max = inf, mass = -one(QQ)) @req is_definite(L) "Lattice must be definite" result = typeof(L)[ L ] i = 1 @@ -1465,7 +1465,7 @@ function __colon_raw(K, a, b) d = degree(K) bb = b B = inv(basis_matrix(a)) #QQMatrix(basis_mat_inv(a, copy = false)) - M = zero_matrix(FlintQQ, d^2, d) + M = zero_matrix(QQ, d^2, d) for i = 1:d N = representation_matrix(bb[i])*B for s = 1:d @@ -2137,9 +2137,9 @@ function _lattice_to_binary_quadratic_form(L::QuadLat) M = absolute_basis_matrix(L) # This corresponds to a basis of L @assert nrows(M) == 2 G = gram_matrix(ambient_space(L), M) - GG = change_base_ring(FlintQQ, G) + GG = change_base_ring(QQ, G) d = denominator(GG) - f = binary_quadratic_form(FlintZZ(d * GG[1, 1]), FlintZZ(2 * d * GG[1, 2]), FlintZZ(d * GG[2, 2])) + f = binary_quadratic_form(ZZ(d * GG[1, 1]), ZZ(2 * d * GG[1, 2]), ZZ(d * GG[2, 2])) return f, d end @@ -2249,7 +2249,7 @@ function primitive_form(g::QuadBin{ZZRingElem}) end function automorphism_group_generators(g::QuadBin{ZZRingElem}) - gens = dense_matrix_type(FlintZZ)[] + gens = dense_matrix_type(ZZ)[] g = primitive_form(g) d = discriminant(g) @assert d > 0 @@ -2259,7 +2259,7 @@ function automorphism_group_generators(g::QuadBin{ZZRingElem}) # Then any isometry preserves the set {e_1,e_2, -e_1, -e_2}. # We see that the orthogonal group is generated by -id and # possibly the one exchanging e_1 <-> e_2 if it is integral. - push!(gens, matrix(FlintZZ, 2, 2, [-1, 0, 0, -1])) + push!(gens, matrix(ZZ, 2, 2, [-1, 0, 0, -1])) g = primitive_form(g) gg = binary_quadratic_form(g.a, -g.b, g.c) @@ -2312,7 +2312,7 @@ function automorphism_group_generators(g::QuadBin{ZZRingElem}) @assert norm_one_gens[i] == divexact(_x + _y * deltasqrt, 2) @assert iseven(_x + g.b * _y) @assert iseven(_x + d * _y) - T = zero_matrix(FlintZZ, 2, 2) + T = zero_matrix(ZZ, 2, 2) T[1, 1] = divexact(_x + _y * g.b, 2) T[1, 2] = g.c * _y T[2, 1] = -g.a * _y diff --git a/src/QuadForm/Quad/NormalForm.jl b/src/QuadForm/Quad/NormalForm.jl index 19c71b4dfb..dbb50205a6 100644 --- a/src/QuadForm/Quad/NormalForm.jl +++ b/src/QuadForm/Quad/NormalForm.jl @@ -68,7 +68,7 @@ function _ispadic_normal_form_odd(G, p) return false end u = blocks[i][end][1, 1] - m = FlintZZ(u) + m = ZZ(u) if is_square(F(m)) return false end @@ -100,12 +100,12 @@ function _ispadic_normal_form_dyadic(G, p) end end - U = matrix(FlintQQ,2,2,[0,1,1,0]) - V = matrix(FlintQQ,2,2,[2,1,1,2]) - W1 = matrix(FlintQQ,1,1,[1]) - W3 = matrix(FlintQQ,1,1,[3]) - W5 = matrix(FlintQQ,1,1,[5]) - W7 = matrix(FlintQQ,1,1,[7]) + U = matrix(QQ,2,2,[0,1,1,0]) + V = matrix(QQ,2,2,[2,1,1,2]) + W1 = matrix(QQ,1,1,[1]) + W3 = matrix(QQ,1,1,[3]) + W5 = matrix(QQ,1,1,[5]) + W7 = matrix(QQ,1,1,[7]) for B in blocks i = 1 @@ -170,7 +170,7 @@ We refer to [MirMor2009]_ IV Definition 4.6. for the details. If `partial` is set, only the partial normal form is returned. """ function padic_normal_form(G, p::IntegerUnion; prec::Int = -1, partial::Bool = false) - return _padic_normal_form(change_base_ring(FlintQQ, G), ZZRingElem(p), prec = prec, partial = partial) + return _padic_normal_form(change_base_ring(QQ, G), ZZRingElem(p), prec = prec, partial = partial) end # For a definition in the even case, see Definition 4.6 of Miranda, Morrison, @@ -178,7 +178,7 @@ end function _padic_normal_form(G::QQMatrix, p::ZZRingElem; prec::Int = -1, partial::Bool = false) _G = deepcopy(G) dd = denominator(G) - G0 = change_base_ring(FlintZZ, dd * G) + G0 = change_base_ring(ZZ, dd * G) d = valuation(dd, p) n = nrows(G) r = rank(G0) @@ -187,12 +187,12 @@ function _padic_normal_form(G::QQMatrix, p::ZZRingElem; prec::Int = -1, partial: _, U = hnf_with_transform(G0) _ker = U[(r + 1):n, :] _nondeg = U[1:r, :] - ker = change_base_ring(FlintQQ, _ker) - nondeg = change_base_ring(FlintQQ, _nondeg) + ker = change_base_ring(QQ, _ker) + nondeg = change_base_ring(QQ, _nondeg) G = p^d * nondeg * G * transpose(nondeg) else - ker = zero_matrix(FlintQQ, 0, n) - nondeg = identity_matrix(FlintQQ, n) + ker = zero_matrix(QQ, 0, n) + nondeg = identity_matrix(QQ, n) G = p^d * G end # continue with the non-degenerate part @@ -202,7 +202,7 @@ function _padic_normal_form(G::QQMatrix, p::ZZRingElem; prec::Int = -1, partial: end modu = p^prec - R = residue_ring(FlintZZ, modu, cached = false)[1] + R = residue_ring(ZZ, modu, cached = false)[1] Gmod = map(q -> R(invmod(denominator(q), modu) * numerator(q)), G) # this will probably fail D = deepcopy(Gmod) @@ -211,7 +211,7 @@ function _padic_normal_form(G::QQMatrix, p::ZZRingElem; prec::Int = -1, partial: Qp = padic_field(p, precision = prec, cached = false) if n == 0 - return (zero_matrix(FlintQQ, n, n), zero_matrix(FlintQQ, n, n))::Tuple{QQMatrix, QQMatrix} + return (zero_matrix(QQ, n, n), zero_matrix(QQ, n, n))::Tuple{QQMatrix, QQMatrix} end # the transformation matrix is called B @@ -248,8 +248,8 @@ function _padic_normal_form(G::QQMatrix, p::ZZRingElem; prec::Int = -1, partial: # if debug: @assert _val(det(B), p) == 0 # B is invertible! - DD = map_entries(x -> FlintQQ(lift(x))//p^d, D) - BB = map_entries(x -> FlintQQ(lift(x)), B) + DD = map_entries(x -> QQ(lift(x))//p^d, D) + BB = map_entries(x -> QQ(lift(x)), B) return (DD, BB)::Tuple{QQMatrix, QQMatrix} end @@ -851,7 +851,7 @@ end function _issquare(d::zzModRingElem, p) f = ZZ(modulus(parent(d))) - R = residue_ring(FlintZZ, f, cached = false)[1] + R = residue_ring(ZZ, f, cached = false)[1] g = R(d) return _issquare(g, ZZ(p)) end diff --git a/src/QuadForm/Quad/Spaces.jl b/src/QuadForm/Quad/Spaces.jl index a05de1f214..0214b84f01 100644 --- a/src/QuadForm/Quad/Spaces.jl +++ b/src/QuadForm/Quad/Spaces.jl @@ -507,7 +507,7 @@ function _quadratic_form_with_invariants(dim::Int, det::ZZRingElem, if dim == 1 !isempty(finite) && error("Impossible Hasse invariants") - return matrix(FlintQQ, 1, 1, ZZRingElem[det]) + return matrix(QQ, 1, 1, ZZRingElem[det]) end finite = unique(finite) @@ -570,7 +570,7 @@ function _quadratic_form_with_invariants(dim::Int, det::ZZRingElem, filter!(p -> hilbert_symbol(-1, -det, p) != (p in finite ? -1 : 1), PP) #// Find some a such that for all p in PP: -a*Det is not a local square #// TODO: Find some smaller a?! The approach below is very lame. - a = prod(p for p in PP if det % p != 0; init = one(FlintZZ)) + a = prod(p for p in PP if det % p != 0; init = one(ZZ)) if negative == 3 a = -a negative = 2 @@ -586,9 +586,9 @@ function _quadratic_form_with_invariants(dim::Int, det::ZZRingElem, #// The binary case a = _find_quaternion_algebra(QQFieldElem(-det)::QQFieldElem, finite::Vector{ZZRingElem}, negative == 2 ? PosInf[inf] : PosInf[]) - Drat = map(FlintQQ, D) + Drat = map(QQ, D) push!(Drat, a) - push!(Drat, squarefree_part(FlintZZ(det * a))) + push!(Drat, squarefree_part(ZZ(det * a))) M = diagonal_matrix(Drat) _, _, d, f, n = _quadratic_form_invariants(M) diff --git a/src/QuadForm/Quad/ZGenus.jl b/src/QuadForm/Quad/ZGenus.jl index 8854fc9e24..29c2289f19 100644 --- a/src/QuadForm/Quad/ZGenus.jl +++ b/src/QuadForm/Quad/ZGenus.jl @@ -1248,7 +1248,7 @@ Return the oddity of this even form. The oddity is also called the $2$-signature """ function oddity(S::ZZLocalGenus) - R = residue_ring(FlintZZ, 8)[1] + R = residue_ring(ZZ, 8)[1] p = prime(S) @req p == 2 "The oddity is only defined for p=2" k = 0 diff --git a/src/QuadForm/Quad/ZLattices.jl b/src/QuadForm/Quad/ZLattices.jl index 3eea0308e8..21f59f0595 100644 --- a/src/QuadForm/Quad/ZLattices.jl +++ b/src/QuadForm/Quad/ZLattices.jl @@ -11,7 +11,7 @@ basis_matrix(L::ZZLat) = L.basis_matrix ambient_space(L::ZZLat) = L.space -base_ring(L::ZZLat) = FlintZZ +base_ring(L::ZZLat) = ZZ base_ring_type(::Type{ZZLat}) = ZZRing @@ -45,13 +45,13 @@ julia> gram_matrix(L) == matrix(ZZ, [2 -1; -1 2]) true ``` """ -function integer_lattice(B::QQMatrix; gram = identity_matrix(FlintQQ, ncols(B)), check::Bool=true) - V = quadratic_space(FlintQQ, gram; check) +function integer_lattice(B::QQMatrix; gram = identity_matrix(QQ, ncols(B)), check::Bool=true) + V = quadratic_space(QQ, gram; check) return lattice(V, B; check) end -function integer_lattice(B::ZZMatrix; gram = identity_matrix(FlintQQ, ncols(B)), check::Bool=true) - V = quadratic_space(FlintQQ, gram; check) +function integer_lattice(B::ZZMatrix; gram = identity_matrix(QQ, ncols(B)), check::Bool=true) + V = quadratic_space(QQ, gram; check) return lattice(V, B; check) end @@ -60,7 +60,7 @@ quadratic_lattice(::QQField, B::Union{ZZMatrix, QQMatrix}; gram = identity_matri function integer_lattice(;gram, check=true) n = nrows(gram) - return lattice(quadratic_space(FlintQQ, gram; check), identity_matrix(FlintQQ, n); check) + return lattice(quadratic_space(QQ, gram; check), identity_matrix(QQ, n); check) end ### Documentation in ./Lattices.jl @@ -221,7 +221,7 @@ function rational_span(L::ZZLat) return L.rational_span else G = gram_matrix(L) - V = quadratic_space(FlintQQ, G) + V = quadratic_space(QQ, G) L.rational_span = V return V end @@ -394,7 +394,7 @@ function assert_has_automorphisms(L::ZZLat; redo::Bool = false, V = ambient_space(L) GL = gram_matrix(L) d = denominator(GL) - res = ZZMatrix[change_base_ring(FlintZZ, d * GL)] + res = ZZMatrix[change_base_ring(ZZ, d * GL)] # So the first one is either positive definite or negative definite # Make it positive definite. This does not change the automorphisms. if res[1][1, 1] < 0 @@ -410,7 +410,7 @@ function assert_has_automorphisms(L::ZZLat; redo::Bool = false, fl, Csmall = try_init_small(C, depth = depth, bacher_depth = bacher_depth) if fl _gens, order = auto(Csmall) - gens = ZZMatrix[matrix(FlintZZ, g) for g in _gens] + gens = ZZMatrix[matrix(ZZ, g) for g in _gens] end end if !try_small || !fl @@ -425,8 +425,8 @@ function assert_has_automorphisms(L::ZZLat; redo::Bool = false, end # Now gens are with respect to the basis of L - @hassert :Lattice 1 all(let gens = gens; i -> change_base_ring(FlintQQ, gens[i]) * GL * - transpose(change_base_ring(FlintQQ, gens[i])) == GL; end, 1:length(gens)) + @hassert :Lattice 1 all(let gens = gens; i -> change_base_ring(QQ, gens[i]) * GL * + transpose(change_base_ring(QQ, gens[i])) == GL; end, 1:length(gens)) L.automorphism_group_generators = gens L.automorphism_group_order = order @@ -444,14 +444,14 @@ function automorphism_group_generators(L::ZZLat; ambient_representation::Bool = gens = L.automorphism_group_generators if !ambient_representation - return QQMatrix[ change_base_ring(FlintQQ, g) for g in gens] + return QQMatrix[ change_base_ring(QQ, g) for g in gens] else # Now translate to get the automorphisms with respect to basis_matrix(L) bm = basis_matrix(L) V = ambient_space(L) if rank(L) == rank(V) bminv = inv(bm) - res = QQMatrix[bminv * change_base_ring(FlintQQ, g) * bm for g in gens] + res = QQMatrix[bminv * change_base_ring(QQ, g) * bm for g in gens] else # Extend trivially to the orthogonal complement of the rational span !is_regular(V) && @@ -461,8 +461,8 @@ function automorphism_group_generators(L::ZZLat; ambient_representation::Bool = C = orthogonal_complement(V, basis_matrix(L)) C = vcat(basis_matrix(L), C) Cinv = inv(C) - D = identity_matrix(FlintQQ, rank(V) - rank(L)) - res = QQMatrix[Cinv * diagonal_matrix(change_base_ring(FlintQQ, g), D) * C for g in gens] + D = identity_matrix(QQ, rank(V) - rank(L)) + res = QQMatrix[Cinv * diagonal_matrix(change_base_ring(QQ, g), D) * C for g in gens] end @hassert :Lattice 1 all(g * gram_matrix(V) * transpose(g) == gram_matrix(V) for g in res) @@ -527,15 +527,15 @@ function is_isometric_with_isometry(L::ZZLat, M::ZZLat; ambient_representation:: @req is_definite(L) && is_definite(M) "The lattices must be definite" if rank(L) != rank(M) - return false, zero_matrix(FlintQQ, 0, 0) + return false, zero_matrix(QQ, 0, 0) end if genus(L) != genus(M) - return false, zero_matrix(FlintQQ, 0, 0) + return false, zero_matrix(QQ, 0, 0) end if rank(L) == 0 - return true, identity_matrix(FlintQQ, 0, 0) + return true, identity_matrix(QQ, 0, 0) end i = sign(gram_matrix(L)[1,1]) @@ -549,28 +549,28 @@ function is_isometric_with_isometry(L::ZZLat, M::ZZLat; ambient_representation:: GL = gram_matrix(L) dL = denominator(GL) - GLint = change_base_ring(FlintZZ, dL * GL) + GLint = change_base_ring(ZZ, dL * GL) cL = content(GLint) GLint = divexact(GLint, cL) GM = gram_matrix(M) dM = denominator(GM) - GMint = change_base_ring(FlintZZ, dM * GM) + GMint = change_base_ring(ZZ, dM * GM) cM = content(GMint) GMint = divexact(GMint, cM) # GLint, GMint are integral, primitive scalings of GL and GM # If they are isometric, then the scalars must be identical. if dL//cL != dM//cM - return false, zero_matrix(FlintQQ, 0, 0) + return false, zero_matrix(QQ, 0, 0) end # Now compute LLL reduces gram matrices GLlll, TL = lll_gram_with_transform(GLint) - @hassert :Lattice 1 TL * change_base_ring(FlintZZ, dL*GL) * transpose(TL) == GLlll *cL + @hassert :Lattice 1 TL * change_base_ring(ZZ, dL*GL) * transpose(TL) == GLlll *cL GMlll, TM = lll_gram_with_transform(GMint) - @hassert :Lattice 1 TM * change_base_ring(FlintZZ, dM*GM) * transpose(TM) == GMlll *cM + @hassert :Lattice 1 TM * change_base_ring(ZZ, dM*GM) * transpose(TM) == GMlll *cM # Setup for Plesken--Souvignier @@ -580,14 +580,14 @@ function is_isometric_with_isometry(L::ZZLat, M::ZZLat; ambient_representation:: fl, CLsmall, CMsmall = _try_iso_setup_small(G1, G2, depth = depth, bacher_depth = bacher_depth) if fl b, _T = isometry(CLsmall, CMsmall) - T = matrix(FlintZZ, _T) + T = matrix(ZZ, _T) else CL, CM = _iso_setup(ZZMatrix[GLlll], ZZMatrix[GMlll], depth = depth, bacher_depth = bacher_depth) b, T = isometry(CL, CM) end if b - T = change_base_ring(FlintQQ, inv(TL)*T*TM) + T = change_base_ring(QQ, inv(TL)*T*TM) if !ambient_representation @hassert :Lattice 1 T * gram_matrix(M) * transpose(T) == gram_matrix(L) return true, T @@ -610,7 +610,7 @@ function is_isometric_with_isometry(L::ZZLat, M::ZZLat; ambient_representation:: CV = vcat(basis_matrix(L), CV) CW = orthogonal_complement(W, basis_matrix(M)) CW = vcat(basis_matrix(M), CW) - D = identity_matrix(FlintQQ, rank(V) - rank(L)) + D = identity_matrix(QQ, rank(V) - rank(L)) T = inv(CV) * diagonal_matrix(T, D) * CW end @hassert :Lattice 1 T * gram_matrix(ambient_space(M)) * transpose(T) == @@ -618,7 +618,7 @@ function is_isometric_with_isometry(L::ZZLat, M::ZZLat; ambient_representation:: return true, T end else - return false, zero_matrix(FlintQQ, 0, 0) + return false, zero_matrix(QQ, 0, 0) end end @@ -998,11 +998,11 @@ function intersect(M::ZZLat, N::ZZLat) dM = denominator(BM) dN = denominator(BN) d = lcm(dM, dN) - BMint = change_base_ring(FlintZZ, d * BM) - BNint = change_base_ring(FlintZZ, d * BN) + BMint = change_base_ring(ZZ, d * BM) + BNint = change_base_ring(ZZ, d * BN) H = vcat(BMint, BNint) K = kernel(H, side = :left) - BI = divexact(change_base_ring(FlintQQ, hnf(view(K, 1:nrows(K), 1:nrows(BM)) * BMint)), d) + BI = divexact(change_base_ring(QQ, hnf(view(K, 1:nrows(K), 1:nrows(BM)) * BMint)), d) return lattice(ambient_space(M), BI; check = false) end @@ -1067,19 +1067,19 @@ function _to_ZLat(L::QuadLat, K, V) pm = pseudo_matrix(L) cm = coefficient_ideals(pm) pmm = matrix(pm) - bm = zero_matrix(FlintQQ, rank(L), dim(V)) + bm = zero_matrix(QQ, rank(L), dim(V)) for i in 1:nrows(pm) a = norm(cm[i]) for j in 1:ncols(pm) - bm[i, j] = a * FlintQQ(pmm[i, j]) + bm[i, j] = a * QQ(pmm[i, j]) end end return lattice(V, bm; check = false) end function _to_ZLat(L::QuadLat; - K::QQField = FlintQQ, - V::QuadSpace = quadratic_space(K, map_entries(FlintQQ, gram_matrix(ambient_space(L))))) + K::QQField = QQ, + V::QuadSpace = quadratic_space(K, map_entries(QQ, gram_matrix(ambient_space(L))))) return _to_ZLat(L, K, V) end diff --git a/src/QuadForm/QuadBin.jl b/src/QuadForm/QuadBin.jl index d2a5f8b81b..991c3fe7b8 100644 --- a/src/QuadForm/QuadBin.jl +++ b/src/QuadForm/QuadBin.jl @@ -11,7 +11,7 @@ Constructs the binary quadratic form $ax^2 + bxy + cy^2$. """ binary_quadratic_form(a::T, b::T, c::T) where {T <: RingElem} = QuadBin(parent(a), a, b, c) -binary_quadratic_form(a::Integer, b::Integer, c::Integer) = binary_quadratic_form(FlintZZ(a), FlintZZ(b), FlintZZ(c)) +binary_quadratic_form(a::Integer, b::Integer, c::Integer) = binary_quadratic_form(ZZ(a), ZZ(b), ZZ(c)) @doc raw""" binary_quadratic_form(R::Ring, a, b, c) @@ -268,7 +268,7 @@ end function fundamental_discriminant(D::IntegerUnion) fac = factor(D) - sqf = one(FlintZZ) + sqf = one(ZZ) for (p, e) in fac if isodd(e) sqf = sqf * p @@ -489,7 +489,7 @@ function _isequivalent_reducible(f::QuadBin{ZZRingElem}, g::QuadBin{ZZRingElem}; if fred[1] == invmod(gred[1], gred[2]) gg = binary_quadratic_form(gred[1], -gred[2], zero(ZZRingElem)) _, Tgg = reduction_with_transformation(gg) - T = Tf * inv(Tg * matrix(FlintZZ, 2, 2, [1, 0, 0, -1]) * Tgg) + T = Tf * inv(Tg * matrix(ZZ, 2, 2, [1, 0, 0, -1]) * Tgg) @assert Hecke._action(f, T) == g return true, T end @@ -529,7 +529,7 @@ function _reduction(f::QuadBin{ZZRingElem}) end if is_reduced(f) - return f, identity_matrix(FlintZZ, 2) + return f, identity_matrix(ZZ, 2) end if is_indefinite(f) @@ -547,7 +547,7 @@ function _reduction_indefinite(_ff) local f::QuadBin{ZZRingElem} = _ff local _f RR = ArbField(53, cached = false) - U = identity_matrix(FlintZZ, 2) + U = identity_matrix(ZZ, 2) d = sqrt(RR(discriminant(f))) while !is_reduced(f) a = f[1] @@ -565,14 +565,14 @@ function _reduction_indefinite(_ff) @assert fl # might fail with precision too low s = sign(c) * o end - T = matrix(FlintZZ, 2, 2, [0, -1, 1, s]) + T = matrix(ZZ, 2, 2, [0, -1, 1, s]) U = U * T _f = binary_quadratic_form(c, -b + 2*s*c, c*s*s - b*s + a) @assert _buchmann_vollmer_action(f, T) == _f f = _f else if b < 0 - T = matrix(FlintZZ, 2, 2, [1, 0, 0, -1]) + T = matrix(ZZ, 2, 2, [1, 0, 0, -1]) U = U * T _f = binar_quadratic_form(a, -b, c) @assert _buchmann_vollmer_action(f, T) == _f @@ -583,7 +583,7 @@ function _reduction_indefinite(_ff) q, r = divrem(a, -b) q = -q end - T = matrix(FlintZZ, 2, 2, [1, 0, -q, 1]) + T = matrix(ZZ, 2, 2, [1, 0, -q, 1]) U = U * T _f = binary_quadratic_form(r, b, c) @assert _buchmann_vollmer_action(f, T) == _f @@ -613,12 +613,12 @@ function _reduction_reducible(f::QuadBin) _,w, _z = gcdx(x, y) z = -_z @assert x * w - y * z == 1 - T = matrix(FlintZZ, 2, 2, [x, z, y, w]) + T = matrix(ZZ, 2, 2, [x, z, y, w]) g = Hecke._action(f, T) # Now g = [0, +/- N, g[2]] @assert iszero(g[1]) @assert abs(g[2]) == N - TT = matrix(FlintZZ, 2, 2, [0, -1, 1, 0]) + TT = matrix(ZZ, 2, 2, [0, -1, 1, 0]) g = Hecke._action(g, TT) T = T * TT # Now g = [g[1], N, 0] @@ -630,7 +630,7 @@ function _reduction_reducible(f::QuadBin) t = divexact(g[1] * aa - 1, N) # a * aa - N * t == 1 @assert a * aa - N * t == 1 - TT = inv(matrix(FlintZZ, 2, 2, [a, -N, -t, aa])) + TT = inv(matrix(ZZ, 2, 2, [a, -N, -t, aa])) g = Hecke._action(g, TT) T = T * TT end @@ -643,7 +643,7 @@ function _reduction_reducible(f::QuadBin) @assert r >= 0 @assert r < N @assert g[1] - _t * N == r - TT = matrix(FlintZZ, 2, 2, [1, 0, -_t, 1]) + TT = matrix(ZZ, 2, 2, [1, 0, -_t, 1]) g = Hecke._action(g, TT) T = T * TT # @assert 0 <= g[1] < N && g[2] == N && iszero(g[3]) @@ -795,7 +795,7 @@ function _rhotau(f::QuadBin{ZZRingElem}) s = sign(c) * o end g = binary_quadratic_form(-c, -b + 2*s*c, -(a - b*s + c*s*s)) - T = matrix(FlintZZ, 2, 2, [0, 1, 1, -s]) + T = matrix(ZZ, 2, 2, [0, 1, 1, -s]) @assert _buchmann_vollmer_action(f, T) == g return (g, T) end @@ -818,7 +818,7 @@ function _rho(f::QuadBin{ZZRingElem}) @assert fl # might fail with precision too low s = sign(c) * o end - T = matrix(FlintZZ, 2, 2, [0, -1, 1, s]) + T = matrix(ZZ, 2, 2, [0, -1, 1, s]) g = binary_quadratic_form(c, -b + 2*s*c, a - b*s + c*s*s) @assert _buchmann_vollmer_action(f, T) == g return g, T @@ -827,7 +827,7 @@ end # Apply the tau operator of Buchmann--Vollmer, which turns # [a, b, c] into [-a, b, -c] function _tau(f::QuadBin{ZZRingElem}) - T = matrix(FlintZZ, 2, 2, [1, 0, 0, -1]) + T = matrix(ZZ, 2, 2, [1, 0, 0, -1]) g = binary_quadratic_form(-f[1], f[2], -f[3]) @assert _buchmann_vollmer_action(f, T) == g return g, T diff --git a/src/QuadForm/Spaces.jl b/src/QuadForm/Spaces.jl index 1826fa9b65..349fde19bc 100644 --- a/src/QuadForm/Spaces.jl +++ b/src/QuadForm/Spaces.jl @@ -619,7 +619,7 @@ function restrict_scalars(V::AbstractSpace, K::QQField, B = absolute_basis(E) v = elem_type(E)[zero(E) for i in 1:n] w = elem_type(E)[zero(E) for i in 1:n] - G = zero_matrix(FlintQQ, d * n, d * n) + G = zero_matrix(QQ, d * n, d * n) r = 1 c = 1 for i in 1:n @@ -629,7 +629,7 @@ function restrict_scalars(V::AbstractSpace, K::QQField, for j in 1:n for bj in 1:length(B) w[j] = B[bj] - G[r, c] = trace(alpha * inner_product(V, v, w), FlintQQ) + G[r, c] = trace(alpha * inner_product(V, v, w), QQ) w[j] = zero(E) c = c + 1 end @@ -638,7 +638,7 @@ function restrict_scalars(V::AbstractSpace, K::QQField, r = r + 1 end end - Vres = quadratic_space(FlintQQ, G; check = false) + Vres = quadratic_space(QQ, G; check = false) VrestoV = AbstractSpaceRes(Vres, V, identity_matrix(QQ, rank(Vres)), identity_matrix(E, rank(V))) return Vres, VrestoV end diff --git a/src/QuadForm/Torsion.jl b/src/QuadForm/Torsion.jl index ef8ecce936..ab6b4ba6d5 100644 --- a/src/QuadForm/Torsion.jl +++ b/src/QuadForm/Torsion.jl @@ -35,7 +35,7 @@ function torsion_quadratic_module(M::ZZLat, N::ZZLat; gens::Union{Nothing, Vecto """ fl, _rels = is_sublattice_with_relations(M, N) @req fl "Second lattice must be a sublattice of first lattice" - rels = change_base_ring(FlintZZ, _rels) + rels = change_base_ring(ZZ, _rels) A = abelian_group(rels) n = dim(ambient_space(M)) BM = basis_matrix(M) @@ -44,10 +44,10 @@ function torsion_quadratic_module(M::ZZLat, N::ZZLat; gens::Union{Nothing, Vecto for g in gens @req length(g) == n "Generator not an element of the ambient space" fl, v = can_solve_with_solution(BM, - matrix(FlintQQ, 1, n, g); + matrix(QQ, 1, n, g); side = :left) @req denominator(v) == 1 "Generator not an element of the lattice" - ginA = A(change_base_ring(FlintZZ, v)) + ginA = A(change_base_ring(ZZ, v)) push!(gens_in_A, ginA) end S, mS = sub(A, gens_in_A, false) @@ -68,7 +68,7 @@ function torsion_quadratic_module(M::ZZLat, N::ZZLat; gens::Union{Nothing, Vecto if gens !== nothing && length(gens) > 0 gens_lift = gens else - gens_lift = Vector{QQFieldElem}[reshape(collect(change_base_ring(FlintQQ, mS(s).coeff) * BM), :) for s in Hecke.gens(S)] + gens_lift = Vector{QQFieldElem}[reshape(collect(change_base_ring(QQ, mS(s).coeff) * BM), :) for s in Hecke.gens(S)] end num = basis_matrix(M) * gram_matrix(ambient_space(M)) * transpose(basis_matrix(N)) @@ -91,7 +91,7 @@ function torsion_quadratic_module(M::ZZLat, N::ZZLat; gens::Union{Nothing, Vecto T.ab_grp = S T.proj = inv(mS).map T.gens_lift = gens_lift - T.gens_lift_mat = matrix(FlintQQ, length(gens_lift), degree(M), reduce(vcat, gens_lift; init = QQFieldElem[])) + T.gens_lift_mat = matrix(QQ, length(gens_lift), degree(M), reduce(vcat, gens_lift; init = QQFieldElem[])) T.modulus = _modulus T.modulus_qf = _modulus_qf T.value_module = QmodnZ(_modulus) @@ -224,7 +224,7 @@ function gram_matrix_bilinear(T::TorQuadModule) return T.gram_matrix_bilinear end g = gens(T) - G = zero_matrix(FlintQQ, length(g), length(g)) + G = zero_matrix(QQ, length(g), length(g)) for i in 1:length(g) for j in 1:i G[i, j] = G[j, i] = lift(g[i] * g[j]) @@ -248,7 +248,7 @@ function gram_matrix_quadratic(T::TorQuadModule) end g = gens(T) r = length(g) - G = zero_matrix(FlintQQ, r, r) + G = zero_matrix(QQ, r, r) for i in 1:r for j in 1:(i - 1) G[i, j] = G[j, i] = lift(g[i] * g[j]) @@ -339,7 +339,7 @@ and $v \in M$. """ function (T::TorQuadModule)(v::Vector) @req length(v) == dim(ambient_space(cover(T))) "Vector of wrong length" - vv = map(FlintQQ, v) + vv = map(QQ, v) if eltype(vv) != QQFieldElem error("Cannot coerce elements to the rationals") end @@ -348,7 +348,7 @@ end function (T::TorQuadModule)(v::Vector{QQFieldElem}) @req length(v) == degree(cover(T)) "Vector of wrong length" - vv = matrix(FlintQQ, 1, length(v), v) + vv = matrix(QQ, 1, length(v), v) vv = change_base_ring(ZZ, solve(basis_matrix(cover(T)), vv; side = :left)) return T(abelian_group(T)(vv * T.proj)) end @@ -619,7 +619,7 @@ For $a + N \in M/N$ this returns the representative $a$. """ function lift(a::TorQuadModuleElem) T = parent(a) - z = change_base_ring(FlintQQ, a.data.coeff) * T.gens_lift_mat + z = change_base_ring(QQ, a.data.coeff) * T.gens_lift_mat return QQFieldElem[z[1, i] for i in 1:ncols(z)] end @@ -1234,7 +1234,7 @@ julia> a = gens(T)[1]; julia> a*a == -phi(a)*phi(a) true -julia> G = matrix(FlintQQ, 6, 6 , [3 3 0 0 0 0; +julia> G = matrix(QQ, 6, 6 , [3 3 0 0 0 0; 3 3 3 0 3 0; 0 3 3 3 0 0; 0 0 3 3 0 0; @@ -1253,7 +1253,7 @@ julia> B = matrix(QQ, 6, 6 , [1 0 0 0 0 0; julia> M = lattice(V, B); -julia> B2 = matrix(FlintQQ, 6, 6 , [ 1 0 -1 1 0 0; +julia> B2 = matrix(QQ, 6, 6 , [ 1 0 -1 1 0 0; 0 0 1 -1 0 0; -1 1 1 -1 -1 0; 1 -1 -1 2 1 0; @@ -1410,9 +1410,9 @@ function torsion_quadratic_module(q::QQMatrix) @req is_symmetric(q) "Matrix must be symmetric" d = denominator(q) - Q = change_base_ring(FlintZZ, d * q) + Q = change_base_ring(ZZ, d * q) S, U, V = snf_with_transform(Q) - D = change_base_ring(FlintQQ, U) * q * change_base_ring(FlintQQ, V) + D = change_base_ring(QQ, U) * q * change_base_ring(QQ, V) L = integer_lattice(1//d * identity_matrix(QQ, nrows(q)); gram = d^2 * q) denoms = QQFieldElem[denominator(D[i, i]) for i in 1:ncols(D)] rels = diagonal_matrix(denoms) * U diff --git a/src/QuadForm/Types.jl b/src/QuadForm/Types.jl index de4840af44..7363993632 100644 --- a/src/QuadForm/Types.jl +++ b/src/QuadForm/Types.jl @@ -543,8 +543,8 @@ mutable struct ZLatAutoCtx{S, T, V} z.Gtr = ZZMatrix[transpose(g) for g in G] z.dim = nrows(G[1]) z.is_symmetric = falses(length(G)) - z.operate_tmp = zero_matrix(FlintZZ, 1, ncols(G[1])) - z.dot_product_tmp = zero_matrix(FlintZZ, 1, 1) + z.operate_tmp = zero_matrix(ZZ, 1, ncols(G[1])) + z.dot_product_tmp = zero_matrix(ZZ, 1, 1) for i in 1:length(z.G) z.is_symmetric[i] = is_symmetric(z.G[i]) diff --git a/src/RCF/conductor.jl b/src/RCF/conductor.jl index 7e61550f9f..cb29200a61 100644 --- a/src/RCF/conductor.jl +++ b/src/RCF/conductor.jl @@ -20,7 +20,7 @@ function _norm_group_gens_small(C::ClassField) mS=pseudo_inv(mS) dom=domain(mS) - M=zero_matrix(FlintZZ,ngens(dom), ngens(codomain(mS))) + M=zero_matrix(ZZ,ngens(dom), ngens(codomain(mS))) for i=1:ngens(dom) elem=mS(dom[i]).coeff for j=1:ngens(codomain(mS)) @@ -344,7 +344,7 @@ function is_conductor(C::Hecke.ClassField, m::AbsNumFieldOrderIdeal{AbsSimpleNum if check mS1 = pseudo_inv(mS) dom = domain(mS1) - M = zero_matrix(FlintZZ,ngens(dom), ngens(codomain(mS1))) + M = zero_matrix(ZZ,ngens(dom), ngens(codomain(mS1))) for i = 1:ngens(dom) elem = mS1(dom[i]).coeff for j = 1:ngens(codomain(mS1)) @@ -929,7 +929,7 @@ The maximal abelian subfield of $K$ as a class field, i.e. the norm group is computed and the corresponding `ray_class_field` created. """ function maximal_abelian_subfield(::Type{ClassField}, K::AbsSimpleNumField) - Zx, x = polynomial_ring(FlintZZ, cached = false) + Zx, x = polynomial_ring(ZZ, cached = false) QQ = rationals_as_number_field()[1] R, mR = ray_class_group(discriminant(maximal_order(K))*maximal_order(QQ), infinite_places(QQ), n_quo = degree(K)) f = hom(QQ, K, K(1), check = false) @@ -992,7 +992,7 @@ function maximal_abelian_subfield(K::RelSimpleNumField{AbsSimpleNumFieldElem}; o r1, r2 = signature(base_field(K)) #of_closure cannot use the n_quo by the degree: any D_n field has - #zeta_n in the closure...thus a degree 5 field might have a + #zeta_n in the closure...thus a degree 5 field might have a #degree 4 subfield (actually 2 x 4) in the closure. if of_closure C, mC = ray_class_group(dd, infinite_places(base_field(K))[1:r1]) @@ -1365,7 +1365,7 @@ function subfields(C::ClassField; arg...) mQ = C.quotientmap act = induce_action(C, aut) if haskey(arg, :type) - @req !haskey(arg, :degree) "degree and type are exclusive" + @req !haskey(arg, :degree) "degree and type are exclusive" s = stable_subgroups(codomain(mQ), act; quotype = qtype, op = (x,y) -> quo(x, y, false)[2]) else s = stable_subgroups(codomain(mQ), act; op = (x,y) -> quo(x, y, false)[2]) @@ -1774,7 +1774,7 @@ function lorenz_eta_level(k::AbsSimpleNumField) # find max r s.th. eta_r in k, eta_(r+1) not in k # where eta_r = (zeta_(2^r) + 1/zeta_(2^r)) r = 2 - x = polynomial_ring(FlintZZ, cached = false)[2] + x = polynomial_ring(ZZ, cached = false)[2] f = cos_minpoly(2^r, x) while has_root(f, k)[1] r += 1 diff --git a/src/RCF/cyclo.jl b/src/RCF/cyclo.jl index b09d2f1120..301a1f05f3 100644 --- a/src/RCF/cyclo.jl +++ b/src/RCF/cyclo.jl @@ -105,7 +105,7 @@ function cyclotomic_extension(k::AbsSimpleNumField, n::Int; cached::Bool = true, return c end - ZX, X = polynomial_ring(FlintZZ, cached = false) + ZX, X = polynomial_ring(ZZ, cached = false) f = cyclotomic(n, X) fk = change_base_ring(k, f, parent = kt) if n < 5 @@ -371,7 +371,7 @@ function _cyclotomic_extension_non_simple(k::AbsSimpleNumField, n::Int; cached:: OS.disc = discriminant(OL)^(degree(k))*discriminant(OK)^(degree(L)) set_attribute!(S, :maximal_order => OS) - Zx = polynomial_ring(FlintZZ, "x")[1] + Zx = polynomial_ring(ZZ, "x")[1] prim_elems = elem_type(OS)[x for x in basis(OS) if _isprobably_primitive(x)] local poly::ZZPolyRingElem local poly2::ZZPolyRingElem @@ -403,7 +403,7 @@ function _cyclotomic_extension_non_simple(k::AbsSimpleNumField, n::Int; cached:: kt, t = polynomial_ring(k, "t", cached = false) fL = L.pol(t) Kr, gKr = number_field(fL, check = false, cached = false) - M = zero_matrix(FlintQQ, degree(Ka), degree(Ka)) + M = zero_matrix(QQ, degree(Ka), degree(Ka)) z = one(S) elem_to_mat_row!(M, 1, z) elem_to_mat_row!(M, 2, elem_in_nf(a)) @@ -412,7 +412,7 @@ function _cyclotomic_extension_non_simple(k::AbsSimpleNumField, n::Int; cached:: mul!(z, z, elem_in_nf(a)) elem_to_mat_row!(M, i, z) end - N = zero_matrix(FlintQQ, 2, degree(S)) + N = zero_matrix(QQ, 2, degree(S)) for i = 1:2 elem_to_mat_row!(N, i, S[i]) end @@ -497,7 +497,7 @@ function automorphism_list(C::CyclotomicExt; gens::Vector{<:NumFieldHom{AbsSimpl push!(gnew, na) end #Now add the automorphisms of the relative extension - R = residue_ring(FlintZZ, C.n, cached = false)[1] + R = residue_ring(ZZ, C.n, cached = false)[1] U, mU = unit_group(R) if is_cyclic(U) k = degree(C.Kr) @@ -545,7 +545,7 @@ function cyclotomic_field(::Type{ClassField}, n::Integer) end function cyclotomic_field(::Type{ClassField}, n::ZZRingElem) - Zx, x = polynomial_ring(FlintZZ, cached = false) + Zx, x = polynomial_ring(ZZ, cached = false) QQ = rationals_as_number_field()[1] C = ray_class_field(n*maximal_order(QQ), infinite_places(QQ)) set_attribute!(C, :cyclo => n, :show => show_cyclo) diff --git a/src/RCF/rcf.jl b/src/RCF/rcf.jl index 03d37ccac6..9664be1a36 100644 --- a/src/RCF/rcf.jl +++ b/src/RCF/rcf.jl @@ -338,7 +338,7 @@ function find_gens_descent(mR::Map, A::ClassField_pp, cp::ZZRingElem) end if degree(C.Kr) != 1 - RR = residue_ring(FlintZZ, degree(A))[1] + RR = residue_ring(ZZ, degree(A))[1] U, mU = unit_group(RR) if degree(C.Kr) < order(U) # there was a common subfield, we # have to pass to a subgroup @@ -637,7 +637,7 @@ function _rcf_find_kummer(CF::ClassField_pp{S, T}) where {S, T} # = z^(sum a[i] n[i]) x # thus it works iff sum a[i] n[i] = 0 # for all a in the kernel - R = residue_ring(FlintZZ, C.n, cached=false)[1] + R = residue_ring(ZZ, C.n, cached=false)[1] M = change_base_ring(R, mk.map) l = kernel(M; side = :right) n = lift(l) @@ -754,7 +754,7 @@ function _aut_A_over_k(C::CyclotomicExt, CF::ClassField_pp) 2 for n=2^k, k>2 =# e = degree(CF) - g, mg = unit_group(residue_ring(FlintZZ, e, cached=false)[1]) + g, mg = unit_group(residue_ring(ZZ, e, cached=false)[1]) @assert is_snf(g) @assert (e%8 == 0 && ngens(g)==2) || ngens(g) <= 1 @@ -776,7 +776,7 @@ function _aut_A_over_k(C::CyclotomicExt, CF::ClassField_pp) @vprintln :ClassField 2 "building automorphism group over ground field..." ng = ngens(g)+1 AutA_gen = Vector{morphism_type(RelSimpleNumField{AbsSimpleNumFieldElem}, RelSimpleNumField{AbsSimpleNumFieldElem})}(undef, ng) - AutA_rel = zero_matrix(FlintZZ, ng, ng) + AutA_rel = zero_matrix(ZZ, ng, ng) zeta = C.mp[1]\(gen(Kr)) n = degree(A) @assert e % n == 0 diff --git a/src/RieSrf/Theta.jl b/src/RieSrf/Theta.jl index e25cb20c44..33efe04c8e 100644 --- a/src/RieSrf/Theta.jl +++ b/src/RieSrf/Theta.jl @@ -262,7 +262,7 @@ function lll_with_transform(M::ArbMatrix; ctx = LLLContext(0.99, 0.51)) #Find number of bits of precision of coefficients of M and subtract 4 to divide by 16 and ensure the numbers are small enough to round p = -(ceil(Int,log(maximum(radius, M))/log(2))+4) n = nrows(M) - d = zero_matrix(FlintZZ, n, n) + d = zero_matrix(ZZ, n, n) round_scale!(d, M, p) d, T = lll_with_transform(d, ctx) T = change_base_ring(R, T) diff --git a/src/Sparse/Matrix.jl b/src/Sparse/Matrix.jl index a97e81ce45..bebe5b4a0d 100644 --- a/src/Sparse/Matrix.jl +++ b/src/Sparse/Matrix.jl @@ -1152,7 +1152,7 @@ The same matrix $A$, but as an `ZZMatrix`. Requires a conversion from the base ring of $A$ to $\mathbb ZZ$. """ function ZZMatrix(A::SMat{T}) where T <: Integer - B = zero_matrix(FlintZZ, A.r, A.c) + B = zero_matrix(ZZ, A.r, A.c) for i = 1:length(A.rows) ra = A.rows[i] for j = 1:length(ra.pos) @@ -1168,7 +1168,7 @@ end The same matrix $A$, but as an `ZZMatrix`. """ function ZZMatrix(A::SMat{ZZRingElem}) - B = zero_matrix(FlintZZ, A.r, A.c) + B = zero_matrix(ZZ, A.r, A.c) for i = 1:length(A.rows) ra = A.rows[i] for j = 1:length(ra.pos) @@ -1200,7 +1200,7 @@ end """ function maximum(::typeof(abs), A::SMat{ZZRingElem}) if length(A.rows) == 0 - return zero(FlintZZ) + return zero(ZZ) end m = abs(A.rows[1].values[1]) for i in A.rows @@ -1249,7 +1249,7 @@ end function maximum(::typeof(nbits), A::SMat{ZZRingElem}) if length(A.rows) == 0 - return zero(FlintZZ) + return zero(ZZ) end m = nbits(A.rows[1].values[1]) for i in A.rows diff --git a/src/Sparse/Module.jl b/src/Sparse/Module.jl index dea719186a..6b10261e1e 100644 --- a/src/Sparse/Module.jl +++ b/src/Sparse/Module.jl @@ -9,7 +9,7 @@ function show(io::IO, M::ModuleCtxNmod) end function show(io::IO, M::ModuleCtx_fmpz) - print(io, "Sparse module over FlintZZ of (current) rank $(nrows(M.bas_gens)) and further $(nrows(M.rel_gens))") + print(io, "Sparse module over ZZ of (current) rank $(nrows(M.bas_gens)) and further $(nrows(M.rel_gens))") if isdefined(M, :basis_idx) print(io, "\ncurrent index: $(M.basis_idx)") end diff --git a/src/Sparse/Row.jl b/src/Sparse/Row.jl index 5745f3be27..96c4eb82d0 100644 --- a/src/Sparse/Row.jl +++ b/src/Sparse/Row.jl @@ -11,9 +11,9 @@ function SRowSpace(R::Ring; cached = true) return SRowSpace{T}(R, cached) end -base_ring(A::SRow{ZZRingElem}) = FlintZZ +base_ring(A::SRow{ZZRingElem}) = ZZ -base_ring(A::SRow{QQFieldElem}) = FlintQQ +base_ring(A::SRow{QQFieldElem}) = QQ function base_ring(A::SRow{T}) where {T} if isdefined(A, :base_ring) @@ -669,7 +669,7 @@ end function permute_row(n::SRow{ZZRingElem}, p::Nemo.Generic.Perm{Int}) r = Tuple{Int, ZZRingElem}[(p[i], v) for (i,v) = n] sort!(r, lt = (a,b)->a[1] 0 p = b.pos[1] @@ -115,7 +115,7 @@ function _solve_ut(A::SMat{ZZRingElem}, b::SMat{ZZRingElem}) @hassert :HNF 1 is_upper_triangular(A) #still assuming A to be upper-triag d = ZZRingElem(1) - r = sparse_matrix(FlintZZ) + r = sparse_matrix(ZZ) for i = b x, dx = _solve_ut(A, i) nd = lcm(d, dx) @@ -152,7 +152,7 @@ function det_mc(A::SMat{ZZRingElem}) return prod(z) end - b = sparse_matrix(matrix(FlintZZ, 1, A.c, rand(1:10, A.c))) + b = sparse_matrix(matrix(ZZ, 1, A.c, rand(1:10, A.c))) _, qq = solve_dixon_sf(A, b) q = p_start # global prime @@ -161,7 +161,7 @@ function det_mc(A::SMat{ZZRingElem}) mm = ZZRingElem(1) last = ZZRingElem(0) while true - R = residue_ring(FlintZZ, q, cached = false)[1] + R = residue_ring(ZZ, q, cached = false)[1] d = det(matrix(change_base_ring(R, A)))*inv(R(qq)) if first dd = ZZRingElem(d) @@ -201,7 +201,7 @@ function det(A::SMat{ZZRingElem}) #TODO: re-use the zzModMatrix.... ld = ZZRingElem[] for q in lp - R = residue_ring(FlintZZ, Int(q), cached = false)[1] + R = residue_ring(ZZ, Int(q), cached = false)[1] push!(ld, ZZRingElem(det(matrix(change_base_ring(R, A))))) end #ld = [ZZRingElem(det(matrix(sparse_matrix(A, Int(q))))) for q = lp] @@ -236,7 +236,7 @@ If \code{is_int} is given, then $d$ is assumed to be $1$. In this case rational reconstruction is avoided. """ function solve_dixon_sf(A::SMat{ZZRingElem}, b::SRow{ZZRingElem}, is_int::Bool = false) - B = sparse_matrix(FlintZZ) + B = sparse_matrix(ZZ) push!(B, b) s, d = solve_dixon_sf(A, B, is_int) return s[1], d @@ -245,7 +245,7 @@ end function solve_dixon_sf(A::SMat{ZZRingElem}, B::SMat{ZZRingElem}, is_int::Bool = false) #for square matrices (s) of full rank (f) only. p = next_prime(2^20) - R = residue_ring(FlintZZ, p, cached = false)[1] + R = residue_ring(ZZ, p, cached = false)[1] Ap = change_base_ring(R, A) @@ -275,7 +275,7 @@ function solve_dixon_sf(A::SMat{ZZRingElem}, B::SMat{ZZRingElem}, is_int::Bool = #now, to solve xA = b, we do # xAT = bT since AT is upper-triag, we can do this! - sol_all = sparse_matrix(FlintZZ) + sol_all = sparse_matrix(ZZ) den_all = ZZRingElem(1) for b in B @@ -284,7 +284,7 @@ function solve_dixon_sf(A::SMat{ZZRingElem}, B::SMat{ZZRingElem}, is_int::Bool = bp = change_base_ring(R, b) - sol = sparse_row(FlintZZ) + sol = sparse_row(ZZ) last = (sol, ZZRingElem(1)) while true diff --git a/src/Sparse/ZZRow.jl b/src/Sparse/ZZRow.jl index 6e67326888..d4cfc30f04 100644 --- a/src/Sparse/ZZRow.jl +++ b/src/Sparse/ZZRow.jl @@ -342,7 +342,7 @@ function sparse_row(M::ZZMatrix) push!(vals, Nemo.mat_entry_ptr(M, 1, i)) end end - return SRow(FlintZZ, pos, vals) + return SRow(ZZ, pos, vals) end function get_tmp(A::SMat{ZZRingElem}) diff --git a/src/conjugates.jl b/src/conjugates.jl index e5eaac7699..cbaa7e977d 100644 --- a/src/conjugates.jl +++ b/src/conjugates.jl @@ -4,9 +4,9 @@ function conjugates_init(f_in::Union{ZZPolyRingElem, QQPolyRingElem}) f_in = f_in*denominator(f_in) gz = Array{ZZRingElem}(undef, length(f_in)) for i = 1:f_in.length - gz[i] = FlintZZ(numerator(coeff(f_in, i-1))) + gz[i] = ZZ(numerator(coeff(f_in, i-1))) end - g = polynomial_ring(FlintZZ, string(var(parent(f_in))), cached = false)[1](gz) + g = polynomial_ring(ZZ, string(var(parent(f_in))), cached = false)[1](gz) f = g else f = f_in diff --git a/test/AlgAss/AbsAlgAss.jl b/test/AlgAss/AbsAlgAss.jl index 8dff9477a6..3c4d326454 100644 --- a/test/AlgAss/AbsAlgAss.jl +++ b/test/AlgAss/AbsAlgAss.jl @@ -66,7 +66,7 @@ A = matrix_algebra(Fp, [ matrix(Fp, [ 1 1; 0 1 ]) ]) # not semisimple! @test_throws AssertionError decompose(A) - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] A = StructureConstantAlgebra((x^2 + 1)*(x^2 + 3)) dec = Hecke.as_number_fields(A) @@ -82,13 +82,13 @@ end @testset "Generators" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] A = StructureConstantAlgebra((x^2 + 1)*(x^2 + 3)) g, full_basis, v = gens_with_data(A) @test length(full_basis) == dim(A) - M = zero_matrix(FlintQQ, dim(A), dim(A)) + M = zero_matrix(QQ, dim(A), dim(A)) for i = 1:dim(A) Hecke.elem_to_mat_row!(M, i, full_basis[i]) end @@ -105,7 +105,7 @@ end @testset "Radical" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] # f = x^2 + 1 # g = x^3 + 3x^2 + 5x - 5 f2g3 = x^13 + 9x^12 + 44x^11 + 120x^10 + 205x^9 + 153x^8 + 32x^7 - 168x^6 - 5x^5 - 485x^4 + 500x^3 - 400x^2 + 375x - 125 # = f^2*g^3 @@ -159,11 +159,11 @@ I = radical(AS) @test all(in(I), preimage.(Ref(AStoA), ge)) - A = group_algebra(FlintQQ, G) + A = group_algebra(QQ, G) I = radical(A) @test nrows(basis_matrix(I, copy = false)) == 0 - for K in [ F2, F4, FlintQQ ] + for K in [ F2, F4, QQ ] A = matrix_algebra(K, [ matrix(K, 2, 2, [ 1, 0, 0, 0 ]), matrix(K, 2, 2, [ 0, 1, 0, 0 ]), matrix(K, 2, 2, [ 0, 0, 0, 1]) ]) # i. e. upper triangular matrices I = radical(A) @test nrows(basis_matrix(I, copy = false)) == 1 diff --git a/test/AlgAss/AlgGrp.jl b/test/AlgAss/AlgGrp.jl index d5f923a1b7..20c3dde96e 100644 --- a/test/AlgAss/AlgGrp.jl +++ b/test/AlgAss/AlgGrp.jl @@ -1,6 +1,6 @@ @testset "Group algebras" begin G = small_group(8, 4) - A = GroupAlgebra(FlintQQ, G) + A = GroupAlgebra(QQ, G) @testset "Regular matrix algebra" begin B, BtoA = Hecke.regular_matrix_algebra(A) @@ -20,7 +20,7 @@ @test length(full_basis) == dim(A) - M = zero_matrix(FlintQQ, dim(A), dim(A)) + M = zero_matrix(QQ, dim(A), dim(A)) for i = 1:dim(A) Hecke.elem_to_mat_row!(M, i, full_basis[i]) end diff --git a/test/AlgAss/AlgMat.jl b/test/AlgAss/AlgMat.jl index d89f746eb0..1e5fedd896 100644 --- a/test/AlgAss/AlgMat.jl +++ b/test/AlgAss/AlgMat.jl @@ -2,16 +2,16 @@ @testset "Construction" begin - M1 = matrix(FlintQQ, [ 1 1; 0 1]) - M2 = matrix(FlintQQ, [ 1 0; 1 1]) - A = matrix_algebra(FlintQQ, [ M1, M2 ]) + M1 = matrix(QQ, [ 1 1; 0 1]) + M2 = matrix(QQ, [ 1 0; 1 1]) + A = matrix_algebra(QQ, [ M1, M2 ]) @test dim(A) == 4 @test basis_matrix(A) == identity_matrix(QQ, 4) - QG = group_algebra(FlintQQ, small_group(2, 1)) + QG = group_algebra(QQ, small_group(2, 1)) M1 = matrix(QG, [ 1 1; 0 1]) M2 = matrix(QG, [ 1 0; 1 1]) - A = matrix_algebra(FlintQQ, QG, [ M1, M2 ]) + A = matrix_algebra(QQ, QG, [ M1, M2 ]) @test dim(A) == 4 end @@ -244,8 +244,8 @@ 0 0 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 0 1]] - mats2 = map(v -> matrix(FlintQQ, v), mats) - A = matrix_algebra(FlintQQ, mats2) + mats2 = map(v -> matrix(QQ, v), mats) + A = matrix_algebra(QQ, mats2) @test dim(A) == 22 J = radical(A) B, = quo(A, J) diff --git a/test/AlgAss/Elem.jl b/test/AlgAss/Elem.jl index 99a1de452e..2fa5664682 100644 --- a/test/AlgAss/Elem.jl +++ b/test/AlgAss/Elem.jl @@ -1,5 +1,5 @@ @testset "Elements in algebras" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 1 A = StructureConstantAlgebra(f) @@ -7,11 +7,11 @@ @test Hecke.is_integral(A[1]) == true @test Hecke.is_integral(QQFieldElem(1, 2)*A[1]) == false - B = group_algebra(FlintQQ, small_group(2, 1)) + B = group_algebra(QQ, small_group(2, 1)) @test Hecke.is_integral(B[1]) == true @test Hecke.is_integral(QQFieldElem(1, 2)*B[1]) == false - C = matrix_algebra(FlintQQ, B, 2) + C = matrix_algebra(QQ, B, 2) @test Hecke.is_integral(C[1]) == true @test Hecke.is_integral(QQFieldElem(1, 2)*C[1]) == false end @@ -24,7 +24,7 @@ @test !is_central_idempotent(A(QQ[1 0; 0 0])) @test is_central_idempotent(A(QQ[1 0; 0 1])) - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = (x + 1)*(x - 1) B = StructureConstantAlgebra(f) e = B([1//2, 1//2]) diff --git a/test/AlgAss/Ideal.jl b/test/AlgAss/Ideal.jl index c337e4b6c9..79fc453cdb 100644 --- a/test/AlgAss/Ideal.jl +++ b/test/AlgAss/Ideal.jl @@ -45,7 +45,7 @@ end @testset "Quotients" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] # f = x^2 + 1 # g = x^3 + 3x^2 + 5x - 5 f2g3 = x^13 + 9x^12 + 44x^11 + 120x^10 + 205x^9 + 153x^8 + 32x^7 - 168x^6 - 5x^5 - 485x^4 + 500x^3 - 400x^2 + 375x - 125 # = f^2*g^3 @@ -105,7 +105,7 @@ # An example where the multiplication table of the quotient is not 0, # see https://github.com/thofma/Hecke.jl/issues/1399 . G = small_group(8, 4) - A, _ = StructureConstantAlgebra(group_algebra(FlintQQ, G)) + A, _ = StructureConstantAlgebra(group_algebra(QQ, G)) I = left_ideal(A, one(A)) J = left_ideal(A, sum(A[i] for i in 1:8)) Q, AtoQ = quo(I, J) diff --git a/test/AlgAss/StructureConstantAlgebra.jl b/test/AlgAss/StructureConstantAlgebra.jl index 13d0859a40..e1c2629089 100644 --- a/test/AlgAss/StructureConstantAlgebra.jl +++ b/test/AlgAss/StructureConstantAlgebra.jl @@ -86,13 +86,13 @@ end @testset "Change of ring" begin # Restrict from number field to Q - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^3 - 2 K, a = number_field(f, "a") A = StructureConstantAlgebra(matrix_ring(K, 2)) - B, BtoA = Hecke.restrict_scalars(A, FlintQQ) - @test base_ring(B) == FlintQQ + B, BtoA = Hecke.restrict_scalars(A, QQ) + @test base_ring(B) == QQ @test dim(B) == dim(A)*degree(K) test_alg_morphism_char_0(B, A, BtoA) @@ -244,7 +244,7 @@ end @testset "Splitting at infinite place" begin G = small_group(8, 4) - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K, a = number_field(x - 1, "a") A = Hecke.GroupAlgebra(K, G) H = first(c[1] for c in Hecke.decompose(A) if dim(c[1]) == 4) diff --git a/test/AlgAssAbsOrd/Conjugacy/Conjugacy.jl b/test/AlgAssAbsOrd/Conjugacy/Conjugacy.jl index b3f285fbdc..ed8170f30b 100644 --- a/test/AlgAssAbsOrd/Conjugacy/Conjugacy.jl +++ b/test/AlgAssAbsOrd/Conjugacy/Conjugacy.jl @@ -40,7 +40,7 @@ fl, _ = Hecke.is_GLZ_conjugate(QQ[1 2; 3 4], QQ[1 2 3; 4 5 6; 7 8 9]) @test !fl - R = residue_ring(FlintZZ, ZZRingElem(7))[1] + R = residue_ring(ZZ, ZZRingElem(7))[1] x, y = R(6), R(6) q, r = divrem(x, y) @test y * q + r == x diff --git a/test/AlgAssAbsOrd/ICM.jl b/test/AlgAssAbsOrd/ICM.jl index 06dd5c251a..292ee31299 100644 --- a/test/AlgAssAbsOrd/ICM.jl +++ b/test/AlgAssAbsOrd/ICM.jl @@ -1,6 +1,6 @@ @testset "Ideal class monoid of orders in number fields" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^3 + 31*x^2 + 43*x + 77 K, a = number_field(f, "a") O = equation_order(K) @@ -24,7 +24,7 @@ end @testset "Ideal class monoid of orders in algebras" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^3 + 31*x^2 + 43*x + 77 A = StructureConstantAlgebra(f) O = Order(A, basis(A)) @@ -49,11 +49,11 @@ end @testset "Conjugacy of integral matrices" begin - Zx, x = FlintZZ["x"] + Zx, x = ZZ["x"] f = x^3 - 4x^2 + 8x + 5 M = companion_matrix(f) - U = identity_matrix(FlintZZ, nrows(M)) + U = identity_matrix(ZZ, nrows(M)) for i = 1:nrows(M) for j = i + 1:ncols(M) U[i, j] = rand(-10:10) @@ -65,7 +65,7 @@ end @test b == true @test M == V*N*inv(V) - N = identity_matrix(FlintZZ, nrows(M)) + N = identity_matrix(ZZ, nrows(M)) b, V = is_conjugate(M, N) @test b == false @@ -73,7 +73,7 @@ end h = x^2 - x + 5 M = companion_matrix(f*g*h) - U = identity_matrix(FlintZZ, nrows(M)) + U = identity_matrix(ZZ, nrows(M)) for i = 1:nrows(M) for j = i + 1:ncols(M) U[i, j] = rand(-10:10) @@ -85,7 +85,7 @@ end @test b == true @test M == V*N*inv(V) - N = identity_matrix(FlintZZ, nrows(M)) + N = identity_matrix(ZZ, nrows(M)) b, V = is_conjugate(M, N) @test b == false diff --git a/test/AlgAssAbsOrd/Ideal.jl b/test/AlgAssAbsOrd/Ideal.jl index 02d0ebb35b..f8e51bed7c 100644 --- a/test/AlgAssAbsOrd/Ideal.jl +++ b/test/AlgAssAbsOrd/Ideal.jl @@ -1,5 +1,5 @@ @testset "AlgAssAbsOrdIdl" begin - QG = group_algebra(FlintQQ, FinGenAbGroup([ 4 ])) + QG = group_algebra(QQ, FinGenAbGroup([ 4 ])) @testset "Arithmetic" begin O = any_order(QG) @@ -29,7 +29,7 @@ #= @testset "Locally free basis" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^4 - 5x^2 + 5 K, a = number_field(f, "a", cached = false, check = false) # Gal(K/Q) == C_4 OK = maximal_order(K) @@ -50,7 +50,7 @@ =# @testset "rand" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] A = StructureConstantAlgebra(x^2 - QQFieldElem(1, 5)) O = any_order(A) I = 2*O diff --git a/test/AlgAssAbsOrd/LocallyFreeClassGroup.jl b/test/AlgAssAbsOrd/LocallyFreeClassGroup.jl index d8ee6f358d..2818ae9b67 100644 --- a/test/AlgAssAbsOrd/LocallyFreeClassGroup.jl +++ b/test/AlgAssAbsOrd/LocallyFreeClassGroup.jl @@ -1,6 +1,6 @@ @testset "Locally free class group of group algebras" begin G = small_group(8, 4) - A = GroupAlgebra(FlintQQ, G) + A = GroupAlgebra(QQ, G) O = Order(A, basis(A)) C = locally_free_class_group(O) @test C.snf == ZZRingElem[ 2 ] @@ -23,7 +23,7 @@ @test C.snf == ZZRingElem[ 2 ] G = small_group(10, 2) - A = GroupAlgebra(FlintQQ, G) + A = GroupAlgebra(QQ, G) O = Order(A, basis(A)) C = locally_free_class_group(O) @test C.snf == ZZRingElem[] @@ -34,18 +34,18 @@ @test C.snf == ZZRingElem[] G = small_group(12, 3) - A = StructureConstantAlgebra(GroupAlgebra(FlintQQ, G))[1] + A = StructureConstantAlgebra(GroupAlgebra(QQ, G))[1] O = Order(A, basis(A)) C = locally_free_class_group(O) @test C.snf == ZZRingElem[] end @testset "Locally free class group of matrix algebras" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 47 K, a = number_field(f, "a") A = StructureConstantAlgebra(matrix_ring(K, 2)) - A, _ = Hecke.restrict_scalars(A, FlintQQ) + A, _ = Hecke.restrict_scalars(A, QQ) O = MaximalOrder(A) C = Hecke.locally_free_class_group(O) # == class_group(K) @test C.snf == ZZRingElem[ 5 ] @@ -53,14 +53,14 @@ end f = x^2 + 26 K, a = number_field(f, "a") A = StructureConstantAlgebra(matrix_ring(K, 2)) - A, _ = Hecke.restrict_scalars(A, FlintQQ) + A, _ = Hecke.restrict_scalars(A, QQ) O = MaximalOrder(A) C = Hecke.locally_free_class_group(O) # == class_group(K) @test C.snf == ZZRingElem[ 6 ] end @testset "Discrete logarithm of locally free class group" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^12 - x^11 + x^9 - x^8 + x^6 - x^4 + x^3 - x + 1 K, a = number_field(f, "a") # Gal(K/Q) = C2 x C6 (aka 12T2 aka small_group(12, 5)) OK = maximal_order(K) diff --git a/test/AlgAssAbsOrd/Order.jl b/test/AlgAssAbsOrd/Order.jl index c1e96ef7c5..36f722933a 100644 --- a/test/AlgAssAbsOrd/Order.jl +++ b/test/AlgAssAbsOrd/Order.jl @@ -1,5 +1,5 @@ @testset "AlgAssAbsOrd" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] A = matrix(QQ, 3, 3, [1,3^4,0,0,1,0,0,0,1]); B = matrix(QQ, 3, 3, [1,0,0,27,1,0,0,0,1]); @@ -117,11 +117,11 @@ O2 = Hecke.maximal_order_via_decomposition(AA) @test discriminant(O1) == discriminant(O2) - QG = group_algebra(FlintQQ, small_group(2, 1)) + QG = group_algebra(QQ, small_group(2, 1)) O = maximal_order(QG) @test isone(abs(discriminant(O))) - M = matrix_algebra(FlintQQ, 3) + M = matrix_algebra(QQ, 3) O = maximal_order(M) @test isone(abs(discriminant(O))) @@ -184,7 +184,7 @@ end @testset "rand" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] A = StructureConstantAlgebra(x^2 - QQFieldElem(1, 5)) O = any_order(A) diff --git a/test/AlgAssAbsOrd/PicardGroup.jl b/test/AlgAssAbsOrd/PicardGroup.jl index 5c9fd86b2a..1ccd7a1e76 100644 --- a/test/AlgAssAbsOrd/PicardGroup.jl +++ b/test/AlgAssAbsOrd/PicardGroup.jl @@ -30,7 +30,7 @@ end @testset "Picard group of maximal orders of algebras" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^3 - 10x^2 - 3x - 2 g = x^2 - 9x + 1 A = StructureConstantAlgebra(f*g) @@ -50,7 +50,7 @@ end @testset "Picard group of non maximal orders of algebras" begin G = abelian_group([2, 3]) - A = GroupAlgebra(FlintQQ, G) + A = GroupAlgebra(QQ, G) O = Order(A, basis(A)) P, mP = picard_group(O) @test is_snf(P) @@ -66,14 +66,14 @@ end @test mP\ideal(O, one(O)) in P G = abelian_group([3, 3]) - A = GroupAlgebra(FlintQQ, G) + A = GroupAlgebra(QQ, G) O = Order(A, basis(A)) P, mP = picard_group(O) @test is_snf(P) @test P.snf == ZZRingElem[ 3 ] @test test_disc_log_picard(P, mP, O) - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^3 - 10x^2 - 3x - 2 g = x^2 - 9x + 1 A = StructureConstantAlgebra(f*g) @@ -100,7 +100,7 @@ end @testset "Unit groups of orders of algebras" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^3 - 12*x^2 - 6324*x + 459510 K, a = number_field(f, "a", cached = false) OK = equation_order(K) diff --git a/test/AlgAssAbsOrd/ResidueRingMultGrp.jl b/test/AlgAssAbsOrd/ResidueRingMultGrp.jl index 67119aff5d..511296bd0b 100644 --- a/test/AlgAssAbsOrd/ResidueRingMultGrp.jl +++ b/test/AlgAssAbsOrd/ResidueRingMultGrp.jl @@ -1,5 +1,5 @@ @testset "Residue ring multiplicative group" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] A = StructureConstantAlgebra(x^2 - 5) O = Order(A, basis(A)) Q, = quo(O, 2 * O) diff --git a/test/AlgAssRelOrd/Ideal.jl b/test/AlgAssRelOrd/Ideal.jl index 2ca1653abc..5ed92a94e9 100644 --- a/test/AlgAssRelOrd/Ideal.jl +++ b/test/AlgAssRelOrd/Ideal.jl @@ -1,5 +1,5 @@ @testset "AlgAssRelOrdIdl" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 - 10x - 8 K, a = number_field(f, "a") KG = group_algebra(K, FinGenAbGroup([ 2 ])) diff --git a/test/AlgAssRelOrd/Order.jl b/test/AlgAssRelOrd/Order.jl index 90bbf19291..1d0d54c474 100644 --- a/test/AlgAssRelOrd/Order.jl +++ b/test/AlgAssRelOrd/Order.jl @@ -1,5 +1,5 @@ @testset "AlgAssRelOrd" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 - 5x - 1 K, a = number_field(f, "a") @@ -48,7 +48,7 @@ O2 = Hecke.maximal_order_via_relative(KG) @test discriminant(O1) == discriminant(O2) - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, a = number_field(x^4 - 4 * x^2 + 2) A = Hecke.quaternion_algebra2(K, -1, -1) M = maximal_order(A) diff --git a/test/EllCrv/EllCrv.jl b/test/EllCrv/EllCrv.jl index 56c4f9f846..b85b8d3efa 100644 --- a/test/EllCrv/EllCrv.jl +++ b/test/EllCrv/EllCrv.jl @@ -28,7 +28,7 @@ E = @inferred elliptic_curve([0, 0, 0, 1, 2], check = false) @test is_short_weierstrass_model(E) - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f1 = x^3+3*x+5 g1 = x+2 @@ -102,7 +102,7 @@ E43_a1 = elliptic_curve([0, 1, 1, 0, 0]) - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K, a = number_field(x^2 - x - 1, "a") OK = maximal_order(K) @@ -113,15 +113,15 @@ Eshort = elliptic_curve([4, 0]) @testset "Field access" begin - @test base_field(E11_a1) == FlintQQ - @test base_field(E43_a1) == FlintQQ + @test base_field(E11_a1) == QQ + @test base_field(E43_a1) == QQ @test base_field(E31_1_a1) == K @test base_field(E116_1_a1) == K - @test base_field(Eshort) == FlintQQ + @test base_field(Eshort) == QQ end @testset "Point construction" begin - P = @inferred E43_a1([FlintQQ(-1), FlintQQ(0)]) + P = @inferred E43_a1([QQ(-1), QQ(0)]) @test typeof(P) == EllipticCurvePoint{QQFieldElem} @test parent(P) == E43_a1 @test @inferred is_finite(P) @@ -148,7 +148,7 @@ @test @inferred !is_finite(P) @test @inferred is_infinite(P) - P = @inferred E43_a1([FlintQQ(-1), FlintQQ(0)]) + P = @inferred E43_a1([QQ(-1), QQ(0)]) P = @inferred E116_1_a1([K(0), -K(a)]) @test typeof(P) == EllipticCurvePoint{AbsSimpleNumFieldElem} @@ -212,7 +212,7 @@ @testset "Point arithmetic" begin #addition - P = @inferred E43_a1([FlintQQ(-1), FlintQQ(0)]) + P = @inferred E43_a1([QQ(-1), QQ(0)]) O = infinity(E43_a1) @test P == @inferred P + O diff --git a/test/FieldFactory/FieldFactory.jl b/test/FieldFactory/FieldFactory.jl index b2c2a0b02d..0ee6427770 100644 --- a/test/FieldFactory/FieldFactory.jl +++ b/test/FieldFactory/FieldFactory.jl @@ -78,7 +78,7 @@ println("Split extension") @time begin @testset "Split extension" begin - x = polynomial_ring(FlintZZ, "x", cached = false)[2] + x = polynomial_ring(ZZ, "x", cached = false)[2] K = number_field(x^2+1)[1] l = [Hecke.field_context(K)] l1 = Hecke.fields(42, 5, l, ZZRingElem(10)^90) @@ -175,7 +175,7 @@ for x in l3 @test GAP.gap_to_julia(Vector{Int}, Hecke.IdGroup(closure(x.generators_of_automorphisms))) == [30, 3] end - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^36 - x^33 + x^27 - x^24 + x^18 - x^12 + x^9 - x^3 + 1 K, a = number_field(f, cached = false, check = false) d = ZZRingElem(1252291517600545939502745293690906945712691746311040212121628914687318440182651069503694911322360563684969) diff --git a/test/GrpAb/Elem.jl b/test/GrpAb/Elem.jl index f767a82dec..04dd9bf9ec 100644 --- a/test/GrpAb/Elem.jl +++ b/test/GrpAb/Elem.jl @@ -1,21 +1,21 @@ @testset "Elements" begin @testset "Constructors" begin - M = FlintZZ[1 2 3; 4 5 6] + M = ZZ[1 2 3; 4 5 6] G = @inferred abelian_group(M) - N = FlintZZ[1 2 3] + N = ZZ[1 2 3] a = @inferred FinGenAbGroupElem(G, N) @test parent(a) == G @test a.coeff == N @test a[begin:end] == [0, 0, 0] G = @inferred abelian_group([3, 0]) - N = FlintZZ[1 1] + N = ZZ[1 1] a = @inferred FinGenAbGroupElem(G, N) @test @inferred parent(a) == G @test a.coeff == N @test a[begin:end] == [1, 1] - N = matrix(FlintZZ, 1, 2, [ 1, 1 ]) + N = matrix(ZZ, 1, 2, [ 1, 1 ]) a = @inferred G(N) @test @inferred parent(a) == G @test a.coeff == N @@ -27,7 +27,7 @@ end @testset "Generators" begin - M = FlintZZ[1 2 3; 4 5 6] + M = ZZ[1 2 3; 4 5 6] G = abelian_group(M) ge = @inferred gens(G) @test length(ge) == 3 @@ -38,28 +38,28 @@ @testset "Parent" begin G = @inferred abelian_group([3, 0]) - N = FlintZZ[1 1] + N = ZZ[1 1] a = @inferred FinGenAbGroupElem(G, N) @test @inferred parent(a) == G end @testset "String I/O" begin G = abelian_group([3, 0]) - N = FlintZZ[1 1] + N = ZZ[1 1] a = FinGenAbGroupElem(G, N) @test isa(string(a), String) end @testset "Hashing" begin G = abelian_group([3, 0]) - N = FlintZZ[1 1] + N = ZZ[1 1] a = FinGenAbGroupElem(G, N) @test isa(hash(a), UInt) end @testset "Indexing" begin G = abelian_group([3, 0]) - N = FlintZZ[1 2] + N = ZZ[1 2] a = FinGenAbGroupElem(G, N) @test @inferred a[1] == 1 @test @inferred a[2] == 2 @@ -67,7 +67,7 @@ @testset "Comparison" begin G = abelian_group([3, 0]) - N = FlintZZ[1 2] + N = ZZ[1 2] a = FinGenAbGroupElem(G, N) b = FinGenAbGroupElem(G, deepcopy(N)) @test @inferred a == b @@ -160,21 +160,21 @@ G = abelian_group([3, 3, 3]) a = @inferred G(ZZRingElem[1, 1, 1]) @test parent(a) == G - @test a.coeff == FlintZZ[1 1 1] + @test a.coeff == ZZ[1 1 1] a = @inferred G([1, 1, 1]) @test parent(a) == G - @test a.coeff == FlintZZ[1 1 1] + @test a.coeff == ZZ[1 1 1] - M = FlintZZ[1 1 1] + M = ZZ[1 1 1] a = @inferred G(M) M[1, 1] = 3 @test parent(a) == G - @test a.coeff == FlintZZ[1 1 1] + @test a.coeff == ZZ[1 1 1] a = @inferred G[1] @test parent(a) == G - @test a.coeff == FlintZZ[1 0 0] + @test a.coeff == ZZ[1 0 0] end @testset "Order" begin @@ -242,37 +242,37 @@ @testset "Helper" begin @testset "Reduce mod Hermite normal form" begin - a = FlintZZ[21 32 43] - H = FlintZZ[2 0 0 ; 0 3 0 ; 0 0 5] + a = ZZ[21 32 43] + H = ZZ[2 0 0 ; 0 3 0 ; 0 0 5] Hecke.reduce_mod_hnf_ur!(a, H) - @test a == FlintZZ[1 2 3] + @test a == ZZ[1 2 3] - a = FlintZZ[1 3 42] - H = FlintZZ[1 1 14 ; 0 2 11 ; 0 0 17] + a = ZZ[1 3 42] + H = ZZ[1 1 14 ; 0 2 11 ; 0 0 17] Hecke.reduce_mod_hnf_ur!(a, H) - @test a == FlintZZ[0 0 0] + @test a == ZZ[0 0 0] - a = FlintZZ[0 0 1] - H = FlintZZ[1 32 62 ; 0 45 90 ; 0 0 0] + a = ZZ[0 0 1] + H = ZZ[1 32 62 ; 0 45 90 ; 0 0 0] Hecke.reduce_mod_hnf_ur!(a, H) - @test a == FlintZZ[0 0 1] + @test a == ZZ[0 0 1] end @testset "Smith normal form with transform" begin - M = matrix_space(FlintZZ,1,1)([0]) - S = matrix_space(FlintZZ,1,1)([0]) + M = matrix_space(ZZ,1,1)([0]) + S = matrix_space(ZZ,1,1)([0]) T,L,R = snf_with_transform(M, true, true) @test S == T @test L*M*R == T - M = matrix_space(FlintZZ,1,1)([1]) - S = matrix_space(FlintZZ,1,1)([1]) + M = matrix_space(ZZ,1,1)([1]) + S = matrix_space(ZZ,1,1)([1]) T,L,R = snf_with_transform(M, true, true) @test S == T @test L*M*R == T - M = FlintZZ[834 599 214 915 ; 784 551 13 628 ; 986 5 649 100 ; 504 119 64 310 ] - S = FlintZZ[1 0 0 0 ; 0 1 0 0 ; 0 0 1 0 ; 0 0 0 36533330310] + M = ZZ[834 599 214 915 ; 784 551 13 628 ; 986 5 649 100 ; 504 119 64 310 ] + S = ZZ[1 0 0 0 ; 0 1 0 0 ; 0 0 1 0 ; 0 0 0 36533330310] T,L,R = snf_with_transform(M, true, true) @test S == T @test L*M*R == T diff --git a/test/GrpAb/GrpAbFinGen.jl b/test/GrpAb/GrpAbFinGen.jl index c6edc46311..3e93fefd96 100644 --- a/test/GrpAb/GrpAbFinGen.jl +++ b/test/GrpAb/GrpAbFinGen.jl @@ -5,7 +5,7 @@ end @testset "Constructor" begin - M1 = matrix(FlintZZ, 2, 3, [1, 2, 3, 4, 5, 6]) + M1 = matrix(ZZ, 2, 3, [1, 2, 3, 4, 5, 6]) G = @inferred abelian_group(M1) @test isa(G, FinGenAbGroup) @test is_abelian(G) @@ -16,7 +16,7 @@ @test is_abelian(G) @test G.rels == M1 - M = FlintZZ[1 2 3; 4 5 6] # ZZMatrix + M = ZZ[1 2 3; 4 5 6] # ZZMatrix G = @inferred abelian_group(M) @test isa(G, FinGenAbGroup) @test is_abelian(G) @@ -48,13 +48,13 @@ G = @inferred abelian_group(N) @test isa(G, FinGenAbGroup) @test is_abelian(G) - @test G.rels == matrix(FlintZZ, 2, 2, [3, 0, 0, 5]) + @test G.rels == matrix(ZZ, 2, 2, [3, 0, 0, 5]) N = ZZRingElem[3, 5] G = @inferred abelian_group(N) @test isa(G, FinGenAbGroup) @test is_abelian(G) - @test G.rels == matrix(FlintZZ, 2, 2, [3, 0, 0, 5]) + @test G.rels == matrix(ZZ, 2, 2, [3, 0, 0, 5]) G = @inferred free_abelian_group(2) @test isa(G, FinGenAbGroup) @@ -76,25 +76,25 @@ @test @inferred is_snf(S) @test @inferred ngens(S) == 2 @test @inferred nrels(S) == 2 - @test @inferred rels(S) == matrix(FlintZZ, 2, 2, [3, 0, 0, 0]) + @test @inferred rels(S) == matrix(ZZ, 2, 2, [3, 0, 0, 0]) G = abelian_group([3, 5]) @test @inferred !is_snf(G) @test @inferred ngens(G) == 2 @test @inferred nrels(G) == 2 - @test @inferred rels(G) == matrix(FlintZZ, 2, 2, [3, 0, 0, 5]) + @test @inferred rels(G) == matrix(ZZ, 2, 2, [3, 0, 0, 5]) end @testset "Hermite normal form" begin - M = FlintZZ[1 2 3; 4 5 6] - HNF = FlintZZ[1 2 3; 0 3 6] + M = ZZ[1 2 3; 4 5 6] + HNF = ZZ[1 2 3; 0 3 6] G = abelian_group(M) Hecke.assure_has_hnf(G) @test G.hnf == HNF end @testset "Smith normal form" begin - M = FlintZZ[16 17 2 ; 19 23 8 ; 16 17 2] + M = ZZ[16 17 2 ; 19 23 8 ; 16 17 2] G = abelian_group(M) S, mS = @inferred snf(G) @test is_snf(S) @@ -102,7 +102,7 @@ @test codomain(mS) == G @test domain(mS) == S - M = FlintZZ[-4 0; 0 4] + M = ZZ[-4 0; 0 4] G = abelian_group(M) S, mS = @inferred snf(G) @test S.snf == ZZRingElem[4, 4] @@ -227,14 +227,14 @@ @testset "Subgroup" begin @test_throws ErrorException sub(FinGenAbGroupElem[]) - G = abelian_group(FlintZZ[3 0 0 ; 0 15 0]) + G = abelian_group(ZZ[3 0 0 ; 0 15 0]) g1 = G[1] g2 = G[2] g3 = G[3] S, S_map = @inferred sub([g1, g2, g3]) @test is_isomorphic(G, S) - G = abelian_group(FlintZZ[3 0 0 ; 0 15 0]) + G = abelian_group(ZZ[3 0 0 ; 0 15 0]) S, mS = snf(G) s1 = S[1] s2 = S[2] @@ -242,19 +242,19 @@ H, mH = @inferred sub(S, [s1, s2, s3]) @test is_isomorphic(H, G) - G = abelian_group(FlintZZ[3 0 0 ; 0 15 0]) + G = abelian_group(ZZ[3 0 0 ; 0 15 0]) g1 = G[1] H, mH = @inferred sub(G, [g1]) @test is_isomorphic(H, abelian_group([3])) - G = abelian_group(FlintZZ[3 0 0 ; 0 15 0]) + G = abelian_group(ZZ[3 0 0 ; 0 15 0]) S, mS = snf(G) s1 = S[1] H, mH = @inferred sub(S, [s1]) @test is_isomorphic(H, abelian_group([3])) # G contains empty relation - G = abelian_group(FlintZZ[3 0 0 ; 0 15 0 ; 0 0 30 ; 0 0 0]) + G = abelian_group(ZZ[3 0 0 ; 0 15 0 ; 0 0 30 ; 0 0 0]) g1 = G[3] S, mS = @inferred sub(G, [g1]) @test is_isomorphic(S, abelian_group([30])) @@ -278,7 +278,7 @@ end @testset "Quotient" begin - G = abelian_group(FlintZZ[3 0 0 ; 0 15 0]) + G = abelian_group(ZZ[3 0 0 ; 0 15 0]) Q, mQ = @inferred quo(G, FinGenAbGroupElem[]) @test is_isomorphic(Q, G) diff --git a/test/LocalField/LocalField.jl b/test/LocalField/LocalField.jl index 0bfb88954d..0cc4d11468 100644 --- a/test/LocalField/LocalField.jl +++ b/test/LocalField/LocalField.jl @@ -1,7 +1,7 @@ @testset "LocalField" begin @testset "Creation" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2-2*x+2 K, a = local_field(f, 2, 10, "a", Hecke.EisensteinLocalField, check = false) @test precision(K) == 20 @@ -98,7 +98,7 @@ @test valuation(mKp(gen(K))) == valuation(gen(K), P) @test iszero(defining_polynomial(K)(mKp(gen(K)))) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^10 + 5*x^9 - 633*x^8 + 38157*x^7 + 1360601*x^6 - 39808345*x^5 - 464252491*x^4 - 17622187401*x^3 + 2826886632714*x^2 - 96335539805104*x + 1313743135204448 K, a = number_field(f, check = false, cached = false) OK = maximal_order(K) @@ -133,7 +133,7 @@ @test iszero(log(one(L))) B = basis(L) for i = 15:20 - el = sum([rand(FlintZZ, 0:10)*B[j] for j = 1:7])*pi^i + el = sum([rand(ZZ, 0:10)*B[j] for j = 1:7])*pi^i explog = exp(log(1+el)) logexp = log(exp(el)) @test iszero(explog - 1 - el) || valuation(explog - 1 - el) > 80 @@ -232,7 +232,7 @@ end @testset "Unramified extension" begin - Qx,x = FlintQQ["x"] + Qx,x = QQ["x"] f = Qx([ 1, 8, -40, -46, 110, 71, -113, -43, 54, 11, -12, -1, 1 ]) L = number_field(f)[1]; P = prime_decomposition(maximal_order(L),7)[1][1]; @@ -248,7 +248,7 @@ end @testset "Ali-Inverse" begin - Qx,x = FlintQQ["x"] + Qx,x = QQ["x"] L = number_field(x^6-6*x^4+9*x^2+23)[1] P = prime_decomposition(maximal_order(L),23)[1][1] lp,mp = Hecke.completion(L,P) diff --git a/test/LocalField/Poly.jl b/test/LocalField/Poly.jl index a9c7a3b96e..56217314b6 100644 --- a/test/LocalField/Poly.jl +++ b/test/LocalField/Poly.jl @@ -8,12 +8,12 @@ Fx, x = polynomial_ring(F, "x") f = x^5 for i = 0:4 - c = K(rand(FlintZZ, 1:100)) + c = K(rand(ZZ, 1:100)) f += c*x^i end u = 1 for i = 1:5 - c = K(rand(FlintZZ, 1:100)) + c = K(rand(ZZ, 1:100)) u += 2*c*x^i end diff --git a/test/LocalField/neq.jl b/test/LocalField/neq.jl index 369a404054..9230451797 100644 --- a/test/LocalField/neq.jl +++ b/test/LocalField/neq.jl @@ -1,5 +1,5 @@ @testset "Unramified extension" begin - Qx,x = FlintQQ["x"] + Qx,x = QQ["x"] f = Qx([1, 8, -40, -46, 110, 71, -113, -43, 54, 11, -12, -1, 1]) L = number_field(f)[1] P = prime_decomposition(maximal_order(L),7)[1][1] diff --git a/test/Map/NumField.jl b/test/Map/NumField.jl index 2e2f7d8377..1dc366dacf 100644 --- a/test/Map/NumField.jl +++ b/test/Map/NumField.jl @@ -1,6 +1,6 @@ @testset "Map/NumField.jl" begin # AbsSimpleNumField -> AbsSimpleNumField - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, a = number_field(x^2 - 2, "a") s = involution(K) @@ -238,7 +238,7 @@ @test f * f == f #Example that was failing - Qx, x = FlintQQ["x"]; + Qx, x = QQ["x"]; K, a = number_field(x^2+5, cached = false) Kns, gns = number_field([x^2+5, x^2+1]) L = absolute_simple_field(Kns)[1] diff --git a/test/Map/NumberField.jl b/test/Map/NumberField.jl index c929f37822..bc3ed2b593 100644 --- a/test/Map/NumberField.jl +++ b/test/Map/NumberField.jl @@ -1,5 +1,5 @@ @testset "Test composition order" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, a = number_field(x^6 + 108, "a") A = automorphism_list(K) for f in A @@ -11,7 +11,7 @@ end @testset "Induce image" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, a = number_field(x^6 + 108, "a") A = automorphism_list(K) OK = maximal_order(K) @@ -31,7 +31,7 @@ end @testset "Automorphisms" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^32 - 217*x^28 + 42321*x^24 - 999502*x^20 + 18913054*x^16 - 80959662*x^12 + 277668081*x^8 - 115322697*x^4 + 43046721 K, a = number_field(f, cached = false, check = false) auts = Hecke._automorphisms(K, is_abelian = true) @@ -63,7 +63,7 @@ end end @testset "CM" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^20 + 6*x^19 + 33*x^18 + 109*x^17 + 332*x^16 + 706*x^15 + 1299*x^14 + 1910*x^13 + 3303*x^12 + 7116*x^11 + 14445*x^10 + 24009*x^9 + 30102*x^8 + 37094*x^7 + 54187*x^6 + 82991*x^5 + 119418*x^4 + 148247*x^3 + 185442*x^2 + 184250*x + 112225 K, a = number_field(f, "a", cached = false) G, mG = automorphism_group(K) @@ -84,7 +84,7 @@ end end @testset "parents" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x - 1 K, a = number_field(f, "a", cached = false) G, mG = automorphism_group(K) diff --git a/test/Misc/NumberField.jl b/test/Misc/NumberField.jl index 0b288dc2dc..80e180c68b 100644 --- a/test/Misc/NumberField.jl +++ b/test/Misc/NumberField.jl @@ -1,6 +1,6 @@ @testset "Misc/number_field" begin @testset "constructors" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] # test number_field constructors with single polynomial K1, a = number_field(x^2 + 1) @@ -31,7 +31,7 @@ end @testset "is_subfield" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, a = number_field(x^2 + 1, "a") L, b = number_field(x^4 + 1, "b") @@ -51,7 +51,7 @@ end @testset "is_isomorphic" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^5 + 12x - 92 K, a = number_field(f, "a") diff --git a/test/Misc/OrdLocalization.jl b/test/Misc/OrdLocalization.jl index a189597662..9e23aa2a94 100644 --- a/test/Misc/OrdLocalization.jl +++ b/test/Misc/OrdLocalization.jl @@ -1,5 +1,5 @@ -Qx,x = FlintQQ["x"] +Qx,x = QQ["x"] K,a = number_field(x^6+108) OK = ring_of_integers(K) lp = prime_decomposition(OK, 5) diff --git a/test/Misc/Poly.jl b/test/Misc/Poly.jl index 95f467ca8b..45273b6ccd 100644 --- a/test/Misc/Poly.jl +++ b/test/Misc/Poly.jl @@ -37,7 +37,7 @@ end function random_symmetric_matrix(x::Int) - M = zero_matrix(FlintZZ, x, x) + M = zero_matrix(ZZ, x, x) for i = 1:x for j= i:x a = rand(1:5) @@ -220,7 +220,7 @@ end fa = factor(QQ, 6*x) @test length(fa) == 1 - # + # let K, = rationals_as_number_field() Ky, y = K["y"] diff --git a/test/Misc/jordan_test.jl b/test/Misc/jordan_test.jl index 01ddc45a71..962adbf0a5 100644 --- a/test/Misc/jordan_test.jl +++ b/test/Misc/jordan_test.jl @@ -1,6 +1,6 @@ @testset "Jordan and Rational canonical form" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^6 + rand(Qx, 1:5, -3:3) M = companion_matrix(f) @test minpoly(Qx, M) == f @@ -13,10 +13,10 @@ @test minpoly(Qx, J) == g^2 @test charpoly(Qx, J) == g^2 - M = identity_matrix(FlintQQ, 6) + M = identity_matrix(QQ, 6) for i = 1:6 for j = i+1:6 - M[i, j] = rand(FlintQQ, -2:2) + M[i, j] = rand(QQ, -2:2) end end M1 = transpose(M) @@ -44,7 +44,7 @@ g = x^3 + rand(Qx, 1:2, -2:2) f1 = f f2 = f*g - C = zero_matrix(FlintQQ, 9, 9) + C = zero_matrix(QQ, 9, 9) Hecke._copy_matrix_into_matrix(C, 1, 1, companion_matrix(f1)) Hecke._copy_matrix_into_matrix(C, 4, 4, companion_matrix(f2)) CF, TM = rational_canonical_form(C) @@ -80,7 +80,7 @@ end 0 0 0 0 1 0; ]) ] Eig = common_eigenspaces(M, side = :right) - V = zero_matrix(FlintQQ, 6, 0) + V = zero_matrix(QQ, 6, 0) for (e, v) in Eig @test length(e) == 3 for i = 1:3 @@ -91,7 +91,7 @@ end @test rref!(V) == 6 Eig = common_eigenspaces(M, side = :left) - V = zero_matrix(FlintQQ, 0, 6) + V = zero_matrix(QQ, 0, 6) for (e, v) in Eig @test length(e) == 3 for i = 1:3 diff --git a/test/Misc/stable_subgroups.jl b/test/Misc/stable_subgroups.jl index 7719a6a4c1..e380e67cc1 100644 --- a/test/Misc/stable_subgroups.jl +++ b/test/Misc/stable_subgroups.jl @@ -3,7 +3,7 @@ @testset "Minimal Submodules" begin F, a = finite_field(3,1,"a") - R = residue_ring(FlintZZ,9)[1] + R = residue_ring(ZZ,9)[1] V=abelian_group([3,3,9,9]) @@ -35,7 +35,7 @@ @testset "Dual Module" begin - R=residue_ring(FlintZZ,9)[1] + R=residue_ring(ZZ,9)[1] V=abelian_group([3,3,9,9]) V.is_snf=true V.snf=[3,3,9,9] @@ -54,7 +54,7 @@ @testset "submodules with given structure" begin - R=residue_ring(FlintZZ,8)[1] + R=residue_ring(ZZ,8)[1] V=abelian_group([2,4,8,8]) V.is_snf=true V.snf=[2,4,8,8] @@ -95,7 +95,7 @@ @testset "submodules" begin - R=residue_ring(FlintZZ,4)[1] + R=residue_ring(ZZ,4)[1] V=abelian_group([2,2,4]) V.is_snf=true V.snf=[2,2,4] diff --git a/test/NfAbs/Conjugates.jl b/test/NfAbs/Conjugates.jl index b1a1a9c9ca..588479d8d1 100644 --- a/test/NfAbs/Conjugates.jl +++ b/test/NfAbs/Conjugates.jl @@ -1,5 +1,5 @@ @testset "NfAbs/Conjugates" begin -Qx, x = FlintQQ["x"] +Qx, x = QQ["x"] K1, a1 = number_field(x^6 - x^5 + x^4 - x^3 + x^2 - x + 1, "a") # totally complex K2, a2 = number_field(x^6 - x^5 - 7*x^4 + 2*x^3 + 7*x^2 - 2*x - 1, "a") # totally real K3, a3 = number_field(x^6 - x^5 - x^4 + 4*x^3 + 3*x^2 - 1, "a") # signature (2, 2) @@ -120,7 +120,7 @@ end end @testset "Bad example" begin - Zx, x = polynomial_ring(FlintZZ) + Zx, x = polynomial_ring(ZZ) f = swinnerton_dyer(3, x) g = swinnerton_dyer(8, x) k, a = number_field(f, cached = false) @@ -138,7 +138,7 @@ end end @testset "Another bad example" begin - Qx, x = polynomial_ring(FlintQQ) + Qx, x = polynomial_ring(QQ) f = x^12-3502319*x^10-3032677266943*x^8+17220065055936439179*x^6+26436504739687580368857995*x^4+12508949875084010197801010438203*x^2+1495531630727918278288148065057756816 K, a = number_field(f, "a") @test 19619386 >= t2(a) >= 19619385 diff --git a/test/NfAbs/Elem.jl b/test/NfAbs/Elem.jl index 75dd8481aa..02ef79e71b 100644 --- a/test/NfAbs/Elem.jl +++ b/test/NfAbs/Elem.jl @@ -1,5 +1,5 @@ @testset "Linear disjoint" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") _K, _ = number_field([x^2 - 2, x^2 - 3], "a", cached = false) K, _ = simple_extension(_K) L, b = number_field(x^2 - 2, "b", cached = false) @@ -10,7 +10,7 @@ end @testset "Random" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K, a = number_field(x^32 + 2, "a") b = @inferred rand([a], -10:10) @@ -47,7 +47,7 @@ end end @testset "Is integral" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 1 K, a = number_field(f, "a") @@ -62,7 +62,7 @@ end end @testset "Compositum" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 1 K, a = number_field(f, "a") L, b = number_field(x^2-3, "b") @@ -73,7 +73,7 @@ end end @testset "PolyFactor" begin - Zx, x = FlintZZ["x"] + Zx, x = ZZ["x"] k, a = number_field(swinnerton_dyer(3, x)) kt, t = k["t"] @@ -89,7 +89,7 @@ end for i in 1:10 n = rand(1:10) d = rand(1:10) - k, a = number_field(n//d * change_base_ring(FlintQQ, swinnerton_dyer(3, x))) + k, a = number_field(n//d * change_base_ring(QQ, swinnerton_dyer(3, x))) kt, t = k["t"] g = swinnerton_dyer(8, x) @test length(factor((t^2-a)*(t^3-a-1))) == 2 #Trager @@ -108,13 +108,13 @@ end for i in 1:10 n = rand(1:10) d = rand(1:10) - K, a = number_field(n//d * change_base_ring(FlintQQ, x - 1), "a") + K, a = number_field(n//d * change_base_ring(QQ, x - 1), "a") Kt, t = K["t"] f = t^5 -3 * t^4 - 104 * t^3 + 312 * t^2 + 400*t -1200 @test length(factor(f)) == 5 @test length(factor(f*t)) == 6 - K, a = number_field(change_base_ring(FlintQQ, x) - n//d, "a") + K, a = number_field(change_base_ring(QQ, x) - n//d, "a") Kt, t = K["t"] f = t^5 -3 * t^4 - 104 * t^3 + 312 * t^2 + 400*t -1200 @test length(factor(f)) == 5 diff --git a/test/NfAbs/NonSimple.jl b/test/NfAbs/NonSimple.jl index 53721bded8..d197cc4ea8 100644 --- a/test/NfAbs/NonSimple.jl +++ b/test/NfAbs/NonSimple.jl @@ -1,6 +1,6 @@ @testset "AbsNonSimpleNumField" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, (a, b) = @inferred number_field([x^2 - 2, x^3 - 3]) @test K isa AbsNonSimpleNumField @@ -10,7 +10,7 @@ @test !is_simple(AbsNonSimpleNumField) @testset "Basics" begin - @test FlintQQ == @inferred base_ring(K) + @test QQ == @inferred base_ring(K) @test 6 == @inferred degree(K) @test [2, 3] == @inferred degrees(K) @test 2 == @inferred ngens(K) @@ -68,10 +68,10 @@ u = rand(-10:10) @test @inferred z^u == @inferred z^ZZRingElem(u) - M = zero_matrix(FlintQQ, 1, 6) + M = zero_matrix(QQ, 1, 6) Hecke.elem_to_mat_row!(M, 1, z) @test z == sum(M[1, j] * basis(K)[j] for j in 1:6) - M = matrix(FlintQQ, 1, 6, [rand(-10:10) for j in 1:6]) + M = matrix(QQ, 1, 6, [rand(-10:10) for j in 1:6]) zz = Hecke.elem_from_mat_row(K, M, 1) @test zz == sum(M[1, j] * basis(K)[j] for j in 1:6) @@ -145,7 +145,7 @@ K2, = @inferred number_field([x^2 - 50, x^3 - 3]) OO = EquationOrder(K2) Omax = @inferred MaximalOrder(OO) - @test discriminant(Omax) == FlintZZ(30233088) + @test discriminant(Omax) == ZZ(30233088) lp = prime_decomposition(Omax, 101) @test length(lp) == 3 @@ -171,7 +171,7 @@ end @testset "coercion" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, (a, b) = number_field([x^2 - 2, x^3 - 3]) @test (@inferred QQ(2*a^0)) == 2*one(QQ) @test @inferred is_rational(2*a^0) diff --git a/test/NfAbs/NormRelation.jl b/test/NfAbs/NormRelation.jl index 581cf8864d..e7aba1684a 100644 --- a/test/NfAbs/NormRelation.jl +++ b/test/NfAbs/NormRelation.jl @@ -1,5 +1,5 @@ @testset "NormRel" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^8 - x^4 + 1 K, a = number_field(f, "a", cached = false) S = prime_ideals_up_to(maximal_order(K), 1000) @@ -19,7 +19,7 @@ # Test a non-normal group - Qx, x = polynomial_ring(FlintQQ, "x"); + Qx, x = polynomial_ring(QQ, "x"); K, a = number_field(x^4-2*x^2+9); OK = maximal_order(K); lP = AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}[] diff --git a/test/NfAbs/Simplify.jl b/test/NfAbs/Simplify.jl index 6e1df760e6..0b5ddf4e0d 100644 --- a/test/NfAbs/Simplify.jl +++ b/test/NfAbs/Simplify.jl @@ -1,5 +1,5 @@ @testset "Simplify" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K, a = number_field(x^2 - 10, cached = false) L, mL = simplify(K) @test is_isomorphic(K, L) diff --git a/test/NfAbs/Subfields.jl b/test/NfAbs/Subfields.jl index 4086f82c86..156358bf3b 100644 --- a/test/NfAbs/Subfields.jl +++ b/test/NfAbs/Subfields.jl @@ -1,5 +1,5 @@ @testset "Fixed fields" begin - Qx,x = FlintQQ["x"] + Qx,x = QQ["x"] @testset "FixedField: absolute" begin f = x^8+236*x^6+12158*x^4+201788*x^2+779689 @@ -27,7 +27,7 @@ end @testset "Subfields" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f_1 = x^6 + 108; K_1,_ = number_field(f_1); #(C_2)^3 diff --git a/test/NfOrd/Clgp.jl b/test/NfOrd/Clgp.jl index de7e57b614..ab3d728e32 100644 --- a/test/NfOrd/Clgp.jl +++ b/test/NfOrd/Clgp.jl @@ -1,5 +1,5 @@ @testset "Clgp" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") @testset "class numbers" begin @testset "quadratic fields" begin classnumbersofquadraticfields = Tuple{Int, Int}[(-50,1),(-49,1),(-48,1),(-47,5),(-46,4) @@ -87,7 +87,7 @@ end @testset "_class_unit_group" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") AF = ArbField(20, cached = false) @testset "K = Q" begin @@ -220,7 +220,7 @@ end end @testset "S3 field" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^6-24*x^4+157*x^2-162 K, a = number_field(f) OK = maximal_order(K) @@ -230,7 +230,7 @@ end end @testset "Proof" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^2 - 3 * 5 * 7 * 11 K, a = number_field(f) OK = maximal_order(K) diff --git a/test/NfOrd/Elem.jl b/test/NfOrd/Elem.jl index e13f7a060f..33d7af34f9 100644 --- a/test/NfOrd/Elem.jl +++ b/test/NfOrd/Elem.jl @@ -1,5 +1,5 @@ @testset "Elements" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K1, a1 = number_field(x^3 - 2, "a") O1 = EquationOrder(K1) @@ -31,13 +31,13 @@ @test b4.has_coord @test b1 == b4 - b5 = @inferred O1([FlintZZ(2), FlintZZ(0), FlintZZ(0)]) + b5 = @inferred O1([ZZ(2), ZZ(0), ZZ(0)]) @test parent(b5) == O1 @test typeof(b5) == AbsSimpleNumFieldOrderElem @test b5.has_coord @test b1 == b5 - b6 = @inferred O1(2*a1^0, [FlintZZ(2), FlintZZ(0), FlintZZ(0)]) + b6 = @inferred O1(2*a1^0, [ZZ(2), ZZ(0), ZZ(0)]) @test parent(b6) == O1 @test typeof(b6) == AbsSimpleNumFieldOrderElem @test b6.has_coord @@ -62,7 +62,7 @@ @test b == K1(2) b = @inferred coordinates(b1) - @test b == [ FlintZZ(2), FlintZZ(0), FlintZZ(0) ] + @test b == [ ZZ(2), ZZ(0), ZZ(0) ] b = O1(a1//2, false) @test_throws ErrorException coordinates(b) @@ -234,12 +234,12 @@ @testset "Representation matrix" begin b = O1(1) c = @inferred representation_matrix(b) - @test c == one(matrix_space(FlintZZ, 3, 3)) + @test c == one(matrix_space(ZZ, 3, 3)) b = O1(a1) c = @inferred representation_matrix(b) - @test c == FlintZZ[0 1 0; 0 0 1; 2 0 0] + @test c == ZZ[0 1 0; 0 0 1; 2 0 0] c = @inferred representation_matrix(b, K1) - @test c == Hecke.FakeFmpqMat(FlintZZ[0 1 0; 0 0 1; 2 0 0], one(FlintZZ)) + @test c == Hecke.FakeFmpqMat(ZZ[0 1 0; 0 0 1; 2 0 0], one(ZZ)) end @testset "Trace" begin @@ -274,7 +274,7 @@ @test -B <= coordinates(b)[i] && coordinates(b)[i] <= B end - B = FlintZZ(10) + B = ZZ(10) b = @inferred rand(O1, B) for i in 1:degree(O1) @test -B <= coordinates(b)[i] && coordinates(b)[i] <= B diff --git a/test/NfOrd/FracIdl.jl b/test/NfOrd/FracIdl.jl index 04100ffa3c..fe9e85bd88 100644 --- a/test/NfOrd/FracIdl.jl +++ b/test/NfOrd/FracIdl.jl @@ -1,38 +1,38 @@ -Qx, x = polynomial_ring(FlintQQ, "x") +Qx, x = polynomial_ring(QQ, "x") K2, a2 = number_field(x^3 - 2, "a1") K3, (a3,) = number_field([x^3 - 2], "a2") @testset "Fractional ideals for $K1" for (K1, a1) in [(K2, a2), (K3, a3)] - O1 = Order(K1, Hecke.Hecke.FakeFmpqMat(FlintZZ[1 0 0; 0 2 0; 0 0 4], one(FlintZZ))) + O1 = Order(K1, Hecke.Hecke.FakeFmpqMat(ZZ[1 0 0; 0 2 0; 0 0 4], one(ZZ))) i = ideal(O1, O1(2*a1)) @testset "Construction" begin I = @inferred fractional_ideal(O1, i) - @test basis_matrix(Hecke.FakeFmpqMat, I) == Hecke.Hecke.FakeFmpqMat(FlintZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(1)) - @test basis_mat_inv(Hecke.FakeFmpqMat, I) == Hecke.Hecke.FakeFmpqMat(FlintZZ[1 0 0; 0 16 0; 0 0 16], ZZRingElem(16)) + @test basis_matrix(Hecke.FakeFmpqMat, I) == Hecke.Hecke.FakeFmpqMat(ZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(1)) + @test basis_mat_inv(Hecke.FakeFmpqMat, I) == Hecke.Hecke.FakeFmpqMat(ZZ[1 0 0; 0 16 0; 0 0 16], ZZRingElem(16)) J = @inferred fractional_ideal(O1, i, 2) - @test basis_matrix(Hecke.FakeFmpqMat, J) == Hecke.Hecke.FakeFmpqMat(FlintZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) - @test basis_mat_inv(Hecke.FakeFmpqMat, J) == Hecke.Hecke.FakeFmpqMat(FlintZZ[1 0 0; 0 16 0; 0 0 16], ZZRingElem(8)) + @test basis_matrix(Hecke.FakeFmpqMat, J) == Hecke.Hecke.FakeFmpqMat(ZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) + @test basis_mat_inv(Hecke.FakeFmpqMat, J) == Hecke.Hecke.FakeFmpqMat(ZZ[1 0 0; 0 16 0; 0 0 16], ZZRingElem(8)) - K = @inferred fractional_ideal(O1, FlintZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) + K = @inferred fractional_ideal(O1, ZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) @test isdefined(K, :basis_matrix) - @test basis_matrix(Hecke.FakeFmpqMat, K) == Hecke.Hecke.FakeFmpqMat(FlintZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) - @test basis_mat_inv(Hecke.FakeFmpqMat, K) == Hecke.Hecke.FakeFmpqMat(FlintZZ[1 0 0; 0 16 0; 0 0 16], ZZRingElem(8)) + @test basis_matrix(Hecke.FakeFmpqMat, K) == Hecke.Hecke.FakeFmpqMat(ZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) + @test basis_mat_inv(Hecke.FakeFmpqMat, K) == Hecke.Hecke.FakeFmpqMat(ZZ[1 0 0; 0 16 0; 0 0 16], ZZRingElem(8)) - L = @inferred fractional_ideal(O1, Hecke.Hecke.FakeFmpqMat(FlintZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2))) - @test L.basis_matrix == Hecke.Hecke.FakeFmpqMat(FlintZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) - @test basis_matrix(Hecke.FakeFmpqMat, L) == Hecke.Hecke.FakeFmpqMat(FlintZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) - @test basis_mat_inv(Hecke.FakeFmpqMat, L) == Hecke.Hecke.FakeFmpqMat(FlintZZ[1 0 0; 0 16 0; 0 0 16], ZZRingElem(8)) + L = @inferred fractional_ideal(O1, Hecke.Hecke.FakeFmpqMat(ZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2))) + @test L.basis_matrix == Hecke.Hecke.FakeFmpqMat(ZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) + @test basis_matrix(Hecke.FakeFmpqMat, L) == Hecke.Hecke.FakeFmpqMat(ZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) + @test basis_mat_inv(Hecke.FakeFmpqMat, L) == Hecke.Hecke.FakeFmpqMat(ZZ[1 0 0; 0 16 0; 0 0 16], ZZRingElem(8)) LL = @inferred fractional_ideal(O1, QQ[8 0 0; 0 1//2 0; 0 0 1//2]) - @test LL.basis_matrix == Hecke.Hecke.FakeFmpqMat(FlintZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) - @test basis_matrix(Hecke.FakeFmpqMat, LL) == Hecke.Hecke.FakeFmpqMat(FlintZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) - @test basis_mat_inv(Hecke.FakeFmpqMat, LL) == Hecke.Hecke.FakeFmpqMat(FlintZZ[1 0 0; 0 16 0; 0 0 16], ZZRingElem(8)) + @test LL.basis_matrix == Hecke.Hecke.FakeFmpqMat(ZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) + @test basis_matrix(Hecke.FakeFmpqMat, LL) == Hecke.Hecke.FakeFmpqMat(ZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) + @test basis_mat_inv(Hecke.FakeFmpqMat, LL) == Hecke.Hecke.FakeFmpqMat(ZZ[1 0 0; 0 16 0; 0 0 16], ZZRingElem(8)) M = @inferred fractional_ideal(O1, 2*a1//2) - @test basis_matrix(Hecke.FakeFmpqMat, M) == Hecke.Hecke.FakeFmpqMat(FlintZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) - @test basis_mat_inv(Hecke.FakeFmpqMat, M) == Hecke.Hecke.FakeFmpqMat(FlintZZ[1 0 0; 0 16 0; 0 0 16], ZZRingElem(8)) + @test basis_matrix(Hecke.FakeFmpqMat, M) == Hecke.Hecke.FakeFmpqMat(ZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) + @test basis_mat_inv(Hecke.FakeFmpqMat, M) == Hecke.Hecke.FakeFmpqMat(ZZ[1 0 0; 0 16 0; 0 0 16], ZZRingElem(8)) @test J == K @test K == L @@ -41,8 +41,8 @@ K3, (a3,) = number_field([x^3 - 2], "a2") end J = fractional_ideal(O1, i, 2) - K = fractional_ideal(O1, FlintZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) - L = fractional_ideal(O1, Hecke.Hecke.FakeFmpqMat(FlintZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2))) + K = fractional_ideal(O1, ZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2)) + L = fractional_ideal(O1, Hecke.Hecke.FakeFmpqMat(ZZ[16 0 0; 0 1 0; 0 0 1], ZZRingElem(2))) M = fractional_ideal(O1, 2*a1//2) @testset "Basis" begin @@ -62,20 +62,20 @@ K3, (a3,) = number_field([x^3 - 2], "a2") @testset "Norm" begin b = @inferred norm(J) - @test b == FlintQQ(16, 2^3) + @test b == QQ(16, 2^3) end @testset "Ring of multipliers" begin - i = ideal(O1, FlintZZ[2 0 0; 0 1 0; 0 0 1]) + i = ideal(O1, ZZ[2 0 0; 0 1 0; 0 0 1]) N = @inferred ring_of_multipliers(i) - @test basis_matrix(N) == QQMatrix(Hecke.Hecke.FakeFmpqMat(FlintZZ[1 0 0; 0 2 0; 0 0 2], ZZRingElem(1))) + @test basis_matrix(N) == QQMatrix(Hecke.Hecke.FakeFmpqMat(ZZ[1 0 0; 0 2 0; 0 0 2], ZZRingElem(1))) end @testset "Denominator" begin # This was once a bug found by Johannes @testset begin - R, x = polynomial_ring(FlintQQ, "x") + R, x = polynomial_ring(QQ, "x") K, a = number_field(x, "a") O = maximal_order(K) I = Hecke.AbsSimpleNumFieldOrderFractionalIdeal(ideal(O, O(2)), ZZRingElem(2)) diff --git a/test/NfOrd/Ideal.jl b/test/NfOrd/Ideal.jl index 66a3d77988..6ea16d637a 100644 --- a/test/NfOrd/Ideal.jl +++ b/test/NfOrd/Ideal.jl @@ -1,8 +1,8 @@ @testset "Ideals" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K1, a1 = number_field(x^3 - 2, "a") - O1 = Order(K1, Hecke.FakeFmpqMat(FlintZZ[1 0 0; 0 2 0; 0 0 4], one(FlintZZ))) + O1 = Order(K1, Hecke.FakeFmpqMat(ZZ[1 0 0; 0 2 0; 0 0 4], one(ZZ))) K2, a2 = number_field(x^2 - 4^2*7^2*5, "a") O2 = Order(K2, [K2(1), a2]) @@ -13,18 +13,18 @@ @test I.princ_gen_special[1] == 1 @test I.princ_gen_special[2] == 17 @test I.princ_gen == O1(-17) - @test basis_matrix(I) == matrix_space(FlintZZ, 3, 3)(17) + @test basis_matrix(I) == matrix_space(ZZ, 3, 3)(17) - J = @inferred ideal(O1, FlintZZ(-17)) + J = @inferred ideal(O1, ZZ(-17)) @test order(J) == O1 @test J.princ_gen_special[1] == 2 - @test J.princ_gen_special[3] == FlintZZ(17) + @test J.princ_gen_special[3] == ZZ(17) @test J.princ_gen == O1(-17) - @test basis_matrix(J) == matrix_space(FlintZZ, 3, 3)(17) + @test basis_matrix(J) == matrix_space(ZZ, 3, 3)(17) K = @inferred ideal(O1, O1(-17)) @test K.princ_gen == O1(-17) - @test basis_matrix(K) == matrix_space(FlintZZ, 3, 3)(17) + @test basis_matrix(K) == matrix_space(ZZ, 3, 3)(17) M = @inferred O1(-17)*O1 L = @inferred O1*O1(-17) @@ -42,7 +42,7 @@ end I = ideal(O1, -17) - J = ideal(O1, FlintZZ(-17)) + J = ideal(O1, ZZ(-17)) K = ideal(O1, O1(-17)) M = O1(-17)*O1 I2 = ideal(O2, O2(1 + a2)) @@ -57,7 +57,7 @@ # Test where gens are weakly normal and second generator is zero @testset begin - R, x = polynomial_ring(FlintQQ, "x") + R, x = polynomial_ring(QQ, "x") _K, _a = number_field(x, "a") _O = maximal_order(_K) _I = fractional_ideal(_O, _K(1)) @@ -90,16 +90,16 @@ M = @inferred ideal(O1, O1(4*a1^2)) b = @inferred basis_matrix(M) - @test b == FlintZZ[16 0 0; 0 16 0; 0 0 1] + @test b == ZZ[16 0 0; 0 16 0; 0 0 1] b = @inferred basis_mat_inv(Hecke.FakeFmpqMat, M) - @test b == Hecke.FakeFmpqMat(FlintZZ[1 0 0; 0 1 0; 0 0 16], FlintZZ(16)) + @test b == Hecke.FakeFmpqMat(ZZ[1 0 0; 0 1 0; 0 0 16], ZZ(16)) b = @inferred basis_matrix(M) - @test b == FlintZZ[16 0 0; 0 16 0; 0 0 1] + @test b == ZZ[16 0 0; 0 16 0; 0 0 1] b = @inferred basis_mat_inv(Hecke.FakeFmpqMat, M) - @test b == Hecke.FakeFmpqMat(FlintZZ[1 0 0; 0 1 0; 0 0 16], FlintZZ(16)) + @test b == Hecke.FakeFmpqMat(ZZ[1 0 0; 0 1 0; 0 0 16], ZZ(16)) end @testset "Inclusion" begin @@ -191,7 +191,7 @@ @testset "p-Radical" begin I = @inferred pradical(O1, 2) - @test I == ideal(O1, FlintZZ[2 0 0; 0 1 0; 0 0 1]) + @test I == ideal(O1, ZZ[2 0 0; 0 1 0; 0 0 1]) # An order which does not contain the equation order P, x = polynomial_ring(QQ) @@ -262,7 +262,7 @@ end # Minimum for non-simple - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x - 1 K, a = number_field([f], "a") O = maximal_order(K) @@ -310,7 +310,7 @@ G = gens(I) @test I == ideal(OO, G) end - + include("Ideal/Prime.jl") end diff --git a/test/NfOrd/Ideal/Prime.jl b/test/NfOrd/Ideal/Prime.jl index a3f110ba93..7727f9fb32 100644 --- a/test/NfOrd/Ideal/Prime.jl +++ b/test/NfOrd/Ideal/Prime.jl @@ -1,5 +1,5 @@ @testset "PrimeIdealsSet" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, a = number_field(x - 1, "a") O = maximal_order(K) @@ -86,7 +86,7 @@ end @assert length(prime_decomposition_type(OK, 5)) == 4 end -Qx, x = FlintQQ["x"] +Qx, x = QQ["x"] f = x^2 - 2 K, a = number_field([f], "a") O = Order(K, [3*a[1]]) @@ -135,7 +135,7 @@ PD = primary_decomposition(I) @test all(x -> all(y -> y[2] === x[2] || x[2] + y[2] == 1*ZG, PD), PD) # Non-maximal, locally maximal order -Qx, x = FlintQQ["x"] +Qx, x = QQ["x"] f = x^3 - x^2 + 1 K, a = number_field(f) O = equation_order(K) diff --git a/test/NfOrd/LinearAlgebra.jl b/test/NfOrd/LinearAlgebra.jl index fb79799f3a..c9c960e206 100644 --- a/test/NfOrd/LinearAlgebra.jl +++ b/test/NfOrd/LinearAlgebra.jl @@ -1,7 +1,7 @@ @testset "Linear algebra" begin @testset "Dixon solve" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, a = number_field(x^3 + 3) A = rand(matrix_space(K, 4, 4), 10:100) while iszero(det(A)) @@ -12,7 +12,7 @@ end @testset "Pseudo matrices" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") # Compute a pseudo-hnf of a matrix over Z and check result against the HNF @@ -48,7 +48,7 @@ Hecke.mul_row!(z, i, K(norm(Apseudohnf.coeffs[i]))) end - zinZ = matrix_space(FlintZZ, 5, 5)(map(zz -> numerator(coordinates(O(zz))[1]), z.entries)) + zinZ = matrix_space(ZZ, 5, 5)(map(zz -> numerator(coordinates(O(zz))[1]), z.entries)) c = parent(zinZ)(Ahnf) - zinZ @test all([ mod(c[i,j], de) == 0 for i in 1:5, j in 1:5]) @@ -140,7 +140,7 @@ end @testset "rand" begin - R, x = polynomial_ring(FlintQQ, "x") + R, x = polynomial_ring(QQ, "x") K, a = number_field(x, "a") O = maximal_order(K) I = Hecke.AbsSimpleNumFieldOrderFractionalIdeal(ideal(O, O(2)), ZZRingElem(2)) @@ -159,7 +159,7 @@ end # issue 859 - Qx, x = polynomial_ring(FlintQQ, "x"); + Qx, x = polynomial_ring(QQ, "x"); K, a = number_field(x^2 + 1, "a", cached = false); M = matrix(K, 1, 3, [5*a, 3*a, 0]) pm = pseudo_hnf(pseudo_matrix(M), :lowerleft) @@ -168,7 +168,7 @@ pm = pseudo_hnf(pseudo_matrix(M), :lowerleft) @test Hecke._spans_subset_of_pseudohnf(pm, pm, shape = :upperright) - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x - 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") diff --git a/test/NfOrd/NfOrd.jl b/test/NfOrd/NfOrd.jl index f38232351a..a4ea1f6234 100644 --- a/test/NfOrd/NfOrd.jl +++ b/test/NfOrd/NfOrd.jl @@ -4,7 +4,7 @@ @test parent_type(elem_type(AbsSimpleNumFieldOrder)) === AbsSimpleNumFieldOrder @testset "Construction" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K1, a1 = number_field(x^3 - 2, "a") O1 = EquationOrder(K1, true) @@ -42,9 +42,9 @@ @test Hecke.nf(O3) == K3 K4, a4 = number_field(x^2 - 5, "a") - O4 = Order(K4, Hecke.FakeFmpqMat(FlintZZ[1 0; 0 2], ZZRingElem(1))) - O44 = Order(K4, FlintQQ[1 0; 0 2]) - O444 = Order(K4, FlintZZ[1 0; 0 2]) + O4 = Order(K4, Hecke.FakeFmpqMat(ZZ[1 0; 0 2], ZZRingElem(1))) + O44 = Order(K4, QQ[1 0; 0 2]) + O444 = Order(K4, ZZ[1 0; 0 2]) @test Hecke.nf(O4) == K4 @@ -58,8 +58,8 @@ @test Hecke.nf(O6) == K6 - O7 = Order(K6, Hecke.FakeFmpqMat(FlintZZ[6 0; 0 1], FlintZZ(6)), check = true, cached = false) - O77 = Order(K6, FlintQQ[1 0; 0 1//6]) + O7 = Order(K6, Hecke.FakeFmpqMat(ZZ[6 0; 0 1], ZZ(6)), check = true, cached = false) + O77 = Order(K6, QQ[1 0; 0 1//6]) #@test O7 == O77 #@test !(O7 === O77) @@ -70,12 +70,12 @@ @test_throws ErrorException Order(K1, [a1, a1, a1], isbasis = true) #@test_throws ErrorException Order(K1, [1, a1, a1]) #@test_throws ErrorException Order(K1, [1.0, a1, a1]) - @test_throws ErrorException Order(K6, Hecke.FakeFmpqMat(FlintZZ[0 0; 0 0], FlintZZ(6))) - @test_throws ErrorException Order(K6, Hecke.FakeFmpqMat(FlintZZ[0 2; 2 0], FlintZZ(6))) - @test_throws ErrorException Order(K6, Hecke.FakeFmpqMat(FlintZZ[0 0], FlintZZ(6))) + @test_throws ErrorException Order(K6, Hecke.FakeFmpqMat(ZZ[0 0; 0 0], ZZ(6))) + @test_throws ErrorException Order(K6, Hecke.FakeFmpqMat(ZZ[0 2; 2 0], ZZ(6))) + @test_throws ErrorException Order(K6, Hecke.FakeFmpqMat(ZZ[0 0], ZZ(6))) end - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K1, a1 = number_field(x^3 - 2, "a") O1 = EquationOrder(K1) @@ -108,12 +108,12 @@ O3 = Order(K3, [ a3^i for i in 0:63]) K4, a4 = number_field(x^2 - 5, "a") - O4 = Order(K4, Hecke.FakeFmpqMat(FlintZZ[1 0; 0 2], ZZRingElem(1))) + O4 = Order(K4, Hecke.FakeFmpqMat(ZZ[1 0; 0 2], ZZRingElem(1))) K6, a6 = number_field(x^2 - 180, "a") O6 = EquationOrder(K6) - O7 = Order(K6, Hecke.FakeFmpqMat(FlintZZ[6 0; 0 1], FlintZZ(6))) + O7 = Order(K6, Hecke.FakeFmpqMat(ZZ[6 0; 0 1], ZZ(6))) O5 = @inferred deepcopy(O2) @@ -157,28 +157,28 @@ @test O4.basis_nf == [ a4^0, 2*a4 ] b = @inferred basis_matrix(O1) - @test b == QQMatrix(Hecke.FakeFmpqMat(one(matrix_space(FlintZZ, 3, 3)), one(FlintZZ))) + @test b == QQMatrix(Hecke.FakeFmpqMat(one(matrix_space(ZZ, 3, 3)), one(ZZ))) b = @inferred basis_matrix(O2) - @test b == QQMatrix(Hecke.FakeFmpqMat(one(matrix_space(FlintZZ, 1, 1)), one(FlintZZ))) + @test b == QQMatrix(Hecke.FakeFmpqMat(one(matrix_space(ZZ, 1, 1)), one(ZZ))) b = @inferred basis_matrix(O3) - @test b == QQMatrix(Hecke.FakeFmpqMat(one(matrix_space(FlintZZ, 64, 64)), one(FlintZZ))) + @test b == QQMatrix(Hecke.FakeFmpqMat(one(matrix_space(ZZ, 64, 64)), one(ZZ))) b = @inferred basis_matrix(O4) - @test b == QQMatrix(Hecke.FakeFmpqMat(FlintZZ[1 0; 0 2], one(FlintZZ))) + @test b == QQMatrix(Hecke.FakeFmpqMat(ZZ[1 0; 0 2], one(ZZ))) b = @inferred basis_matrix_inverse(O1) - @test b == QQMatrix(Hecke.FakeFmpqMat(one(matrix_space(FlintZZ, 3, 3)), one(FlintZZ))) + @test b == QQMatrix(Hecke.FakeFmpqMat(one(matrix_space(ZZ, 3, 3)), one(ZZ))) b = @inferred basis_matrix_inverse(O2) - @test b == QQMatrix(Hecke.FakeFmpqMat(one(matrix_space(FlintZZ, 1, 1)), one(FlintZZ))) + @test b == QQMatrix(Hecke.FakeFmpqMat(one(matrix_space(ZZ, 1, 1)), one(ZZ))) b = @inferred basis_matrix_inverse(O3) - @test b == QQMatrix(Hecke.FakeFmpqMat(one(matrix_space(FlintZZ, 64, 64)), one(FlintZZ))) + @test b == QQMatrix(Hecke.FakeFmpqMat(one(matrix_space(ZZ, 64, 64)), one(ZZ))) b = @inferred basis_matrix_inverse(O4) - @test b == QQMatrix(Hecke.FakeFmpqMat(FlintZZ[2 0; 0 1], FlintZZ(2))) + @test b == QQMatrix(Hecke.FakeFmpqMat(ZZ[2 0; 0 1], ZZ(2))) end @testset "Index" begin @@ -198,11 +198,11 @@ @test b == 1 b = @inferred gen_index(O4) - @test b == FlintQQ(1, 2) + @test b == QQ(1, 2) @test_throws ErrorException index(O4) b = @inferred gen_index(O7) - @test b == FlintQQ(6) + @test b == QQ(6) b = @inferred index(O7) @test b == 6 @@ -341,12 +341,12 @@ end @testset "Addition" begin - O6_2 = Order(K6, Hecke.FakeFmpqMat(FlintZZ[2 0; 0 1], FlintZZ(2))) - O6_3 = Order(K6, Hecke.FakeFmpqMat(FlintZZ[3 0; 0 1], FlintZZ(3))) + O6_2 = Order(K6, Hecke.FakeFmpqMat(ZZ[2 0; 0 1], ZZ(2))) + O6_3 = Order(K6, Hecke.FakeFmpqMat(ZZ[3 0; 0 1], ZZ(3))) b = @inferred O6_2 + O6_3 - @test basis_matrix(b) == QQMatrix(Hecke.FakeFmpqMat(FlintZZ[6 0; 0 1], FlintZZ(6))) + @test basis_matrix(b) == QQMatrix(Hecke.FakeFmpqMat(ZZ[6 0; 0 1], ZZ(6))) @test discriminant(b) == 20 diff --git a/test/NfOrd/Overorders.jl b/test/NfOrd/Overorders.jl index a2f6c78d33..035ee25e50 100644 --- a/test/NfOrd/Overorders.jl +++ b/test/NfOrd/Overorders.jl @@ -1,5 +1,5 @@ @testset "Overorders" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 100x + 100 @@ -29,7 +29,7 @@ @test length(orders) == 36 G = small_group(6, 1) - A = StructureConstantAlgebra(group_algebra(FlintQQ, G))[1] + A = StructureConstantAlgebra(group_algebra(QQ, G))[1] O = Order(A, basis(A)) orders = @inferred overorders(O) @test length(orders) == 12 diff --git a/test/NfOrd/PicardGroup.jl b/test/NfOrd/PicardGroup.jl index 9dadb25877..9b6c8095b7 100644 --- a/test/NfOrd/PicardGroup.jl +++ b/test/NfOrd/PicardGroup.jl @@ -59,7 +59,7 @@ function test_disc_log_units(U, mU, O::AbsSimpleNumFieldOrder) end @testset "Picard group and unit group of non maximal orders" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] AF = ArbField(20) f = x^3 - 2 diff --git a/test/NfOrd/RayClassGroup.jl b/test/NfOrd/RayClassGroup.jl index 155d7b44d5..e08bb019d9 100644 --- a/test/NfOrd/RayClassGroup.jl +++ b/test/NfOrd/RayClassGroup.jl @@ -12,7 +12,7 @@ @testset "quadratic fields" begin - Qx,x=polynomial_ring(FlintQQ,"x") + Qx,x=polynomial_ring(QQ,"x") K,a=number_field(x^2+199,"a") O=maximal_order(K) C,mC=class_group(O) @@ -48,7 +48,7 @@ @testset "infinite places" begin - Qx, x = polynomial_ring(FlintQQ, "x"); + Qx, x = polynomial_ring(QQ, "x"); K, a = number_field(x^4-4*x^3-11*x^2+30*x+20, cached = false) O = maximal_order(K) r, mr = ray_class_group(ideal(O,4), real_places(K), n_quo=2) @@ -60,7 +60,7 @@ @testset "stable subgroups" begin - Qx,x=polynomial_ring(FlintQQ,"x"); + Qx,x=polynomial_ring(QQ,"x"); f=x^2+1; K,a=number_field(f,"a"); auts = automorphism_list(K) diff --git a/test/NfOrd/ResidueField.jl b/test/NfOrd/ResidueField.jl index 08055b039c..480acbd895 100644 --- a/test/NfOrd/ResidueField.jl +++ b/test/NfOrd/ResidueField.jl @@ -1,6 +1,6 @@ @testset "residue_field" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^6 + x^5 + 41*x^4 - 34*x^3 + 355*x^2 - 100*x + 125 K, a = number_field(f, cached = false); OK = maximal_order(K); diff --git a/test/NfOrd/ResidueRing.jl b/test/NfOrd/ResidueRing.jl index 66a28868a6..e1e517d34a 100644 --- a/test/NfOrd/ResidueRing.jl +++ b/test/NfOrd/ResidueRing.jl @@ -1,5 +1,5 @@ @testset "Misc" begin - Qx, x = FlintQQ["x"]; + Qx, x = QQ["x"]; K, _a = number_field(x^8 + 80004*x^6 + 2400240008*x^4 + 32004799999992*x^2 + 160032003200160004, "_a") b = 157453328191711202179717143189242275793624108621833103830859432521850508785517258526515452488748522153967183119056487054396132867155122761740177908802158675099547151431934600059294624763758643834027264184957820535341431162763941519907431779158236803193945811522853106043997692098093426405229082454664722785808907480264724175884815526238357594511046254584438637555852501249999457786620937165228964704989027947254776067765216999556148943111125818991397160603083469919198030025315667559888127107364666690174293808443184386217103353257704573699505266277037457530643496395683094045211536353669445382975586480921791202703694534779918655140129660198749036344823130279899198691061502640952637957879699193290015968322302901562545378386539245212496404354446799209490150082725279606537550544700416847399414154186500381639700132932451154823563434825463242268221455750656647434479984288711169939596281639048534112060707124336297454374635438390895708762841905290953753671494836962595244948808648592005723571714773940423838991752122171795855325880222182782335186436310850989965002786978614879323179197752257229005252554472912441270233647938921429480611697821876175681621052295915073259515083661087106781966040136882186907951504254075827525085702772154483433836707570725828611969723375545013999128904112217385296350221352953386856894989128166308472902983445905252893966221538870025018899924032939025369772089692749583208376491456598228730258217746346345432835549512991683599825369490774816789860338747941143132002842907630818713097072262516350687694055436984885552070603365530100723585446858085778020890039852777386814686790235929821092765234247832779468651290476876884591829875006215725680377999800045903079829509762028016201542764682224717679952987886670134970000599804330547140587597835336800575064328853338862095081318363302811060248825004911164535958656320384534608387589205269230493242951891073482934975871663490470104398575107356467473788818075360615446936196190310463208540310754085106684177917162736315313666103199860230640063344659800240954181719501239935310150083598234590655996155375928344786242420748680611157496715688057596989653834208522920749000079744952730317119285146975053107460312080156488563955101233561735244432251018294564495097699023073606509919867603667339077921899161071017635232671864586732656855217965616405431949172650503668036696276302057723389447691732125782531206105555766506514020345975959722620912089896153755513385834820373311137868156147940946804503051085717884552161410341604690885553651807049513710899817586736560749028086576850552337162773209230245739699924564770297477453766291689099131649962849718364626175534782623427662584033390429861124936938111280636128211536380298688006401614872909259534534419771411777804432644192342752334889197165424471424206175236286413779883412343452685179477465704722504385989265925564238417167349181629828319029309197565050706983533703390287717617128506776551409336446843836792121070471977415526035073020318789524170145625814287713855005503964657509842766546121254666531447155577544030518646108549421041962810562707496454676876630347872054880482444047586360126367387657334614992255185856817472835003352681710172838570392360316311788131780362499101979580278371162727785425584934020146610880393450964056081473809153768514330091587612658887757204224053332597674250688388631522287649711945971845453870632406886572578269720185843522914648897975740934675808369423713297169203686917053124747616134611834775862229805647642103434259196603925616232654642862869900440353632224631209564243637311049436949331054837801798388425664470865382478669165//46126479297897394403*_a^7 - 109129017500735068097485652403006129583338152036591670435148012836571470650560793838107931179065097972373276502621774054923242288113421613207721950481979960990097133839578593997363840254679436991395383283105548104609012882083019875052357667778879870808978267529112054072856463084456046589237240241535410976165607160093510161702875373246603604361638521630312812502919370616305461231999559909728268087747088573098659559957248866641089359066983448774404497913970249327257245639090120944621910596865606263253377991657518350165512065424706905569389036925614986502296765268000367173727631683456463493115355611812250697728236308440843052321162554698413317189611511894312615017228370087170634431297977781212368289780382111032617340306810121538204487701247009733519039439523043587025463744251786974155680349902283153283662670452024530450583502062350434459008403308261126133746156957507540304842941813219935977897153768443225520969482580227387613713727792824868524894022621913854827007279593008412789080817996220812386149493196194281145516427634406035826126211857562169065276829722143571228729508429477903891765890596948910589536324882170034816822708923655009944826984616102489096576379080598917851994550155100921865715488618659650981781714112815554729838883000634036824840611225522831725194807477289803555175988010593681065694689850359166279161923217483805422125643777610157697264936513041972038981014919871073728140509055976425907616337652889090635421456868890051551232157912897736011442976463923643733640409514756627598713931877426819027037108065074481505842560914564157885303260289585629350271289261689973651935183190398511920543939582841513869389341557779966065564386554486521240704599537991160833027259427669131698584060458351750932793651200072225531279912657128345794784083198463146180456612238796386559628498008301433313238745213772811419625156129621843671496474288128418016768704420840626065971675506178103016194527455628785058623689929873281420373121817509218257899468299339430981870558764406393558198912709524986280924707115434487757122963764507647540759073625212219641818903058579337350979807857440188158790653645478023864693629542869388344155752763588233846264606585001719348002856272406233474334974948933862919037363300894938036369773799787583762002515019412037011543581002665007213728126161119666042693356480272678029984369884401315756761277668139960177462619921409167011439759429429794996282198091977010033647664692539874639452154158814697664906336957410898474255250500448661298146818686367425265410437870185962760510770035060195742166260552979574685852809221032688296344603298954785675889739218359795034303214707683774940514574584244708783899750181446905350845005210364287458287301365915156135442059841379086659004121848171107840428810702720517720099182459434527790182361515252780960013105179252114955811899744893393289560702018955568963607023178075130487008405702330459848453963614052715498590599693024714227516587109137301697887087036044486345573958729536870330872538761244442294085468287095146646019242589295206315846435434424287520866106338262458736136878683460739751346826590175770213677066275853437961491431385598446783113473120423643677181313594941062203721776630757041025029813432208904997747375912374601884995881422273420026528000530350679928171133787283704677159816849590245091776638533203061126891600692610630250524001514961799305490531635405229662326818552059339317961646076793852885198426380891822205965239404133701088460001267695332502025034563870530106973046246579603361499791538857080140133076632812374645373489767979026090825246364695638611207296424104458432//230609334403*_a^6 + 9509875485162859936462490814603025225212201306280916742489087666337544199602872686216563375530478612520500142477443417402489329613822060396293826870278353856146636573967037565429595193211078037642125448136934529286638915938008933803592794216740484752209047495907984649036332814480389855118382592984959453365259860078932257367570163848153925920848367238925270678579035372303290120032261195237737691209290526793473291776080296376423200979905584688493290449025546932640461736364338453922499689721643422770620413561905322463520614658183873060085456050483423634400373547139398679379235181169399027126065384421785672510957170422572808607568916442709677573267740951835490838800739890798170303665902539525126301786063840467322248957951230574279330965261616369418575774715493264432416026809500426291016470707953096750102495111745923250409024425357126408571517673577944959593277664508600847306477419161512425796574852471956027361338657479335649267239289944488502153169488712833025512970306763384029534434561753014094786443012051566883948723690308381828289370799539066165166286168588209763420625339408277689252294430292823911015570054665860552661934248072769461573118422297378072785322252798609357605231843402910834160904087472526596300163449114856040780936018364541233673195667568564507425641802572550673528038958946527765756970053895422286868044271357557984438231726530774986232715559899128931666510596940555089494209262889672421429382668300226613152283348963899408016786805759268664269501809861219831200486717973086738415981830449132530296568795497405338162465338409821827738353146444807085435996075663291570858754494282524531599150697792280619735148471820448255178468026277513843610757518132478919601115856079824974171561574967058136802387466312722719419313194982250487383176635390610361824228851023707820255400218859694470642822268166244186589457574186677459721565654920333721336463980376710790361157665549871194459850387371437108326138861206538763818371790048923922211334436923444567455078513019794038098888702836457783231116035491817540746906006460023209826930074385276768402626025346227666710771154082445798814779546095799678020430150932068802068375912133789868407502665960048944091845327794732918197109045983197415905391192377072876166066045340201275390409507499088123694949661734617092489007076013876287684771602404750624394098931941047700299281968670979437632429418459485954336519831694945980284330154389420004010401361884054953118188814873083592617731302599744306457655453963757484708602200969443957436081949903443912266347309956871487047156245420453960363052836530784031388852286502526656274793087482797127397991025277808169350267132775777721013419806719363467801992285764603283248068671691404357745756053141273230087788038787177765037303953440693828153578164559929408845505013147926319785455235318510047637983610707402164933361201854894571814638488274434214591605469177533624660196216566153536332457321342209570567371582859099606123052466494290871890692407750661240715567698612559057909988038745378422557594827405335936991221107566768918528839677574632838686244080331124086101084426938644588303426883415656585011048460470402459061868016794634745438862799232392067986750551201639144447103955954342131005399297173640581810249782927107154949580744656685298056299115698166488639817681305940574659784304438283263965984295205684742477383928619331876203673449107572981614775125231078819431031158764584957893685437379363152617137968115952107208574341928852582476106512893851838176010005145264060726414424983247666799717096972426582713873170210326231277632836303204988034868328350902586781100712180//46126479297897394403*_a^5 - 6547959308079105555985334115485173787259455798499573409449751066219961381974948751874152086606264008538341336710311686843504383771381523635689732472819761619327808224642394797029825142961275578357705787752899097372749990950745358542891564782068350008280314008281781468479533497993531707447412888972607729391888760819930796722495928145542709468907034574862029375800168075719560284842437593703515541801000808563065770916554846496198643722737140893361818683834042900134089252836685436919203879633130107007729186255434416046631054949613263747974480993610750420110810509610558031158005356270754722513907567419958666365089634979067464825374395607014195858011069936682545526263736661970412407146741262828304522123402487426179105653089220912535345671050223078030609404450261661308701875582595722023289132354836793763326327552462375876095911290745150768409422215302284090277036909764367433371186194676822598545785020414130417709210893778803711598051095025077761230691145360075117330090790139690784170427241409241184793741890758049257293276690919630961639224963877445268254740336988058560866227964785533189313736967598128533193358565579966429078996180837147906709508730935381550772775897594096268955376998406365513786660748096816378208866410197158914899792657804043477564086354753820949175138838252342792917669632611642051303812780401250695082273716895463292938382877944164682151290720655544406282938857222104165835886824376697507308795491848651216306558255047140873177031939089689956158601473788346471305891851704427169178033340509363995260280558120599039313565339995678601433966223895716932274977898279921799063414861790291512256477462849656515191099272149913523865994322042300247484757381478545632303301620179003240178440795622021759469484659306733676327857319253015004378634560074185697119757647552260786350829137494102601660951190316796230800348618089569863977131450236281337842155802659279245210432473721698537177704036392638361087538643172256631785228055294188113910483896896964537774197266981912426279051160396918226828044276340300134402892071797987867740625935659983602948417821320877399733490431062126169903756800035972387929347159831249039426033477320821207243568924313273164318867382056918820927047166885929642868079872780298072058259167534854600887674906194761044766637947321905762838115025919502201893686775529321227155122161803847748037190182643733890568112120524392839020408445284646559366924449914804556038927176881777558116408153837199489289710030118568730252263540527920575211405414819418250775157093086898137556167223643681864921459965699880440300540258880403363157268887143885050124736132580024421648261488890441863980755504203851016451552810387177214861402002632277976072154656557641198438794474602427957713565319133962812641409499784636504241391145930990536466522055638197363162706336965485401578625608493093384160221242541372048954348604730863979481478358951232251826934724770391035346433162780868903079450259722456376476620996336741269707128671689671293593014070752189026529716268162282989054446593842890969363417818936326099827008112508424049085684994765011306560312289063726564361051330683757984565408865998678003880374614171659467918233178323653614347714041398683975583838865559398717674838049494300862303522877099249748431733087822101497050124369504596848038943330609113885996781865269250073735749824758023036291941138900737881928042879187584590198933766760664477756334687899784760817675979706271116002326294726830332709776996064255340786506123901359547478596720887269360896710491914502522568264864122008103471700133058277523501696432374467707949660200039115714836864//230609334403*_a^4 + 27351928385067938006765558531439846444319897633555181513639547852926415394394173988631211624240563072249206935444196044027300964775256946052401956648436334626276849827308365062570808368089117881452119397407201830501974535054905796769478459021596900123153791684492824954358613364323118542477026214044689740370893669991460155381086886800728093489249431389538723349204764514796095181236427412710062947592696089916493665703116755301392240662231431757176826281157789635123995853642784556579673360643420861744784464674152825645314049842698793248642240631588594980286354227421434525989880584606075809695212849707261282427778433940692040452467875075836833221647259958459532557057883565484468251071662584876061338015158003747064855815371261645088703854145503259244728671525515753856848226902935077583442222396506137790041817563294343380980702484533090224730979007604739630159414136877019291284749179348526532291491730034929605335471483445995252212845617701621638505823750792728756722077020374923860923578620746763439487396735105911609623743006991725318960074235259237009460661409184014229422297341000405169401780548541112339649802576096890062776306248041623835351301664729479343044592532011091089101529037674705944136891942572428641611099543266414500771623598985996726568686681857808947069451093323302933179557264224691852170299465180715931241050549714892868864751501566969060834339767817721833041556117125232604953347509243634724877691505460166753056824735124045674381218677040396531403504859870575678536580096135981111145719419585185295276534370961075592605196630963069390734605734480619049572284787354083641404380963265554310117228122637021555905366117547924264803894909744088733206530653637116358809804188087537449527905375913982947794335218641612258244122729667523113671851306820415659571218839415843228520143073256829116132059954957795690531175957506078413740462579206819187713174216228434263215756367781440756230609548836643326681088982394989159574543275192730278192682126410996480940436990057933014407310586883682641396201032237173447881556106763486711271224736600229812684045389386537343080085030588080039393935572451758612297264678392680935685927791647736821631685393342765857872212927400905915029353865225711080711187937571408096542284760714491977927747638420942828171807006787827965945341745218466859619265890544529107984603968713163159027691484205835321795814113086527081481712888458753226374588229942341397610546415428916099430509826744483759933736975034172980689113916862967026820256348111179438215258113127295478740707216526552338077158245116462412625889254200382254031826374073657455859187114388723778165515349295593882177668987290207961750632777642831439066114978459318350665279310884562136459389311235817898320940373878794576566955184257865168555041907920076570883220058040110141954901898709000859346371088747590128115674499735688969774837506603462891554466692476395835261484918664973398584660743322141588214797054096162667509227138760300834402952805392794524264841905594499930725155983859803048758930524144131942987128005539781924665907949582902546669552152568276111357851327655405666795200063045647696266480911395501956076204976616399805153033055175470015365673076148734951517588426454325582262995830393447484367277572805607022317298159233847482657194421091018267447248774355586307338979027227591435600261621495216475675655715890711921778054601401578290804540182256244918345136757436638197452833421577960766679408750639018592954637812545252297151835651129224169989901740005581428564958702967661958356771809505920623578130987955205214503925126099394733458675514742059765754079545734850//6589497042556770629*_a^3 - 130954820782624046715512646688636050693993523277233700448994274533589739107530011304607929738662255208717735858399575860664342635889621359622423114162932052224156638627300045117679420310887643880315585956935891159319719249281598085896789451229940509413014179416977929829203647555634329738172595111368012688327906639780997873856430124490173578740759017233098331742877619733727812245788549427674801885839970112224214325751379520054809497598201420395318499947955303364768196112393653855366050826994906322172841063482266036883577778178624155833853033171959909951526145317006910072472423672692492824825499747943989613649382174672539045903708960995770871230707179893952114232048814070148021143216304474858886385311721953678376586302937465232225142165087436277728827860389573425384469319051216880483242471571379084135828897975104095636651141573653517226109215051896544743973136081516734450796449566178039547036712566337563088276928054333899976001698123962386644223090096508580548581025857595536160880156017303338870937767063134150982231150870254387722539382576822179163207857536018626030188267657914467811163260932806911513545768679531392015847181074740594086482361649669017683686676703565943261195624482132005928656742610960603940818754971815237450175550141083078188540659820946175619188105522358149311631578502360441257646265689041619834275975302656720071583161688880901681497608421120493420693273825883258634026463410890692977186753368234233456727566971825148123698486393012967387936099733822419552521203950427134088943463055484319077590891624015161676862110085791867633235596576896234641154288413485389858942272524607847923855703658321937477584182130557276163117331734255052379872476964180193923650389647148439182962609152853980202648879574499368237391444125994189639484208248587609019621642325642439393961424490704723959283627630049883276004564516295900146552081802761153043865609271471342437484758475470372607077226914365487159090857798600557844701183340264818274460925443408380579565808553546554741025908135032158118059675976671971077678581003163249519895593268736516319758244386657398704017094726968610075668408056992321346676307722056006927248126627994375088341060209472850047599988830881767624389502990050685604977110122999199041853852487005552914827850499289414375028223180110846651143736965887346928992695690940500675435887801312839139310901688245396876675223550765760570909377292436235136679047717808015856423177563752520182262835711673328880258209019080404254284503652027892556878859827347272945757674913402279572240998521050694820479121179242968517064221693533607513548147366056536213158115710252275604444267580614100513249939620064501372190282649936786058120195550747134529216186722523584630700159538770784308046772899797085712172357162406999858677983511123068429349778237938614121510164295076327588470049782248272457686055843625278718417289886476110228259825868779740413483836639955331370203288634448457686970476075931587819189901047479209542599777784296326937973305851748253230413677356343239401032797815115762400425309889616274156190752564182737806839336947879130334694712405517271076060939103669993002082841739735273368539274178281426171770288959566647454584007549464895968521694068591059132879041099354770437245853936736341187286760583364814853104000688398178038024370865188660410951476056290396285863798577349554915407541316906156136665039351505212323981722937817570077435296656229331308650405886673333885374642873029962497884599344314396467039376472594567000626595281949431540640543123628913090445531679108696308823438430827851773032243455984273604057478486510757270191083136//230609334403*_a^2 + 1284946355115194463208875703880150901544562270873945882343608230372892380068600875536309172687272909300258885776022344545646867289840405404787169624761585015447329052682368457916644505126484036891742265297471118447081184446936061822177640827110723510183089692666685487877799858590629217098973515817454888860640016128233562905183205685051023317149686640586983633509724952981986084234981681801723072850599798378266981266025981402184633453788917134592203288968541824697064396602186097820536279603364574718102218627912807227313199244557330236284352999359938337469913350315701924498903817190936701567877033872889845665500448869141783112724783795501257717247909229775739929906036033536775926871070192724498034373054784741108501447157078880558119858467292388682305055466472846649501741796393138064394067475164348934444753048726585742316885411649154264993418591918969131612798702735704363672556868348376008607553429814995469530882077046582470630914774507412143281771021937357396960878020679437606477414600977707823002355247011310493915541742269904637272049337057480528555480151611443132182605401050743563925681412075285534721328936601522166816316463336838178336487382229837878334440332569623256733519638018118699553337056088723264572781743600707445692642838083073648604399016944501217042309619888564441291931673192526366022720063335468775024858755473621597865388882391472525702882299447428233741818255289213481840235453429620477800181722385647827482860828384008301226457046846561111195375111085579171424327130987931709629245191357393658667460168225466849729027555597965573315275854198688023327551884906430991278083254550633908470082717994676027535083809217901279741326829162847142967619355998159511280321888012200209549706499439207933871471847249958910879309351934159882148462933446306923487115462544097540652560031051619507982236105021839595997728609005643465179891213823399349429303054286048613828817418251609270654199516329646718199088856491289893281476430705774908168202032361603869657413602440273445379151438506432977293945367816438347816442265207570136112850186637418555538054143736874681813307869217950105579661963317241365563171196923711349590562180098525785095868512535945548873189195198489703415914471089508914067427932011227790694446523747779785380634021494514331121922015867722473933371393964662584699928799139375264394768894669376020645205621828355396024543171745411190871465795444108208432386822513265247465655532942721244442616933594323370532078722999130606131951375458933835478617699855765688886124401743685943473319428487418103902085862069901407614833427977324074462589506682407527144826107875195202333732296475372190196712619262080898041987735242303144329734130977941408623104983250163565381005020214452819911105874789195046897658358526721420382117952517446520168881106368545001023676318586088953960087796381774549073572026569278145522973604375049735181328995100136677970891308847255095976319274741454162530415519179037093463768531780725829826922570033597345299571849936165204399808919299935359507504075489135460009480229184278964093473638550140227994742963783665016674336643162189365280444395937787661496190031883805214124390606094591010098351423504840709123731032608454785755569816102323461753131333310812742838981309971636977218301990217347740021444685046116804182531758541411936510894492857776217720805315344289273550562972287883288970555639603475575229799634249498918400388552299477072136033299197047784578292818020776377101336896850569627466819921235541420714481137583369026200944058085265708419372014173936873191966501687254783926824037945662577454535205685126168554103746829074441060//46126479297897394403*_a - 872941305025909256259927895497336456843160696671035497593832080786102286003505246772783290374135343783357039513551169720110583750401816648328691369395901686450808725988360082406589108618367963754967499360087155297451742255316916674867967946916356764938379913370308047478143573630160532898023617998091675879238917664754910736523627875086164403650962017943365177426889973569838839383984144190731285162338592087308536788469232671447518793042968567188617270153069503488888661657353369078164936685635575028664354414198899306796682471649110158000972389146838267407288028673357921881412265627264109298265555796856764816957550463197951713393366631193918583672504327651783069050335442360244265690497695993624047708010088414500423143674150832204869374075515069301554662787220224454313321909948738525308694320337515181568000029208132005803914998169092119118832575241908754510034970856487467311674572928094372808990248630060126186483396939435412355948340163601568664820823909179808258957745880837485220931841369495124584956693231045945576494825564108958049902698618659758028396190313463454231455571817267169596127023086721966580102528352621066457268606165886839047480332145407936229001146492863508509489175061551498350823812764370245271291399141761606824395242859941394032843380442587930307078323501747086151711579124147811174440572516575194268812162252049197216736639128510683775829155188777575121728018291102938969614414138900407673723315465313095258730094197916506221926848809813052048772510269322783004545349994942928910682240163448317429934024374979089629234179704761734607774039471570296630751924745207383141494241292710826267905802774995917348511663449488120001731251343981888592294121839518230351645262807578661854987340118795812751558636549365188844968035107062051936036649506177651007596207676541593107777167335298829539692999245445857507765435079770142349667117334911610639558461298537127403991713249070309850348795686580281673322272378450241835278551418589149296448612993945737533359862348733309165985290936375840777705058720435776621203704246126978758593235686308123741754428270806563486128184630765930539017403483213863525622295237692002941927284861767004036932839647362091296506909746657278127348659313232307554046547204630231845655955319826690235264313988133320518767638189565314418608088625408595788058320173684821108942415194349930749505973903344183445486385622909336533393835742026666858236907285299213790298301897239165579779878885701046422754158670095708825120172838344770434288080358775010112440405235662753328320798468086484518960221999398213635466595444534677789362366406183119986503384732758331254797749920049151197926967141286819821670763291960669331253558703635929057895383580668458223426459584234804121872003680519647021808832479786408664219592661584508933891104725619297386877335317318324348258063359758243856661577358170725370799807557736627050949884003154921544246326570016950175894272713853780402571380264485503930269741447366518275461087979690052989261955839309071266734788013402457769168451977105899643154003021194094250668928827123931962215939682075756620977405078861994248628810029176026481828451208736419726540076063890160862253993414730343075229845663314587708901515808964415081962867569689803243407073910339343406291433359757750488726388100139748794716034176854991228078435330801043788060921840571146195310383532162795933534681181333029604541590079714907666392314405393189520278482084992715410795148922628471457856857621075723283551487319414750392916478335797266706719854087147131211814897472009961485026886211575132505232693187275713350247096535066511807635233895912//230609334403 t, c = is_power(b, 8) @@ -8,7 +8,7 @@ end @testset "rand" begin - Qx, x = polynomial_ring(FlintQQ, "x"); + Qx, x = polynomial_ring(QQ, "x"); K, a = number_field(x,"a"); O = maximal_order(K) m0 = O(9)*O diff --git a/test/NfOrd/ResidueRingMultGrp.jl b/test/NfOrd/ResidueRingMultGrp.jl index d3fad02867..8365e545ca 100644 --- a/test/NfOrd/ResidueRingMultGrp.jl +++ b/test/NfOrd/ResidueRingMultGrp.jl @@ -20,7 +20,7 @@ @testset "multiplicative_group" begin - Qx, x = polynomial_ring(FlintQQ, "x"); + Qx, x = polynomial_ring(QQ, "x"); @testset "K = Q" begin K, a = number_field(x,"a"); @@ -279,7 +279,7 @@ end @testset "_multgrp_mod_pv" begin - Qx, x = polynomial_ring(FlintQQ, "x"); + Qx, x = polynomial_ring(QQ, "x"); @testset "K = Q" begin K, a = number_field(x,"a"); @@ -433,7 +433,7 @@ end @testset "_multgrp_mod_p" begin - Qx, x = polynomial_ring(FlintQQ, "x"); + Qx, x = polynomial_ring(QQ, "x"); @testset "K = Q" begin K, a = number_field(x, "a"); @@ -532,7 +532,7 @@ end @testset "_1_plus_p_mod_1_plus_pv" begin - Qx, x = polynomial_ring(FlintQQ, "x"); + Qx, x = polynomial_ring(QQ, "x"); @testset "Method: $method" for method in [:quadratic,:artin_hasse,:p_adic] @@ -661,7 +661,7 @@ end @testset "Non-maximal orders" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K1, a1 = number_field(x^3 - 2, "a1") OK1 = maximal_order(K1) diff --git a/test/NfRel/Elem.jl b/test/NfRel/Elem.jl index 2323f56364..0358fb3e02 100644 --- a/test/NfRel/Elem.jl +++ b/test/NfRel/Elem.jl @@ -1,5 +1,5 @@ @testset "Is integral" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 1 K, a = number_field(f, "a") Ky, y = K["y"] diff --git a/test/NfRel/FracIdeal.jl b/test/NfRel/FracIdeal.jl index b1179f58bd..4904bcd233 100644 --- a/test/NfRel/FracIdeal.jl +++ b/test/NfRel/FracIdeal.jl @@ -1,5 +1,5 @@ @testset "Relative fractional ideals" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 12*x - 92 K, a = number_field(f, "a") OK = maximal_order(K) diff --git a/test/NfRel/Ideal.jl b/test/NfRel/Ideal.jl index 9ba75ed063..a278a1fb67 100644 --- a/test/NfRel/Ideal.jl +++ b/test/NfRel/Ideal.jl @@ -1,6 +1,6 @@ @testset "Relative ideals" begin @testset "Arithmetic" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 12*x - 92 K, a = number_field(f, "a") OK = maximal_order(K) @@ -37,7 +37,7 @@ end @testset "Prime decomposition" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 12*x - 92 K, a = number_field(f, "a") OK = maximal_order(K) @@ -85,7 +85,7 @@ end @testset "Residue fields" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^4 - 95x^3 - 91x^2 + 90x - 31 K, a = number_field(f, "a") OK = maximal_order(K) @@ -153,7 +153,7 @@ end @testset "Idempotents and uniformizers" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 12*x - 92 K, a = number_field(f, "a") OK = maximal_order(K) diff --git a/test/NfRel/NEQ_Kirschmer.jl b/test/NfRel/NEQ_Kirschmer.jl index fa1bf0fd4a..e7c91ed7f8 100644 --- a/test/NfRel/NEQ_Kirschmer.jl +++ b/test/NfRel/NEQ_Kirschmer.jl @@ -1,5 +1,5 @@ @testset "NEQ Kirschmer" begin - R,x = FlintZZ["x"] + R,x = ZZ["x"] K,a = number_field(x^2+3x+1,"a") kt,t = K["t"] E, b = number_field( t^2 + (a+5)* (-2*a+2) ) diff --git a/test/NfRel/NfRel.jl b/test/NfRel/NfRel.jl index bb58dd571b..6917f23377 100644 --- a/test/NfRel/NfRel.jl +++ b/test/NfRel/NfRel.jl @@ -1,6 +1,6 @@ @testset "RelSimpleNumField" begin @testset "is_subfield" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 12x - 92 K, a = number_field(f, "a") Ky, y = K["y"] @@ -17,7 +17,7 @@ @testset "is_isomorphic" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 12x - 92 K, a = number_field(f, "a") Ky, y = K["y"] @@ -39,7 +39,7 @@ end @testset "signature" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 12x - 92 K, a = number_field(f, "a") Ky, y = K["y"] @@ -48,7 +48,7 @@ L, b = number_field(g, "b") @test signature(L) == (2, 4) - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 12x - 92 K, a = number_field(f, "a") Ky, y = K["y"] @@ -58,7 +58,7 @@ end @testset "rand" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 12x - 92 K, a = number_field(f, "a") Ky, y = K["y"] diff --git a/test/NfRel/NfRelOrd.jl b/test/NfRel/NfRelOrd.jl index 23b4512fbd..5c6f4b0dca 100644 --- a/test/NfRel/NfRelOrd.jl +++ b/test/NfRel/NfRelOrd.jl @@ -10,7 +10,7 @@ function monic_randpoly(S::PolyRing, dmin::Int, dmax::Int, n::Int) end @testset "Relative maximal orders of simple extensions" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 36*x + 16 K, a = number_field(f, "a", cached = false) Ky, y = K["y"] @@ -75,7 +75,7 @@ end @testset "Relative maximal orders of non-simple extensions" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, a = number_field(x, "a") OK = maximal_order(K) @@ -144,7 +144,7 @@ end end @testset "Field towers" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] Q1, q1 = number_field(x, "q1", cached = false) Z1 = maximal_order(Q1) @@ -175,7 +175,7 @@ end end @testset "Different/codifferent" begin - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2 - 2 K, a = number_field(f, "a", cached = false) Kt, t = K["t"] @@ -190,7 +190,7 @@ end end @testset "rand" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 36*x + 16 K, a = number_field(f, "a") Ky, y = K["y"] diff --git a/test/NfRel/NonSimple.jl b/test/NfRel/NonSimple.jl index 1b34a7c642..7c55a12d76 100644 --- a/test/NfRel/NonSimple.jl +++ b/test/NfRel/NonSimple.jl @@ -1,5 +1,5 @@ @testset "RelNonSimpleNumField" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, _ = number_field(x^2 - 2) Ky, y = K["y"] L, (a, b) = @inferred number_field([y^2 - 3, y^3 - 5]) diff --git a/test/NumField/Elem.jl b/test/NumField/Elem.jl index 262d3ab798..b125ca98fb 100644 --- a/test/NumField/Elem.jl +++ b/test/NumField/Elem.jl @@ -1,5 +1,5 @@ @testset "NumField/Elem" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") QasNumberField, _ = number_field(x - 1) Kt, t = polynomial_ring(QasNumberField, "t") K1, a1 = number_field(x^3 - 2) @@ -37,7 +37,7 @@ end @testset "NumField/Component" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") QasNumberField, _ = number_field(x - 1) Kt, t = polynomial_ring(QasNumberField, "t") K3, a3 = number_field(t^3 - 2) @@ -55,7 +55,7 @@ end @testset "rand" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K, a = number_field(x^3 - 2) v = [a^0, a^2] @assert elem_type(K) == AbsSimpleNumFieldElem @@ -77,7 +77,7 @@ end @testset "NumField/Coordinates" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K, a = number_field(x^2+1, cached = false) BK = basis(K) for i = 1:5 @@ -148,7 +148,7 @@ end @testset "relative extension" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] f = x^2 + 12x - 92 K, a = number_field(f, "a") Ky, y = K["y"] diff --git a/test/NumField/Hilbert.jl b/test/NumField/Hilbert.jl index bb5607256f..7978bd4dc4 100644 --- a/test/NumField/Hilbert.jl +++ b/test/NumField/Hilbert.jl @@ -25,7 +25,7 @@ end end - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K, b = number_field(x^3-3*x-1, "a") OK = maximal_order(K) for P in prime_ideals_up_to(OK, 200) diff --git a/test/NumField/NfAbs/NfAbs.jl b/test/NumField/NfAbs/NfAbs.jl index 8b3460f127..d26f13ed9d 100644 --- a/test/NumField/NfAbs/NfAbs.jl +++ b/test/NumField/NfAbs/NfAbs.jl @@ -19,7 +19,7 @@ end @testset "Splitting Field" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^3-2 K = splitting_field(f) @test typeof(K) == AbsSimpleNumField @@ -42,7 +42,7 @@ end @testset "simplify" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K = number_field(x^5 - x^4 - x^3 - 220*x^2 - 360*x - 200)[1] @test typeof(K) == AbsSimpleNumField L = simplify(K, canonical = true)[1] @@ -51,7 +51,7 @@ end @testset "simplify-Gunter" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^18 - x^16 - 6*x^14 - 4*x^12 - 4*x^10 + 2*x^8 + 6*x^6 - 4*x^4 + 3*x^2 - 1 g = x^18 - 3*x^16 + 4*x^14 - 6*x^12 - 2*x^10 + 4*x^8 + 4*x^6 + 6*x^4 + x^2 - 1 h = x^18 + x^16 - x^14 - 8*x^12 - 3*x^8 + 27*x^6 - 25*x^4 + 8*x^2 - 1 @@ -61,7 +61,7 @@ end end @testset "simplify-Fabian" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^8 + 4*x^7 - 56*x^6 - 168*x^5 + 758*x^4 + 2412*x^3 - 1656*x^2 - 9508*x - 6828 g = x^8 - 4*x^7 - 30*x^6 + 44*x^5 + 298*x^4 + 108*x^3 - 614*x^2 - 680*x - 199 @test simplify(number_field(f)[1], canonical = true)[1].pol == g @@ -70,7 +70,7 @@ end @testset "factor-van-Hoeij" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^12 + 4*x^10 + 11*x^8 + 4*x^6 - 41*x^4 - 8*x^2 + 37 K, a = number_field(f) @test length(factor(K, f).fac) == 4 diff --git a/test/NumFieldOrd/NumFieldOrd.jl b/test/NumFieldOrd/NumFieldOrd.jl index 209ead94e7..c59bb0fc2b 100644 --- a/test/NumFieldOrd/NumFieldOrd.jl +++ b/test/NumFieldOrd/NumFieldOrd.jl @@ -1,5 +1,5 @@ @testset "NumFieldOrder" begin - x = polynomial_ring(FlintQQ, "x", cached = false)[2] + x = polynomial_ring(QQ, "x", cached = false)[2] K, a = number_field(x^2+1, check = false, cached = false) Kns, gKns = number_field([x^2+1], check = false, cached = false) Kt, t = polynomial_ring(K, "t", cached = false) @@ -17,7 +17,7 @@ BOK = absolute_basis(OK) @test @inferred discriminant(BOK) == @inferred discriminant(OK) @test @inferred signature(OK) == (0, 1) - @test @inferred discriminant(OK, FlintQQ) == discriminant(OK) + @test @inferred discriminant(OK, QQ) == discriminant(OK) OKns = maximal_order(Kns) @inferred Hecke.nf(OKns) @@ -30,7 +30,7 @@ BOKns = absolute_basis(OKns) @test @inferred discriminant(BOKns) == @inferred discriminant(OKns) @test @inferred signature(OKns) == (0, 1) - @test @inferred discriminant(OKns, FlintQQ) == discriminant(OKns) + @test @inferred discriminant(OKns, QQ) == discriminant(OKns) OL = maximal_order(L) @inferred Hecke.nf(OL) @@ -43,7 +43,7 @@ BOL = absolute_basis(OL) @test numerator(det(trace_matrix(map(elem_in_nf, BOL)))) == @inferred absolute_discriminant(OL) @test @inferred signature(OL) == (0, 2) - @test @inferred discriminant(OL, FlintQQ) == absolute_discriminant(OL) + @test @inferred discriminant(OL, QQ) == absolute_discriminant(OL) OLns = maximal_order(Lns) @inferred Hecke.nf(OLns) @@ -56,7 +56,7 @@ BOLns = absolute_basis(OLns) @test numerator(det(trace_matrix(map(elem_in_nf, BOLns)))) == @inferred absolute_discriminant(OLns) @test @inferred signature(OLns) == (0, 2) - @test @inferred discriminant(OLns, FlintQQ) == absolute_discriminant(OLns) + @test @inferred discriminant(OLns, QQ) == absolute_discriminant(OLns) end diff --git a/test/QuadForm/Basic.jl b/test/QuadForm/Basic.jl index e58ef5576d..353ac50073 100644 --- a/test/QuadForm/Basic.jl +++ b/test/QuadForm/Basic.jl @@ -1,5 +1,5 @@ @testset "Basic" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K, a = number_field(x^2 - 5, "a") OK = maximal_order(K) G = matrix(K, 5, 5, [ 1, 0, 0, 0, 0, diff --git a/test/QuadForm/Genus.jl b/test/QuadForm/Genus.jl index 38ede849bb..4370611fc3 100644 --- a/test/QuadForm/Genus.jl +++ b/test/QuadForm/Genus.jl @@ -3,7 +3,7 @@ # TODO: move the remaining examples in the corresponding files in ~/test/QuadForm/Quad # Representatives - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, a = number_field(x^2 - 15) gens = [[a-1, 2*a-12, 0], [-471//70*a+881//14, 12*a-471, 1//70*a+39//14], [-7367*a+33891, 38904*a-212340, -194*a+1164], [2858191//5*a-1701731, -3700688*a+8438412, 103014//5*a-40352]] D = matrix(K, 3, 3, [38*a+150, 0, 0, 0, 2*a+8, 0, 0, 0, 302*a+1170]) @@ -36,7 +36,7 @@ # Addition of genera - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x - 1; K, a = number_field(f) D = matrix(K, 3, 3, [2, 0, 0, 0, -1, 0, 0, 0, -36]); @@ -48,7 +48,7 @@ fl, _ = Hecke.is_maximal_integral(LL, p) @test fl - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x - 1; K, a = number_field(f) D = matrix(K, 3, 3, [2, 0, 0, 0, -1, 0, 0, 0, -36]); diff --git a/test/QuadForm/Herm/Genus.jl b/test/QuadForm/Herm/Genus.jl index de80494a17..1057788482 100644 --- a/test/QuadForm/Herm/Genus.jl +++ b/test/QuadForm/Herm/Genus.jl @@ -408,7 +408,7 @@ @test G == genus([g], [(rlp[1], 2), (rlp[2], 2)]) # rank 1 representative - Qx, x = polynomial_ring(FlintQQ, "x"); + Qx, x = polynomial_ring(QQ, "x"); f = x^2 + x - 1; K, a = number_field(f, "a", cached = false); Kt, t = polynomial_ring(K, "t"); @@ -423,7 +423,7 @@ # Fix norm in non-dyadic ramified case # Rank 1 example - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^10 - 10*x^8 + 35*x^6 + x^5 - 50*x^4 - 5*x^3 + 25*x^2 + 5*x - 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -530,7 +530,7 @@ end @testset "non-integral genera" begin # rescaling - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^2 - 3 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -588,7 +588,7 @@ end end @testset "Hermitian form with given invariants" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^6 + x^5 - 5*x^4 - 4*x^3 + 6*x^2 + 3*x - 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -610,7 +610,7 @@ end end @testset "Hashes" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x - 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") diff --git a/test/QuadForm/Herm/GenusRep.jl b/test/QuadForm/Herm/GenusRep.jl index 5fa2abf068..bf34b34f4d 100644 --- a/test/QuadForm/Herm/GenusRep.jl +++ b/test/QuadForm/Herm/GenusRep.jl @@ -6,7 +6,7 @@ # Lattice 214 from the database: `a(P) != P` in `_neighbours` - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^2 - x - 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -28,7 +28,7 @@ # Lattice 324 from the database: `special == true` in `_neighbours` - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^2 - x - 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -52,7 +52,7 @@ # Lattice 441 from the database: `special == false` in `_neighbours`; calls `_all_row_span` - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x - 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -104,7 +104,7 @@ # Other indefinite examples # - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, a = number_field(x - 1, "a") Kt, t = K["t"] E, b = number_field(t^2 + 1, "b") @@ -113,7 +113,7 @@ L = @inferred representative(G) @test length(@inferred Hecke.genus_representatives(L)) == 1 - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^6 + x^5 + x^4 + x^3 + x^2 + x + 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -150,7 +150,7 @@ @test length(genus_representatives(H)) == 1 # Non-CM and class number 69; Salem polynomial - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^3 - 44*x^2 - 4*x + 175 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -163,7 +163,7 @@ let # 1512 - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^3 - 6*x^2 - 4*x + 23 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") diff --git a/test/QuadForm/Herm/Lattices.jl b/test/QuadForm/Herm/Lattices.jl index 7e4743c55f..e995129e47 100644 --- a/test/QuadForm/Herm/Lattices.jl +++ b/test/QuadForm/Herm/Lattices.jl @@ -56,7 +56,7 @@ # A maximal integral lattice # - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^2 - 3 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -82,7 +82,7 @@ # Construction of maximal/minimal integral overlattices # - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x - 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -111,7 +111,7 @@ # Construction of maximal/minimal locally integral overlattices # - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x - 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") diff --git a/test/QuadForm/Herm/Mass.jl b/test/QuadForm/Herm/Mass.jl index ad02adc1dd..030bf24fe1 100644 --- a/test/QuadForm/Herm/Mass.jl +++ b/test/QuadForm/Herm/Mass.jl @@ -4,7 +4,7 @@ # Examples from arguments checks: indefinite and rank 0 cases # - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^2 - 2 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -101,7 +101,7 @@ @test m == 1//147456 - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^2-3 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -114,7 +114,7 @@ @test m == 1//108 - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^4-x^3-4*x^2+4*x+1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") diff --git a/test/QuadForm/Herm/Spaces.jl b/test/QuadForm/Herm/Spaces.jl index 998ae51f15..472bf08134 100644 --- a/test/QuadForm/Herm/Spaces.jl +++ b/test/QuadForm/Herm/Spaces.jl @@ -1,5 +1,5 @@ @testset "Spaces" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K, a = number_field(x^2 - 2, "a1") OK = maximal_order(K) p = 3*OK @@ -32,11 +32,11 @@ @test inner_product(V, v, v) == matrix(E,1,1,[3]) @test_throws ArgumentError hermitian_space(E, E[1 b; b 1]) - @test_throws ArgumentError hermitian_space(E, FlintQQ[1 0; 1 1]) + @test_throws ArgumentError hermitian_space(E, QQ[1 0; 1 1]) - V = @inferred hermitian_space(E, FlintQQ[1 2; 2 1]) - @test V === hermitian_space(E, FlintQQ[1 2; 2 1]) - @test V !== hermitian_space(E, FlintQQ[1 2; 2 1], cached = false) + V = @inferred hermitian_space(E, QQ[1 2; 2 1]) + @test V === hermitian_space(E, QQ[1 2; 2 1]) + @test V !== hermitian_space(E, QQ[1 2; 2 1], cached = false) @test is_hermitian(V) @test !is_definite(V) @test involution(V) == s @@ -59,7 +59,7 @@ @test gram_matrix(Vm) == -gram_matrix(V) - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^2-3 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") diff --git a/test/QuadForm/IO.jl b/test/QuadForm/IO.jl index 94306a6fcf..9d8037cb85 100644 --- a/test/QuadForm/IO.jl +++ b/test/QuadForm/IO.jl @@ -1,5 +1,5 @@ @testset "IO" begin - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2 - 2; K, a = number_field(f) D = matrix(K, 3, 3, [2, 0, 0, 0, 1, 0, 0, 0, 16]); @@ -8,7 +8,7 @@ @test Hecke.to_hecke_string(L) isa String @test Hecke.to_magma_string(L) isa String - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x^4-x^3-4*x^2+4*x+1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -21,8 +21,8 @@ @test Hecke.to_magma_string(L) isa String # For Zlattices - B = matrix(FlintQQ, 6, 7 ,[1, -1, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 1, -1]); - G = matrix(FlintQQ, 7, 7 ,[3, 2, 2, 2, 2, 2, 1, 2, 3, 2, 2, 2, 2, 1, 2, 2, 3, 2, 2, 2, 1, 2, 2, 2, 3, 2, 2, 1, 2, 2, 2, 2, 3, 2, 1, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1]); + B = matrix(QQ, 6, 7 ,[1, -1, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 1, -1]); + G = matrix(QQ, 7, 7 ,[3, 2, 2, 2, 2, 2, 1, 2, 3, 2, 2, 2, 2, 1, 2, 2, 3, 2, 2, 2, 1, 2, 2, 2, 3, 2, 2, 1, 2, 2, 2, 2, 3, 2, 1, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1]); L = integer_lattice(B, gram = G) @test Hecke.to_hecke_string(L) isa String diff --git a/test/QuadForm/Lattices.jl b/test/QuadForm/Lattices.jl index 9ebf7cb8bf..89c9889135 100644 --- a/test/QuadForm/Lattices.jl +++ b/test/QuadForm/Lattices.jl @@ -1,5 +1,5 @@ @testset "Lattices" begin - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2-2 K, a = number_field(f,"a") D = matrix(K, 3, 3, [1//64, 0, 0, 0, 1//64, 0, 0, 0, 1//64]) @@ -8,7 +8,7 @@ D = matrix(K, 3, 3, [1//64, 0, 0, 0, 1//64, 0, 0, 0, 1//64]) gensM = [[32, 0, 0], [720*a+448, 0, 0], [16, 16, 0], [152*a+208, 152*a+208, 0], [4*a+24, 4*a, 8], [116*a+152, 20*a+32, 32*a+40]] M = @inferred quadratic_lattice(K, gensM, gram = D) - @test norm(volume(M))*discriminant(K)^rank(L) == abs(det(restrict_scalars(M, FlintQQ))) + @test norm(volume(M))*discriminant(K)^rank(L) == abs(det(restrict_scalars(M, QQ))) p = prime_decomposition(base_ring(L), 2)[1][1] @test @inferred is_locally_isometric(L, M, p) @@ -36,7 +36,7 @@ OK = maximal_order(K) p3 = prime_ideals_over(OK, 3)[1] @test is_modular(L, p3)[1] - @test norm(volume(L))*discriminant(OK)^rank(L) == abs(det(restrict_scalars(L, FlintQQ))) + @test norm(volume(L))*discriminant(OK)^rank(L) == abs(det(restrict_scalars(L, QQ))) @test ambient_space(dual(L)) === ambient_space(L) @test ambient_space(Hecke.lattice_in_same_ambient_space(L,pseudo_matrix(L))) === ambient_space(L) @@ -61,7 +61,7 @@ @test sprint(show, L) isa String # Smoke test for genus symbol - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K, a = number_field(x^2 - 2, "a") L = @inferred quadratic_lattice(K, identity_matrix(K, 10), gram = 35*identity_matrix(K, 10)) P = prime_decomposition(maximal_order(K), 5)[1][1] @@ -76,7 +76,7 @@ #@test GS.data[4] == [35] #@test GS.data[5] == [] - Qx, x = FlintQQ["x"]; + Qx, x = QQ["x"]; K, a = number_field(x^2 - 2, cached = true); Kt, t = K["t"]; L, b = number_field(t^2 + 11, "b", check = true) @@ -164,7 +164,7 @@ @test R != base_ring(base_ring(L)) # Use ZZRingElem in the automorphism group computation (issue 1054) - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, a = number_field(x^2 + 1, "a") OK = maximal_order(K) G = pseudo_matrix(matrix(K, 6, 6 ,[876708188094148315826780735392810, 798141405233250328867679564294410, -352823337641433300965521329447720, 326768950610851461363580717982402, -690595881941554449465975342845028, 433433545243019702766746394677218, 798141405233250328867679564294410, 867615301468758683549323652197099, -301315621373858240463110267500961, 316796431934778296047626373086339, -725765288914917260527454069649226, 505082964151083450666500945258490, -352823337641433300965521329447720, -301315621373858240463110267500961, 809946152369211852531731702980788, -343784636213856787915462553587466, 84764902049682607076640678540130, -613908853150167850995565570653796, 326768950610851461363580717982402, 316796431934778296047626373086339, -343784636213856787915462553587466, 219957919673551825679009958633894, -226934633316066727073394927118195, 298257387132139131540277459301842, -690595881941554449465975342845028, -725765288914917260527454069649226, 84764902049682607076640678540130, -226934633316066727073394927118195, 671443408734467545153681225010914, -277626128761200144008657217470664, 433433545243019702766746394677218, 505082964151083450666500945258490, -613908853150167850995565570653796, 298257387132139131540277459301842, -277626128761200144008657217470664, 640432299215298238271419741190578]), [ one(K)*OK, one(K)*OK, one(K)*OK, one(K)*OK, one(K)*OK, one(K)*OK ]) @@ -174,7 +174,7 @@ end @testset "Misc" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, a = number_field(x - 1, "a") Kt, t = K["t"] E, b = number_field(t^2 - 2, "b") @@ -186,7 +186,7 @@ end end @testset "Jordan decomposition" begin - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x - 1; K, a = number_field(f) D = matrix(K, 3, 3, [3, 2, 1, 2, 3, 1, 1, 1, 1]); @@ -204,12 +204,12 @@ end Vres, VrestoV = restrict_scalars(ambient_space(L), QQ) @test domain(VrestoV) === Vres @test codomain(VrestoV) === ambient_space(L) - Lres = restrict_scalars(L, FlintQQ) + Lres = restrict_scalars(L, QQ) @test ambient_space(Lres) === Vres @test all(v -> VrestoV(VrestoV\v) == v, generators(L)) - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x - 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -221,7 +221,7 @@ end L = hermitian_lattice(E, gens, gram = D) M = hermitian_lattice(E, gens2, gram = D) - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x - 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -231,7 +231,7 @@ end gens = Vector{Hecke.RelSimpleNumFieldElem{AbsSimpleNumFieldElem}}[map(E, [-1, -4*b + 6, 0]), map(E, [16*b - 2, -134*b - 71, -2*b - 1]), map(E, [3*b - 92, -1041//2*b + 1387//2, -15//2*b + 21//2])] O = hermitian_lattice(E, gens, gram = D) - Lres, f = Hecke.restrict_scalars_with_map(L, FlintQQ) + Lres, f = Hecke.restrict_scalars_with_map(L, QQ) Mres = Hecke.restrict_scalars(M, f) @test Lres == Hecke.restrict_scalars(L, f) @test is_sublattice(Lres, Mres) @@ -239,7 +239,7 @@ end end @testset "#859" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x - 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -254,7 +254,7 @@ end end @testset "Intersection/primitive closure restrict scalars" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x - 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") @@ -285,7 +285,7 @@ end end @testset "Direct sums" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") f = x - 1 K, a = number_field(f, "a", cached = false) Kt, t = polynomial_ring(K, "t") diff --git a/test/QuadForm/MassQuad.jl b/test/QuadForm/MassQuad.jl index 909cb1a29f..05abe5d1f3 100644 --- a/test/QuadForm/MassQuad.jl +++ b/test/QuadForm/MassQuad.jl @@ -441,7 +441,7 @@ end end @testset "Exact totally real Dedekind zeta functions" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, a = quadratic_field(5) res = map(QQFieldElem, [1//30, 0, 1//60, 0, 67//630, 0, 361//120, 0, 412751//1650, @@ -470,7 +470,7 @@ end end @testset "Masses" begin - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2-2; K, a = number_field(f) D = matrix(K, 4, 4, [1, 0, 0, 0, 0, -5*a+8, 0, 0, 0, 0, 1, 0, 0, 0, 0, -15*a+24]); @@ -478,7 +478,7 @@ end L26097 = quadratic_lattice(K, gens, gram = D) @test mass(L26097) == QQFieldElem(3, 32) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2-2; K, a = number_field(f) D = matrix(K, 4, 4, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]); @@ -486,7 +486,7 @@ end L23539 = quadratic_lattice(K, gens, gram = D) @test mass(L23539) == QQFieldElem(1, 128) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2-2; K, a = number_field(f) D = matrix(K, 4, 4, [1, 0, 0, 0, 0, -5*a+8, 0, 0, 0, 0, 1, 0, 0, 0, 0, -15*a+24]); @@ -494,7 +494,7 @@ end L23563 = quadratic_lattice(K, gens, gram = D) @test mass(L23563) == QQFieldElem(1, 32) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2-x-1; K, a = number_field(f) D = matrix(K, 4, 4, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, a+2]); @@ -502,7 +502,7 @@ end L23460 = quadratic_lattice(K, gens, gram = D) @test mass(L23460) == QQFieldElem(1, 96) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2-x-4; K, a = number_field(f) D = matrix(K, 3, 3, [4, 0, 0, 0, 2, 0, 0, 0, 4]); @@ -510,7 +510,7 @@ end L2354 = quadratic_lattice(K, gens, gram = D) @test mass(L2354) == QQFieldElem(1, 4) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2-2; K, a = number_field(f) D = matrix(K, 3, 3, [2, 0, 0, 0, 2, 0, 0, 0, 2]); @@ -518,7 +518,7 @@ end L1109 = quadratic_lattice(K, gens, gram = D) @test mass(L1109) == QQFieldElem(1, 32) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x-1; K, a = number_field(f) D = matrix(K, 6, 6, [1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2]); @@ -526,7 +526,7 @@ end L28819 = quadratic_lattice(K, gens, gram = D) @test mass(L28819) == QQFieldElem(1, 46080) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2-2; K, a = number_field(f) D = matrix(K, 4, 4, [1, 0, 0, 0, 0, -5*a+8, 0, 0, 0, 0, 1, 0, 0, 0, 0, -15*a+24]); @@ -543,7 +543,7 @@ end @test Hecke.local_factor(L, p) == QQFieldElem(1) @test mass(L) == QQFieldElem(1, 12) - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2 - 2 K, a = number_field(f) D = matrix(K, 2, 2, [3*a + 4, 9*a + 12, 9*a + 12, 36*a + 48]) diff --git a/test/QuadForm/Quad/Genus.jl b/test/QuadForm/Quad/Genus.jl index 65d18a2a04..ae14216bc3 100644 --- a/test/QuadForm/Quad/Genus.jl +++ b/test/QuadForm/Quad/Genus.jl @@ -1,5 +1,5 @@ @testset "Genus" begin - Qx, x = FlintQQ["x"] + Qx, x = QQ["x"] K, a = number_field(x - 1, "a", cached = false) OK = maximal_order(K) rlp = real_places(K) @@ -124,7 +124,7 @@ @test L3 in G3 end - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x - 1; K, a = number_field(f) D = matrix(K, 3, 3, [30, -15, 0, -15, 30, -15, 0, -15, 30]); @@ -134,7 +134,7 @@ fl, LL = Hecke.is_maximal_integral(L, p) @test !fl - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2 - 2; K, a = number_field(f) p = prime_ideals_over(maximal_order(K),2)[1] @@ -197,7 +197,7 @@ end @testset "Hashes" begin - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x - 1; K, a = number_field(f, "a", cached = false) D = matrix(K, 3, 3, [4, 0, 0, 0, 10, 0, 0, 0, 20]); diff --git a/test/QuadForm/Quad/GenusRep.jl b/test/QuadForm/Quad/GenusRep.jl index b9e16e3b72..6527cbf080 100644 --- a/test/QuadForm/Quad/GenusRep.jl +++ b/test/QuadForm/Quad/GenusRep.jl @@ -1,5 +1,5 @@ @testset "Genus representatives" begin - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x-1; K, a = number_field(f) D = matrix(K, 3, 3, [-717210130, 0, 0, 0, -55, 0, 0, 0, -1173298395869600]); @@ -7,7 +7,7 @@ L = quadratic_lattice(K, gens, gram = D) @test length(genus_representatives(L)) == 6 - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x-1; K, a = number_field(f) D = matrix(K, 3, 3, [-34, 0, 0, 0, -17, 0, 0, 0, -17192032]); @@ -15,7 +15,7 @@ L = quadratic_lattice(K, gens, gram = D) @test length(genus_representatives(L)) == 93 - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x-1; K, a = number_field(f) D = matrix(K, 3, 3, [-98, 0, 0, 0, -2, 0, 0, 0, -5829824]); @@ -23,7 +23,7 @@ L = quadratic_lattice(K, gens, gram = D) @test length(genus_representatives(L)) == 114 - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2-2; K, a = number_field(f) D = matrix(K, 3, 3, [2, 0, 0, 0, -1, 0, 0, 0, -7436]); @@ -31,7 +31,7 @@ L = quadratic_lattice(K, gens, gram = D) @test length(genus_representatives(L)) == 1 - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x - 1 K, a = number_field(f) M = matrix(QQ, 2, 2, [47, 80, 80, 560]) @@ -45,7 +45,7 @@ end @test w == Int[37, 16, 19, 11, 6, 3, 52, 7, 13, 21] - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2 - 2; K, a = number_field(f) D = matrix(K, 2, 2, [15, 2, 2, 32]); @@ -55,7 +55,7 @@ # Local isometry test - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x - 1; K, a = number_field(f) D = matrix(K, 7, 7, [8, -4, 3, 4, 0, 1, 1, -4, 8, 1, 0, 4, 1, 1, 3, 1, 8, 4, 0, 1, 1, 4, 0, 4, 8, 3, 0, 4, 0, 4, 0, 3, 8, 4, 0, 1, 1, 1, 0, 4, 8, -4, 1, 1, 1, 4, 0, -4, 8]); @@ -72,7 +72,7 @@ # Rank 2 case # This is the integer_lattice with basis [1 2; 3 4] - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x - 1; K, a = number_field(f) D = matrix(K, 2, 2, [1, 0, 0, 1]); @@ -80,7 +80,7 @@ L = quadratic_lattice(K, gens, gram = D) @test length(genus_representatives(L)) == 1 - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x - 1 K, a = number_field(f) D = matrix(K, 3, 3, [-18, -6, -9, -6, -3, -3, -9, -3, -6]) @@ -88,7 +88,7 @@ L = quadratic_lattice(K, gens, gram = D) @test length(genus_representatives(L)) == 1 - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x - 1; K, a = number_field(f) D = matrix(K, 2, 2, [2, 0, 0, 3]); @@ -106,8 +106,8 @@ L = integer_lattice(ZZ[4 3; 3 8]) @test length(genus_representatives(L)) == 4 - B = matrix(FlintQQ, 5, 5 ,[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]); - G = matrix(FlintQQ, 5, 5 ,[-2, 0, 0, 0, 0, 0, -4, -2, 2, 2, 0, -2, -4, 0, 0, 0, 2, 0, -4, 0, 0, 2, 0, 0, -4]); + B = matrix(QQ, 5, 5 ,[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]); + G = matrix(QQ, 5, 5 ,[-2, 0, 0, 0, 0, 0, -4, -2, 2, 2, 0, -2, -4, 0, 0, 0, 2, 0, -4, 0, 0, 2, 0, 0, -4]); L = integer_lattice(B, gram = G); @test length(genus_representatives(L))==1 @@ -1049,7 +1049,7 @@ end L75 = quadratic_lattice(K, gens, gram = D) @test length(genus_representatives(L75)) == res[75] - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2 - 2; K, a = number_field(f) D = matrix(K, 3, 3, [2, 0, 0, 0, 1, 0, 0, 0, -2]); @@ -1057,7 +1057,7 @@ end L = quadratic_lattice(K, gens, gram = D) @test length(genus_representatives(L)) == 1 - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2 - 2; K, a = number_field(f) D = matrix(K, 3, 3, [2, 0, 0, 0, 1, 0, 0, 0, -8]); @@ -1065,7 +1065,7 @@ end L = quadratic_lattice(K, gens, gram = D) @test length(genus_representatives(L)) == 1 - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x^2 - 2; K, a = number_field(f) D = matrix(K, 3, 3, [2, 0, 0, 0, 1, 0, 0, 0, 16]); @@ -1098,8 +1098,8 @@ end end @testset "Genus Representatives non-full rank, definite" begin - B = matrix(FlintQQ, 5, 8 ,[0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 4, 0, 1, 0, 0, 0, 0, 0, 31//2, 3//2, 1//2, 1, 0, 0, 0, 0, 5//2, 3//2, 0, 0, 1//2]); - G = matrix(FlintQQ, 8, 8 ,[16, -8, 0, 0, 0, 0, 0, 0, -8, 16, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 6]); + B = matrix(QQ, 5, 8 ,[0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 4, 0, 1, 0, 0, 0, 0, 0, 31//2, 3//2, 1//2, 1, 0, 0, 0, 0, 5//2, 3//2, 0, 0, 1//2]); + G = matrix(QQ, 8, 8 ,[16, -8, 0, 0, 0, 0, 0, 0, -8, 16, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 6]); L = integer_lattice(B, gram = G); Ns = @inferred genus_representatives(L) #this uses the automorphisms @@ -1109,8 +1109,8 @@ end @test length(Ns2) == length(Ns) # Binary case - B = matrix(FlintQQ, 2, 23 ,[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); - G = matrix(FlintQQ, 23, 23 ,[-4, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 0, 0, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 0, 0, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 1, -1, 3, 1//2, -1//2, 3//2, -3//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 3, -3, -1//2, 3//2, -3//2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, -3, 10, 3//2, -3//2, 5, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -3, 10, -10, -3//2, 5, -5, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1//2, -1//2, 3//2, -3//2, -1//2, 1, -1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 3//2, -3//2, 5, 1, -1, 3, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3//2, -3//2, 5, -5, -1, 3, -3, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3//2, 5, -5, 17, 3, -3, 10, -10]); + B = matrix(QQ, 2, 23 ,[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + G = matrix(QQ, 23, 23 ,[-4, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 0, 0, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 0, 0, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 1, -1, 3, 1//2, -1//2, 3//2, -3//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 3, -3, -1//2, 3//2, -3//2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, -3, 10, 3//2, -3//2, 5, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -3, 10, -10, -3//2, 5, -5, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1//2, -1//2, 3//2, -3//2, -1//2, 1, -1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1//2, 3//2, -3//2, 5, 1, -1, 3, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3//2, -3//2, 5, -5, -1, 3, -3, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3//2, 5, -5, 17, 3, -3, 10, -10]); L = integer_lattice(B, gram = G); @test length(representatives(genus(L))) == 1 end diff --git a/test/QuadForm/Quad/Lattices.jl b/test/QuadForm/Quad/Lattices.jl index d47116496b..f05e002858 100644 --- a/test/QuadForm/Quad/Lattices.jl +++ b/test/QuadForm/Quad/Lattices.jl @@ -4,7 +4,7 @@ # Constructors # - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x - 1; K, a = number_field(f, "a", cached = false) D = matrix(K, 3, 3, [4, 0, 0, 0, 10, 0, 0, 0, 20]); diff --git a/test/QuadForm/Quad/NormalForm.jl b/test/QuadForm/Quad/NormalForm.jl index 961fb74eca..e25b2078cc 100644 --- a/test/QuadForm/Quad/NormalForm.jl +++ b/test/QuadForm/Quad/NormalForm.jl @@ -52,11 +52,11 @@ end @test Hecke.collect_small_blocks(L) == typeof(L)[] end - G1 = matrix(FlintQQ, 4, 4, [2, 0, 0, 1, + G1 = matrix(QQ, 4, 4, [2, 0, 0, 1, 0, 2, 0, 1, 0, 0, 4, 2, 1, 1, 2, 6]) - G2 = matrix(FlintQQ, 4, 4, [2, 1, 1, 0, + G2 = matrix(QQ, 4, 4, [2, 1, 1, 0, 1, 2, 0, 0, 1, 0, 2, 0, 0, 0, 0, 16]) @@ -78,7 +78,7 @@ end 0, 0, 0, 16]) @test DD == D2 - D4 = matrix(FlintQQ, 4, 4, [2, -1, -1, -1, + D4 = matrix(QQ, 4, 4, [2, -1, -1, -1, -1, 2, 0, 0, -1, 0, 2, 0, -1, 0, 0, 2]) @@ -90,13 +90,13 @@ end 1, 2, 0, 0, 0, 0, 4, 2, 0, 0, 2, 4]) - A4 = matrix(FlintQQ, 4, 4, [2, -1, 0, 0, -1, 2, -1, 0, 0, -1, 2, -1, 0, 0, -1, 2]) + A4 = matrix(QQ, 4, 4, [2, -1, 0, 0, -1, 2, -1, 0, 0, -1, 2, -1, 0, 0, -1, 2]) D, B = Hecke.padic_normal_form(A4, 2) K = base_ring(D) @test D == matrix(K, 4, 4, [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 2, 1, 0, 0, 1, 2]) @test _test_normal_form(A4, D, B, 2) - A4_extended = matrix(FlintQQ, 5, 5, [2, -1, 0, 0, -1, + A4_extended = matrix(QQ, 5, 5, [2, -1, 0, 0, -1, -1, 2, -1, 0, 0, 0, -1, 2, -1, 0, 0, 0, -1, 2, -1, @@ -124,85 +124,85 @@ end @test _test_normal_form(A4dual, D, B, 5) # Corner cases - Z = matrix(FlintQQ, 0, 0, []) + Z = matrix(QQ, 0, 0, []) B, D = Hecke.padic_normal_form(Z, 2) @test iszero(B) @test iszero(D) - Z = zero_matrix(FlintQQ, 10, 10) + Z = zero_matrix(QQ, 10, 10) B, D = Hecke.padic_normal_form(Z, 3) @test iszero(B) @test iszero(D) # 2-adic cases - M = matrix(FlintQQ, 3, 3, QQFieldElem[2, 1, 0, 1, 3, 1, 0, 1, 2]) + M = matrix(QQ, 3, 3, QQFieldElem[2, 1, 0, 1, 3, 1, 0, 1, 2]) D, B = Hecke.padic_normal_form(M, 2) @test _test_normal_form(M, D, B, 2) - M = matrix(FlintQQ, 3, 3, QQFieldElem[400, 0, 0, 0, 160, 0, 0, 0, 80]) + M = matrix(QQ, 3, 3, QQFieldElem[400, 0, 0, 0, 160, 0, 0, 0, 80]) D, B = Hecke.padic_normal_form(M, 2) @test _test_normal_form(M, D, B, 2) - M = matrix(FlintQQ, 6, 6, QQFieldElem[12544, 3584, 0, 896, 8064, 0, 3584, 1152, 896, 512, 2304, 1152, 0, 896, 18816, 5376, 3584, 8064, 896, 512, 5376, 1728, 1600, 2816, 8064, 2304, 3584, 1600, 6272, 0, 0, 1152, 8064, 2816, 0, 12544]) + M = matrix(QQ, 6, 6, QQFieldElem[12544, 3584, 0, 896, 8064, 0, 3584, 1152, 896, 512, 2304, 1152, 0, 896, 18816, 5376, 3584, 8064, 896, 512, 5376, 1728, 1600, 2816, 8064, 2304, 3584, 1600, 6272, 0, 0, 1152, 8064, 2816, 0, 12544]) D, B = Hecke.padic_normal_form(M, 2) @test _test_normal_form(M, D, B, 2) - M = matrix(FlintQQ, 4, 4, QQFieldElem[4, 0, 2, 1, 0, 4, 1, 2, 2, 1, 5, 1, 1, 2, 1, 5]) + M = matrix(QQ, 4, 4, QQFieldElem[4, 0, 2, 1, 0, 4, 1, 2, 2, 1, 5, 1, 1, 2, 1, 5]) D, B = Hecke.padic_normal_form(M, 2) @test _test_normal_form(M, D, B, 2) - M = matrix(FlintQQ, 3, 3, QQFieldElem[1, 0, 0, 0, 1, 0, 0, 0, 1]) + M = matrix(QQ, 3, 3, QQFieldElem[1, 0, 0, 0, 1, 0, 0, 0, 1]) D, B = Hecke.padic_normal_form(M, 2) @test _test_normal_form(M, D, B, 2) - M = matrix(FlintQQ, 6, 6, QQFieldElem[2, 1, 0, 1, 1, 1, 1, 2, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 1, 0, 0, 3, 0, 0, 1, 0, 0, 0, 3, 0, 1, 0, 0, 0, 0, 3]) + M = matrix(QQ, 6, 6, QQFieldElem[2, 1, 0, 1, 1, 1, 1, 2, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 1, 0, 0, 3, 0, 0, 1, 0, 0, 0, 3, 0, 1, 0, 0, 0, 0, 3]) D, B = Hecke.padic_normal_form(M, 2) @test _test_normal_form(M, D, B, 2) - M = matrix(FlintQQ, 10, 10, QQFieldElem[3, 1, 0, 0, 0, -1, 1, -1, 0, 1, 1, 3, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 3, 1, 0, 1, -1, -1, -1, -1, 0, 1, 1, 3, -1, 0, -1, -1, 1, -1, 0, 0, 0, -1, 3, 1, 1, 2, 1, 2, -1, 0, 1, 0, 1, 3, 0, 1, 0, -1, 1, 1, -1, -1, 1, 0, 4, 1, -1, 2, -1, 0, -1, -1, 2, 1, 1, 4, 1, 2, 0, 0, -1, 1, 1, 0, -1, 1, 4, 1, 1, 1, -1, -1, 2, -1, 2, 2, 1, 5]) + M = matrix(QQ, 10, 10, QQFieldElem[3, 1, 0, 0, 0, -1, 1, -1, 0, 1, 1, 3, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 3, 1, 0, 1, -1, -1, -1, -1, 0, 1, 1, 3, -1, 0, -1, -1, 1, -1, 0, 0, 0, -1, 3, 1, 1, 2, 1, 2, -1, 0, 1, 0, 1, 3, 0, 1, 0, -1, 1, 1, -1, -1, 1, 0, 4, 1, -1, 2, -1, 0, -1, -1, 2, 1, 1, 4, 1, 2, 0, 0, -1, 1, 1, 0, -1, 1, 4, 1, 1, 1, -1, -1, 2, -1, 2, 2, 1, 5]) D, B = Hecke.padic_normal_form(M, 2) @test _test_normal_form(M, D, B, 2) - M = matrix(FlintQQ, 6, 6, QQFieldElem[4, 1, -1, -1, 1, -1, 1, 4, 0, 1, 2, 1, -1, 0, 4, -1, 2, -1, -1, 1, -1, 4, -1, 0, 1, 2, 2, -1, 4, -1, -1, 1, -1, 0, -1, 4]) + M = matrix(QQ, 6, 6, QQFieldElem[4, 1, -1, -1, 1, -1, 1, 4, 0, 1, 2, 1, -1, 0, 4, -1, 2, -1, -1, 1, -1, 4, -1, 0, 1, 2, 2, -1, 4, -1, -1, 1, -1, 0, -1, 4]) D, B = Hecke.padic_normal_form(M, 2) @test _test_normal_form(M, D, B, 2) - M = matrix(FlintQQ, 5, 5, QQFieldElem[5, -1, -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, 5]) + M = matrix(QQ, 5, 5, QQFieldElem[5, -1, -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, 5]) D, B = Hecke.padic_normal_form(M, 2) @test _test_normal_form(M, D, B, 2) - M = matrix(FlintQQ, 3, 3, QQFieldElem[2, 1, 0, 1, 4, 1, 0, 1, 4]) + M = matrix(QQ, 3, 3, QQFieldElem[2, 1, 0, 1, 4, 1, 0, 1, 4]) D, B = Hecke.padic_normal_form(M, 2) @test _test_normal_form(M, D, B, 2) - M = matrix(FlintQQ, 7, 7, QQFieldElem[8, -4, 3, 4, 0, 1, 1, -4, 8, 1, 0, 4, 1, 1, 3, 1, 8, 4, 0, 1, 1, 4, 0, 4, 8, 3, 0, 4, 0, 4, 0, 3, 8, 4, 0, 1, 1, 1, 0, 4, 8, -4, 1, 1, 1, 4, 0, -4, 8]) + M = matrix(QQ, 7, 7, QQFieldElem[8, -4, 3, 4, 0, 1, 1, -4, 8, 1, 0, 4, 1, 1, 3, 1, 8, 4, 0, 1, 1, 4, 0, 4, 8, 3, 0, 4, 0, 4, 0, 3, 8, 4, 0, 1, 1, 1, 0, 4, 8, -4, 1, 1, 1, 4, 0, -4, 8]) D, B = Hecke.padic_normal_form(M, 2) @test _test_normal_form(M, D, B, 2) - M = matrix(FlintQQ, 24, 24, QQFieldElem[2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18014398509481985//18014398509481984, -1//18014398509481984, -1//18014398509481984, -1//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 1, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1//36028797018963968, -1//18014398509481984, -1//18014398509481984, -1//18014398509481984, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -36028797018963969//36028797018963968, -36028797018963969//36028797018963968, -36028797018963969//36028797018963968, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18014398509481985//18014398509481984, 0, 0, -18014398509481983//18014398509481984, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 2, 0, -1, -1, 1, 0, 0, 0, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, -1, 0, 0, 0, 0, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 1, 2, 1, -1, 0, 0, 0, 0, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 1, -1, 0, 1, 2, 0, 0, 0, 0, 0, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 1, -1, -1, 0, 2, 0, 0, 0, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, -1, -1, 18014398509481983//18014398509481984, 0, -36028797018963969//36028797018963968, -18014398509481983//18014398509481984, 0, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 18014398509481983//18014398509481984, 0, 0, -18014398509481983//18014398509481984, 0, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 2, 1, -18014398509481983//18014398509481984, 0, 36028797018963969//36028797018963968, 18014398509481983//18014398509481984, 0, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 1, 2, 0, 0, 36028797018963969//36028797018963968, 0, 0, 0, 0, 0, 1, 18014398509481985//18014398509481984, 1//36028797018963968, 0, 0, 0, 0, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 5192296858534827340300120177508381//1298074214633706907132624082305024, 649037107316853399523116512706557//324518553658426726783156020576256, -162259276829213336369980246065155//162259276829213363391578010288128, 18014398509481979//324518553658426726783156020576256, 54043195528445949//649037107316853453566312041152512, -1298074214633706708974240478003207//649037107316853453566312041152512, 324518553658426690754359001612289//162259276829213363391578010288128, -324518553658426690754359001612289//162259276829213363391578010288128, 1, -1//18014398509481984, -1//18014398509481984, -36028797018963969//36028797018963968, 18014398509481985//18014398509481984, 0, 0, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 649037107316853399523116512706557//324518553658426726783156020576256, 2596148429267413814265248164610069//649037107316853453566312041152512, 288230376151711757//1298074214633706907132624082305024, 2596148429267413814265248164610069//1298074214633706907132624082305024, -649037107316853435551913531670527//324518553658426726783156020576256, -1298074214633706817060631534895105//649037107316853453566312041152512, 324518553658426690754359001612289//324518553658426726783156020576256, 54043195528445949//649037107316853453566312041152512, 1, -1//18014398509481984, -1//18014398509481984, -36028797018963969//36028797018963968, 0, 0, 0, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -36028797018963969//36028797018963968, 0, 36028797018963969//36028797018963968, 36028797018963969//36028797018963968, -162259276829213336369980246065155//162259276829213363391578010288128, 288230376151711757//1298074214633706907132624082305024, 2596148429267413814265248164610069//649037107316853453566312041152512, 1298074214633707051247812158160913//1298074214633706907132624082305024, -54043195528445949//649037107316853453566312041152512, 649037107316853327465522474778629//649037107316853453566312041152512, -324518553658426690754359001612289//324518553658426726783156020576256, 324518553658426690754359001612289//324518553658426726783156020576256, 1, -1//18014398509481984, -1//18014398509481984, -36028797018963969//36028797018963968, 0, 0, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 18014398509481979//324518553658426726783156020576256, 2596148429267413814265248164610069//1298074214633706907132624082305024, 1298074214633707051247812158160913//1298074214633706907132624082305024, 5192296858534827340300120177508381//1298074214633706907132624082305024, -1298074214633706817060631534895105//649037107316853453566312041152512, -54043195528445949//649037107316853453566312041152512, 0, 0, 0, 18014398509481983//18014398509481984, 0, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 0, 0, 0, 54043195528445949//649037107316853453566312041152512, -649037107316853435551913531670527//324518553658426726783156020576256, -54043195528445949//649037107316853453566312041152512, -1298074214633706817060631534895105//649037107316853453566312041152512, 324518553658426690754359001612289//81129638414606681695789005144064, 324518553658426690754359001612289//162259276829213363391578010288128, -324518553658426690754359001612289//162259276829213363391578010288128, 324518553658426690754359001612289//324518553658426726783156020576256, 0, 18014398509481983//18014398509481984, 0, 18014398509481983//18014398509481984, 0, 0, 0, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, -1298074214633706708974240478003207//649037107316853453566312041152512, -1298074214633706817060631534895105//649037107316853453566312041152512, 649037107316853327465522474778629//649037107316853453566312041152512, -54043195528445949//649037107316853453566312041152512, 324518553658426690754359001612289//162259276829213363391578010288128, 324518553658426690754359001612289//81129638414606681695789005144064, -324518553658426690754359001612289//162259276829213363391578010288128, 324518553658426690754359001612289//162259276829213363391578010288128, 0, 0, 0, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 324518553658426690754359001612289//162259276829213363391578010288128, 324518553658426690754359001612289//324518553658426726783156020576256, -324518553658426690754359001612289//324518553658426726783156020576256, 0, -324518553658426690754359001612289//162259276829213363391578010288128, -324518553658426690754359001612289//162259276829213363391578010288128, 324518553658426690754359001612289//81129638414606681695789005144064, -324518553658426690754359001612289//162259276829213363391578010288128, 0, 0, 0, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, -324518553658426690754359001612289//162259276829213363391578010288128, 54043195528445949//649037107316853453566312041152512, 324518553658426690754359001612289//324518553658426726783156020576256, 0, 324518553658426690754359001612289//324518553658426726783156020576256, 324518553658426690754359001612289//162259276829213363391578010288128, -324518553658426690754359001612289//162259276829213363391578010288128, 324518553658426690754359001612289//81129638414606681695789005144064]) + M = matrix(QQ, 24, 24, QQFieldElem[2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18014398509481985//18014398509481984, -1//18014398509481984, -1//18014398509481984, -1//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 1, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1//36028797018963968, -1//18014398509481984, -1//18014398509481984, -1//18014398509481984, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -36028797018963969//36028797018963968, -36028797018963969//36028797018963968, -36028797018963969//36028797018963968, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18014398509481985//18014398509481984, 0, 0, -18014398509481983//18014398509481984, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 2, 0, -1, -1, 1, 0, 0, 0, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, -1, 0, 0, 0, 0, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 1, 2, 1, -1, 0, 0, 0, 0, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 1, -1, 0, 1, 2, 0, 0, 0, 0, 0, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 1, -1, -1, 0, 2, 0, 0, 0, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, -1, -1, 18014398509481983//18014398509481984, 0, -36028797018963969//36028797018963968, -18014398509481983//18014398509481984, 0, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 18014398509481983//18014398509481984, 0, 0, -18014398509481983//18014398509481984, 0, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 2, 1, -18014398509481983//18014398509481984, 0, 36028797018963969//36028797018963968, 18014398509481983//18014398509481984, 0, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 1, 2, 0, 0, 36028797018963969//36028797018963968, 0, 0, 0, 0, 0, 1, 18014398509481985//18014398509481984, 1//36028797018963968, 0, 0, 0, 0, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 5192296858534827340300120177508381//1298074214633706907132624082305024, 649037107316853399523116512706557//324518553658426726783156020576256, -162259276829213336369980246065155//162259276829213363391578010288128, 18014398509481979//324518553658426726783156020576256, 54043195528445949//649037107316853453566312041152512, -1298074214633706708974240478003207//649037107316853453566312041152512, 324518553658426690754359001612289//162259276829213363391578010288128, -324518553658426690754359001612289//162259276829213363391578010288128, 1, -1//18014398509481984, -1//18014398509481984, -36028797018963969//36028797018963968, 18014398509481985//18014398509481984, 0, 0, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 0, 0, 0, 649037107316853399523116512706557//324518553658426726783156020576256, 2596148429267413814265248164610069//649037107316853453566312041152512, 288230376151711757//1298074214633706907132624082305024, 2596148429267413814265248164610069//1298074214633706907132624082305024, -649037107316853435551913531670527//324518553658426726783156020576256, -1298074214633706817060631534895105//649037107316853453566312041152512, 324518553658426690754359001612289//324518553658426726783156020576256, 54043195528445949//649037107316853453566312041152512, 1, -1//18014398509481984, -1//18014398509481984, -36028797018963969//36028797018963968, 0, 0, 0, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -36028797018963969//36028797018963968, 0, 36028797018963969//36028797018963968, 36028797018963969//36028797018963968, -162259276829213336369980246065155//162259276829213363391578010288128, 288230376151711757//1298074214633706907132624082305024, 2596148429267413814265248164610069//649037107316853453566312041152512, 1298074214633707051247812158160913//1298074214633706907132624082305024, -54043195528445949//649037107316853453566312041152512, 649037107316853327465522474778629//649037107316853453566312041152512, -324518553658426690754359001612289//324518553658426726783156020576256, 324518553658426690754359001612289//324518553658426726783156020576256, 1, -1//18014398509481984, -1//18014398509481984, -36028797018963969//36028797018963968, 0, 0, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, 18014398509481979//324518553658426726783156020576256, 2596148429267413814265248164610069//1298074214633706907132624082305024, 1298074214633707051247812158160913//1298074214633706907132624082305024, 5192296858534827340300120177508381//1298074214633706907132624082305024, -1298074214633706817060631534895105//649037107316853453566312041152512, -54043195528445949//649037107316853453566312041152512, 0, 0, 0, 18014398509481983//18014398509481984, 0, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 0, 0, 0, 54043195528445949//649037107316853453566312041152512, -649037107316853435551913531670527//324518553658426726783156020576256, -54043195528445949//649037107316853453566312041152512, -1298074214633706817060631534895105//649037107316853453566312041152512, 324518553658426690754359001612289//81129638414606681695789005144064, 324518553658426690754359001612289//162259276829213363391578010288128, -324518553658426690754359001612289//162259276829213363391578010288128, 324518553658426690754359001612289//324518553658426726783156020576256, 0, 18014398509481983//18014398509481984, 0, 18014398509481983//18014398509481984, 0, 0, 0, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, -1298074214633706708974240478003207//649037107316853453566312041152512, -1298074214633706817060631534895105//649037107316853453566312041152512, 649037107316853327465522474778629//649037107316853453566312041152512, -54043195528445949//649037107316853453566312041152512, 324518553658426690754359001612289//162259276829213363391578010288128, 324518553658426690754359001612289//81129638414606681695789005144064, -324518553658426690754359001612289//162259276829213363391578010288128, 324518553658426690754359001612289//162259276829213363391578010288128, 0, 0, 0, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 324518553658426690754359001612289//162259276829213363391578010288128, 324518553658426690754359001612289//324518553658426726783156020576256, -324518553658426690754359001612289//324518553658426726783156020576256, 0, -324518553658426690754359001612289//162259276829213363391578010288128, -324518553658426690754359001612289//162259276829213363391578010288128, 324518553658426690754359001612289//81129638414606681695789005144064, -324518553658426690754359001612289//162259276829213363391578010288128, 0, 0, 0, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 0, 18014398509481983//18014398509481984, 18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, -18014398509481983//18014398509481984, 18014398509481983//18014398509481984, 0, -324518553658426690754359001612289//162259276829213363391578010288128, 54043195528445949//649037107316853453566312041152512, 324518553658426690754359001612289//324518553658426726783156020576256, 0, 324518553658426690754359001612289//324518553658426726783156020576256, 324518553658426690754359001612289//162259276829213363391578010288128, -324518553658426690754359001612289//162259276829213363391578010288128, 324518553658426690754359001612289//81129638414606681695789005144064]) D, B = Hecke.padic_normal_form(M, 2) @test _test_normal_form(M, D, B, 2) # non-dyadic tests - M = matrix(FlintQQ, 2, 2, QQFieldElem[2, -1, -1, 2]) + M = matrix(QQ, 2, 2, QQFieldElem[2, -1, -1, 2]) D, B = Hecke.padic_normal_form(M, 3) @test _test_normal_form(M, D, B, 3) - M = matrix(FlintQQ, 2, 2, QQFieldElem[2, -1, -1, 2]) + M = matrix(QQ, 2, 2, QQFieldElem[2, -1, -1, 2]) D, B = Hecke.padic_normal_form(M, 3) @test _test_normal_form(M, D, B, 3) - M = matrix(FlintQQ, 3, 3, QQFieldElem[2, -1, 0, -1, 2, -1, 0, -1, 2]) + M = matrix(QQ, 3, 3, QQFieldElem[2, -1, 0, -1, 2, -1, 0, -1, 2]) D, B = Hecke.padic_normal_form(M, 3) @test _test_normal_form(M, D, B, 3) - M = matrix(FlintQQ, 3, 3, QQFieldElem[3, -1, -1, -1, 3, -1, -1, -1, 3]) + M = matrix(QQ, 3, 3, QQFieldElem[3, -1, -1, -1, 3, -1, -1, -1, 3]) D, B = Hecke.padic_normal_form(M, 3) @test _test_normal_form(M, D, B, 3) - R = residue_ring(FlintZZ, ZZRingElem(2)^30)[1] + R = residue_ring(ZZ, ZZRingElem(2)^30)[1] U = matrix(R,2,2,[0,1,1,0]) V = matrix(R,2,2,[2,1,1,2]) W1 = matrix(R,1,1,[1]) @@ -425,14 +425,14 @@ end # test _ispadic_normal_form # not the right block structure - @test !Hecke._ispadic_normal_form(matrix(FlintQQ, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 2) - @test !Hecke._ispadic_normal_form(matrix(FlintQQ, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 3) - @test !Hecke._ispadic_normal_form(matrix(FlintQQ, 2, 2, [1, 1, 1, 1]), 3) - - @test !Hecke._ispadic_normal_form(matrix(FlintQQ, 2, 2, [2, 0, 0, 1]), 3) - @test !Hecke._ispadic_normal_form(matrix(FlintQQ, 2, 2, [1, 0, 0, 3]), 5) - @test !Hecke._ispadic_normal_form(matrix(FlintQQ, 2, 2, [1, 0, 0, 4]), 5) - @test !Hecke._ispadic_normal_form(matrix(FlintQQ, 2, 2, [1, 1, 1, 1]), 2) - @test !Hecke._ispadic_normal_form(matrix(FlintQQ, 1, 1, [9]), 2) + @test !Hecke._ispadic_normal_form(matrix(QQ, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 2) + @test !Hecke._ispadic_normal_form(matrix(QQ, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 3) + @test !Hecke._ispadic_normal_form(matrix(QQ, 2, 2, [1, 1, 1, 1]), 3) + + @test !Hecke._ispadic_normal_form(matrix(QQ, 2, 2, [2, 0, 0, 1]), 3) + @test !Hecke._ispadic_normal_form(matrix(QQ, 2, 2, [1, 0, 0, 3]), 5) + @test !Hecke._ispadic_normal_form(matrix(QQ, 2, 2, [1, 0, 0, 4]), 5) + @test !Hecke._ispadic_normal_form(matrix(QQ, 2, 2, [1, 1, 1, 1]), 2) + @test !Hecke._ispadic_normal_form(matrix(QQ, 1, 1, [9]), 2) end diff --git a/test/QuadForm/Quad/Spaces.jl b/test/QuadForm/Quad/Spaces.jl index ffdb2f06d6..71d74724ac 100644 --- a/test/QuadForm/Quad/Spaces.jl +++ b/test/QuadForm/Quad/Spaces.jl @@ -1,5 +1,5 @@ @testset "Spaces" begin - k = FlintQQ + k = QQ q = quadratic_space(QQ, QQ[1 1; 1 1;]) @test 0 in diagonal(q) @@ -26,7 +26,7 @@ @test inner_product(q, [1, 1], [1, 2]) == 3 end - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K1, a1 = number_field(x^2 - 2, "a1") K2, a2 = number_field(x^3 - 2, "a2") @@ -37,12 +37,12 @@ V = @inferred quadratic_space(K, 2) @test_throws ArgumentError quadratic_space(K, -1) - V = @inferred quadratic_space(K, identity_matrix(FlintZZ, 2)) + V = @inferred quadratic_space(K, identity_matrix(ZZ, 2)) @test V == V @test V === V - W = quadratic_space(K, identity_matrix(FlintZZ, 2)) + W = quadratic_space(K, identity_matrix(ZZ, 2)) @test V === W - W = quadratic_space(K, identity_matrix(FlintZZ, 2), cached = false) + W = quadratic_space(K, identity_matrix(ZZ, 2), cached = false) @test V != W @test (@inferred gram_matrix(V)) == identity_matrix(K, 2) @@ -149,7 +149,7 @@ quadratic_space(QQ, matrix(QQ, 2, 2, [1, 0, 0, 1]))) @test fl - Qx, x = polynomial_ring(FlintQQ, "x", cached = false) + Qx, x = polynomial_ring(QQ, "x", cached = false) f = x - 1; K, a = number_field(f) D = matrix(K, 2, 2, [1, 0, 0, 3]); @@ -314,7 +314,7 @@ @test any(i!=0 for i in v1) @test inner_product(q1, v1, v1)==0 - q = quadratic_space(QQ,matrix(FlintQQ, 16, 16 ,[-2, -1, -1, -1, -1, -1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -1, -1, -1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -2, 0, -1, -1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, -2, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, -2, -1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, -1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1, 1, 1, 1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 2, -1, -1, -1, -1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 2, 0, 1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 2, 0, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 1, 0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 1, 1, 1, 2, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 1, 1, 1, 1, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1, -1, -1, 0, -1, -1, 2])) + q = quadratic_space(QQ,matrix(QQ, 16, 16 ,[-2, -1, -1, -1, -1, -1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -1, -1, -1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -2, 0, -1, -1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, -2, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, -2, -1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, -1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1, 1, 1, 1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 2, -1, -1, -1, -1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 2, 0, 1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 2, 0, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 1, 0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 1, 1, 1, 2, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 1, 1, 1, 1, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1, -1, -1, 0, -1, -1, 2])) ok, v = is_isotropic_with_vector(q) @test ok @test iszero(inner_product(q, v,v)) diff --git a/test/QuadForm/Quad/ZLattices.jl b/test/QuadForm/Quad/ZLattices.jl index 778943e8da..041ba167f8 100644 --- a/test/QuadForm/Quad/ZLattices.jl +++ b/test/QuadForm/Quad/ZLattices.jl @@ -1,5 +1,5 @@ function _random_invertible_matrix(n, B) - A = identity_matrix(FlintZZ, n) + A = identity_matrix(ZZ, n) if n == 1 return A end @@ -9,7 +9,7 @@ function _random_invertible_matrix(n, B) A[i, j] += rand(B) end @assert det(A) == 1 - C = identity_matrix(FlintZZ, n) + C = identity_matrix(ZZ, n) for k in 1:10 i = rand(1:(n - 1)) j = rand((i + 1):n) @@ -123,7 +123,7 @@ end @test (@inferred integer_lattice(gram = G, check=false)) isa ZZLat @test_throws ArgumentError integer_lattice(gram = B) - V = quadratic_space(FlintQQ, G) + V = quadratic_space(QQ, G) B = matrix(ZZ, 1, 2, [1, 0]) @test (@inferred lattice(V, B)) isa ZZLat Lr1 = lattice(V, B) @@ -143,7 +143,7 @@ end @test (@inferred base_ring(Lr0)) isa ZZRing @test !(@inferred is_sublattice(Lr2, Lr1)) - M = integer_lattice(;gram = FlintQQ[2 2; 2 2]) + M = integer_lattice(;gram = QQ[2 2; 2 2]) @test !(@inferred is_sublattice(Lr0, M)) @test is_sublattice(Lr2, Lr0) @test is_sublattice(Lr1, lattice(V, QQ[2 0;])) @@ -212,22 +212,22 @@ end @test gram_matrix(R[3][1])==gram_matrix(root_lattice(R[2][1]...)) - B = matrix(FlintQQ, 6, 6 ,[1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1]); - G = matrix(FlintQQ, 6, 6 ,[3, 1, -1, 1, 0, 0, 1, 3, 1, 1, 1, 1, -1, 1, 3, 0, 0, 1, 1, 1, 0, 4, 2, 2, 0, 1, 0, 2, 4, 2, 0, 1, 1, 2, 2, 4]); + B = matrix(QQ, 6, 6 ,[1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1]); + G = matrix(QQ, 6, 6 ,[3, 1, -1, 1, 0, 0, 1, 3, 1, 1, 1, 1, -1, 1, 3, 0, 0, 1, 1, 1, 0, 4, 2, 2, 0, 1, 0, 2, 4, 2, 0, 1, 1, 2, 2, 4]); L = integer_lattice(B, gram = G); R = root_lattice_recognition(L) @test (isempty(R[1]) && isempty(R[2])) - B = matrix(FlintQQ, 19, 20 ,[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]); - G = matrix(FlintQQ, 20, 20 ,[-2, 0, 1, -1, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -4, 0, 0, 0, -1, -1, -2, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 1, 0, -2, 1, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 1, -2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 1, 0, -2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -2, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, -2, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, -1, -1, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -2, -1, 1, 1, 0, -1, -1, 0, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -1, 1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, 1, -1, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, -2, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, -2, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, -1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, -1, 0, -2, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 1, -1, 0, -1, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 1, -1, 0, -1, -1, -2, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2]); + B = matrix(QQ, 19, 20 ,[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]); + G = matrix(QQ, 20, 20 ,[-2, 0, 1, -1, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -4, 0, 0, 0, -1, -1, -2, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 1, 0, -2, 1, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 1, -2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 1, 0, -2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -2, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, -2, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, -1, -1, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -2, -1, 1, 1, 0, -1, -1, 0, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -1, 1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, 1, -1, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, -2, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, -2, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, -1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, -1, 0, -2, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 1, -1, 0, -1, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 1, -1, 0, -1, -1, -2, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2]); rsL = integer_lattice(B, gram = G); @test length(root_lattice_recognition(rsL)[1]) == 4 rsLp = rescale(rsL,-1) @test length(Hecke._irreducible_components_short_vectors(rsLp, 2))==4 @test length(Hecke._irreducible_components_short_vectors(rsLp, 4))==4 - B = matrix(FlintQQ, 4, 4 ,[1, 0, 0, 0, 0, 3, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1]); - G = matrix(FlintQQ, 4, 4 ,[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 10]); + B = matrix(QQ, 4, 4 ,[1, 0, 0, 0, 0, 3, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1]); + G = matrix(QQ, 4, 4 ,[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 10]); L = integer_lattice(B, gram = G); ADE, _ = root_lattice_recognition(L) @@ -243,7 +243,7 @@ end for (m, o) in lattices_and_aut_order n = length(m[1]) - G = matrix(FlintZZ, n, n, reduce(vcat, m)) + G = matrix(ZZ, n, n, reduce(vcat, m)) L = integer_lattice(gram = G) Ge = automorphism_group_generators(L, ambient_representation = true) test_automorphisms(L, Ge, true) @@ -317,7 +317,7 @@ end for (m, o) in lattices_and_aut_order n = length(m[1]) - G = matrix(FlintZZ, n, n, reduce(vcat, m)) + G = matrix(ZZ, n, n, reduce(vcat, m)) L = integer_lattice(gram = G) X = _random_invertible_matrix(n, -3:3) @assert abs(det(X)) == 1 @@ -341,7 +341,7 @@ end L = lattice(D, i) L = integer_lattice(gram = gram_matrix(L)) # to avoid caching n = rank(L) - X = change_base_ring(FlintQQ, _random_invertible_matrix(n, -3:3)) + X = change_base_ring(QQ, _random_invertible_matrix(n, -3:3)) @assert abs(det(X)) == 1 L2 = integer_lattice(gram = X * gram_matrix(L) * transpose(X)) b, T = is_isometric_with_isometry(L, L2, ambient_representation = false) @@ -353,7 +353,7 @@ end for i in [ 1, 101, 113 ] # triggering different checks in the Bacher polynomials L = integer_lattice(gram = gram_matrix(lattice(D, i))) n = rank(L) - X = change_base_ring(FlintQQ, _random_invertible_matrix(n, -3:3)) + X = change_base_ring(QQ, _random_invertible_matrix(n, -3:3)) @assert abs(det(X)) == 1 L2 = integer_lattice(gram = X * gram_matrix(L) * transpose(X)) b, T = is_isometric_with_isometry(L, L2, ambient_representation = false, bacher_depth = 1) @@ -741,8 +741,8 @@ end # Issue 1054 let - B = matrix(FlintQQ, 6, 6 ,[1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1]) - G = matrix(FlintQQ, 6, 6 ,[876708188094148315826780735392810, 798141405233250328867679564294410, -352823337641433300965521329447720, 326768950610851461363580717982402, -690595881941554449465975342845028, 433433545243019702766746394677218, 798141405233250328867679564294410, 867615301468758683549323652197099, -301315621373858240463110267500961, 316796431934778296047626373086339, -725765288914917260527454069649226, 505082964151083450666500945258490, -352823337641433300965521329447720, -301315621373858240463110267500961, 809946152369211852531731702980788, -343784636213856787915462553587466, 84764902049682607076640678540130, -613908853150167850995565570653796, 326768950610851461363580717982402, 316796431934778296047626373086339, -343784636213856787915462553587466, 219957919673551825679009958633894, -226934633316066727073394927118195, 298257387132139131540277459301842, -690595881941554449465975342845028, -725765288914917260527454069649226, 84764902049682607076640678540130, -226934633316066727073394927118195, 671443408734467545153681225010914, -277626128761200144008657217470664, 433433545243019702766746394677218, 505082964151083450666500945258490, -613908853150167850995565570653796, 298257387132139131540277459301842, -277626128761200144008657217470664, 640432299215298238271419741190578]) + B = matrix(QQ, 6, 6 ,[1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1]) + G = matrix(QQ, 6, 6 ,[876708188094148315826780735392810, 798141405233250328867679564294410, -352823337641433300965521329447720, 326768950610851461363580717982402, -690595881941554449465975342845028, 433433545243019702766746394677218, 798141405233250328867679564294410, 867615301468758683549323652197099, -301315621373858240463110267500961, 316796431934778296047626373086339, -725765288914917260527454069649226, 505082964151083450666500945258490, -352823337641433300965521329447720, -301315621373858240463110267500961, 809946152369211852531731702980788, -343784636213856787915462553587466, 84764902049682607076640678540130, -613908853150167850995565570653796, 326768950610851461363580717982402, 316796431934778296047626373086339, -343784636213856787915462553587466, 219957919673551825679009958633894, -226934633316066727073394927118195, 298257387132139131540277459301842, -690595881941554449465975342845028, -725765288914917260527454069649226, 84764902049682607076640678540130, -226934633316066727073394927118195, 671443408734467545153681225010914, -277626128761200144008657217470664, 433433545243019702766746394677218, 505082964151083450666500945258490, -613908853150167850995565570653796, 298257387132139131540277459301842, -277626128761200144008657217470664, 640432299215298238271419741190578]) L = integer_lattice(B, gram = G) @test automorphism_group_order(L) == 2 @test is_isometric_with_isometry(L, L)[1] @@ -803,8 +803,8 @@ end end @testset "Fix irreducible components" begin - B = matrix(FlintQQ, 8, 16 ,[0, 0, 0, 0, 0, 0, 0, 0, 1, -1//2, 0, -1//2, 1//2, 1//2, 1//2, 1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1//2, 0, -1//2, -1//2, -1//2, 1//2, 1//2, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1//2, 0, 1//2, -1//2, -1//2, 1//2, 1//2, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1//2, 0, -1//2, -1//2, 1//2, -1//2, 1//2, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1//2, 0, -1//2, -1//2, -1//2, 1//2, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1//2, -1, -1//2, -1//2, 1//2, -1//2, -1//2]); - G = matrix(FlintQQ, 16, 16 ,[-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]); + B = matrix(QQ, 8, 16 ,[0, 0, 0, 0, 0, 0, 0, 0, 1, -1//2, 0, -1//2, 1//2, 1//2, 1//2, 1//2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1//2, 0, -1//2, -1//2, -1//2, 1//2, 1//2, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1//2, 0, 1//2, -1//2, -1//2, 1//2, 1//2, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1//2, 0, -1//2, -1//2, 1//2, -1//2, 1//2, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1//2, 0, -1//2, -1//2, -1//2, 1//2, -1//2, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1//2, -1, -1//2, -1//2, 1//2, -1//2, -1//2]); + G = matrix(QQ, 16, 16 ,[-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]); L = integer_lattice(B, gram = G); @test irreducible_components(L)[1] == L end diff --git a/test/QuadForm/QuadBin.jl b/test/QuadForm/QuadBin.jl index bddfacce07..c0dd9a1c4e 100644 --- a/test/QuadForm/QuadBin.jl +++ b/test/QuadForm/QuadBin.jl @@ -160,7 +160,7 @@ @test g[1] == -1 && g[2] == 2 && g[3] == 2 g, T = Hecke.reduction_with_transformation(f) @test g[1] == -1 && g[2] == 2 && g[3] == 2 - @test T == matrix(FlintZZ, 2, 2, [-1, 1, 0, -1]) + @test T == matrix(ZZ, 2, 2, [-1, 1, 0, -1]) @test Hecke._buchmann_vollmer_action(f, T) == g # TODO: We do not have equivalence for indefinite types :( diff --git a/test/QuadForm/Torsion.jl b/test/QuadForm/Torsion.jl index 54aa8828a9..2498fa7568 100644 --- a/test/QuadForm/Torsion.jl +++ b/test/QuadForm/Torsion.jl @@ -181,8 +181,8 @@ T1 = discriminant_group(L1) @test genus(T1, (6,0)) == genus(L1) - B = matrix(FlintQQ, 8, 8 ,[2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3//2, 1//2, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1//2, 0, 1//2, 0, 0, 2//3, 1//6]); - G = matrix(FlintQQ, 8, 8 ,[1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0, 0, 0, 0, 0, 0, 0, 0, -42]); + B = matrix(QQ, 8, 8 ,[2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3//2, 1//2, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1//2, 0, 1//2, 0, 0, 2//3, 1//6]); + G = matrix(QQ, 8, 8 ,[1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0, 0, 0, 0, 0, 0, 0, 0, -42]); L = integer_lattice(B, gram = G); T = discriminant_group(L) @@ -190,8 +190,8 @@ T2 = Hecke._as_finite_bilinear_module(T) @test genus(T2, signature_tuple(L)[[1,3]]; parity = 2) == genus(L) - B = matrix(FlintQQ, 7, 7 ,[2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1//2, 1//2, 1//2, 0, 1//2, 0, 0, 1//2, 1, 1//2, 3//2, 0, 1//2, 0, 1//2, 1, 1//2, 1, 0, 0, 1//2]); - G = matrix(FlintQQ, 7, 7 ,[1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -10]); + B = matrix(QQ, 7, 7 ,[2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1//2, 1//2, 1//2, 0, 1//2, 0, 0, 1//2, 1, 1//2, 3//2, 0, 1//2, 0, 1//2, 1, 1//2, 1, 0, 0, 1//2]); + G = matrix(QQ, 7, 7 ,[1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -10]); L = integer_lattice(B, gram = G); T = discriminant_group(L) @@ -214,15 +214,15 @@ @test is_genus(D, (2,0)) == false @test is_genus(D, (3,0)) == true - B = matrix(FlintQQ, 7, 7 ,[2, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1//2, 13//2, 1//2, 1//2, 1, 0, 0, 3//2, 3, 0, 1//2, 1//2, 1//2, 0, 1, 5//2, 1//2, 0, 0, 0, 1//2]); - G = matrix(FlintQQ, 7, 7 ,[1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -38]); + B = matrix(QQ, 7, 7 ,[2, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1//2, 13//2, 1//2, 1//2, 1, 0, 0, 3//2, 3, 0, 1//2, 1//2, 1//2, 0, 1, 5//2, 1//2, 0, 0, 0, 1//2]); + G = matrix(QQ, 7, 7 ,[1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -38]); L = integer_lattice(B, gram = G); T = discriminant_group(L) @test is_genus(T, signature_tuple(L)[[1,3]]; parity = 1) - B = matrix(FlintQQ, 6, 6 ,[2, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 1, 6, 1, 0, 0, 0, 0, 5, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1//2, 9, 1//2, 0, 0, 1//2]); - G = matrix(FlintQQ, 6, 6 ,[1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2]); + B = matrix(QQ, 6, 6 ,[2, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 1, 6, 1, 0, 0, 0, 0, 5, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1//2, 9, 1//2, 0, 0, 1//2]); + G = matrix(QQ, 6, 6 ,[1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2]); L = integer_lattice(B, gram = G); T = discriminant_group(L) @@ -323,16 +323,16 @@ # direct sums - B = matrix(FlintQQ, 3, 3 ,[1, 1, 0, 1, -1, 0, 0, 1, -1]) - G = matrix(FlintQQ, 3, 3 ,[1, 0, 0, 0, 1, 0, 0, 0, 1]) + B = matrix(QQ, 3, 3 ,[1, 1, 0, 1, -1, 0, 0, 1, -1]) + G = matrix(QQ, 3, 3 ,[1, 0, 0, 0, 1, 0, 0, 0, 1]) L1 = integer_lattice(B, gram = G) qL1 = discriminant_group(L1) Z = torsion_quadratic_module(QQ[1;]) @test_throws ArgumentError direct_sum(qL1, Z) @test_throws ArgumentError direct_product(qL1, rescale(Z, 2)) - B = matrix(FlintQQ, 4, 4 ,[2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 1, 1, 1, 1]) - G = matrix(FlintQQ, 4, 4 ,[1//2, 0, 0, 0, 0, 1//2, 0, 0, 0, 0, 1//2, 0, 0, 0, 0, 1//2]) + B = matrix(QQ, 4, 4 ,[2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 1, 1, 1, 1]) + G = matrix(QQ, 4, 4 ,[1//2, 0, 0, 0, 0, 1//2, 0, 0, 0, 0, 1//2, 0, 0, 0, 0, 1//2]) L2 = integer_lattice(B, gram = G) qL2 = discriminant_group(L2) Z = torsion_quadratic_module(QQ[2;]) diff --git a/test/RCF/conductor_sieve.jl b/test/RCF/conductor_sieve.jl index 7dcea12be5..30d3e49df5 100644 --- a/test/RCF/conductor_sieve.jl +++ b/test/RCF/conductor_sieve.jl @@ -2,7 +2,7 @@ @testset "abelian extensions && related examples" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K, a = number_field(x - 1, "a") l = Hecke.abelian_normal_extensions(K, Int[2,2], ZZRingElem(10)^4) @test length(l)==47 @@ -19,7 +19,7 @@ auts = small_generating_set(automorphism_list(K, copy = false)) l = Hecke.abelian_normal_extensions(K, Int[2], ZZRingElem(10)^5) @test length(l) == 41 - l1 = typeof(l[1])[x for x in l if abs(discriminant(x, FlintQQ)) < 5*10^3] + l1 = typeof(l[1])[x for x in l if abs(discriminant(x, QQ)) < 5*10^3] lnn = Hecke.abelian_extensions(K, Int[2], 5*ZZRingElem(10)^3) ln = typeof(l[1])[x for x in lnn if is_normal(x)] @test length(ln) == length(l1) diff --git a/test/RCF/rcf.jl b/test/RCF/rcf.jl index 61f26e5d45..3eec91112b 100644 --- a/test/RCF/rcf.jl +++ b/test/RCF/rcf.jl @@ -1,5 +1,5 @@ @testset "RCF" begin - Qx, x = polynomial_ring(FlintQQ) + Qx, x = polynomial_ring(QQ) k, a = number_field(x - 1, "a") Z = maximal_order(k) @@ -78,7 +78,7 @@ @test Hecke.is_local_norm(r1, zk(p)) == b end - Qx, x = polynomial_ring(FlintQQ, "x"); + Qx, x = polynomial_ring(QQ, "x"); k, a = number_field(x^2 - 10, "a"); A = ray_class_field(35*maximal_order(k)) B = Hecke.maximal_abelian_subfield(A, k) @@ -90,7 +90,7 @@ @test degree(A) == 2 @test degree(intersect(A, cyclotomic_field(ClassField, 10))) == 1 - Qx, x = polynomial_ring(FlintQQ, "x"); + Qx, x = polynomial_ring(QQ, "x"); k, a = number_field(x^2 - 10, "a"); A = ray_class_field(35*maximal_order(k)) @@ -182,7 +182,7 @@ end end @testset "Some abelian extensions" begin - Qx, x = polynomial_ring(FlintQQ, "x") + Qx, x = polynomial_ring(QQ, "x") K, a = number_field(x - 1, "a") O = maximal_order(K) r, mr = Hecke.ray_class_groupQQ(O, 7872, true, 16) diff --git a/test/Sparse/HNF.jl b/test/Sparse/HNF.jl index 36fb58808c..ab92c07893 100644 --- a/test/Sparse/HNF.jl +++ b/test/Sparse/HNF.jl @@ -2,7 +2,7 @@ for i in 1:10 r = 20 c = 10 - A = matrix(FlintZZ, rand([0,0,0,0,0,0,0,0,0,0,1], r, c)) + A = matrix(ZZ, rand([0,0,0,0,0,0,0,0,0,0,1], r, c)) As = sparse_matrix(A) @test hnf(A) == ZZMatrix(hnf(As)) diff --git a/test/Sparse/Matrix.jl b/test/Sparse/Matrix.jl index d4a7061fea..c7bc573917 100644 --- a/test/Sparse/Matrix.jl +++ b/test/Sparse/Matrix.jl @@ -1,12 +1,12 @@ using Hecke.SparseArrays @testset "Matrix" begin - R = FlintZZ + R = ZZ M = SMatSpace(R, 3, 3) @test R == @inferred base_ring(M) - A = identity_matrix(FlintZZ, 3) + A = identity_matrix(ZZ, 3) Asparse = sparse_matrix(A) @test R == @inferred base_ring(Asparse) @@ -19,24 +19,24 @@ using Hecke.SparseArrays @test 3 == @inferred size(Asparse, 1) @test 3 == @inferred size(Asparse, 2) @test 1 == @inferred size(Asparse, 3) - B = identity_matrix(FlintZZ, 3) + B = identity_matrix(ZZ, 3) Bsparse = sparse_matrix(B) - Csparse = sparse_matrix(FlintZZ) - @test base_ring(Csparse) == FlintZZ + Csparse = sparse_matrix(ZZ) + @test base_ring(Csparse) == ZZ @test nrows(Csparse) == 0 @test ncols(Csparse) == 0 A = ZZRingElem[1 2; 0 0; 3 4] Dsparse = sparse_matrix(A) - @test base_ring(Dsparse) == FlintZZ + @test base_ring(Dsparse) == ZZ @test nrows(Dsparse) == 3 @test ncols(Dsparse) == 2 @test nnz(Dsparse) == 4 - Esparse = sparse_matrix(FlintZZ) - @test base_ring(Esparse) == FlintZZ + Esparse = sparse_matrix(ZZ) + @test base_ring(Esparse) == ZZ @test nrows(Esparse) == 0 @test ncols(Esparse) == 0 @test nnz(Esparse) == 0 @@ -47,9 +47,9 @@ using Hecke.SparseArrays # Equality - @test @inferred ==(sparse_matrix(FlintZZ, [0 0 0; 1 1 1]), sparse_matrix(FlintZZ, [0 0 0; 1 1 1])) + @test @inferred ==(sparse_matrix(ZZ, [0 0 0; 1 1 1]), sparse_matrix(ZZ, [0 0 0; 1 1 1])) - B = zero_matrix(FlintZZ, 2, 3) + B = zero_matrix(ZZ, 2, 3) Bsparse = sparse_matrix(B) @test nrows(Bsparse) == 2 @test ncols(Bsparse) == 3 @@ -71,13 +71,13 @@ using Hecke.SparseArrays # Entry access - A = identity_matrix(FlintZZ, 3) + A = identity_matrix(ZZ, 3) Asparse = sparse_matrix(A) for i in 1:3 for j in 1:3 b = @inferred A[i, j] if i == j - @test b == one(FlintZZ) + @test b == one(ZZ) else @test iszero(b) end @@ -86,55 +86,55 @@ using Hecke.SparseArrays # Row access - D = sparse_matrix(FlintZZ, [1 5 3; 0 0 0; 0 1 0]) - @test sparse_row(FlintZZ, [1, 2, 3], ZZRingElem[1, 5, 3]) == @inferred D[1] - @test sparse_row(FlintZZ) == @inferred D[2] - @test sparse_row(FlintZZ, [2], ZZRingElem[1]) == @inferred D[3] + D = sparse_matrix(ZZ, [1 5 3; 0 0 0; 0 1 0]) + @test sparse_row(ZZ, [1, 2, 3], ZZRingElem[1, 5, 3]) == @inferred D[1] + @test sparse_row(ZZ) == @inferred D[2] + @test sparse_row(ZZ, [2], ZZRingElem[1]) == @inferred D[3] - D[1] = sparse_row(FlintZZ, [1], ZZRingElem[1]) - D[2] = sparse_row(FlintZZ, [2], ZZRingElem[1]) - D[3] = sparse_row(FlintZZ, [3], ZZRingElem[1]) - @test D == sparse_matrix(identity_matrix(FlintZZ, 3)) + D[1] = sparse_row(ZZ, [1], ZZRingElem[1]) + D[2] = sparse_row(ZZ, [2], ZZRingElem[1]) + D[3] = sparse_row(ZZ, [3], ZZRingElem[1]) + @test D == sparse_matrix(identity_matrix(ZZ, 3)) # Modular reduction - D = sparse_matrix(FlintZZ, [1 5 3; 5 5 5; -4 1 1]) + D = sparse_matrix(ZZ, [1 5 3; 5 5 5; -4 1 1]) D = mod_sym!(D, ZZRingElem(5)) @test nrows(D) == 3 @test ncols(D) == 3 - @test D.rows[1] == sparse_row(FlintZZ, [1, 3], ZZRingElem[1, -2]) - @test D.rows[2] == sparse_row(FlintZZ) - @test D.rows[3] == sparse_row(FlintZZ, [1, 2, 3], ZZRingElem[1, 1, 1]) + @test D.rows[1] == sparse_row(ZZ, [1, 3], ZZRingElem[1, -2]) + @test D.rows[2] == sparse_row(ZZ) + @test D.rows[3] == sparse_row(ZZ, [1, 2, 3], ZZRingElem[1, 1, 1]) # Random row - D = sparse_matrix(FlintZZ, [1 5 3; 5 5 5; -4 1 1]) + D = sparse_matrix(ZZ, [1 5 3; 5 5 5; -4 1 1]) r = @inferred rand_row(D) @test any(isequal(r), D.rows) # Change of ring - R = residue_ring(FlintZZ, 5)[1] - D = sparse_matrix(FlintZZ, [1 5 3; 5 5 5; -4 1 1]) + R = residue_ring(ZZ, 5)[1] + D = sparse_matrix(ZZ, [1 5 3; 5 5 5; -4 1 1]) D_R = @inferred change_base_ring(R, D) @test D_R == sparse_matrix(R, map(R, [1 0 3; 0 0 0; 1 1 1])) # Transpose - D = sparse_matrix(FlintZZ, [1 5 3; 0 0 0; 0 1 0]) + D = sparse_matrix(ZZ, [1 5 3; 0 0 0; 0 1 0]) Dt = @inferred transpose(D) - @test Dt == sparse_matrix(FlintZZ, [1 0 0; 5 0 1; 3 0 0]) + @test Dt == sparse_matrix(ZZ, [1 0 0; 5 0 1; 3 0 0]) @test Dt == transpose(D) # Iterator interface - D = sparse_matrix(FlintZZ, [1 5 3; 0 0 0; 0 1 0]) + D = sparse_matrix(ZZ, [1 5 3; 0 0 0; 0 1 0]) @test D.rows == [ r for r in D] @test D.rows == @inferred collect(D) # Multiplications - D = sparse_matrix(FlintZZ, [1 5 3; 0 0 0; 0 1 0]) + D = sparse_matrix(ZZ, [1 5 3; 0 0 0; 0 1 0]) v = ZZRingElem[1, 2, 3] w = @inferred D * v @test w == ZZRingElem[20, 0, 2] @@ -148,51 +148,51 @@ using Hecke.SparseArrays w = @inferred D * view(v, 2:4, :) @test w == ZZRingElem[1 2 23; 0 0 0; 0 0 4] - v = matrix(FlintZZ, ZZRingElem[1 2 3; 0 0 4; 0 0 0]) + v = matrix(ZZ, ZZRingElem[1 2 3; 0 0 4; 0 0 0]) w = @inferred D * v - @test w == matrix(FlintZZ, ZZRingElem[1 2 23; 0 0 0; 0 0 4]) + @test w == matrix(ZZ, ZZRingElem[1 2 23; 0 0 0; 0 0 4]) - v = sparse_row(FlintZZ, [2], ZZRingElem[1]) + v = sparse_row(ZZ, [2], ZZRingElem[1]) w = @inferred v * D - @test w == sparse_row(FlintZZ) + @test w == sparse_row(ZZ) # Addition - D = sparse_matrix(FlintZZ, [1 5 3; 0 0 0; 0 1 0]) - E = sparse_matrix(FlintZZ, [0 0 0; 1 0 1; 0 0 1]) + D = sparse_matrix(ZZ, [1 5 3; 0 0 0; 0 1 0]) + E = sparse_matrix(ZZ, [0 0 0; 1 0 1; 0 0 1]) DplusE = @inferred D + E - @test DplusE == sparse_matrix(FlintZZ, [1 5 3; 1 0 1; 0 1 1]) + @test DplusE == sparse_matrix(ZZ, [1 5 3; 1 0 1; 0 1 1]) @test D + E == E + D # Subtraction - D = sparse_matrix(FlintZZ, [1 5 3; 0 1 0; 0 1 0]) - E = sparse_matrix(FlintZZ, [1 5 0; 1 0 1; 0 0 0]) + D = sparse_matrix(ZZ, [1 5 3; 0 1 0; 0 1 0]) + E = sparse_matrix(ZZ, [1 5 0; 1 0 1; 0 0 0]) DminusE = @inferred D - E - @test DminusE == sparse_matrix(FlintZZ, [0 0 3; -1 1 -1; 0 1 0]) + @test DminusE == sparse_matrix(ZZ, [0 0 3; -1 1 -1; 0 1 0]) minusD = @inferred -D - @test minusD == sparse_matrix(FlintZZ, [-1 -5 -3; 0 -1 0; 0 -1 0]) + @test minusD == sparse_matrix(ZZ, [-1 -5 -3; 0 -1 0; 0 -1 0]) # Scalar multiplication - D = sparse_matrix(FlintZZ, [1 5 3; 0 0 0; 0 1 0]) + D = sparse_matrix(ZZ, [1 5 3; 0 0 0; 0 1 0]) E = @inferred 0 * D - @test E == zero_matrix(SMat, FlintZZ, 3) - @test E == sparse_matrix(FlintZZ, 3, 3) + @test E == zero_matrix(SMat, ZZ, 3) + @test E == sparse_matrix(ZZ, 3, 3) E = @inferred D * 0 - @test E == zero_matrix(SMat, FlintZZ, 3) - @test E == sparse_matrix(FlintZZ, 3, 3) + @test E == zero_matrix(SMat, ZZ, 3) + @test E == sparse_matrix(ZZ, 3, 3) E = @inferred BigInt(2) * D - @test E == sparse_matrix(FlintZZ, [2 10 6; 0 0 0; 0 2 0]) + @test E == sparse_matrix(ZZ, [2 10 6; 0 0 0; 0 2 0]) E = @inferred D * BigInt(2) - @test E == sparse_matrix(FlintZZ, [2 10 6; 0 0 0; 0 2 0]) + @test E == sparse_matrix(ZZ, [2 10 6; 0 0 0; 0 2 0]) E = @inferred ZZRingElem(2) * D - @test E == sparse_matrix(FlintZZ, [2 10 6; 0 0 0; 0 2 0]) + @test E == sparse_matrix(ZZ, [2 10 6; 0 0 0; 0 2 0]) E = @inferred D * ZZRingElem(2) - @test E == sparse_matrix(FlintZZ, [2 10 6; 0 0 0; 0 2 0]) + @test E == sparse_matrix(ZZ, [2 10 6; 0 0 0; 0 2 0]) - R = residue_ring(FlintZZ, 6)[1] + R = residue_ring(ZZ, 6)[1] D = sparse_matrix(R, [1 2 2; 0 0 1; 2 2 2]) E = @inferred ZZRingElem(3) * D @test E == sparse_matrix(R, [3 0 0; 0 0 3; 0 0 0]) @@ -242,78 +242,78 @@ using Hecke.SparseArrays # Submatrix - D = sparse_matrix(FlintZZ, [1 5 3; 0 0 0; 0 1 0]) + D = sparse_matrix(ZZ, [1 5 3; 0 0 0; 0 1 0]) E = @inferred sub(D, 2:3, 2:3) - @test base_ring(E) == FlintZZ + @test base_ring(E) == ZZ @test nrows(E) == 2 @test ncols(E) == 2 - @test E == sparse_matrix(FlintZZ, [0 0; 1 0]) + @test E == sparse_matrix(ZZ, [0 0; 1 0]) # Vertical concatenation - D = sparse_matrix(FlintZZ, [1 5 3; 0 0 0; 0 1 0]) + D = sparse_matrix(ZZ, [1 5 3; 0 0 0; 0 1 0]) E = @inferred vcat(D, D) - @test base_ring(E) == FlintZZ + @test base_ring(E) == ZZ @test nrows(E) == 6 @test ncols(E) == 3 - @test E == sparse_matrix(FlintZZ, [1 5 3; 0 0 0; 0 1 0; + @test E == sparse_matrix(ZZ, [1 5 3; 0 0 0; 0 1 0; 1 5 3; 0 0 0; 0 1 0]) # Horizontal concatenation - D = sparse_matrix(FlintZZ, [1 5 3; 0 0 0; 0 1 0]) + D = sparse_matrix(ZZ, [1 5 3; 0 0 0; 0 1 0]) E = @inferred hcat(D, D) - @test base_ring(E) == FlintZZ + @test base_ring(E) == ZZ @test nrows(E) == 3 @test ncols(E) == 6 - @test E == sparse_matrix(FlintZZ, [1 5 3 1 5 3; 0 0 0 0 0 0; 0 1 0 0 1 0]) + @test E == sparse_matrix(ZZ, [1 5 3 1 5 3; 0 0 0 0 0 0; 0 1 0 0 1 0]) # Hadamard bound - D = sparse_matrix(FlintZZ, [1 5 3; 0 1 0; 0 1 0]) + D = sparse_matrix(ZZ, [1 5 3; 0 1 0; 0 1 0]) h = @inferred hadamard_bound2(D) @test h == ZZRingElem(35) # Maximum/minimum - D = sparse_matrix(FlintZZ, [1 5 3; 0 -10 0; 0 1 0]) + D = sparse_matrix(ZZ, [1 5 3; 0 -10 0; 0 1 0]) b = @inferred maximum(abs, D) @test b == ZZRingElem(10) - D = sparse_matrix(FlintQQ, [1 2 QQFieldElem(9, 4); 0 -10 0; 0 1 0]) + D = sparse_matrix(QQ, [1 2 QQFieldElem(9, 4); 0 -10 0; 0 1 0]) b = @inferred maximum(D) @test b == QQFieldElem(9, 4) b = @inferred minimum(D) @test b == QQFieldElem(-10) - D = sparse_matrix(FlintZZ, [0 2 0; 0 0 1; 0 0 0]) + D = sparse_matrix(ZZ, [0 2 0; 0 0 1; 0 0 0]) @test @inferred is_upper_triangular(D) - D = sparse_matrix(FlintZZ, [0 0 2; 0 0 1; 0 0 0]) + D = sparse_matrix(ZZ, [0 0 2; 0 0 1; 0 0 0]) @test !is_upper_triangular(D) - D = sparse_matrix(FlintZZ, [0 0 0; 0 0 0; 0 0 0]) + D = sparse_matrix(ZZ, [0 0 0; 0 0 0; 0 0 0]) @test @inferred is_upper_triangular(D) # Zero and identity matrix - D = @inferred identity_matrix(SMat, FlintZZ, 3) - @test D == sparse_matrix(FlintZZ, [1 0 0; 0 1 0; 0 0 1]); - D = @inferred zero_matrix(SMat, FlintZZ, 3) - @test D == sparse_matrix(FlintZZ, [0 0 0; 0 0 0; 0 0 0]); - @test D == sparse_matrix(FlintZZ, 3, 3) - D = @inferred zero_matrix(SMat, FlintZZ, 4, 3) - @test D == sparse_matrix(FlintZZ, [0 0 0; 0 0 0; 0 0 0; 0 0 0]); - @test D == sparse_matrix(FlintZZ, 4, 3) + D = @inferred identity_matrix(SMat, ZZ, 3) + @test D == sparse_matrix(ZZ, [1 0 0; 0 1 0; 0 0 1]); + D = @inferred zero_matrix(SMat, ZZ, 3) + @test D == sparse_matrix(ZZ, [0 0 0; 0 0 0; 0 0 0]); + @test D == sparse_matrix(ZZ, 3, 3) + D = @inferred zero_matrix(SMat, ZZ, 4, 3) + @test D == sparse_matrix(ZZ, [0 0 0; 0 0 0; 0 0 0; 0 0 0]); + @test D == sparse_matrix(ZZ, 4, 3) # Block diag matrix - D1 = sparse_matrix(FlintZZ, [1 5; 0 1]) - D2 = sparse_matrix(FlintZZ, [2 3 8; 4 0 0]) + D1 = sparse_matrix(ZZ, [1 5; 0 1]) + D2 = sparse_matrix(ZZ, [2 3 8; 4 0 0]) D = @inferred block_diagonal_matrix([D1, D2]) - @test D == sparse_matrix(FlintZZ, [1 5 0 0 0; 0 1 0 0 0; 0 0 2 3 8; 0 0 4 0 0]) + @test D == sparse_matrix(ZZ, [1 5 0 0 0; 0 1 0 0 0; 0 0 2 3 8; 0 0 4 0 0]) D = @inferred diagonal_matrix([D1, D2]) - @test D == sparse_matrix(FlintZZ, [1 5 0 0 0; 0 1 0 0 0; 0 0 2 3 8; 0 0 4 0 0]) + @test D == sparse_matrix(ZZ, [1 5 0 0 0; 0 1 0 0 0; 0 0 2 3 8; 0 0 4 0 0]) D = @inferred diagonal_matrix(D1, D2) - @test D == sparse_matrix(FlintZZ, [1 5 0 0 0; 0 1 0 0 0; 0 0 2 3 8; 0 0 4 0 0]) + @test D == sparse_matrix(ZZ, [1 5 0 0 0; 0 1 0 0 0; 0 0 2 3 8; 0 0 4 0 0]) # Concatenation syntax - D = sparse_matrix(FlintZZ, [1 5 3; 0 -10 0; 0 1 0]) + D = sparse_matrix(ZZ, [1 5 3; 0 -10 0; 0 1 0]) E = [D D D] @test E == hcat(hcat(D, D), D) E = [D; D; D] @@ -321,31 +321,31 @@ using Hecke.SparseArrays # Is one - D = sparse_matrix(FlintZZ, [1 5 3; 0 -10 0; 0 1 0]) + D = sparse_matrix(ZZ, [1 5 3; 0 -10 0; 0 1 0]) b = @inferred isone(D) @test !b - D = sparse_matrix(FlintZZ, [1 0 0; 0 1 0; 0 0 1]) + D = sparse_matrix(ZZ, [1 0 0; 0 1 0; 0 0 1]) b = @inferred isone(D) @test b - D = sparse_matrix(FlintZZ, [1 0 0; 0 0 1; 0 1 0]) + D = sparse_matrix(ZZ, [1 0 0; 0 0 1; 0 1 0]) b = @inferred isone(D) @test !b - D = sparse_matrix(FlintZZ, [1 0 0; 0 1 0; 0 0 1; 0 0 0]) + D = sparse_matrix(ZZ, [1 0 0; 0 1 0; 0 0 1; 0 0 0]) b = @inferred isone(D) @test !b - D = sparse_matrix(FlintZZ, [0 0 0; 0 0 0]) + D = sparse_matrix(ZZ, [0 0 0; 0 0 0]) b = @inferred iszero(D) @test b - D = sparse_matrix(FlintZZ, [0 0 0; 0 0 1]) + D = sparse_matrix(ZZ, [0 0 0; 0 0 1]) b = @inferred iszero(D) @test !b - D = sparse_matrix(FlintZZ, [0 0 1; 0 0 0]) + D = sparse_matrix(ZZ, [0 0 1; 0 0 0]) b = @inferred iszero(D) @test !b # Conversion to julia types - D = sparse_matrix(FlintZZ, [1 5 3; 0 -10 0; 0 1 0]) + D = sparse_matrix(ZZ, [1 5 3; 0 -10 0; 0 1 0]) @test Matrix(D) == ZZRingElem[1 5 3; 0 -10 0; 0 1 0] @test Array(D) == ZZRingElem[1 5 3; 0 -10 0; 0 1 0] E = SparseArrays.sparse(D) @@ -353,8 +353,8 @@ using Hecke.SparseArrays @test Array(E) == ZZRingElem[1 5 3; 0 -10 0; 0 1 0] # kronecker_product - D1 = sparse_matrix(FlintZZ, [12 403 -23; 0 0 122; -1 2 99]) - D2 = sparse_matrix(FlintZZ, [81 0 2; 31 0 -5]) + D1 = sparse_matrix(ZZ, [12 403 -23; 0 0 122; -1 2 99]) + D2 = sparse_matrix(ZZ, [81 0 2; 31 0 -5]) E = @inferred kronecker_product(D1, D2) @test E == sparse_matrix(kronecker_product(matrix(D1), matrix(D2))) end @@ -372,13 +372,13 @@ end end @testset "Hecke #1227" begin - A = sparse_matrix(FlintZZ, [2 0; 0 0]) - @test kronecker_product(A, A) == sparse_matrix(FlintZZ, [4 0 0 0; 0 0 0 0; 0 0 0 0; 0 0 0 0]) + A = sparse_matrix(ZZ, [2 0; 0 0]) + @test kronecker_product(A, A) == sparse_matrix(ZZ, [4 0 0 0; 0 0 0 0; 0 0 0 0; 0 0 0 0]) end @testset "Hecke #1261" begin - D1 = sparse_matrix(FlintZZ, [3 0 4 0; 0 3 0 4; 0 0 2 0; 0 0 0 2]) - D2 = identity_matrix(SMat, FlintZZ, 2) + D1 = sparse_matrix(ZZ, [3 0 4 0; 0 3 0 4; 0 0 2 0; 0 0 0 2]) + D2 = identity_matrix(SMat, ZZ, 2) E = kronecker_product(D1, D2) @test E == sparse_matrix(kronecker_product(matrix(D1), matrix(D2))) end diff --git a/test/Sparse/Row.jl b/test/Sparse/Row.jl index 5b1e10f9be..d104b80cca 100644 --- a/test/Sparse/Row.jl +++ b/test/Sparse/Row.jl @@ -1,10 +1,10 @@ @testset "Row" begin - R = FlintZZ + R = ZZ S, _ = residue_ring(ZZ, 4) # Construction - A = @inferred sparse_row(FlintZZ) + A = @inferred sparse_row(ZZ) @test A isa SRow{ZZRingElem} @test A isa sparse_row_type(ZZRing) @@ -52,22 +52,22 @@ # Modular reduction for T in [Int, ZZRingElem] - G = sparse_row(FlintZZ, collect(1:5), map(ZZRingElem, collect(1:5))) + G = sparse_row(ZZ, collect(1:5), map(ZZRingElem, collect(1:5))) mod!(G, T(2)) - @test G == sparse_row(FlintZZ, [1, 3, 5], ZZRingElem[1, 1, 1]) + @test G == sparse_row(ZZ, [1, 3, 5], ZZRingElem[1, 1, 1]) - G = sparse_row(FlintZZ, collect(1:5), map(ZZRingElem, collect(1:5))) + G = sparse_row(ZZ, collect(1:5), map(ZZRingElem, collect(1:5))) mod_sym!(G, T(3)) - @test G == sparse_row(FlintZZ, [1, 2, 4, 5], ZZRingElem[1, -1, 1, -1]) + @test G == sparse_row(ZZ, [1, 2, 4, 5], ZZRingElem[1, -1, 1, -1]) end # Change ring - G = sparse_row(FlintZZ, collect(1:5), map(ZZRingElem, collect(1:5))) + G = sparse_row(ZZ, collect(1:5), map(ZZRingElem, collect(1:5))) f = x -> (x^2 - 4) H = @inferred map_entries(f, G) - @test H == sparse_row(FlintZZ, [1, 3, 4, 5], ZZRingElem[-3, 5, 12, 21]) + @test H == sparse_row(ZZ, [1, 3, 4, 5], ZZRingElem[-3, 5, 12, 21]) Rx, x = polynomial_ring(R, "x", cached = false) H = @inferred change_base_ring(Rx, G) @@ -80,33 +80,33 @@ # Dot product - A = sparse_row(FlintZZ, [1, 3, 5], ZZRingElem[1, 2, 3]) - B = sparse_row(FlintZZ, [3, 4, 6], ZZRingElem[10, 1, 1]) + A = sparse_row(ZZ, [1, 3, 5], ZZRingElem[1, 2, 3]) + B = sparse_row(ZZ, [3, 4, 6], ZZRingElem[10, 1, 1]) @test ZZRingElem(20) == @inferred dot(A, B) # Inplace scaling - A = sparse_row(FlintZZ, [1, 2, 4], ZZRingElem[1, 2, 3]) + A = sparse_row(ZZ, [1, 2, 4], ZZRingElem[1, 2, 3]) scale_row!(A, ZZRingElem(2)) B = sparse_row(S, [1, 3, 4], [1, 2, 3]) scale_row!(B, S(2)) - @test A == sparse_row(FlintZZ, [1, 2, 4], ZZRingElem[2, 4, 6]) + @test A == sparse_row(ZZ, [1, 2, 4], ZZRingElem[2, 4, 6]) @test B == sparse_row(S, [1, 4], [2, 2]) # Addition - A = sparse_row(FlintZZ, [1, 2, 3, 5], ZZRingElem[1, 2, 3, 5]) - B = sparse_row(FlintZZ, [2, 3, 4, 6], ZZRingElem[-2, 4, 3, 1]) - @test sparse_row(FlintZZ, [1, 3, 4, 5, 6], ZZRingElem[1, 7, 3, 5, 1]) == @inferred A + B + A = sparse_row(ZZ, [1, 2, 3, 5], ZZRingElem[1, 2, 3, 5]) + B = sparse_row(ZZ, [2, 3, 4, 6], ZZRingElem[-2, 4, 3, 1]) + @test sparse_row(ZZ, [1, 3, 4, 5, 6], ZZRingElem[1, 7, 3, 5, 1]) == @inferred A + B # Subtraction - A = sparse_row(FlintZZ, [1, 2, 3, 5], ZZRingElem[1, 2, 3, 5]) - B = sparse_row(FlintZZ, [2, 3, 4, 6], ZZRingElem[2, -4, -3, -1]) - @test sparse_row(FlintZZ, [1, 3, 4, 5, 6], ZZRingElem[1, 7, 3, 5, 1]) == @inferred A - B + A = sparse_row(ZZ, [1, 2, 3, 5], ZZRingElem[1, 2, 3, 5]) + B = sparse_row(ZZ, [2, 3, 4, 6], ZZRingElem[2, -4, -3, -1]) + @test sparse_row(ZZ, [1, 3, 4, 5, 6], ZZRingElem[1, 7, 3, 5, 1]) == @inferred A - B # Scalar multiplication - A = sparse_row(FlintZZ, [1, 2, 3, 5], ZZRingElem[2, 4, 8, 6]) + A = sparse_row(ZZ, [1, 2, 3, 5], ZZRingElem[2, 4, 8, 6]) for T in [Int, BigInt, ZZRingElem] b = T(2) B = @inferred b * A @@ -124,11 +124,11 @@ end # Elementary row operation - A = sparse_row(FlintZZ, [1, 2, 3, 5], ZZRingElem[1, 2, 3, 5]) - B = sparse_row(FlintZZ, [2, 3, 4, 6], ZZRingElem[-1, 4, 3, 1]) + A = sparse_row(ZZ, [1, 2, 3, 5], ZZRingElem[1, 2, 3, 5]) + B = sparse_row(ZZ, [2, 3, 4, 6], ZZRingElem[-1, 4, 3, 1]) C = add_scaled_row(B, A, ZZRingElem(2)) - @test C == sparse_row(FlintZZ, [1, 3, 4, 5, 6], ZZRingElem[1, 11, 6, 5, 2]) + @test C == sparse_row(ZZ, [1, 3, 4, 5, 6], ZZRingElem[1, 11, 6, 5, 2]) RR,_ = residue_ring(ZZ, 12) A = sparse_row(RR, [1,2,3,4,6,7], [4,1,1,2,1,4]) @@ -143,7 +143,7 @@ # Maximum - A = sparse_row(FlintZZ, [1, 2, 3, 5], ZZRingElem[-5, 2, 4, 10]) + A = sparse_row(ZZ, [1, 2, 3, 5], ZZRingElem[-5, 2, 4, 10]) @test 10 == @inferred maximum(A) # Minimum @@ -152,37 +152,37 @@ # Lifting - S = residue_ring(FlintZZ, 5)[1] + S = residue_ring(ZZ, 5)[1] A = sparse_row(S, [1, 2, 3, 5], [1, 1, 2, 3]) B = @inferred lift(A) @test sparse_row(R, [1, 2, 3, 5], [1, 1, 2, 3]) == B # 2-norm - A = sparse_row(FlintZZ, [1, 2, 3, 5], ZZRingElem[-5, 2, 4, 10]) + A = sparse_row(ZZ, [1, 2, 3, 5], ZZRingElem[-5, 2, 4, 10]) b = @inferred norm2(A) @test b == ZZRingElem(25 + 4 + 16 + 100) - S = residue_ring(FlintZZ, 5)[1] + S = residue_ring(ZZ, 5)[1] A = sparse_row(S, [1, 2, 3, 5], [1, 1, 2, 3]) b = @inferred norm2(A) @test b == R(0) # Maximum/minimum - A = sparse_row(FlintZZ, [1, 3, 4, 5], ZZRingElem[-5, 2, -10, 1]) + A = sparse_row(ZZ, [1, 3, 4, 5], ZZRingElem[-5, 2, -10, 1]) @test maximum(abs, A) == ZZRingElem(10) - B = sparse_row(FlintQQ, [1, 2, 4, 5], map(QQFieldElem, [1, 2, 9//4, 1])) + B = sparse_row(QQ, [1, 2, 4, 5], map(QQFieldElem, [1, 2, 9//4, 1])) @test maximum(B) == QQFieldElem(9, 4) - C = sparse_row(FlintZZ, [1, 2, 4, 5], ZZRingElem[-10, 100, 1, 1]) + C = sparse_row(ZZ, [1, 2, 4, 5], ZZRingElem[-10, 100, 1, 1]) @test minimum(C) == ZZRingElem(-10) # Conversion - A = sparse_row(FlintZZ, [1, 3, 4, 5], ZZRingElem[-5, 2, -10, 1]) + A = sparse_row(ZZ, [1, 3, 4, 5], ZZRingElem[-5, 2, -10, 1]) @test Vector(A, 3) == ZZRingElem[-5, 0, 2] @test Vector(A, 6) == ZZRingElem[-5, 0, 2, -10, 1, 0] - @test dense_row(A, 3) == matrix(FlintZZ, 1, 3, [-5, 0, 2]) - @test dense_row(A, 6) == matrix(FlintZZ, 1, 6, [-5, 0, 2, -10, 1, 0]) + @test dense_row(A, 3) == matrix(ZZ, 1, 3, [-5, 0, 2]) + @test dense_row(A, 6) == matrix(ZZ, 1, 6, [-5, 0, 2, -10, 1, 0]) @test sparse_row(dense_row(A, 6)) == A # SRow{NCRingElem} diff --git a/test/Sparse/Rref.jl b/test/Sparse/Rref.jl index abec265ebe..9b3999a6ef 100644 --- a/test/Sparse/Rref.jl +++ b/test/Sparse/Rref.jl @@ -1,5 +1,5 @@ @testset "Sparse rref" begin - M = sparse_matrix(zero_matrix(FlintQQ, 2, 2)) + M = sparse_matrix(zero_matrix(QQ, 2, 2)) @test rref(M) == (0, M) M = sparse_matrix(matrix(GF(5), 3, 3, [ 0, 1, 2, 0, 1, 3, 0, 0, 4 ])) @@ -8,7 +8,7 @@ for i in 1:10 r = 20 c = 10 - M = matrix(FlintQQ, rand([0,0,0,0,0,0,0,0,0,0,1], r, c)) + M = matrix(QQ, rand([0,0,0,0,0,0,0,0,0,0,1], r, c)) Ms = sparse_matrix(M) n, N = rref(M) ns, Ns = rref(Ms) @@ -18,8 +18,8 @@ end @testset "Sparse kernel" begin - M = sparse_matrix(zero_matrix(FlintQQ, 2, 2)) - @test nullspace(M) == (2, identity_matrix(FlintQQ, 2)) + M = sparse_matrix(zero_matrix(QQ, 2, 2)) + @test nullspace(M) == (2, identity_matrix(QQ, 2)) M = sparse_matrix(matrix(GF(5), 3, 3, [ 0, 1, 2, 0, 1, 3, 0, 0, 4 ])) @test nullspace(M) == (1, matrix(GF(5), 3, 1, [ 1, 0, 0 ])) @@ -29,7 +29,7 @@ end for i in 1:10 r = 10 c = 20 - M = matrix(FlintQQ, rand([0,0,0,0,0,0,0,0,0,0,1], r, c)) + M = matrix(QQ, rand([0,0,0,0,0,0,0,0,0,0,1], r, c)) @test kernel(sparse_matrix(M)) == kernel(M) end end diff --git a/test/Sparse/Solve.jl b/test/Sparse/Solve.jl index 34693a3b5c..c853cf3ab8 100644 --- a/test/Sparse/Solve.jl +++ b/test/Sparse/Solve.jl @@ -25,9 +25,9 @@ for i in 1:10 r = 10 c = 20 - M = matrix(FlintQQ, rand([0,0,0,0,0,0,0,0,0,0,1], r, c)) + M = matrix(QQ, rand([0,0,0,0,0,0,0,0,0,0,1], r, c)) Ms = sparse_matrix(M) - N = matrix(FlintQQ, rand([0,0,0,0,0,0,0,0,0,0,1], r, 2)) + N = matrix(QQ, rand([0,0,0,0,0,0,0,0,0,0,1], r, 2)) Ns = sparse_matrix(N) fl, sol = can_solve_with_solution(Ms, Ns, side = :right) @test fl == can_solve(Ms, Ns, side = :right) diff --git a/test/Sparse/Trafo.jl b/test/Sparse/Trafo.jl index 37bafab1ba..a7ad6228e3 100644 --- a/test/Sparse/Trafo.jl +++ b/test/Sparse/Trafo.jl @@ -1,5 +1,5 @@ @testset "Trafo" begin - A = matrix(FlintZZ, [0 1 0 0 0; + A = matrix(ZZ, [0 1 0 0 0; 0 0 4 0 0; 0 0 3 0 0; 0 0 0 4 0; @@ -11,7 +11,7 @@ T = @inferred Hecke.sparse_trafo_scale(2, ZZRingElem(-1)) @inferred Hecke.apply_left!(Asparse, T) - @test Asparse == sparse_matrix(FlintZZ, [0 1 0 0 0; + @test Asparse == sparse_matrix(ZZ, [0 1 0 0 0; 0 0 -4 0 0; 0 0 3 0 0; 0 0 0 4 0; @@ -27,7 +27,7 @@ T = @inferred Hecke.sparse_trafo_swap(ZZRingElem, 5, 4) @inferred Hecke.apply_left!(Asparse, T) - @test Asparse == sparse_matrix(FlintZZ, [0 1 0 0 0; + @test Asparse == sparse_matrix(ZZ, [0 1 0 0 0; 0 0 -4 0 0; 0 0 3 0 0; 5 0 0 0 0; @@ -43,7 +43,7 @@ T = @inferred Hecke.sparse_trafo_add_scaled(3, 2, ZZRingElem(2)) @inferred Hecke.apply_left!(Asparse, T) - @test Asparse == sparse_matrix(FlintZZ, [0 1 0 0 0; + @test Asparse == sparse_matrix(ZZ, [0 1 0 0 0; 0 0 2 0 0; 0 0 3 0 0; 5 0 0 0 0; @@ -60,7 +60,7 @@ T = @inferred Hecke.sparse_trafo_para_add_scaled(2, 3, ZZRingElem(2), ZZRingElem(-1), ZZRingElem(3), ZZRingElem(-2)) @inferred Hecke.apply_left!(Asparse, T) - @test Asparse == sparse_matrix(FlintZZ, [0 1 0 0 0; + @test Asparse == sparse_matrix(ZZ, [0 1 0 0 0; 0 0 1 0 0; 0 0 0 0 0; 5 0 0 0 0; @@ -74,18 +74,18 @@ v = ZZRingElem[1, -23, 14, 5, 4] - Asparse = sparse_matrix(FlintZZ, [1 1 0 0 0; + Asparse = sparse_matrix(ZZ, [1 1 0 0 0; 0 1 2 0 0; 0 0 1 2 1; 0 0 0 4 0; 0 0 0 0 1]) Asparsec = copy(Asparse) - B = matrix(FlintZZ, [1 2 5; 0 1 10; 0 0 -1]) + B = matrix(ZZ, [1 2 5; 0 1 10; 0 0 -1]) T = @inferred Hecke.sparse_trafo_partial_dense(3, 3:5, 3:5, B) @inferred Hecke.apply_left!(Asparse, T) - @test Asparse == sparse_matrix(FlintZZ, [1 1 0 0 0; + @test Asparse == sparse_matrix(ZZ, [1 1 0 0 0; 0 1 2 0 0; 0 0 1 10 6; 0 0 0 4 10; @@ -101,13 +101,13 @@ v = ZZRingElem[1, -23, 62, 85, 108] - Asparse = sparse_matrix(FlintZZ, [1 1 0 0 0; + Asparse = sparse_matrix(ZZ, [1 1 0 0 0; 0 0 0 0 0; 0 0 1 10 4; 0 0 4 28 10; 0 0 7 46 16]) - Bsparse = sparse_matrix(FlintZZ, [1 0 0 1 0; + Bsparse = sparse_matrix(ZZ, [1 0 0 1 0; 0 0 0 0 0; 0 10 1 0 4; 0 28 4 0 10; @@ -118,7 +118,7 @@ T = @inferred Hecke.sparse_trafo_move_row(ZZRingElem, 2, 5) @inferred Hecke.apply_left!(Asparse, T) - @test Asparse == sparse_matrix(FlintZZ, [1 1 0 0 0; + @test Asparse == sparse_matrix(ZZ, [1 1 0 0 0; 0 0 1 10 4; 0 0 4 28 10; 0 0 7 46 16; From b085401e58e5b52bcb26240c22d4904e58a5600e Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Sat, 9 Nov 2024 23:09:50 +0100 Subject: [PATCH 39/51] feat: add some assertion and comment (#1679) --- src/AlgAssAbsOrd/PIP/unit_group_generators.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/AlgAssAbsOrd/PIP/unit_group_generators.jl b/src/AlgAssAbsOrd/PIP/unit_group_generators.jl index bc9b052783..52a42598b0 100644 --- a/src/AlgAssAbsOrd/PIP/unit_group_generators.jl +++ b/src/AlgAssAbsOrd/PIP/unit_group_generators.jl @@ -133,6 +133,10 @@ function _SLn_generators(OK, n) end end + # The generating set must contain 1 + # Make sure that this holds + @assert one(OK) in B + for i in 1:n for j in 1:n if j == i From 0299a8d4f900bde4bfe7bb50cd714e251a0f20a5 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 11 Nov 2024 19:17:36 +0100 Subject: [PATCH 40/51] Remove strange checkbounds method (#1680) It seems to be unused --- src/Hecke.jl | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Hecke.jl b/src/Hecke.jl index c451bae7dc..324a9b2d55 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -567,9 +567,6 @@ mutable struct NotImplemented <: Exception end Base.showerror(io::IO, ::NotImplemented) = print(io, """Not implemented (yet).""") -# what is this function doing here? -function checkbounds(a::Int, b::Int) nothing; end; - ################################################################################ ################################################################################ From 5341ab1b0c558d951e279a0a47e0a127b7ab435b Mon Sep 17 00:00:00 2001 From: Claus Fieker Date: Tue, 12 Nov 2024 08:30:07 +0100 Subject: [PATCH 41/51] Mult dep2 (#1673) * add test * include * move into 'proper' position * fix index problem, returned too many elementary divisors Try elementary_divisors(sparse_matrix(identity_matrix(ZZ, 2))) without will give 3 EDs, the last one being 0 * update MultDep - it seems to be working "fine" now. Needs further work on the Ge stuff and some of the internal interface are bad. Example k, a = wildanger_field(5,13); zk = lll(maximal_order(k)) class_group(zk) h = zk.__attrs[:ClassGrpCtx] r = vcat(h.R_gen, h.R_rel); r = [x for x = r if isa(x, AbsSimpleNumFieldElem)] q = Main.MultDep.syzygies(r) Then the rows of q are the relations * reduce exponents * I hate lin. alg. * deal with 0 properly in lift * add mult. group * add stub to multiplicative group --- examples/MultDep.jl | 369 --------------------- src/Hecke.jl | 1 + src/LocalField/Conjugates.jl | 3 + src/Map/NfOrd.jl | 1 + src/NumField/NfAbs.jl | 1 + src/NumField/NfAbs/MultDep.jl | 607 ++++++++++++++++++++++++++++++++++ src/Sparse/UpperTriangular.jl | 2 +- test/NumField/NfAbs/NfAbs.jl | 17 + 8 files changed, 631 insertions(+), 370 deletions(-) delete mode 100644 examples/MultDep.jl create mode 100644 src/NumField/NfAbs/MultDep.jl diff --git a/examples/MultDep.jl b/examples/MultDep.jl deleted file mode 100644 index 149064a45e..0000000000 --- a/examples/MultDep.jl +++ /dev/null @@ -1,369 +0,0 @@ -module MultDep - -using Hecke -import Base.* - -function multiplicative_group_mod_units_fac_elem(A::Vector{AbsSimpleNumFieldElem}; use_max_ord::Bool = false) - k = parent(A[1]) - @assert all(i->parent(i) === k, A) - if use_max_ord - zk = maximal_order(k) - cp = coprime_base(A, zk) - else - cp = coprime_base(A) - end - sort!(cp, lt = (a,b) -> norm(a) > norm(b)) - M = sparse_matrix(ZZ) - for a = A - T = Tuple{Int, ZZRingElem}[] - for i = 1:length(cp) - p = cp[i] - v = valuation(a, p) - if v != 0 - push!(T, (i, ZZRingElem(v))) - end -# isone(I) && break - end - push!(M, sparse_row(ZZ, T)) - end - h, t = Hecke.hnf_kannan_bachem(M, Val(true), truncate = true) - return h, t, cp -end - -function units(h::SMat, t, b::Vector{AbsSimpleNumFieldElem}) - u = FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}[] - for i=nrows(h)+1:length(b) - k = [ZZRingElem(0) for i=b] - k[i] = 1 - for i in length(t):-1:1 - Hecke.apply_right!(k, t[i]) - end - push!(u, FacElem(b, k)) - end - return u -end - -function unit_group_mod_torsion_fac_elem(O::AbsNumFieldOrder, u::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}}) - U = Hecke._unit_group_init(O) - s = signature(O) - r = s[1] + s[2] - 1 - for y = u - is_tors, p = is_torsion_unit(y, false, U.tors_prec) - U.tors_prec = max(p, U.tors_prec) - if is_tors - continue - end - Hecke._add_unit(U, y) - if length(U.units) >= r - break - end - end - if length(U.units) < r - # maybe use pAdic stuff here... - error("not complete yet") - end - - U.full_rank = true - - U.units = Hecke.reduce(U.units, U.tors_prec) - - for y = u - is_tors, p = is_torsion_unit(y, false, U.tors_prec) - U.tors_prec = max(p, U.tors_prec) - if is_tors - continue - end - x = Hecke.reduce_mod_units([y], U)[1] - is_tors, p = is_torsion_unit(x, false, U.tors_prec) - U.tors_prec = max(p, U.tors_prec) - if is_tors - continue - end - Hecke._add_dependent_unit(U, x) - end - return U -end - -function *(O1::AbsNumFieldOrder, O2::AbsNumFieldOrder) - k = nf(O1) - @assert k === nf(O2) - b1 = basis(O1, k) - n = length(b1) - b2 = basis(O2, k) - p = [x*y for (x,y) in Base.Iterators.ProductIterator((b1, b2))] - d = reduce(lcm, [denominator(x) for x = p]) - M = zero_matrix(ZZ, n*n, n) - z = ZZRingElem() - for i = 1:n*n - a = p[i]*d - Hecke.elem_to_mat_row!(M, i, z, a) - end - h = hnf(M) - b = AbsSimpleNumFieldElem[] - for i=1:n - push!(b, Hecke.elem_from_mat_row(k, h, i, d)) - end - return Hecke.Order(k, b) -end - -mutable struct GeIdeal - a::AbsNumFieldOrderIdeal - function GeIdeal(a::AbsNumFieldOrderIdeal) - o =order(a) - if o.is_maximal == 1 - return new(a) - end - #keep track of known maximality and use this to speed things up - o = ring_of_multipliers(a) - if o === order(a) - return new(a) - else - return new(extend(a, o)) - end - end - function GeIdeal(a::AbsSimpleNumFieldElem) - o = Hecke.any_order(parent(a)) - d = denominator(a, o) - return new(o(a*d)*o), new(o(d)*o) - end -end - -import Hecke.gcd, Hecke.isone, Hecke.*, Hecke.gcd_into!, Hecke.copy, Hecke.divexact, - Hecke.is_unit, Hecke.coprime_base, Hecke.valuation - -function make_compatible!(a::GeIdeal, b::GeIdeal) - o1 = order(a.a) - o2 = order(b.a) - if o1 === o2 - return - end - o = o1*o2 - a.a = extend(a.a, o) - b.a = extend(b.a, o) -end - -#is_unit, divexact, gcd, isone, *, gcd_into!, copy -isone(a::GeIdeal) = isone(a.a) -is_unit(a::GeIdeal) = isone(a) -copy(a::GeIdeal) = GeIdeal(a.a) - -function gcd(a::GeIdeal, b::GeIdeal) - make_compatible!(a, b) - return GeIdeal(a.a + b.a) -end - -function gcd_into!(a::GeIdeal, b::GeIdeal, c::GeIdeal) - make_compatible!(b, c) - a.a = b.a + c.a - return a -end - -function *(a::GeIdeal, b::GeIdeal) - make_compatible!(a, b) - return GeIdeal(a.a * b.a) -end - -function divexact(a::GeIdeal, b::GeIdeal; check::Bool=true) - make_compatible!(a, b) - return GeIdeal(divexact(a.a, b.a; check=check)) -end - -Hecke.norm(a::GeIdeal) = norm(a.a) - -function coprime_base(A::Vector{AbsSimpleNumFieldElem}) - c = Vector{GeIdeal}() - for a = A - n,d = GeIdeal(a) - isone(n) || push!(c, n) - isone(d) || push!(c, d) - end - return coprime_base(c) -end - -function coprime_base(A::Vector{AbsSimpleNumFieldElem}, O::AbsNumFieldOrder) - c = Vector{AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}}() - for a = A - n,d = integral_split(a*O) - isone(n) || push!(c, n) - isone(d) || push!(c, d) - end - return coprime_base(c) -end - - -function valuation(a::AbsSimpleNumFieldElem, p::GeIdeal) - return valuation(a, p.a) -end - - -function mult_syzygies_units(A::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}}) - p = next_prime(100) - K = base_ring(parent(A[1])) - m = maximum(degree, keys(factor(GF(p), K.pol).fac)) - while m > 4 - p = next_prime(p) - m = maximum(degree, keys(factor(GF(p), K.pol).fac)) - end - #experimentally, the runtime is dominated by log - u = FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}[] - prec = 10 - - r1, r2 = signature(K) - r = r1+r2 -1 - n = degree(K) - C = qAdicConj(K, p) - la = matrix(conjugates_log(A[1], C, prec, all = false, flat = true))' - lu = zero_matrix(base_ring(la), 0, n) - uu = [] - for a = A - while true - @vtime :qAdic 1 la = matrix(conjugates_log(a, C, prec, all = false, flat = true))' - if iszero(la) - @vtime :qAdic 1 @hassert :qAdic 1 verify_gamma([a], [ZZRingElem(1)], ZZRingElem(p)^prec) - @vprint :qAdic 1 println("torsion found") - break - end - lv = vcat(lu, la) - #check_precision and change - if false && any(x->precision(x) < prec, lv) - println("loss of precision - not sure what to do") - for i=1:rows(lv) - for j = cols(lv) #seems to not do anything - lv[i, j] = setprecision(lv[i, j], min_p) - @assert precision(lv[i,j]) == min_p - end - end - end - @vtime :qAdic 1 k = kernel(lv, side = :left) - @assert nrows(k) < 2 - if nrows(k) == 0 - println("new ") - push!(u, a) - lu = vcat(lu, la) - @assert length(u) <= r - else # length == 1 extend the module - s = QQFieldElem[] - for x in k[1, :] - @vtime :qAdic 1 y = lift_reco(QQ, x, reco = true) - if y === nothing - prec *= 2 - @vprint :qAdic 1 "increase prec to ", prec - lu = matrix([conjugates_log(x, C, prec, all = false, flat = true) for x = u])' - break - end - push!(s, y) - end - if length(s) < ncols(k) - continue - end - d = reduce(lcm, map(denominator, s)) - gamma = ZZRingElem[ZZ(x*d)::ZZRingElem for x = s] - @assert reduce(gcd, gamma) == 1 # should be a primitive relation - @time if !verify_gamma(push!(copy(u), a), gamma, ZZRingElem(p)^prec) - prec *= 2 - @vprint :qAdic 1 "increase prec to ", prec - lu = matrix([conjugates_log(x, C, prec, all = false, flat = true) for x = u])' - continue - end - @assert length(gamma) == length(u)+1 - gamma = vcat(gamma[1:length(u)], [0 for i=length(u)+1:r+length(uu)], [gamma[end]]) - push!(uu, (a, gamma)) - end - break - end - end - #= - let u_1, .., u_n be units and - has rank s and - r_i in Z^n be such that - prod u_i^r_i = 1 (OK, sum of the logs is zero) - rank = s as well - so the r_i form a Q-basis for the relations. - Essentially, the gamma of above are the r_i - Let [H|0] = [r_i|i]*T be the hnf with trafo, so T in Gl(n, Z) - Then - = <[u_i|i] T> - [r_i|i] * [u_i|i]^t = 0 (by construction) - [r_i|i] T inv(T) [u[i] | i] = 0 - [H | 0] [v_i | i] = 0 - so, since H is triangular(!!) v_1, ... v_n-s = 0 - and = - - for the case of n=s+1 this is mostly the "normal" construction. - Note: as a side, the relations do not have to be primitive. - If they are, (and n=s+1), then H = 1 - =# - - for i=1:length(uu)-1 - append!(uu[i][2], zeros(ZZ, length(uu[end][2])-length(uu[i][2]))) - end - if length(uu) == 0 - U = matrix(ZZ, length(uu), length(uu[end][2]), reduce(vcat, [x[2] for x = uu])) - else - U = matrix(ZZ, length(uu), length(uu[end][2]), reduce(vcat, [x[2] for x = uu])) - end - _, U = hnf_with_transform(U') - if false - U = inv(U) - V = sub(U, 1:rows(U), 1:cols(U)-length(u)) - U = sub(U, 1:rows(U), cols(U)-length(u)+1:cols(U)) - #U can be reduced modulo V... - Z = zero_matrix(ZZ, cols(V), cols(U)) - I = identity_matrix(ZZ, cols(U)) * p^(2*prec) - k = base_ring(A[1]) - A = [ Z V'; I U'] - l = lll(A) - U = sub(l, cols(V)+1:rows(l), cols(U)+1:cols(l)) - U = lll(U) - else - U = lll(U') - end - return Hecke._transform(vcat(u, FacElem{AbsSimpleNumFieldElem,AbsSimpleNumField}[FacElem(k(1)) for i=length(u)+1:r], [x[1] for x = uu]), U') -end - -function verify_gamma(a::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}}, g::Vector{ZZRingElem}, v::ZZRingElem) - #knowing that sum g[i] log(a[i]) == 0 mod v, prove that prod a[i]^g[i] is - #torsion - #= I claim N(1-a) > v^n for n the field degree: - Let K be one of the p-adic fields involved, set b = a^g - then log(K(b)) = 0 (v = p^l) by assumption - so val(log(K(b))) >= l, but - val(X) = 1/deg(K) val(norm(X)) for p-adics - This is true for all completions involved, and sum degrees is n - =# - - t = prod([a[i]^g[i] for i=1:length(a)]) - # t is either 1 or 1-t is large, norm(1-t) is div. by p^ln - #in this case T2(1-t) is large, by the arguments above: T2>= (np^l)^2=:B - # and, see the bottom, \|Log()\|_2^2 >= 1/4 arcosh((B-2)/2)^2 - B = ArbField(nbits(v)*2)(v)^2 - B = 1/2 *acosh((B-2)/2)^2 - p = Hecke.upper_bound(log(B)/log(parent(B)(2)), ZZRingElem) - @vprint :qAdic 1 "using", p, nbits(v)*2 - b = conjugates_arb_log(t, max(-Int(div(p, 2)), 2)) -# @show B , sum(x*x for x = b), is_torsion_unit(t)[1] - @hassert :qAdic 1 (B > sum(x*x for x = b)) == is_torsion_unit(t)[1] - return B > sum(x*x for x = b) -end - -function lift_reco(::QQField, a::PadicFieldElem; reco::Bool = false) - if reco - u, v, N = getUnit(a) - R = parent(a) - fl, c, d = rational_reconstruction(u, prime(R, N-v)) - !fl && return nothing - - x = QQ(c, d) - if v < 0 - return x//prime(R, -v) - else - return x*prime(R, v) - end - else - return lift(QQ, a) - end -end - -Hecke.number_of_rows(A::Matrix{T}) where {T} = size(A)[1] -Hecke.number_of_columns(A::Matrix{T}) where {T} = size(A)[2] - diff --git a/src/Hecke.jl b/src/Hecke.jl index 324a9b2d55..133fc4ecc2 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -579,6 +579,7 @@ Base.showerror(io::IO, ::NotImplemented) = # - The Hecke.MPolyFactor submodule wants to extend it, but is loaded earlier # - Introduce the function here, to make everyone happy function is_absolutely_irreducible end +function multiplicative_group end ################################################################################ # diff --git a/src/LocalField/Conjugates.jl b/src/LocalField/Conjugates.jl index a734eecf06..6b231d1a79 100644 --- a/src/LocalField/Conjugates.jl +++ b/src/LocalField/Conjugates.jl @@ -269,6 +269,9 @@ end function conjugates_log(a::FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}, C::qAdicConj, n::Int = 10; all::Bool = false, flat::Bool = true) first = true local res::Vector{QadicFieldElem} + if length(a.fac) == 0 + res = conjugates_log(one(base_ring(parent(a))), C, n, flat = false, all = false) + end for (k, v) = a.fac try y = conjugates_log(k, C, n, flat = false, all = false) diff --git a/src/Map/NfOrd.jl b/src/Map/NfOrd.jl index 5d01396592..021f35fbc1 100644 --- a/src/Map/NfOrd.jl +++ b/src/Map/NfOrd.jl @@ -1087,6 +1087,7 @@ function image(mF::NfToGFMor_easy, a::FacElem{AbsSimpleNumFieldElem, AbsSimpleNu p = mF.defining_pol q = one(Fq) t = mF.t + quo = gcd(quo, order(Fq)-1) for (k, v) = a.fac vv = v if quo != 0 diff --git a/src/NumField/NfAbs.jl b/src/NumField/NfAbs.jl index 4aa2f43f60..93f456e9b3 100644 --- a/src/NumField/NfAbs.jl +++ b/src/NumField/NfAbs.jl @@ -21,3 +21,4 @@ include("NfAbs/MPolyFactor.jl") include("NfAbs/MPolyAbsFact.jl") include("NfAbs/ConjugatesNS.jl") include("NfAbs/Cyclotomic.jl") +include("NfAbs/MultDep.jl") diff --git a/src/NumField/NfAbs/MultDep.jl b/src/NumField/NfAbs/MultDep.jl new file mode 100644 index 0000000000..ceb5af9003 --- /dev/null +++ b/src/NumField/NfAbs/MultDep.jl @@ -0,0 +1,607 @@ +module MultDep + +using Hecke +import Base.* + +""" +Given A[i] elements in K, find matrices I and U s.th. +A^I is a basis for + /Units < K^*/Units +actually a sub-group of the S-unit group for a coprime base +generated from the elements in A. + +A^U is a generating set for the relations: + < Units +and every u s.th. A^u is a unit is in the span of U + +The coprime base is returned as well, the columns of I correspond to the +ordeing of the base. +""" +function syzygies_sunits_mod_units(A::Vector{AbsSimpleNumFieldElem}; use_ge::Bool = false, max_ord::Union{Nothing, AbsSimpleNumFieldOrder}=nothing) + k = parent(A[1]) + @assert all(i->parent(i) === k, A) + if !use_ge + if max_ord === nothing + zk = maximal_order(k) + else + zk = max_ord + end + cp = coprime_base(A, zk) + else + cp = coprime_base(A) + end + sort!(cp, lt = (a,b) -> norm(a) > norm(b)) + M = sparse_matrix(FlintZZ) + for a = A + T = Tuple{Int, ZZRingElem}[] + for i = 1:length(cp) + p = cp[i] + v = valuation(a, p) + if v != 0 + push!(T, (i, ZZRingElem(v))) + end +# isone(I) && break + end + push!(M, sparse_row(FlintZZ, T)) + end + h, t = Hecke.hnf_with_transform(matrix(M)) + h = h[1:rank(h), :] + return t[1:nrows(h), :], t[nrows(h)+1:end, :], cp + # THINK! do we want or not... + # - M is naturally sparse, hence it makes sense + # - for this application we need all units, hence the complete + # kernel - which is huge and dense... + # - cp seems to not be used for anything afterwards. + # It will be when we actually create the group, in the DiscLog + h, t = Hecke.hnf_kannan_bachem(M, Val(true), truncate = true) + return h, t, cp +end + +#= +function units(h::SMat, t, b::Vector{AbsSimpleNumFieldElem}) + u = FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}[] + for i=nrows(h)+1:length(b) + k = [ZZRingElem(0) for i=b] + k[i] = 1 + for i in length(t):-1:1 + Hecke.apply_right!(k, t[i]) + end + push!(u, FacElem(b, k)) + end + return u +end +=# + +#= For Ge's PhD + - smallest common overorder (non-coprime case) + - ideals in non-maximal orders with checking if the operation + worked - if not automatically redoing with larger order +=# +function *(O1::AbsNumFieldOrder, O2::AbsNumFieldOrder) + k = number_field(O1) + @assert k === number_field(O2) + b1 = basis(O1, k) + n = length(b1) + b2 = basis(O2, k) + p = [x*y for (x,y) in Base.Iterators.ProductIterator((b1, b2))] + d = reduce(lcm, [denominator(x) for x = p]) + M = zero_matrix(FlintZZ, n*n, n) + z = ZZRingElem() + for i = 1:n*n + a = p[i]*d + Hecke.elem_to_mat_row!(M, i, z, a) + end + h = hnf(M) + b = AbsSimpleNumFieldElem[] + for i=1:n + push!(b, Hecke.elem_from_mat_row(k, h, i, d)) + end + return Hecke.Order(k, b) +end + +mutable struct GeIdeal + a::AbsNumFieldOrderIdeal + function GeIdeal(a::AbsNumFieldOrderIdeal) + o =order(a) + if o.is_maximal == 1 + return new(a) + end + #keep track of known maximality and use this to speed things up + o = ring_of_multipliers(a) + if o === order(a) + return new(a) + else + return new(extend(a, o)) + end + end + function GeIdeal(a::AbsSimpleNumFieldElem) + o = Hecke.any_order(parent(a)) + d = denominator(a, o) + return new(o(a*d)*o), new(o(d)*o) + end +end + +import Hecke.gcd, Hecke.isone, Hecke.*, Hecke.gcd_into!, Hecke.copy, Hecke.divexact, + Hecke.is_unit, Hecke.coprime_base, Hecke.valuation + +function make_compatible!(a::GeIdeal, b::GeIdeal) + o1 = order(a.a) + o2 = order(b.a) + if o1 === o2 + return + end + o = o1*o2 + a.a = extend(a.a, o) + b.a = extend(b.a, o) +end + +#is_unit, divexact, gcd, isone, *, gcd_into!, copy +isone(a::GeIdeal) = isone(a.a) +is_unit(a::GeIdeal) = isone(a) +copy(a::GeIdeal) = GeIdeal(a.a) + +function gcd(a::GeIdeal, b::GeIdeal) + make_compatible!(a, b) + return GeIdeal(a.a + b.a) +end + +function gcd_into!(a::GeIdeal, b::GeIdeal, c::GeIdeal) + make_compatible!(b, c) + a.a = b.a + c.a + return a +end + +function *(a::GeIdeal, b::GeIdeal) + make_compatible!(a, b) + return GeIdeal(a.a * b.a) +end + +function divexact(a::GeIdeal, b::GeIdeal; check::Bool=true) + make_compatible!(a, b) + return GeIdeal(divexact(a.a, b.a; check=check)) +end + +Hecke.norm(a::GeIdeal) = norm(a.a) +#XXX: not sure if those 2 should get "exported", Ge does not seem to be +# overly fast.... +#TODO: do an integer coprime base first, then refine. Possibly also do +# a p-maximality for all p from the integer coprime base. +#TODO: find examples where Ge is useful +function coprime_base(A::Vector{AbsSimpleNumFieldElem}) + c = Vector{GeIdeal}() + for a = A + n,d = GeIdeal(a) + isone(n) || push!(c, n) + isone(d) || push!(c, d) + end + return Hecke.AbstractAlgebra.coprime_base_steel(c) +end + +function coprime_base(A::Vector{AbsSimpleNumFieldElem}, O::AbsNumFieldOrder) + c = Vector{AbsNumFieldOrderIdeal{AbsSimpleNumField, AbsSimpleNumFieldElem}}() + for a = A + n,d = integral_split(a*O) + isone(n) || push!(c, n) + isone(d) || push!(c, d) + end + return coprime_base(c) +end + + +function valuation(a::AbsSimpleNumFieldElem, p::GeIdeal) + return valuation(a, p.a) +end + +#TODO: don't use Gram Schidt over Q, use reals. If M is LLL, then +# a low precision should be OK +#TODO: an interface to reduce several v +#TODO: a sane implementation that is more memory friendly (views, ...) +""" +reduce the rows of v modulo the lattice spanned by the rows of M. +M should be LLL reduced. +""" +function size_reduce(M::ZZMatrix, v::ZZMatrix) + s = gram_schmidt_orthogonalisation(QQ.(transpose(M))) + d = diagonal(transpose(s)*s) + for i=1:nrows(v) + for j=nrows(M):-1:1 + x = ZZ(round((v[i:i, :]* s[:, j:j]/d[j])[1,1])) + v[i:i, :] -= x*M[j:j, :] + end + end + return v +end + +""" +A a vector of units in fac-elem form. Find matrices U and V s.th. +A^U is a basis for /Tor +and +A^V is a generating system for the relations of A in Units/Tor + +The pAdic Ctx is returned as well +""" +function syzygies_units_mod_tor(A::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}}) + p = next_prime(100) + K = base_ring(parent(A[1])) + m = maximum(degree, keys(factor(GF(p), K.pol).fac)) + while m > 4 + p = next_prime(p) + m = maximum(degree, keys(factor(GF(p), K.pol).fac)) + end + #experimentally, the runtime is dominated by log + u = FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}[] + prec = 10 + + r1, r2 = signature(K) + r = r1+r2 -1 + n = degree(K) + C = Hecke.qAdicConj(K, p) + la = transpose(matrix(conjugates_log(A[1], C, prec, all = false, flat = true))) + lu = zero_matrix(base_ring(la), 0, n) + uu = [] + indep = Int[] + dep = Int[] + for ia = 1:length(A) + a = A[ia] + while true + @vtime :qAdic 1 la = transpose(matrix(conjugates_log(a, C, prec, all = false, flat = true))) + if iszero(la) + @vtime :qAdic 1 @hassert :qAdic 1 verify_gamma([a], [ZZRingElem(1)], ZZRingElem(p)^prec) + @vprint :qAdic 1 println("torsion found") + gamma = vcat([ZZ(0) for i=1:r+length(uu)], [ZZ(1)]) + push!(uu, (a, gamma)) + push!(dep, ia) + break + end + lv = vcat(lu, la) + #check_precision and change + if false && any(x->precision(x) < prec, lv) + println("loss of precision - not sure what to do") + for i=1:rows(lv) + for j = cols(lv) #seems to not do anything + lv[i, j] = setprecision(lv[i, j], min_p) + @assert precision(lv[i,j]) == min_p + end + end + end + @vtime :qAdic 1 k = kernel(lv, side = :left) + @assert nrows(k) < 2 + if nrows(k) == 0 + @vprint :qAdic 1 "new independent unit found\n" + push!(u, a) + push!(indep, ia) + lu = vcat(lu, la) + @assert length(u) <= r + else # length == 1 extend the module + @vprint :qAdic 1 "dependent unit found, looking for relation\n" + s = QQFieldElem[] + for x in k[1, :] + @vtime :qAdic 1 y = lift_reco(FlintQQ, x, reco = true) + if y === nothing + prec *= 2 + @vprint :qAdic 1 "increase prec to ", prec + lu = transpose(matrix([conjugates_log(x, C, prec, all = false, flat = true) for x = u])) + break + end + push!(s, y) + end + if length(s) < ncols(k) + continue + end + d = reduce(lcm, map(denominator, s)) + gamma = ZZRingElem[FlintZZ(x*d)::ZZRingElem for x = s] + @assert reduce(gcd, gamma) == 1 # should be a primitive relation + if !verify_gamma(push!(copy(u), a), gamma, ZZRingElem(p)^prec) + prec *= 2 + @vprint :qAdic 1 "increase prec to ", prec + lu = transpose(matrix([conjugates_log(x, C, prec, all = false, flat = true) for x = u])) + continue + end + @assert length(gamma) == length(u)+1 + gamma = vcat(gamma[1:length(u)], [0 for i=length(u)+1:r+length(uu)], [gamma[end]]) + push!(uu, (a, gamma)) + push!(dep, ia) + end + break + end + end + #= + let u_1, .., u_n be units and + has rank s and + r_i in Z^n be such that + prod u_i^r_i = 1 (OK, sum of the logs is zero) + rank = s as well #wrong: + #Input: u^2, u^3, u^7 in rank r = 2 + #U = [-3 0 2 0; -7 0 0 2] + the r_i form a Q-generating basis for the relations. + They are indep as they are growing in length (new columns per new element, non + are torsion, so the final non-zero entries are moving right.) + Essentially, the gamma of above are the r_i + Let [H|0] = [r_i|i]*T be the hnf with trafo, so T in Gl(n, Z) + Then + = <[u_i|i] T> + [r_i|i] * [u_i|i]^t = 0 (by construction) + [r_i|i] T inv(T) [u[i] | i] = 0 + Careful! H may not have full rank, hence the shape is different + [H | 0] [v_i | i] = 0 + so, since H is triangular(!!) v_1, ... v_n-s = 0 + and = + + for the case of n=s+1 this is mostly the "normal" construction. + Note: as a side, the relations do not have to be primitive. + If they are, (and n=s+1), then H = 1 + We deal with that by saturation + =# + + for i=1:length(uu)-1 + append!(uu[i][2], zeros(FlintZZ, length(uu[end][2])-length(uu[i][2]))) + end + if length(uu) == 0 #all torsion + return [], A + else + U = matrix(FlintZZ, length(uu), length(uu[end][2]), reduce(vcat, [x[2] for x = uu])) + U = hcat(U[:, 1:length(u)], U[:, r+1:ncols(U)]) + end + + U = saturate(U) + + _, U = hnf_with_transform(transpose(U)) + + k = base_ring(A[1]) + + U = inv(U) + V = sub(U, 1:nrows(U), 1:ncols(U)-length(u)) #the torsion part + U = sub(U, 1:nrows(U), ncols(U)-length(u)+1:ncols(U)) + #U can be reduced modulo V... + V = lll(transpose(V)) + U = size_reduce(V, transpose(U)) + U = lll(U) + + #so basis is A[indep] cat A[dep] ^U + #rels: A[tor], .. * V + nt = zero_matrix(ZZ, length(A), length(A)) + for i=1:length(indep) + nt[i, indep[i]] = 1 + end + for i=1:length(dep) + nt[i+length(indep), dep[i]] = 1 + end +# @assert nt*matrix([collect(1:length(A))]) == matrix([vcat(indep, dep)]) + rel = V*nt + return U*nt, rel, C +end + + +function verify_gamma(a::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}}, g::Vector{ZZRingElem}, v::ZZRingElem) + #knowing that sum g[i] log(a[i]) == 0 mod v, prove that prod a[i]^g[i] is + #torsion + #= I claim N(1-a) > v^n for n the field degree: + Let K be one of the p-adic fields involved, set b = a^g + then log(K(b)) = 0 (v = p^l) by assumption + so val(log(K(b))) >= l, but + val(X) = 1/deg(K) val(norm(X)) for p-adics + This is true for all completions involved, and sum degrees is n + =# + + t = prod([a[i]^g[i] for i=1:length(a)]) + # t is either 1 or 1-t is large, norm(1-t) is div. by p^ln + #in this case T2(1-t) is large, by the arguments above: T2>= (np^l)^2=:B + # and, see the bottom, \|Log()\|_2^2 >= 1/4 arcosh((B-2)/2)^2 + B = ArbField(nbits(v)*2)(v)^2 + B = 1/2 *acosh((B-2)/2)^2 + p = Hecke.upper_bound(ZZRingElem, log(B)/log(parent(B)(2))) + @vprint :qAdic 1 "using", p, nbits(v)*2 + b = conjugates_arb_log(t, max(-Int(div(p, 2)), 2)) +# @show B , sum(x*x for x = b), is_torsion_unit(t)[1] + @hassert :qAdic 1 (B > sum(x*x for x = b)) == is_torsion_unit(t)[1] + return B > sum(x*x for x = b) +end + +""" +A padic number a is internally written as + p^v*u +for a unit u given in some precision. +This returns u, v and the precision +""" +function canonical_split(a::PadicFieldElem) + u = ZZ() + ccall((:fmpz_set, Hecke.libflint), Nothing, (Ref{ZZRingElem}, Ref{Int}), u, a.u) + return u, a.v, a.N +end + +#TODO: different name ... +function lift_reco(::QQField, a::PadicFieldElem; reco::Bool = false) + if iszero(a) + return QQ(0) + end + if reco + u, v, N = canonical_split(a) + R = parent(a) + fl, c, d = rational_reconstruction(u, prime(R, N-v)) + !fl && return nothing + + x = FlintQQ(c, d) + if v < 0 + return x//prime(R, -v) + else + return x*prime(R, v) + end + else + return lift(QQ, a) + end +end + +""" +Given torsion units A[i] in factored form, find a generator +for the group as well as a basis for the relations +""" +function syzygies_tor(A::Vector{FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}}) + K = base_ring(parent(A[1])) + bnd = Int(Hecke._torsion_group_order_divisor(K)) + #bnd is a multiple of the torsion in the field + #so any residue field where bnd divides q-1 can be used to find the + #relations, Tor is a subgroup of k^* in this case. + O = any_order(K) + #XXX: bad, but prime ideals in non-max orders seem a bit dodgy + # in particular extend_easy gives garbage + #= + k, a = wildanger_field(5,13); + O = any_order(k); + P = prime_ideals_over(O, 71)[1] + F, mF = residue_field(O, P) + mF(O(gen(k))) # => 25 + mmF = Hecke.extend_easy(mF, k); + mmF(gen(k)) # => 70 + degree(P) # => 0 + P.prim_elem # => 21 but should be a root... + =# + + O = maximal_order(K) + for p = PrimesSet(bnd, -1, bnd, 1) + if discriminant(O) % p == 0 + continue + end + P = prime_ideals_over(O, p)[1] + if degree(P) > 1 + continue + end + F, mF = Hecke.ResidueFieldSmallDegree1(O, P) + mF = Hecke.extend_easy(mF, K) + a = try + map(mF, A) + catch e + if isa(e, Hecke.BadPrime) + #if some element in the base of the fac elems is not a unit mod P + #use the next prime... + continue + end + rethrow(e) + end + U, mU = unit_group(F) + b = map(pseudo_inv(mU), a) + B = free_abelian_group(length(A)) + h = hom(B, U, b) + k, mk = kernel(h) + i, mi = image(h) + @assert ngens(i) == 1 + return preimage(h, mi(i[1])).coeff, vcat([mk(x).coeff for x = gens(k)]...), order(i[1]) + end +end + +@doc raw""" + syzygies(A::Vector{AbsSimpleNumFieldElem}) -> ZZMatrix + +Given non-zero elements A[i] in K, find a basis for the relations, returned + as a matrix. +""" +function syzygies(A::Vector{AbsSimpleNumFieldElem}; use_ge::Bool = false, max_ord::Union{Nothing, AbsSimpleNumFieldOrder} = nothing) + _, t, _ = syzygies_sunits_mod_units(A; use_ge, max_ord) + u = [FacElem(A, t[i, :]) for i = 1:nrows(t)] + _, tt = syzygies_units_mod_tor(u) + u = Hecke._transform(u, transpose(tt)) + _, ttt, _ = syzygies_tor(u) + return ttt*tt*t +end + +@doc raw""" + multiplicative_group(A::Vector{AbsSimpleNumFieldElem}) -> FinGenAbGroup, Map + +Return the subgroup of the multiplicative group of the number field generated +by the elements in `A` as an abstract abelian group together with a map +mapping group elements to number field elements and vice-versa. +""" +function Hecke.multiplicative_group(A::Vector{AbsSimpleNumFieldElem}; use_ge::Bool = false, max_ord::Union{Nothing, AbsSimpleNumFieldOrder} = nothing, task::Symbol = :all) + + S, T, cp = syzygies_sunits_mod_units(A; use_ge, max_ord) + u = [FacElem(A, T[i, :]) for i = 1:nrows(T)] + g1 = [FacElem(A, S[i, :]) for i = 1:nrows(S)] #gens for mult grp/ units + + U, T, C = syzygies_units_mod_tor(u) + g2 = Hecke._transform(u, transpose(U)) + u = Hecke._transform(u, transpose(T)) + + Ut, _, o = syzygies_tor(u) + + t = evaluate(Hecke._transform(u, transpose(Ut))[1]) + + G = abelian_group(vcat([0 for i=1:length(g1)+length(g2)], [o])) + g = vcat(g1, g2, [FacElem(t)]) + + function im(a::FinGenAbGroupElem) + @assert parent(a) == G + return prod(g[i]^a[i] for i = 1:length(g)) + end + + local log_mat::Union{Generic.MatSpaceElem{PadicFieldElem}, Nothing} = nothing + local prec::Int = 20 + local gamma::Vector{ZZRingElem} + + function pr(a::FacElem{AbsSimpleNumFieldElem, AbsSimpleNumField}) + @assert base_ring(parent(a)) == parent(A[1]) + c = ZZRingElem[] + for i=1:length(cp) + v = valuation(a, cp[i]) + push!(c, divexact(v, valuation(g1[i], cp[i]))) + a *= g1[i]^-c[end] + end + + if log_mat === nothing + log_mat = matrix([conjugates_log(x, C, prec, all = false, flat = true) for x = g2]) + end + while true + log_a = matrix([conjugates_log(a, C, prec, all = false, flat = true)]) + + lv = vcat(log_mat, log_a) + #check_precision and change + @vtime :qAdic 1 k = kernel(lv, side = :left) + + @assert nrows(k) < 2 + if nrows(k) == 0 + error("not in the image") + else # length == 1 extend the module + @vprint :qAdic 1 "looking for relation\n" + s = QQFieldElem[] + for x in k[1, :] + @vtime :qAdic 1 y = lift_reco(FlintQQ, x, reco = true) + if y === nothing + prec *= 2 + @vprint :qAdic 1 "increase prec to ", prec + log_mat = transpose(matrix([conjugates_log(x, C, prec, all = false, flat = true) for x = g2])) + break + end + push!(s, y) + end + if length(s) < ncols(k) + continue + end + d = reduce(lcm, map(denominator, s)) + gamma = ZZRingElem[FlintZZ(x*d)::ZZRingElem for x = s] + @assert reduce(gcd, gamma) == 1 # should be a primitive relation + if !verify_gamma(push!(copy(g2), a), gamma, prime(base_ring(log_mat), prec)) + prec *= 2 + @vprint :qAdic 1 "increase prec to ", prec + log_mat = transpose(matrix([conjugates_log(x, C, prec, all = false, flat = true) for x = g2])) + continue + end + @assert length(gamma) == length(g2)+1 + break + end + end + for i=1:length(gamma)-1 + push!(c, divexact(gamma[i], -gamma[end])) + end + _, _c, _ = syzygies_tor(typeof(a)[g[end], a*prod(g2[i]^-gamma[i] for i=1:length(gamma)-1)]) + + push!(c, divexact(_c[1,1], _c[1,2])) + return G(c) + end + return G, MapFromFunc(G, parent(g1[1]), im, pr) +end + +export syzygies + +end + +using .MultDep + + diff --git a/src/Sparse/UpperTriangular.jl b/src/Sparse/UpperTriangular.jl index 830ff289d4..889c65d955 100644 --- a/src/Sparse/UpperTriangular.jl +++ b/src/Sparse/UpperTriangular.jl @@ -92,7 +92,7 @@ function elementary_divisors(A::SMat{ZZRingElem}) e[i] *= p^v[i] end end - for i = length(e):min(nrows(A), ncols(A)) + for i = length(e)+1:min(nrows(A), ncols(A)) push!(e, ZZRingElem(0)) end return e diff --git a/test/NumField/NfAbs/NfAbs.jl b/test/NumField/NfAbs/NfAbs.jl index d26f13ed9d..08d8840dc3 100644 --- a/test/NumField/NfAbs/NfAbs.jl +++ b/test/NumField/NfAbs/NfAbs.jl @@ -85,3 +85,20 @@ end @test !is_normal(K) @test length(automorphism_list(K)) == 2 end + + +@testset "NumField/NfAbs/MultDep" begin + k, a = wildanger_field(5,13; cached = false); + zk = lll(maximal_order(k)) + class_group(zk) + h = zk.__attrs[:ClassGrpCtx] + r = vcat(h.R_gen, h.R_rel); + r = [x for x = r if isa(x, AbsSimpleNumFieldElem)] + q = Hecke.syzygies(r) + @test all(isone, evaluate(FacElem(r, q[i, :])) for i=1:nrows(q)) + + U, mU = Hecke.multiplicative_group(r) + @test preimage(mU, mU(U[2])) == U[2] +end + + From ad39e8f34d8cfdc934b38032b33a9ad868330bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Wed, 13 Nov 2024 12:34:04 +0100 Subject: [PATCH 42/51] Add mutating arithmetic for `SRow`s (#1659) * Make `scale_row!` follow its docstring i.e. don't throw on zero scalars, and coerce scalars if needed * Fix a docstring typo * Let `add_scaled_row` coerce the scalar * Add mutating arithmetics for SRow * Skip deepcopy in addmul! in case of aliasing * Add `submul!` * Add tests * Some fixes (tests run now) * Comment out tests * Adapt to AA changes * Bump AbstractAlgebra compat --- Project.toml | 2 +- src/Sparse/Row.jl | 184 +++++++++++++++++++++++++++++++++++++++----- src/Sparse/ZZRow.jl | 4 +- test/Sparse/Row.jl | 36 +++++++++ 4 files changed, 205 insertions(+), 21 deletions(-) diff --git a/Project.toml b/Project.toml index c15a66b789..326f904601 100644 --- a/Project.toml +++ b/Project.toml @@ -28,7 +28,7 @@ GAPExt = "GAP" PolymakeExt = "Polymake" [compat] -AbstractAlgebra = "^0.43.1" +AbstractAlgebra = "^0.43.10" Dates = "1.6" Distributed = "1.6" GAP = "0.9.6, 0.10, 0.11, 0.12" diff --git a/src/Sparse/Row.jl b/src/Sparse/Row.jl index 96c4eb82d0..653ba87d2c 100644 --- a/src/Sparse/Row.jl +++ b/src/Sparse/Row.jl @@ -105,6 +105,14 @@ function Base.empty!(A::SRow) return A end +function Base.empty(A::SRow) + return sparse_row(base_ring(A)) +end + +function zero(A::SRow) + return empty(A) +end + function swap!(A::SRow, B::SRow) A.pos, B.pos = B.pos, A.pos A.values, B.values = B.values, A.values @@ -447,6 +455,7 @@ end # Inplace scaling # ################################################################################ + @doc raw""" scale_row!(a::SRow, b::NCRingElem) -> SRow @@ -454,8 +463,9 @@ Returns the (left) product of $b \times a$ and reassigns the value of $a$ to thi For rows, the standard multiplication is from the left. """ function scale_row!(a::SRow{T}, b::T) where T - @assert !iszero(b) - if isone(b) + if iszero(b) + return empty!(a) + elseif isone(b) return a end i = 1 @@ -465,20 +475,23 @@ function scale_row!(a::SRow{T}, b::T) where T deleteat!(a.values, i) deleteat!(a.pos, i) else - i += 1 + i += 1 end end return a end +scale_row!(a::SRow, b) = scale_row!(a, base_ring(a)(b)) + @doc raw""" scale_row_right!(a::SRow, b::NCRingElem) -> SRow Returns the (right) product of $a \times b$ and modifies $a$ to this product. """ function scale_row_right!(a::SRow{T}, b::T) where T - @assert !iszero(b) - if isone(b) + if iszero(b) + return empty!(a) + elseif isone(b) return a end i = 1 @@ -488,16 +501,20 @@ function scale_row_right!(a::SRow{T}, b::T) where T deleteat!(a.values, i) deleteat!(a.pos, i) else - i += 1 + i += 1 end end return a end +scale_row_right!(a::SRow, b) = scale_row_right!(a, base_ring(a)(b)) + function scale_row_left!(a::SRow{T}, b::T) where T return scale_row!(a,b) end +scale_row_left!(a::SRow, b) = scale_row_left!(a, base_ring(a)(b)) + ################################################################################ # # Addition @@ -506,9 +523,9 @@ end function +(A::SRow{T}, B::SRow{T}) where T if length(A.values) == 0 - return B + return deepcopy(B) elseif length(B.values) == 0 - return A + return deepcopy(A) end return add_scaled_row(A, B, one(base_ring(A))) end @@ -516,12 +533,12 @@ end function -(A::SRow{T}, B::SRow{T}) where T if length(A) == 0 if length(B) == 0 - return A + return deepcopy(A) else - return add_scaled_row(B, A, base_ring(B)(-1)) + return add_scaled_row(B, A, -1) end end - return add_scaled_row(B, A, base_ring(A)(-1)) + return add_scaled_row(B, A, -1) end function -(A::SRow{T}) where {T} @@ -683,10 +700,10 @@ end Returns the row $c A + B$. """ -add_scaled_row(a::SRow{T}, b::SRow{T}, c::T) where {T} = add_scaled_row!(a, deepcopy(b), c) +add_scaled_row(a::SRow{T}, b::SRow{T}, c) where {T} = add_scaled_row!(a, deepcopy(b), c) -add_left_scaled_row(a::SRow{T}, b::SRow{T}, c::T) where {T} = add_left_scaled_row!(a, deepcopy(b), c) -add_right_scaled_row(a::SRow{T}, b::SRow{T}, c::T) where {T} = add_right_scaled_row!(a, deepcopy(b), c) +add_left_scaled_row(a::SRow{T}, b::SRow{T}, c) where {T} = add_left_scaled_row!(a, deepcopy(b), c) +add_right_scaled_row(a::SRow{T}, b::SRow{T}, c) where {T} = add_right_scaled_row!(a, deepcopy(b), c) @@ -696,7 +713,9 @@ add_right_scaled_row(a::SRow{T}, b::SRow{T}, c::T) where {T} = add_right_scaled_ Adds the left scaled row $c A$ to $B$. """ function add_scaled_row!(a::SRow{T}, b::SRow{T}, c::T, ::Val{left_side} = Val(true)) where {T, left_side} - @assert a !== b + if a === b + a = deepcopy(a) + end i = 1 j = 1 t = base_ring(a)() @@ -735,17 +754,144 @@ function add_scaled_row!(a::SRow{T}, b::SRow{T}, c::T, ::Val{left_side} = Val(tr return b end +add_scaled_row!(a::SRow{T}, b::SRow{T}, c) where {T} = add_scaled_row!(a, b, base_ring(a)(c)) + +add_scaled_row!(a::SRow{T}, b::SRow{T}, c, side::Val) where {T} = add_scaled_row!(a, b, base_ring(a)(c), side) + # ignore tmp argument -add_scaled_row!(a::SRow{T}, b::SRow{T}, c::T, tmp::SRow{T}) where T = add_scaled_row!(a, b, c) +add_scaled_row!(a::SRow{T}, b::SRow{T}, c, tmp::SRow{T}) where T = add_scaled_row!(a, b, c) -add_left_scaled_row!(a::SRow{T}, b::SRow{T}, c::T) where T = add_scaled_row!(a, b, c) +add_left_scaled_row!(a::SRow{T}, b::SRow{T}, c) where T = add_scaled_row!(a, b, c) @doc raw""" add_right_scaled_row!(A::SRow{T}, B::SRow{T}, c::T) -> SRow{T} -Return the right scaled row $c A$ to $B$ by changing $B$ in place. +Return the right scaled row $A c$ to $B$ by changing $B$ in place. """ -add_right_scaled_row!(a::SRow{T}, b::SRow{T}, c::T) where T = add_scaled_row!(a, b, c, Val(false)) +add_right_scaled_row!(a::SRow{T}, b::SRow{T}, c) where T = add_scaled_row!(a, b, c, Val(false)) + + +################################################################################ +# +# Mutating arithmetics +# +################################################################################ + +function zero!(z::SRow) + return empty!(z) +end + +function neg!(z::SRow{T}, x::SRow{T}) where T + if z === x + return neg!(x) + end + swap!(z, -x) + return z +end + +function neg!(z::SRow) + for i in 1:length(z) + z.values[i] = neg!(z.values[i]) + end + return z +end + +function add!(z::SRow{T}, x::SRow{T}, y::SRow{T}) where T + if z === x + return add!(x, y) + elseif z === y + return add!(y, x) + end + swap!(z, x + y) + return z +end + +function add!(z::SRow{T}, x::SRow{T}) where T + if z === x + return scale_row!(z, 2) + end + return add_scaled_row!(x, z, one(base_ring(x))) +end + +function sub!(z::SRow{T}, x::SRow{T}, y::SRow{T}) where T + if z === x + return sub!(x, y) + elseif z === y + return neg!(sub!(y, x)) + end + swap!(z, x - y) + return z +end + +function sub!(z::SRow{T}, x::SRow{T}) where T + if z === x + return empty!(z) + end + return add_scaled_row!(x, z, -1) +end + +function mul!(z::SRow{T}, x::SRow{T}, y::SRow{T}) where T + error("Not implemented") +end + +function mul!(z::SRow{T}, x::SRow{T}, c) where T + if z === x + return scale_row_right!(x, c) + end + swap!(z, x * c) + return z +end + +function mul!(z::SRow{T}, c, y::SRow{T}) where T + if z === y + return scale_row_left!(y, c) + end + swap!(z, c * y) + return z +end + +function addmul!(z::SRow{T}, x::SRow{T}, y::SRow{T}) where T + error("Not implemented") +end + +function addmul!(z::SRow{T}, x::SRow{T}, y) where T + if z === x + return scale_row_right!(x, y+1) + end + return add_right_scaled_row!(x, z, y) +end + +function addmul!(z::SRow{T}, x, y::SRow{T}) where T + if z === x + return scale_row_left!(y, x+1) + end + return add_left_scaled_row!(y, z, x) +end + +function submul!(z::SRow{T}, x::SRow{T}, y::SRow{T}) where T + error("Not implemented") +end + +function submul!(z::SRow{T}, x::SRow{T}, y) where T + if z === x + return scale_row_right!(x, -y+1) + end + return add_right_scaled_row!(x, z, -y) +end + +function submul!(z::SRow{T}, x, y::SRow{T}) where T + if z === x + return scale_row_left!(y, -x+1) + end + return add_left_scaled_row!(y, z, -x) +end + + +# ignore temp variable +addmul!(z::SRow{T}, x::SRow{T}, y, t) where T = addmul!(z, x, y) +addmul!(z::SRow{T}, x, y::SRow{T}, t) where T = addmul!(z, x, y) +submul!(z::SRow{T}, x::SRow{T}, y, t) where T = submul!(z, x, y) +submul!(z::SRow{T}, x, y::SRow{T}, t) where T = submul!(z, x, y) ################################################################################ diff --git a/src/Sparse/ZZRow.jl b/src/Sparse/ZZRow.jl index d4cfc30f04..a9073f5a23 100644 --- a/src/Sparse/ZZRow.jl +++ b/src/Sparse/ZZRow.jl @@ -276,7 +276,6 @@ end function add_scaled_row(Ai::SRow{ZZRingElem}, Aj::SRow{ZZRingElem}, c::ZZRingElem, sr::SRow{ZZRingElem} = sparse_row(ZZ)) empty!(sr) - @assert c != 0 n = ZZRingElem() pi = 1 pj = 1 @@ -323,6 +322,9 @@ function add_scaled_row(Ai::SRow{ZZRingElem}, Aj::SRow{ZZRingElem}, c::ZZRingEle end function add_scaled_row!(Ai::SRow{ZZRingElem}, Aj::SRow{ZZRingElem}, c::ZZRingElem, sr::SRow{ZZRingElem} = sparse_row(ZZ)) + if iszero(c) + return Aj + end _t = sr sr = add_scaled_row(Ai, Aj, c, sr) @assert _t === sr diff --git a/test/Sparse/Row.jl b/test/Sparse/Row.jl index d104b80cca..14c3fb12bf 100644 --- a/test/Sparse/Row.jl +++ b/test/Sparse/Row.jl @@ -204,4 +204,40 @@ B = sparse_row(F,[1],[y]) C = add_scaled_row(A,B,F(1)) @test C == A+B + + # mutating arithmetic + randcoeff() = begin + n = rand((1,1,1,2,5,7,15)) + return rand(-2^n:2^n) + end + Main.equality(A::SRow, B::SRow) = A == B + @testset "mutating arithmetic; R = $R" for R in (ZZ, QQ) + for _ in 1:10 + maxind_A = rand(0:10) + inds_A = Hecke.Random.randsubseq(1:maxind_A, rand()) + vals_A = elem_type(R)[R(rand((-1, 1)) * rand(1:10)) for _ in 1:length(inds_A)] + A = sparse_row(R, inds_A, vals_A) + + maxind_B = rand(0:10) + inds_B = Hecke.Random.randsubseq(1:maxind_B, rand()) + vals_B = elem_type(R)[R(rand((-1, 1)) * rand(1:10)) for _ in 1:length(inds_B)] + B = sparse_row(R, inds_B, vals_B) + + test_mutating_op_like_zero(zero, zero!, A) + + test_mutating_op_like_neg(-, neg!, A) + + test_mutating_op_like_add(+, add!, A, B) + test_mutating_op_like_add(-, sub!, A, B) + test_mutating_op_like_add(*, mul!, A, randcoeff(), SRow) + test_mutating_op_like_add(*, mul!, randcoeff(), A, SRow) + test_mutating_op_like_add(*, mul!, A, ZZ(randcoeff()), SRow) + test_mutating_op_like_add(*, mul!, ZZ(randcoeff()), A, SRow) + + test_mutating_op_like_addmul((a, b, c) -> a + b*c, addmul!, A, B, randcoeff(), SRow) + test_mutating_op_like_addmul((a, b, c) -> a + b*c, addmul!, A, randcoeff(), B, SRow) + test_mutating_op_like_addmul((a, b, c) -> a - b*c, submul!, A, B, randcoeff(), SRow) + test_mutating_op_like_addmul((a, b, c) -> a - b*c, submul!, A, randcoeff(), B, SRow) + end + end end From 0d6625ae9a50846cce1264e7102c0b26dfee13ba Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Wed, 13 Nov 2024 16:20:35 +0100 Subject: [PATCH 43/51] [chore] tag 0.36.7 (#1683) --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 326f904601..2c8c4db264 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Hecke" uuid = "3e1990a7-5d81-5526-99ce-9ba3ff248f21" -version = "0.34.6" +version = "0.34.7" [deps] AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d" From 8532b39894901126063e6b090f85f5360bdd75df Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Mon, 18 Nov 2024 19:41:30 +0100 Subject: [PATCH 44/51] fix: don't use polynomial rings over zero rings (#1684) --- src/FunField/HessQR.jl | 2 ++ src/Misc/nmod_poly.jl | 3 +++ src/NumFieldOrd/NfOrd/Ideal/Ideal.jl | 7 ++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/FunField/HessQR.jl b/src/FunField/HessQR.jl index b5a0d86eca..b5d7d6e3ba 100644 --- a/src/FunField/HessQR.jl +++ b/src/FunField/HessQR.jl @@ -111,6 +111,8 @@ function expressify(a::HessQRElem; context = nothing) expressify(a.g, context = context))) end +Hecke.characteristic(::HessQR) = 0 + function Hecke.integral_split(a::Generic.RationalFunctionFieldElem{QQFieldElem}, S::HessQR) if iszero(a) return zero(S), one(S) diff --git a/src/Misc/nmod_poly.jl b/src/Misc/nmod_poly.jl index 510d979da6..5e3d9ad6e2 100644 --- a/src/Misc/nmod_poly.jl +++ b/src/Misc/nmod_poly.jl @@ -199,6 +199,9 @@ function resultant_ideal_pp(f::PolyRingElem{T}, g::PolyRingElem{T}) where T <: R s = gcd(lift(res), pn) if !isone(s) new_pn = divexact(pn, s) + if is_one(new_pn) + return zero(R) + end R1 = residue_ring(ZZ, S(new_pn), cached = false)[1] R1t = polynomial_ring(R1, "y", cached = false)[1] f2 = R1t(T[R1(lift(coeff(f, i))) for i = 0:degree(f)]) diff --git a/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl b/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl index 2399da4d0d..66cf12b241 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl @@ -1033,6 +1033,9 @@ function _minmod(a::ZZRingElem, b::AbsNumFieldOrderElem) end function _minmod_easy(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) + if is_one(a) + return a + end Zk = parent(b) k = number_field(Zk) if fits(Int, a) @@ -1053,6 +1056,9 @@ function _minmod_easy(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) end function _minmod_easy_pp(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) + if isone(a) + return one(a) + end Zk = parent(b) k = number_field(Zk) if fits(Int, a) @@ -1147,7 +1153,6 @@ end function _minmod_comp(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) - Zk = parent(b) k = number_field(Zk) acom, auncom = ppio(a, index(Zk)) From a67f89f3c006f18d2c37a9cd8e02eea040609a3e Mon Sep 17 00:00:00 2001 From: Erik Paemurru <143521159+paemurru@users.noreply.github.com> Date: Tue, 19 Nov 2024 16:42:36 +0100 Subject: [PATCH 45/51] Improve banner coloring (#1681) --- src/Hecke.jl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Hecke.jl b/src/Hecke.jl index 133fc4ecc2..1640b102c9 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -145,18 +145,18 @@ end global const maximal_order = MaximalOrder function _print_banner() - printstyled(raw""" _ _ _ """, color = :red) + printstyled(raw""" _ _ _ """, color = :red) println("") - printstyled(raw"""| | | | | | """, color = :red) - println("| Software package for") - printstyled(raw"""| |__| | ___ ___| | _____ """, color = :red) - println("| algorithmic algebraic number theory") - printstyled(raw"""| __ |/ _ \/ __| |/ / _ \ """, color = :red) - println("| ") - printstyled(raw"""| | | | __/ (__| < __/ """, color = :red) - println("| Manual: https://thofma.github.io/Hecke.jl") - printstyled(raw"""|_| |_|\___|\___|_|\_\___| """, color = :red) - print("| Version ") + printstyled(raw"""| | | | | | """, color = :red) + println(" | Software package for") + printstyled(raw"""| |__| | ___ ___| | _____ """, color = :red) + println(" | algorithmic algebraic number theory") + printstyled(raw"""| __ |/ _ \/ __| |/ / _ \\""", color = :red) + println(" | ") + printstyled(raw"""| | | | __/ (__| < __/""", color = :red) + println(" | Manual: https://thofma.github.io/Hecke.jl") + printstyled(raw"""|_| |_|\___|\___|_|\_\___|""", color = :red) + print(" | Version ") printstyled("$VERSION_NUMBER", color = :green) println() end From 1b69e3d8fc2528d51dbf341b6ab1023a9cee38e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Tue, 19 Nov 2024 17:34:51 +0100 Subject: [PATCH 46/51] fix: group algebras of additive groups with sparse rep (#1685) * fix: group algebra operation redirection * fix: order for finite dim group algebras with sparse rep * fix: construct group algebras for `AdditiveGroup` that is not `FinGenAbGroup` * fix: `is_commutative` for group algebras with sparse rep * Add test for additive group with sparse rep * fix: add warning to `StructureConstantAlgebra` constructor * fix: show for infinite dim group algebras * Add some printing tests * fix: unary minus for sparse group algebra elems --- src/AlgAss/AlgGrp.jl | 57 +++++++++++++++++++++++++++++++------------ src/AlgAss/Elem.jl | 8 ++++-- src/AlgAss/Types.jl | 8 ++---- test/AlgAss/AlgGrp.jl | 39 ++++++++++++++++++++++++++++- 4 files changed, 88 insertions(+), 24 deletions(-) diff --git a/src/AlgAss/AlgGrp.jl b/src/AlgAss/AlgGrp.jl index abeeaa10e4..f977a7675a 100644 --- a/src/AlgAss/AlgGrp.jl +++ b/src/AlgAss/AlgGrp.jl @@ -12,7 +12,7 @@ base_ring(A::GroupAlgebra{T}) where {T} = A.base_ring::parent_type(T) base_ring_type(::Type{GroupAlgebra{T, S, R}}) where {T, S, R} = parent_type(T) -Generic.dim(A::GroupAlgebra) = size(multiplication_table(A, copy = false), 1) +Generic.dim(A::GroupAlgebra) = order(Int, group(A)) elem_type(::Type{GroupAlgebra{T, S, R}}) where {T, S, R} = GroupAlgebraElem{T, GroupAlgebra{T, S, R}} @@ -55,11 +55,15 @@ end # get the underyling group operation, I wish this was part of the group interface _op(G::AbstractAlgebra.AdditiveGroup) = + - _op(G::Group) = * - _op(A::GroupAlgebra) = _op(group(A)) +_is_identity_elem(x::AbstractAlgebra.AdditiveGroupElem) = iszero(x) +_is_identity_elem(x::GroupElem) = isone(x) + +_identity_elem(G::AbstractAlgebra.AdditiveGroup) = zero(G) +_identity_elem(G::Group) = one(G) + ################################################################################ # # Construction @@ -81,12 +85,12 @@ Group algebra over rational field ``` """ -group_algebra(K::Ring, G; cached = true) = _group_algebra(K, G; op = *, cached) +group_algebra(K::Ring, G; cached = true) = _group_algebra(K, G; cached) # one additional level of indirection to hide the non-user facing options # `op` and `sparse`. -function _group_algebra(K::Ring, G; op = *, sparse = _use_sparse_group_algebra(G), cached::Bool = true) - A = GroupAlgebra(K, G; op = _op(G) , sparse = sparse, cached = cached) +function _group_algebra(K::Ring, G; op = _op(G), sparse = _use_sparse_group_algebra(G), cached::Bool = true) + A = GroupAlgebra(K, G; op = op , sparse = sparse, cached = cached) if !(K isa Field) return A end @@ -128,16 +132,26 @@ function is_commutative(A::GroupAlgebra) if is_commutative_known(A) return A.is_commutative == 1 end - for i in 1:dim(A) - for j in 1:dim(A) - if multiplication_table(A, copy = false)[i, j] != multiplication_table(A, copy = false)[j, i] - A.is_commutative = 2 - return false + if _is_sparse(A) + if is_abelian(group(A)) + A.is_commutative = 1 + return true + else + A.is_commutative = 2 + return false + end + else + for i in 1:dim(A) + for j in 1:dim(A) + if multiplication_table(A, copy = false)[i, j] != multiplication_table(A, copy = false)[j, i] + A.is_commutative = 2 + return false + end end end + A.is_commutative = 1 + return true end - A.is_commutative = 1 - return true end ################################################################################ @@ -157,9 +171,21 @@ end function show(io::IO, A::GroupAlgebra) if is_terse(io) - print(io, "Group algebra of dimension ", dim(A), " over ", base_ring(A)) + print(io, "Group algebra of ") + if is_finite(group(A)) + print(io, "dimension ", order(group(A))) + else + print(io, "infinite dimension ") + end + print(io, " over ", base_ring(A)) else - print(io, "Group algebra of group of order ", order(group(A)), " over ") + print(io, "Group algebra of group ") + if is_finite(group(A)) + print(io, "of order ", order(group(A))) + else + print(io, "of infinite order ") + end + print(io, "over ") print(terse(io), base_ring(A)) end end @@ -236,6 +262,7 @@ end ################################################################################ function StructureConstantAlgebra(A::GroupAlgebra{T, S, R}) where {T, S, R} + @req _is_dense(A) "StructureConstantAlgebra only works for dense group algebras" K = base_ring(A) mult = Array{T, 3}(undef, dim(A), dim(A), dim(A)) B = basis(A) diff --git a/src/AlgAss/Elem.jl b/src/AlgAss/Elem.jl index 46e8d75b69..6f7970a8a5 100644 --- a/src/AlgAss/Elem.jl +++ b/src/AlgAss/Elem.jl @@ -147,8 +147,12 @@ end ################################################################################ function -(a::AbstractAssociativeAlgebraElem{T}) where {T} - v = T[ -coefficients(a, copy = false)[i] for i = 1:dim(parent(a)) ] - return parent(a)(v) + if _is_sparse(a) + return parent(a)(-a.coeffs_sparse) + else + v = T[ -coefficients(a, copy = false)[i] for i = 1:dim(parent(a)) ] + return parent(a)(v) + end end ################################################################################ diff --git a/src/AlgAss/Types.jl b/src/AlgAss/Types.jl index 1da1e9a9a6..207ff9385a 100644 --- a/src/AlgAss/Types.jl +++ b/src/AlgAss/Types.jl @@ -186,11 +186,7 @@ end end if A.sparse - if G isa FinGenAbGroup - el = zero(G) - else - el = one(G) - end + el = _identity_elem(G) A.group_to_base[el] = 1 A.base_to_group[1] = el A.sparse_one = sparse_row(K, [1], [one(K)]) @@ -199,7 +195,7 @@ end A.mult_table = zeros(Int, d, d) i = 2 for g in collect(G) - if isone(g) + if _is_identity_elem(g) A.group_to_base[deepcopy(g)] = 1 A.base_to_group[1] = deepcopy(g) continue diff --git a/test/AlgAss/AlgGrp.jl b/test/AlgAss/AlgGrp.jl index 20c3dde96e..7ee39d22ca 100644 --- a/test/AlgAss/AlgGrp.jl +++ b/test/AlgAss/AlgGrp.jl @@ -1,7 +1,8 @@ @testset "Group algebras" begin G = small_group(8, 4) A = GroupAlgebra(QQ, G) - + @test sprint(show, MIME"text/plain"(), A) isa String + @test sprint(show, A) isa String @testset "Regular matrix algebra" begin B, BtoA = Hecke.regular_matrix_algebra(A) @@ -90,6 +91,10 @@ let G = SymmetricGroup(10) QG = Hecke._group_algebra(QQ, G; sparse = true, cached = false) + @test dim(QG) == factorial(10) + #@test !is_commutative(QG) # needs https://github.com/Nemocas/AbstractAlgebra.jl/pull/1907 + @test sprint(show, MIME"text/plain"(), QG) isa String + @test sprint(show, QG) isa String for i in 1:10 a = rand(G) b = rand(G) @@ -102,6 +107,38 @@ @test aa * bb == cc @test bb * aa == dd @test (aa + bb)^2 == QG(a)^2 + cc + dd + QG(b)^2 + @test aa - bb == aa + (-bb) + end + end + + let + G = abelian_group([2, 3, 5000]) + QG = Hecke._group_algebra(QQ, G; sparse = true, cached = false) + @test dim(QG) == 2 * 3 * 5000 + @test is_commutative(QG) + @test sprint(show, MIME"text/plain"(), QG) isa String + @test sprint(show, QG) isa String + for i in 1:10 + a = rand(G) + b = rand(G) + c = a + b + d = b + a + aa = QG(a) + bb = QG(b) + cc = QG(c) + dd = QG(d) + @test aa * bb == cc + @test bb * aa == dd + @test (aa + bb)^2 == QG(a)^2 + cc + dd + QG(b)^2 + @test aa - bb == aa + (-bb) end end + + let + G = abelian_group([2, 3, 0]) + QG = Hecke._group_algebra(QQ, G; sparse = true, cached = false) + @test is_commutative(QG) + @test sprint(show, MIME"text/plain"(), QG) isa String + @test sprint(show, QG) isa String + end end From 5b4309e251bd4ba72d7c48011d0dba6d30ee8efb Mon Sep 17 00:00:00 2001 From: Jens Brandt Date: Tue, 19 Nov 2024 13:47:19 +0100 Subject: [PATCH 47/51] fix misplaced bracket for maps --- src/Map/NumberField.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Map/NumberField.jl b/src/Map/NumberField.jl index 4bb356a380..789e94ee26 100644 --- a/src/Map/NumberField.jl +++ b/src/Map/NumberField.jl @@ -30,7 +30,7 @@ end is_injective(m::NumFieldHom) = true -is_surjective(m::NumFieldHom) = absolute_degree(domain(m) == absolute_degree(codomain(m))) +is_surjective(m::NumFieldHom) = absolute_degree(domain(m)) == absolute_degree(codomain(m)) is_bijective(m::NumFieldHom) = is_surjective(m) From b9aaec03cd9de719e2348cf568bdac36f6fdc84a Mon Sep 17 00:00:00 2001 From: Tobias Braun Date: Wed, 20 Nov 2024 22:42:20 +0100 Subject: [PATCH 48/51] Show method for pseudo-matrices modified (#1689) Added an output for pseudo-matrices with zero rows that --- src/NumFieldOrd/NfOrd/LinearAlgebra.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/NumFieldOrd/NfOrd/LinearAlgebra.jl b/src/NumFieldOrd/NfOrd/LinearAlgebra.jl index e9a595bed7..f313ff19a7 100644 --- a/src/NumFieldOrd/NfOrd/LinearAlgebra.jl +++ b/src/NumFieldOrd/NfOrd/LinearAlgebra.jl @@ -214,7 +214,9 @@ end function show(io::IO, P::PMat) compact = get(io, :compact, false) - if compact + if nrows(P.matrix) == 0 + print(io, "empty $(0) x $(ncols(P)) pseudo-matrix") + elseif compact for i in 1:nrows(P.matrix) i == 1 || print(io, "\n") print(io, "(") From 3f95a586efc2b6f5a61adef783646be3d480c92f Mon Sep 17 00:00:00 2001 From: Tobias Braun Date: Fri, 22 Nov 2024 22:14:56 +0100 Subject: [PATCH 49/51] is_empty for pseudo-matrices (#1691) * Show method for pseudo-matrices modified Added an output for pseudo-matrices with zero rows that * Added an 'is_empty' method for pseudo-matrices * Tests added for is_empty * Added test for printing --- src/NumFieldOrd/NfOrd/LinearAlgebra.jl | 9 +++++++++ test/NfOrd/LinearAlgebra.jl | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/NumFieldOrd/NfOrd/LinearAlgebra.jl b/src/NumFieldOrd/NfOrd/LinearAlgebra.jl index f313ff19a7..2ea8e08a64 100644 --- a/src/NumFieldOrd/NfOrd/LinearAlgebra.jl +++ b/src/NumFieldOrd/NfOrd/LinearAlgebra.jl @@ -2052,3 +2052,12 @@ function inv(x::Generic.MatSpaceElem{AbsSimpleNumFieldOrderElem}) K = nf(R) return change_base_ring(R, inv(change_base_ring(K, x))) end + +################################################################################ +# +# Emptiness check +# +################################################################################ + +is_empty(P::PMat) = is_empty(matrix(P)) + diff --git a/test/NfOrd/LinearAlgebra.jl b/test/NfOrd/LinearAlgebra.jl index c9c960e206..5bbe8a9f64 100644 --- a/test/NfOrd/LinearAlgebra.jl +++ b/test/NfOrd/LinearAlgebra.jl @@ -137,6 +137,31 @@ @test Hecke._in_span(map(K, [1, 2, 3, 4]), A)[1] @test Hecke._in_span(map(K, [5, 6, 7, 8]), A)[1] == false end + @testset "emptiness" begin + K, a = quadratic_field(-5) + O = maximal_order(K) + ide = fractional_ideal(O, one(O)) + pmat00 = pseudo_matrix(identity_matrix(K, 0), []) + pmat02 = pseudo_matrix(matrix(K, 0, 2, []), []) + pmat20 = pseudo_matrix(matrix(K, 2, 0, []), [ide, ide]) + pmat11 = pseudo_matrix(identity_matrix(K, 1), [ide]) + pmat23 = pseudo_matrix(matrix(K, 2, 3, [1, 2, 3, a, 2*a, 3*a]), [ide, ide]) + @test is_empty(pmat00) + @test is_empty(pmat02) + @test is_empty(pmat20) + @test !is_empty(pmat11) + @test !is_empty(pmat23) + @test isempty(pmat00) + @test isempty(pmat02) + @test isempty(pmat20) + @test !is_empty(pmat11) + @test !is_empty(pmat23) + + @test sprint(show, pmat00) isa String + @test sprint(show, pmat02) isa String + @test sprint(show, pmat20) isa String + + end end @testset "rand" begin From d92ea97c2efad1ecaf53602a340a3ab10fce8f21 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Sun, 24 Nov 2024 23:53:38 +0100 Subject: [PATCH 50/51] Bump to 0.34.8 (#1692) --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 2c8c4db264..a8ebbb7d33 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Hecke" uuid = "3e1990a7-5d81-5526-99ce-9ba3ff248f21" -version = "0.34.7" +version = "0.34.8" [deps] AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d" From 5d2ba17ad55ba322e8a96a0a0fe74416f6f2a3cd Mon Sep 17 00:00:00 2001 From: Erik Paemurru <143521159+paemurru@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:56:00 +0100 Subject: [PATCH 51/51] Remove copyright notices (#1682) --- src/EllCrv/EllCrv.jl | 30 ---------------- src/EllCrv/Finite.jl | 30 ---------------- src/EllCrv/Heights.jl | 30 ---------------- src/EllCrv/LocalData.jl | 30 ---------------- src/EllCrv/MinimalModels.jl | 30 ---------------- src/EllCrv/Misc.jl | 29 ---------------- src/EllCrv/Models.jl | 30 ---------------- src/EllCrv/Pairings.jl | 28 --------------- src/EllCrv/Periods.jl | 30 ---------------- src/EllCrv/Torsion.jl | 30 ---------------- src/GrpAb.jl | 28 --------------- src/GrpAb/Elem.jl | 28 --------------- src/GrpAb/GrpAbFinGen.jl | 28 --------------- src/GrpAb/Lattice.jl | 28 --------------- src/GrpAb/Map.jl | 28 --------------- src/GrpAb/SubgroupEnum.jl | 28 --------------- src/Hecke.jl | 34 ------------------- src/LinearAlgebra/LatEnum.jl | 32 ++--------------- src/Map/GrpAb.jl | 28 --------------- src/Map/NfRel.jl | 28 --------------- src/Misc/acb_root_ctx.jl | 28 --------------- src/Misc/arf.jl | 28 --------------- src/NumField/Hilbert.jl | 28 --------------- src/NumField/NfAbs/NonSimple.jl | 28 --------------- src/NumField/NfRel/NfRel.jl | 28 --------------- src/NumField/NfRel/NfRelNS.jl | 28 --------------- src/NumFieldOrd/NfOrd/Clgp.jl | 28 --------------- src/NumFieldOrd/NfOrd/Elem.jl | 28 --------------- src/NumFieldOrd/NfOrd/FacElem.jl | 28 --------------- src/NumFieldOrd/NfOrd/FactorBaseBound.jl | 28 --------------- src/NumFieldOrd/NfOrd/FracIdeal.jl | 28 --------------- src/NumFieldOrd/NfOrd/Hensel.jl | 28 --------------- src/NumFieldOrd/NfOrd/Ideal.jl | 28 --------------- src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl | 28 --------------- src/NumFieldOrd/NfOrd/Ideal/Ideal.jl | 28 --------------- src/NumFieldOrd/NfOrd/Ideal/Prime.jl | 28 --------------- .../NfOrd/MaxOrd/DedekindCriterion.jl | 28 --------------- src/NumFieldOrd/NfOrd/NfOrd.jl | 28 --------------- src/NumFieldOrd/NfOrd/ResidueRing.jl | 28 --------------- src/NumFieldOrd/NfOrd/TorsionUnits.jl | 28 --------------- src/NumFieldOrd/NfOrd/Unit.jl | 28 --------------- src/NumFieldOrd/NfOrd/Zeta.jl | 28 --------------- 42 files changed, 3 insertions(+), 1200 deletions(-) diff --git a/src/EllCrv/EllCrv.jl b/src/EllCrv/EllCrv.jl index b77f9899eb..264ba5cf96 100644 --- a/src/EllCrv/EllCrv.jl +++ b/src/EllCrv/EllCrv.jl @@ -2,36 +2,6 @@ # # EllipticCurve/EllipticCurve.jl : Elliptic curves over general fields # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# (C) 2016 Tommy Hofmann -# (C) 2016 Robin Ammon -# (C) 2016 Sofia Brenner -# (C) 2022 Jeroen Hanselman -# ################################################################################ ################################################################################ diff --git a/src/EllCrv/Finite.jl b/src/EllCrv/Finite.jl index 7b68ec1bbe..292352b9a1 100644 --- a/src/EllCrv/Finite.jl +++ b/src/EllCrv/Finite.jl @@ -2,36 +2,6 @@ # # EllipticCurve/Finite.jl : Elliptic curves over finite fields # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# (C) 2016 Tommy Hofmann -# (C) 2016 Robin Ammon -# (C) 2016 Sofia Brenner -# (C) 2022 Jeroen Hanselman -# ################################################################################ ################################################################################ diff --git a/src/EllCrv/Heights.jl b/src/EllCrv/Heights.jl index 5f61f5d8d7..8df3e11f53 100644 --- a/src/EllCrv/Heights.jl +++ b/src/EllCrv/Heights.jl @@ -2,36 +2,6 @@ # # EllipticCurve/Heights.jl : Height functions on elliptic curves # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# (C) 2016 Tommy Hofmann -# (C) 2016 Robin Ammon -# (C) 2016 Sofia Brenner -# (C) 2022 Jeroen Hanselman -# ################################################################################ ################################################################################ diff --git a/src/EllCrv/LocalData.jl b/src/EllCrv/LocalData.jl index f8272a0af9..7f7efd63cd 100644 --- a/src/EllCrv/LocalData.jl +++ b/src/EllCrv/LocalData.jl @@ -2,36 +2,6 @@ # # EllipticCurve/LocalData.jl : Computing local data for elliptic curves # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# (C) 2016 Tommy Hofmann -# (C) 2016 Robin Ammon -# (C) 2016 Sofia Brenner -# (C) 2022 Jeroen Hanselman -# ################################################################################ ################################################################################ diff --git a/src/EllCrv/MinimalModels.jl b/src/EllCrv/MinimalModels.jl index 18339cf37b..31f86e6841 100644 --- a/src/EllCrv/MinimalModels.jl +++ b/src/EllCrv/MinimalModels.jl @@ -2,36 +2,6 @@ # # EllipticCurve/MinimalModels.jl : Minimal models and global minimal models # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# (C) 2016 Tommy Hofmann -# (C) 2016 Robin Ammon -# (C) 2016 Sofia Brenner -# (C) 2022 Jeroen Hanselman -# ################################################################################ ################################################################################ diff --git a/src/EllCrv/Misc.jl b/src/EllCrv/Misc.jl index 3bbba63aed..c98a9f0093 100644 --- a/src/EllCrv/Misc.jl +++ b/src/EllCrv/Misc.jl @@ -2,35 +2,6 @@ # # EllipticCurve/Misc.jl : Misc functions # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# (C) 2016 Tommy Hofmann -# (C) 2016 Robin Ammon -# (C) 2016 Sofia Brenner -# ################################################################################ ############################################################################### diff --git a/src/EllCrv/Models.jl b/src/EllCrv/Models.jl index 58fe5bd5d1..06185b17dd 100644 --- a/src/EllCrv/Models.jl +++ b/src/EllCrv/Models.jl @@ -2,36 +2,6 @@ # # EllipticCurve/Models.jl : Different models of elliptic curves # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# (C) 2016 Tommy Hofmann -# (C) 2016 Robin Ammon -# (C) 2016 Sofia Brenner -# (C) 2022 Jeroen Hanselman -# ################################################################################ ################################################################################ diff --git a/src/EllCrv/Pairings.jl b/src/EllCrv/Pairings.jl index 0a8feb75cb..ca1848def5 100644 --- a/src/EllCrv/Pairings.jl +++ b/src/EllCrv/Pairings.jl @@ -3,34 +3,6 @@ # EllipticCurve/Pairings.jl: Functions for computing various pairings # on elliptic curves # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# (C) 2016 Tommy Hofmann -# (C) 2022 Jeroen Hanselman -# ################################################################################ ################################################################################ diff --git a/src/EllCrv/Periods.jl b/src/EllCrv/Periods.jl index cce96c3ac9..5bf356adc5 100644 --- a/src/EllCrv/Periods.jl +++ b/src/EllCrv/Periods.jl @@ -3,36 +3,6 @@ # EllipticCurve/Periods.jl: Functions for computing the period matrix of # an elliptic curve # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# (C) 2016 Tommy Hofmann -# (C) 2016 Robin Ammon -# (C) 2016 Sofia Brenner -# (C) 2022 Jeroen Hanselman -# ################################################################################ ################################################################################ diff --git a/src/EllCrv/Torsion.jl b/src/EllCrv/Torsion.jl index 2f5ba49380..52bb9eb33d 100644 --- a/src/EllCrv/Torsion.jl +++ b/src/EllCrv/Torsion.jl @@ -2,36 +2,6 @@ # # EllipticCurve/Torsion.jl : Computing torsion points on elliptic curves # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# (C) 2016 Tommy Hofmann -# (C) 2016 Robin Ammon -# (C) 2016 Sofia Brenner -# (C) 2022 Jeroen Hanselman -# ################################################################################ ################################################################################ diff --git a/src/GrpAb.jl b/src/GrpAb.jl index fe0e005f79..511189e6ba 100644 --- a/src/GrpAb.jl +++ b/src/GrpAb.jl @@ -2,34 +2,6 @@ # # GrpAb.jl : Finitely generated abelian groups # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016, 2017: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016, 2017 Tommy Hofmann, Claus Fieker -# ################################################################################ include("GrpAb/GrpAbFinGen.jl") diff --git a/src/GrpAb/Elem.jl b/src/GrpAb/Elem.jl index 95b0f088c4..06103a753e 100644 --- a/src/GrpAb/Elem.jl +++ b/src/GrpAb/Elem.jl @@ -2,34 +2,6 @@ # # GrpAb/Elem.jl : Elements in finitely generated abelian groups # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016, 2017: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016, 2017 Tommy Hofmann, Claus Fieker -# ################################################################################ import Base.+, Nemo.snf, Nemo.parent, Base.rand, Nemo.is_snf diff --git a/src/GrpAb/GrpAbFinGen.jl b/src/GrpAb/GrpAbFinGen.jl index e2cf98c0ae..3d5b350770 100644 --- a/src/GrpAb/GrpAbFinGen.jl +++ b/src/GrpAb/GrpAbFinGen.jl @@ -2,34 +2,6 @@ # # GrpAb/FinGenAbGroup.jl : Finitely generated abelian groups # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016, 2017: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016, 2017 Tommy Hofmann, Claus Fieker -# ################################################################################ import Base.+, Nemo.snf, Nemo.parent, Base.rand, Nemo.is_snf diff --git a/src/GrpAb/Lattice.jl b/src/GrpAb/Lattice.jl index 53d153b852..e24d186076 100644 --- a/src/GrpAb/Lattice.jl +++ b/src/GrpAb/Lattice.jl @@ -2,34 +2,6 @@ # # GrpAb/Lattice.jl : Lattice of abelian groups # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016, 2017: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2017 Tommy Hofmann -# ################################################################################ ################################################################################ diff --git a/src/GrpAb/Map.jl b/src/GrpAb/Map.jl index 8e98892842..0aa78dde3b 100644 --- a/src/GrpAb/Map.jl +++ b/src/GrpAb/Map.jl @@ -3,34 +3,6 @@ # GrpAb/Map.jl : Functions for maps between # finitely generated abelian groups # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016, 2017: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016, 2017 Tommy Hofmann, Claus Fieker -# ################################################################################ ################################################################################ diff --git a/src/GrpAb/SubgroupEnum.jl b/src/GrpAb/SubgroupEnum.jl index fa9949c7cf..d1d2081efe 100644 --- a/src/GrpAb/SubgroupEnum.jl +++ b/src/GrpAb/SubgroupEnum.jl @@ -3,34 +3,6 @@ # GrpAb/SubgroupEnum.jl : Subgroup enumeration for finitely generated # abelian groups. # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016, 2017: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2017 Tommy Hofmann, Claus Fieker -# ################################################################################ ################################################################################ diff --git a/src/Hecke.jl b/src/Hecke.jl index 1640b102c9..9b9e1185d9 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -1,37 +1,3 @@ -################################################################################ -# -# Hecke.jl : Hecke main file -# -# This file is part of Hecke. -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# (C) 2015-2019 Claus Fieker, Tommy Hofmann -# (C) 2020-2024 Claus Fieker, Tommy Hofmann, Carlo Sircana -# -################################################################################ - - @doc raw""" Hecke is a Julia package for algorithmic algebraic number theory. For more information please visit diff --git a/src/LinearAlgebra/LatEnum.jl b/src/LinearAlgebra/LatEnum.jl index 5d953e80cb..07016a0187 100644 --- a/src/LinearAlgebra/LatEnum.jl +++ b/src/LinearAlgebra/LatEnum.jl @@ -2,36 +2,8 @@ # # LatEnum.jl : Basic lattice enumeration # -# This file is part of hecke. -# -# Copyright (c) 2015: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# (C) 2015 Claus Fieker -# (C) 2015 Tommy Hofmann -# ################################################################################ +# # TODO: # - (sh/c)ould be indexed by the type of G and C # in fact, since G is not used after the creation, maybe we should drop it. @@ -44,6 +16,8 @@ # - lower bounds should be non-trivial speed-up by effectively generating the # L, U for the other bound as well and using this for exclusion. # (see other comment below) +# +################################################################################ function show(io::IO, E::enum_ctx) println(io, "EnumCtx") diff --git a/src/Map/GrpAb.jl b/src/Map/GrpAb.jl index e3d5e9efa0..3966fe315b 100644 --- a/src/Map/GrpAb.jl +++ b/src/Map/GrpAb.jl @@ -2,34 +2,6 @@ # # Map/AbGrp.jl : Types for maps with domains of type FinGenAbGroup # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015 - 2018 Tommy Hofmann, Carlo Sircana -# ################################################################################ ################################################################################ diff --git a/src/Map/NfRel.jl b/src/Map/NfRel.jl index 180af04180..36dde2d493 100644 --- a/src/Map/NfRel.jl +++ b/src/Map/NfRel.jl @@ -2,34 +2,6 @@ # # Map/RelSimpleNumField.jl : Types for maps with domains of type RelSimpleNumField # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016, 2017: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2017 Tommy Hofmann, Claus Fieker -# ################################################################################ mutable struct NfRelToFqMor{T} <: Map{RelSimpleNumField{T}, FqField, HeckeMap, NfRelToFqMor} diff --git a/src/Misc/acb_root_ctx.jl b/src/Misc/acb_root_ctx.jl index 868c48a3d3..516941064b 100644 --- a/src/Misc/acb_root_ctx.jl +++ b/src/Misc/acb_root_ctx.jl @@ -2,34 +2,6 @@ # # acb_root_ctx.jl: handling roots using arb # -# This file is part of hecke. -# -# Copyright (c) 2015: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015 Tommy Hofmann -# ################################################################################ # # TODO: diff --git a/src/Misc/arf.jl b/src/Misc/arf.jl index 41c1e54ae2..05f3e45e45 100644 --- a/src/Misc/arf.jl +++ b/src/Misc/arf.jl @@ -2,34 +2,6 @@ # # arf.jl: wrapper for arf # -# This file is part of hecke. -# -# Copyright (c) 2015: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015 Tommy Hofmann -# ################################################################################ # # TODO: diff --git a/src/NumField/Hilbert.jl b/src/NumField/Hilbert.jl index d7efea02a3..1cd6a1cefa 100644 --- a/src/NumField/Hilbert.jl +++ b/src/NumField/Hilbert.jl @@ -2,34 +2,6 @@ # # NfAbs/Hilbert.jl: Hilbert symbols # -# This file is part of Hecke. -# -# Copyright (c) 2015-2019: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2019 Markus Kirschmer -# ################################################################################ function quadratic_defect(a::Union{Rational{<:Integer},IntegerUnion,QQFieldElem}, p::IntegerUnion) diff --git a/src/NumField/NfAbs/NonSimple.jl b/src/NumField/NfAbs/NonSimple.jl index 7487573733..3a176a35aa 100644 --- a/src/NumField/NfAbs/NonSimple.jl +++ b/src/NumField/NfAbs/NonSimple.jl @@ -2,34 +2,6 @@ # # NfAbs/NonSimple.jl : non-simple absolute number fields # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016, 2017, 2018: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2018 Tommy Hofmann, Claus Fieker -# ################################################################################ @inline base_ring(K::AbsNonSimpleNumField) = QQ diff --git a/src/NumField/NfRel/NfRel.jl b/src/NumField/NfRel/NfRel.jl index aba51530bf..7f281b2810 100644 --- a/src/NumField/NfRel/NfRel.jl +++ b/src/NumField/NfRel/NfRel.jl @@ -2,34 +2,6 @@ # # RelSimpleNumField/RelSimpleNumField.jl : Relative number field extensions # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016, 2017: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2017 Claus Fieker, Tommy Hofmann -# ################################################################################ ################################################################################ diff --git a/src/NumField/NfRel/NfRelNS.jl b/src/NumField/NfRel/NfRelNS.jl index 1fb1f0efcb..37b0fbd0ac 100644 --- a/src/NumField/NfRel/NfRelNS.jl +++ b/src/NumField/NfRel/NfRelNS.jl @@ -2,34 +2,6 @@ # # RelSimpleNumField/RelNonSimpleNumField.jl : non-simple relative fields # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016, 2017: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2017 Tommy Hofmann, Claus Fieker -# ################################################################################ #= trivial example diff --git a/src/NumFieldOrd/NfOrd/Clgp.jl b/src/NumFieldOrd/NfOrd/Clgp.jl index 3f442e84d5..6ff8caa53c 100644 --- a/src/NumFieldOrd/NfOrd/Clgp.jl +++ b/src/NumFieldOrd/NfOrd/Clgp.jl @@ -2,34 +2,6 @@ # # Clgrp.jl : Class group computation of maximal orders in number fields # -# This file is part of hecke. -# -# Copyright (c) 2015: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# (C) 2015, 2016 Claus Fieker -# ################################################################################ # # Todo: diff --git a/src/NumFieldOrd/NfOrd/Elem.jl b/src/NumFieldOrd/NfOrd/Elem.jl index 463bada6b5..51671f20a3 100644 --- a/src/NumFieldOrd/NfOrd/Elem.jl +++ b/src/NumFieldOrd/NfOrd/Elem.jl @@ -2,34 +2,6 @@ # # AbsSimpleNumFieldOrder/Elem.jl : Elements of orders of number fields # -# This file is part of hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016 Tommy Hofmann -# ################################################################################ ################################################################################ diff --git a/src/NumFieldOrd/NfOrd/FacElem.jl b/src/NumFieldOrd/NfOrd/FacElem.jl index 24a440473d..c0490f2828 100644 --- a/src/NumFieldOrd/NfOrd/FacElem.jl +++ b/src/NumFieldOrd/NfOrd/FacElem.jl @@ -2,34 +2,6 @@ # # AbsSimpleNumFieldOrder/FacElem.jl : Factored elements over number fields # -# This file is part of hecke. -# -# Copyright (c) 2015: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016 Tommy Hofmann -# ################################################################################ # Get FacElem from ClassGrpCtx diff --git a/src/NumFieldOrd/NfOrd/FactorBaseBound.jl b/src/NumFieldOrd/NfOrd/FactorBaseBound.jl index e13306c7e4..ef2271f39f 100644 --- a/src/NumFieldOrd/NfOrd/FactorBaseBound.jl +++ b/src/NumFieldOrd/NfOrd/FactorBaseBound.jl @@ -3,34 +3,6 @@ # AbsSimpleNumFieldOrder/FactorBaseBound.jl: Bounds for the factor base for Buchmann # algorithm # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2016 Tommy Hofmann -# ################################################################################ ################################################################################ diff --git a/src/NumFieldOrd/NfOrd/FracIdeal.jl b/src/NumFieldOrd/NfOrd/FracIdeal.jl index 351ed59b55..0eab9b0f27 100644 --- a/src/NumFieldOrd/NfOrd/FracIdeal.jl +++ b/src/NumFieldOrd/NfOrd/FracIdeal.jl @@ -3,34 +3,6 @@ # AbsSimpleNumFieldOrder/AbsSimpleNumFieldOrderFractionalIdeal.jl : Fractional ideals of generic # orders in number fields # -# This file is part of hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016 Tommy Hofmann -# ################################################################################ ################################################################################ diff --git a/src/NumFieldOrd/NfOrd/Hensel.jl b/src/NumFieldOrd/NfOrd/Hensel.jl index 7be0d13b62..09607e3c48 100644 --- a/src/NumFieldOrd/NfOrd/Hensel.jl +++ b/src/NumFieldOrd/NfOrd/Hensel.jl @@ -2,34 +2,6 @@ # # AbsSimpleNumFieldOrder/Hensel.jl : Hensel lifting for simple absolute number fields # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# (C) 2019 Claus Fieker, Tommy Hofmann, Carlo Sircana -# ################################################################################ # TODO/missing: diff --git a/src/NumFieldOrd/NfOrd/Ideal.jl b/src/NumFieldOrd/NfOrd/Ideal.jl index 3c0dcc5912..e973d57496 100644 --- a/src/NumFieldOrd/NfOrd/Ideal.jl +++ b/src/NumFieldOrd/NfOrd/Ideal.jl @@ -2,34 +2,6 @@ # # AbsSimpleNumFieldOrder/Ideal.jl : Ideals in orders of absolute number fields # -# This file is part of Hecke. -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016, 2017 Tommy Hofmann -# Copyright (C) 2015, 2016, 2017 Claus Fieker -# ################################################################################ include("Ideal/Ideal.jl") diff --git a/src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl b/src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl index 8c10252ad9..166218f139 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/Arithmetic.jl @@ -3,34 +3,6 @@ # AbsSimpleNumFieldOrder/Ideal/Arithmetic.jl : Arithmetic for ideals in orders of absolute # number fields # -# This file is part of Hecke. -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016, 2017 Tommy Hofmann -# Copyright (C) 2015, 2016, 2017 Claus Fieker -# ################################################################################ function check_parent(x::AbsNumFieldOrderIdeal, y::AbsNumFieldOrderIdeal) diff --git a/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl b/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl index 66cf12b241..9bf41b0fe7 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl @@ -2,34 +2,6 @@ # # AbsSimpleNumFieldOrder/Ideal/Ideal.jl : Ideals in orders of absolute number fields # -# This file is part of Hecke. -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016, 2017 Tommy Hofmann -# Copyright (C) 2015, 2016, 2017 Claus Fieker -# ################################################################################ ################################################################################ diff --git a/src/NumFieldOrd/NfOrd/Ideal/Prime.jl b/src/NumFieldOrd/NfOrd/Ideal/Prime.jl index 685604c4a5..bf85921d35 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/Prime.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/Prime.jl @@ -2,34 +2,6 @@ # # AbsSimpleNumFieldOrder/Ideal/Prime.jl : Prime ideals in orders of absolute number fields # -# This file is part of Hecke. -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016, 2017 Tommy Hofmann -# Copyright (C) 2015, 2016, 2017 Claus Fieker -# ################################################################################ @doc raw""" diff --git a/src/NumFieldOrd/NfOrd/MaxOrd/DedekindCriterion.jl b/src/NumFieldOrd/NfOrd/MaxOrd/DedekindCriterion.jl index c2e9426a79..7b1d3cc09b 100644 --- a/src/NumFieldOrd/NfOrd/MaxOrd/DedekindCriterion.jl +++ b/src/NumFieldOrd/NfOrd/MaxOrd/DedekindCriterion.jl @@ -2,34 +2,6 @@ # # DedekindCriterion.jl : Dedekinds Criterion for maximality # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016 Tommy Hofmann -# ################################################################################ function dedekind_test(O::AbsSimpleNumFieldOrder, p::ZZRingElem, ::Val{compute_order} = Val(true)) where compute_order diff --git a/src/NumFieldOrd/NfOrd/NfOrd.jl b/src/NumFieldOrd/NfOrd/NfOrd.jl index 745f62e7b1..7659530ca4 100644 --- a/src/NumFieldOrd/NfOrd/NfOrd.jl +++ b/src/NumFieldOrd/NfOrd/NfOrd.jl @@ -2,34 +2,6 @@ # # AbsSimpleNumFieldOrder/AbsSimpleNumFieldOrder.jl : Orders in absolute number fields # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016, 2017 Tommy Hofmann -# ################################################################################ ################################################################################ diff --git a/src/NumFieldOrd/NfOrd/ResidueRing.jl b/src/NumFieldOrd/NfOrd/ResidueRing.jl index 3c1c402989..e1cefd3eb2 100644 --- a/src/NumFieldOrd/NfOrd/ResidueRing.jl +++ b/src/NumFieldOrd/NfOrd/ResidueRing.jl @@ -2,34 +2,6 @@ # # AbsSimpleNumFieldOrder/residue_ring.jl : Quotients of maximal orders of number fields # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# (C) 2016 Tommy Hofmann -# ################################################################################ ################################################################################ diff --git a/src/NumFieldOrd/NfOrd/TorsionUnits.jl b/src/NumFieldOrd/NfOrd/TorsionUnits.jl index 8ad44ddf79..ab08f6ad62 100644 --- a/src/NumFieldOrd/NfOrd/TorsionUnits.jl +++ b/src/NumFieldOrd/NfOrd/TorsionUnits.jl @@ -2,34 +2,6 @@ # # AbsSimpleNumFieldOrder/TorsionUnits.jl : Torsion units in generic number field orders # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016 Tommy Hofmann -# ################################################################################ ################################################################################ diff --git a/src/NumFieldOrd/NfOrd/Unit.jl b/src/NumFieldOrd/NfOrd/Unit.jl index 31ddd0e22f..8a7583c340 100644 --- a/src/NumFieldOrd/NfOrd/Unit.jl +++ b/src/NumFieldOrd/NfOrd/Unit.jl @@ -2,34 +2,6 @@ # # AbsSimpleNumFieldOrder/Units.jl : Units in generic number field orders # -# This file is part of Hecke. -# -# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016 Tommy Hofmann -# ################################################################################ include("Unit/FindUnits.jl") diff --git a/src/NumFieldOrd/NfOrd/Zeta.jl b/src/NumFieldOrd/NfOrd/Zeta.jl index c75083960a..af43ab32b1 100644 --- a/src/NumFieldOrd/NfOrd/Zeta.jl +++ b/src/NumFieldOrd/NfOrd/Zeta.jl @@ -2,34 +2,6 @@ # # NfOrdClsZeta.jl: Zeta functions of orders in number fields # -# This file is part of hecke. -# -# Copyright (c) 2015: Claus Fieker, Tommy Hofmann -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Copyright (C) 2015, 2016 Tommy Hofmann -# ################################################################################ export zeta_log_residue