Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ cohomCalg_jll = "5558cf25-a90e-53b0-b813-cadaa3ae7ade"
lib4ti2_jll = "1493ae25-0f90-5c0e-a06c-8c5077d6d66f"

[compat]
AbstractAlgebra = "0.46.2"
AbstractAlgebra = "0.47.3"
AlgebraicSolving = "0.9.0"
Compat = "4.13.0"
Distributed = "1.6"
GAP = "0.15.0"
Hecke = "0.37.2"
Hecke = "0.38.5"
JSON = "^0.20, ^0.21"
JSON3 = "1.13.2"
LazyArtifacts = "1.6"
Markdown = "1.6"
Nemo = "0.51.1"
Nemo = "0.52.1"
Pkg = "1.6"
Polymake = "0.13.1"
ProgressMeter = "1.10.2"
Expand Down
4 changes: 2 additions & 2 deletions docs/src/NumberTheory/abelian_closure.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ julia> x = z(5)
zeta(5)

julia> y = F(x)
Root 0.309017 + 0.951057*im of x^4 + x^3 + x^2 + x + 1
{a4: 0.309017 + 0.951057*im}

julia> y^5
Root 1.00000 of x - 1
{a1: 1.00000}
```

Real elements of `K` can be compared with `<` and `>`.
Expand Down
14 changes: 7 additions & 7 deletions docs/src/Rings/integer.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ factorisation struct which can be manipulated using the functions below.

```jldoctest; filter = Main.Oscar.doctestfilter_hash_changes_in_1_13()
julia> factor(ZZ(-6000361807272228723606))
-1 * 2 * 229^3 * 43669^3 * 3
-1 * 2 * 3 * 229^3 * 43669^3

julia> factor(ZZ(0))
ERROR: ArgumentError: Argument is not non-zero
Expand All @@ -591,12 +591,12 @@ Once created, a factorisation is iterable:

```jldoctest; filter = Main.Oscar.doctestfilter_hash_changes_in_1_13()
julia> F = factor(ZZ(-60))
-1 * 5 * 2^2 * 3
-1 * 2^2 * 3 * 5

julia> for (p, e) in F; println("$p^$e"); end
5^1
2^2
3^1
5^1

```

Expand All @@ -606,13 +606,13 @@ array using `collect`:

```jldoctest; filter = Main.Oscar.doctestfilter_hash_changes_in_1_13()
julia> F = factor(ZZ(-60))
-1 * 5 * 2^2 * 3
-1 * 2^2 * 3 * 5

julia> collect(F)
3-element Vector{Pair{ZZRingElem, Int64}}:
5 => 1
2 => 2
3 => 1
5 => 1

```

Expand All @@ -627,7 +627,7 @@ functionality.

```jldoctest; filter = Main.Oscar.doctestfilter_hash_changes_in_1_13()
julia> F = factor(ZZ(-60))
-1 * 5 * 2^2 * 3
-1 * 2^2 * 3 * 5

julia> 5 in F
true
Expand All @@ -642,7 +642,7 @@ julia> F[3]
1

julia> F[ZZ(7)]
ERROR: 7 is not a factor of -1 * 5 * 2^2 * 3
ERROR: 7 is not a factor of -1 * 2^2 * 3 * 5
[...]

```
Expand Down
8 changes: 4 additions & 4 deletions experimental/GModule/src/Brueckner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function find_primes(mp::Map{<:Oscar.GAPGroup, PcGroup})
# expensive find minimal field step can be omitted.
I = [gmodule(ZZ, gmodule(QQ, gmodule(CyclotomicField, x))) for x = I]
end
lp = Set(collect(keys(factor(order(Q)).fac)))
lp = Set(prime_divisors(order(Q)))
for i = I
ib = gmodule(i.M, G, [action(i, mp(g)) for g = gens(G)])
ia = gmodule(FinGenAbGroup, ib)
Expand Down Expand Up @@ -217,7 +217,7 @@ function find_primes(mp::Map{<:Oscar.GAPGroup, PcGroup})
# q = quo(kernel(da)[1], image(db)[1])[1]
t = torsion_subgroup(q)[1]
if order(t) > 1
push!(lp, collect(keys(factor(order(t)).fac))...)
push!(lp, prime_divisors(order(t))...)
end
end
return lp
Expand Down Expand Up @@ -400,14 +400,14 @@ end
function sq(mp::Map, primes::Vector=[]; index::Union{Integer, ZZRingElem, Nothing} = nothing)
if index !== nothing
lf = factor(ZZRingElem(index))
primes = collect(keys(lf.fac))
primes = prime_divisors(ZZ(index))
while length(primes) > 0
@time nw = brueckner(mp; limit = 1, primes)
if length(nw) == 0
return mp
end
mp = nw[1]
for (p, k) = lf.fac
for (p, k) = lf
if p in primes && valuation(order(codomain(mp)), p) >= k
deleteat!(primes, findfirst(isequal(p), primes))
# @show :removing, p
Expand Down
2 changes: 1 addition & 1 deletion experimental/GModule/src/Cohomology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1921,7 +1921,7 @@ function pc_group_with_isomorphism(M::FinGenAbGroup; refine::Bool = true)
if refine
hm = elem_type(M)[]
for i=1:nrows(h)
lf = collect(factor(h[i,i]).fac)
lf = collect(factor(h[i,i]))
for (p,k) = lf
v = divexact(h[i,i], p^k)*M[i]
for j=1:k-1
Expand Down
4 changes: 2 additions & 2 deletions experimental/GModule/src/GModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ function invariant_lattice_classes(M::GModule{<:Oscar.GAPGroup, <:AbstractAlgebr
res = Any[(M, sub(M.M, gens(M.M))[2])]
sres = 1
new = true
lp = keys(factor(order(M.G)).fac)
lp = prime_divisors(order(M.G))
while new
new = false
lres = length(res)
Expand Down Expand Up @@ -2191,7 +2191,7 @@ function split_homogeneous2(M::GModule{<:Any, <:AbstractAlgebra.FPModule{QQField
i = _i.elem_in_algebra
f = minpoly(i)
lf = factor(f)
if length(lf) == 1 && degree(f) == s*m*k && haskey(lf.fac, f)
if length(lf) == 1 && degree(f) == s*m*k && f in lf
if first
best_f = f
best_i = i
Expand Down
8 changes: 4 additions & 4 deletions experimental/GModule/src/GaloisCohomology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ function is_coboundary(c::CoChain{2,PermGroupElem,MultGrpElem{AbsSimpleNumFieldE
cp = coprime_base(vcat([numerator(norm(x.data*denominator(x.data))) for x = values(c.d)],
map(x->denominator(x.data), values(c.d))))
@vprint :GaloisCohomology 2 ".. coprime done, now factoring ..\n"
s = Set(reduce(vcat, [collect(keys(factor(x).fac)) for x = cp], init = [1]))
s = Set(reduce(vcat, [prime_divisors(x) for x = cp], init = [1]))
while 1 in s
pop!(s, 1)
end
Expand Down Expand Up @@ -733,7 +733,7 @@ function Hecke.extend_easy(m::Hecke.CompletionMap, L::FacElemMon{AbsSimpleNumFie

#want a map: L-> codomain(m)
function to(a::FacElem{AbsSimpleNumFieldElem})
return prod(m(k)^v for (k,v) = a.fac)
return prod(m(k)^v for (k,v) in a)
end
function from(a::Hecke.LocalFieldElem)
return FacElem(preimage(m, a))
Expand All @@ -750,7 +750,7 @@ function Hecke.extend_easy(m::Hecke.CompletionMap, mu::Map, L::FacElemMon{AbsSim
#want a map: L-> codomain(m) -> domain(mu)
function to(a::FacElem{AbsSimpleNumFieldElem})
s = domain(mu)[0]
for (k,v) = a.fac
for (k,v) = a
if haskey(cache, k)
s += v*cache[k]
else
Expand Down Expand Up @@ -834,7 +834,7 @@ function idele_class_gmodule(k::AbsSimpleNumField, s::Vector{Int} = Int[]; redo:
cf = Tuple{FinGenAbGroup, <:Map}[x for x = cf]

@vprint :GaloisCohomology 2 " .. gathering primes ..\n"
s = push!(Set{ZZRingElem}(s), Set{ZZRingElem}(keys(factor(discriminant(zk)).fac))...)
s = push!(Set{ZZRingElem}(s), Set{ZZRingElem}(prime_divisors(discriminant(zk)))...)
for i=1:length(sf)
l = factor(prod(s)*zf[i])
q, mq = quo(cf[i][1], [preimage(cf[i][2], P) for P = keys(l)])
Expand Down
4 changes: 2 additions & 2 deletions experimental/GaloisGrp/src/Solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ function Oscar.solve(f::ZZPolyRingElem; max_prec::Int=typemax(Int), show_radical
CHECK = get_assertion_level(:SolveRadical) > 0
@vprint :SolveRadical 1 "computing initial galois group...\n"
@vtime :SolveRadical 1 G, C = galois_group(f)
lp = [p for p = keys(factor(order(G)).fac) if p > 2]
lp = [p for (p, _) in factor(order(G)) if p > 2]
if length(lp) > 0
@vprint :SolveRadical 1 "need to add roots-of-one: $lp\n"
@vtime :SolveRadical 1 G, C = galois_group(f*prod(cyclotomic(Int(p), gen(parent(f))) for p = lp))
Expand Down Expand Up @@ -599,7 +599,7 @@ function Oscar.solve(f::ZZPolyRingElem; max_prec::Int=typemax(Int), show_radical
p = parent(s)
if p == QQ
lf = factor(s, ZZ)
t = prod([p for (p, k) = lf.fac if isodd(k)], init = ZZ(1)) * lf.unit
t = prod([p for (p, k) = lf if isodd(k)], init = ZZ(1)) * lf.unit
r = root(s//t, 2)
else
_, ma = absolute_simple_field(p)
Expand Down
2 changes: 1 addition & 1 deletion experimental/GaloisGrp/src/Subfields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ function _subfields(K::AbsSimpleNumField; pStart = 2*degree(K)+1, prime = 0)
f = divexact(f, content(f))

p, ct = find_prime(Hecke.Globals.Qx(f), pStart = pStart, prime = prime,
filter_pattern = x->any(t->degree(t) == 1, keys(x.fac)))
filter_pattern = x->any(t->degree(t) == 1, first.(collect(x))))
n = degree(K)
if primitive_by_shape(ct, n)
return nothing
Expand Down
11 changes: 5 additions & 6 deletions experimental/StandardFiniteFields/src/StandardFiniteFields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ const PrimeFieldMatrix = Union{FpMatrix,fpMatrix}

# NOTE: These give missing features to OSCAR/Nemo that will likely be added in the near future.

function pop_largest_factor!(f::Fac{ZZRingElem})
D = f.fac
m = maximum(f)
function pop_largest_factor!(D::Dict{ZZRingElem, Int})
m = maximum(D)
if isone(m[2])
Base.delete!(D, m[1])
else
Expand Down Expand Up @@ -463,11 +462,11 @@ function standard_finite_field(p::IntegerUnion, n::IntegerUnion)
F = Native.GF(p)
set_standard_prime_field!(F)

function _sff(N::Fac{ZZRingElem})
function _sff(N::Dict{ZZRingElem, Int})
# local m::ZZRingElem, k::IntegerUnion, nK::ZZRingElem, K::FinField, stn::ZZRingElem,
# n1::ZZRingElem, q1::ZZRingElem, l::Vector{ZZRingElem}, c::Vector{ZZRingElem}, b::FinFieldElem
m, k = pop_largest_factor!(N)
nK = evaluate(N)
nK = prod(p^e for (p, e) in N; init = one(ZZ))

K = get_standard_extension!(F, nK) do
_sff(N)
Expand All @@ -490,7 +489,7 @@ function standard_finite_field(p::IntegerUnion, n::IntegerUnion)

return get_standard_extension!(F, n) do
N = factor(ZZ(n))
return _sff(N)
return _sff(Dict(p => e for (p, e) in N))
end
end

Expand Down
2 changes: 1 addition & 1 deletion gap/pkg/OscarInterface/gap/QQBar.gi
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ BindGlobal( "_DisplayStringQQBarMatrixElement", function( x )
str:= String( x );
if ValueOption( "short" ) = true then
pos:= Position( str, ' ' );
str:= str{ [ pos + 1 .. Position( str, ' ', pos ) - 1 ] };
str:= str{ [ pos + 1 .. Position( str, '}', pos ) - 1 ] };
fi;
return str;
end );
Expand Down
18 changes: 9 additions & 9 deletions gap/pkg/OscarInterface/tst/QQBar.tst
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ gap> START_TEST( "QQBar.tst" );
gap> F:= QQBarField;
QQBarField
gap> x:= One( F );
<Root 1.00000 of x - 1>
<{a1: 1.00000}>
gap> Print( x, "\n" );
<Root 1.00000 of x - 1>
<{a1: 1.00000}>
gap> String( x );
"<Root 1.00000 of x - 1>"
"<{a1: 1.00000}>"
gap> z:= Zero( F );
<Root 0 of x>
<{a1: 0}>
gap> Zero( x ) = z;
true
gap> z < x;
Expand All @@ -38,7 +38,7 @@ true
gap> x * x = x;
true
gap> r:= Sqrt( y );
<Root 1.41421 of x^2 - 2>
<{a2: 1.41421}>
gap> r^2 = y;
true
gap> r^-1 = 1 / r;
Expand All @@ -63,13 +63,13 @@ gap> M:= [ [ z, r ], [ r, z ] ];;
gap> Determinant( M ) = -2;
true
gap> MinimalPolynomial( M );
x_1^2+(<Root -2.00000 of x + 2>)
x_1^2+(<{a1: -2.00000}>)
gap> Eigenvalues( F, M );
[ <Root 1.41421 of x^2 - 2>, <Root -1.41421 of x^2 - 2> ]
[ <{a2: 1.41421}>, <{a2: -1.41421}> ]
gap> Display( M );
2x2 matrix over QQBarField:
. <Root 1.41421 of x^2 - 2>
<Root 1.41421 of x^2 - 2> .
. <{a2: 1.41421}>
<{a2: 1.41421}> .
gap> Display( M : short );
2x2 matrix over QQBarField:
. 1.41421
Expand Down
16 changes: 8 additions & 8 deletions src/NumberTheory/GaloisGrp/GaloisGrp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1335,13 +1335,13 @@ function sum_orbits(K, Qt_to_G, r)
end
@vprint :GaloisGroup 1 "... factoring...\n"
@vtime :GaloisGroup 2 fg = factor(g)
@assert all(isone, values(fg.fac))
@assert all(isone(e) for (_, e) in fg)

O = []
if isa(r[1], AcbFieldElem)
mm = collect(m)
end
for f = keys(fg.fac)
for (f, _) in fg
r = roots(map_coefficients(Qt_to_G, f))
if isa(r[1], AcbFieldElem)
push!(O, [mm[argmin(map(x->abs(x[1]-y), mm))][2] for y = r])
Expand Down Expand Up @@ -1708,13 +1708,13 @@ function find_prime(f::QQPolyRingElem, extra::Int = 5; prime::Int = 0, pStart::I
if prime != 0
p = prime
lf = factor(GF(p), f)
return p, Set([CycleType(map(degree, collect(keys(lf.fac))))])
return p, Set([CycleType(map(degree, first.(collect(lf))))])
end
if pStart < 0
error("should no longer happen")
p = -pStart
lf = factor(GF(p), f)
return p, Set([CycleType(map(degree, collect(keys(lf.fac))))])
return p, Set([CycleType(map(degree, first.(collect(lf))))])
end

d_max = degree(f)^2
Expand All @@ -1737,13 +1737,13 @@ function find_prime(f::QQPolyRingElem, extra::Int = 5; prime::Int = 0, pStart::I
continue
end
lf = factor(GF(p), f)
if any(>(1), values(lf.fac))
if any(>(1), (e for (_, e) in lf))
continue
end
filter_pattern(lf) || continue
no_p +=1
push!(ct, sort(map(degree, collect(keys(lf.fac))))) # ct = cycle types as vector of cycle lengths
d = lcm([degree(x) for x = keys(lf.fac)])
push!(ct, sort(map(degree, first.(collect(lf))))) # ct = cycle types as vector of cycle lengths
d = lcm([degree(x) for (x, _) in lf])
if d <= d_max
if d >= d_min
push!(ps, (p, d))
Expand Down Expand Up @@ -2850,7 +2850,7 @@ group of permutations of the roots. Furthermore, the `GaloisCtx` is
returned allowing algorithmic access to the splitting field.
"""
function galois_group(f::PolyRingElem{<:FieldElem}; prime=0, pStart::Int = 2*degree(f))
lf = [(k,v) for (k,v) = factor(f).fac]
lf = [(k,v) for (k,v) = factor(f)]

if length(lf) == 1
@vprint :GaloisGroup 1 "poly has only one factor\n"
Expand Down
2 changes: 1 addition & 1 deletion src/NumberTheory/GaloisGrp/Qt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function _subfields(FF::Generic.FunctionField, f::ZZMPolyRingElem; tStart::Int =
@vprint :Subfields 2 "now looking for a nice prime...\n"
p, _ = find_prime(defining_polynomial(K), pStart = 200)

d = lcm(map(degree, collect(keys(factor(GF(p), g).fac))))
d = lcm(map(degree, first.(collect(factor(GF(p), g)))))

@assert evaluate(evaluate(f, [X, T+t]), [gen(Zx), zero(Zx)]) == g

Expand Down
2 changes: 1 addition & 1 deletion src/NumberTheory/NmbThy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function norm_equation_fac_elem(R::AbsNumFieldOrder, k::ZZRingElem; abs::Bool =
end
lp = factor(k)
S = Tuple{Vector{Tuple{Hecke.ideal_type(R), Int}}, Vector{ZZMatrix}}[]
for (p, k) = lp.fac
for (p, k) in lp
P = prime_decomposition(R, p)
s = solve_non_negative(matrix(ZZ, 1, length(P), [degree(x[1]) for x = P]), matrix(ZZ, 1, 1, [k]))
push!(S, (P, ZZMatrix[view(s, i:i, 1:ncols(s)) for i=1:nrows(s)]))
Expand Down
4 changes: 2 additions & 2 deletions src/NumberTheory/QuadFormAndIsom/lattices_with_isometry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ julia> L = root_lattice(:A, 5);
julia> Lf = integer_lattice_with_isometry(L; neg=true);

julia> factor(characteristic_polynomial(Lf))
1 * (x + 1)^5
(x + 1)^5
```
"""
characteristic_polynomial(Lf::ZZLatWithIsom) = characteristic_polynomial(isometry(Lf))
Expand Down Expand Up @@ -1810,7 +1810,7 @@ julia> mf = minimal_polynomial(Lf)
x^5 - 1

julia> factor(mf)
1 * (x - 1) * (x^4 + x^3 + x^2 + x + 1)
(x - 1) * (x^4 + x^3 + x^2 + x + 1)

julia> kernel_lattice(Lf, x-1)
Integer lattice of rank 1 and degree 5
Expand Down
Loading
Loading