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
14 changes: 7 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,26 @@ f4ncgb_jll = "160f184c-7e1a-5d95-af1f-70d62a450302"
lib4ti2_jll = "1493ae25-0f90-5c0e-a06c-8c5077d6d66f"

[compat]
AbstractAlgebra = "0.47.4"
AlgebraicSolving = "0.10.1"
AbstractAlgebra = "0.48.0"
AlgebraicSolving = "0.10.3"
Compat = "4.13.0"
Distributed = "1.6"
GAP = "0.16.2"
Hecke = "0.39.7"
GAP = "0.16.3"
Hecke = "0.39.10"
JSON = "1.0.1"
JSON3 = "1.13.2"
LazyArtifacts = "1.6"
Markdown = "1.6"
Mongoc = "0.9.2, 0.10"
Nemo = "0.53.2"
Nemo = "0.54.0"
NetworkOptions = "1.2.0"
Pkg = "1.6"
Polymake = "0.13.4"
Polymake = "0.13.6"
ProgressMeter = "1.10.2"
Random = "1.6"
RandomExtensions = "0.4.3"
Serialization = "1.6"
Singular = "0.28.3"
Singular = "0.28.7"
TOPCOM_jll = "0.17.8"
UUIDs = "1.6"
cohomCalg_jll = "0.32.0"
Expand Down
8 changes: 8 additions & 0 deletions docs/oscar_references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -2533,6 +2533,14 @@ @Book{Mar18
doi = {10.1007/978-3-319-90233-3}
}

@Misc{Mil20,
author = {Milne, J. S.},
title = {Class Field Theory (v4.03)},
pages = {287+viii},
year = {2020},
url = {https://www.jmilne.org/math/CourseNotes/cft.html}
}

@Article{Moe93,
author = {Moeller, H. Michael},
title = {On Decomposing Systems of Polynomial Equations with Finitely Many Solutions},
Expand Down
6 changes: 3 additions & 3 deletions docs/src/DeveloperDocumentation/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ the user's convenience.
Let's see an example. Say, you want to implement the characteristic
polynomial of a matrix. You could do it as follows:
```julia
function characteristic_polynomial(A::MatrixElem)
function characteristic_polynomial(A::MatElem)
kk = base_ring(A)
P, x = kk[:x]
AP = change_base_ring(P, A)
Expand All @@ -310,7 +310,7 @@ To solve this, we should have implemented the function differently:
```julia
# Implementation of the recommended keyword argument signature:
function characteristic_polynomial(
A::MatrixElem;
A::MatElem;
parent::AbstractAlgebra.Ring=polynomial_ring(base_ring(A), :t)[1]
)
AP = change_base_ring(parent, A)
Expand All @@ -322,7 +322,7 @@ end
# output's parent as the first argument:
function characteristic_polynomial(
P::PolyRing,
A::MatrixElem
A::MatElem
)
coefficient_ring(P) === base_ring(A) || error("coefficient rings incompatible")
return characteristic_polynomial(A, parent=P)
Expand Down
1 change: 0 additions & 1 deletion docs/src/Groups/matgroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ matrix(A::Vector{AbstractAlgebra.Generic.FreeModuleElem{T}}) where T <: RingElem
conjugate_transpose(x::MatElem{T}) where T <: FinFieldElem
complement(V::AbstractAlgebra.Generic.FreeModule{T}, W::AbstractAlgebra.Generic.Submodule{T}) where T <: FieldElem
permutation_matrix(R::NCRing, Q::AbstractVector{<:IntegerUnion})
is_alternating(M::MatrixElem)
is_hermitian(B::MatElem{T}) where T <: FinFieldElem
```

Expand Down
2 changes: 1 addition & 1 deletion examples/Reynolds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ function action_on_monomials(R::MPolyRing, d::Int, A::Vector{QQMatrix})
bb = Vector{QQFieldElem}[]
h = [x^a for x = g]
for x = m
b = zeros(QQ, length(m))
b = zeros(QQFieldElem, length(m))
y = evaluate(x, h)
for (c,v) = zip(AbstractAlgebra.coefficients(y), AbstractAlgebra.monomials(y))
b[findfirst(==(v), m)] = c
Expand Down
4 changes: 2 additions & 2 deletions experimental/AlgebraicShifting/src/PartialShiftGraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function partial_shift_graph(F::Field, complexes::Vector{T},
if length(complexes) == 1
@req is_shifted(complexes[1]) "The list of complexes should be closed under shifting by elements of W"
return (
graph_from_adjacency_matrix(Directed, zeros(length(complexes),length(complexes))),
graph_from_adjacency_matrix(Directed, zeros(Int,length(complexes),length(complexes))),
EdgeLabels(),
complexes) :: Tuple{Graph{Directed}, EdgeLabels, Vector{T}}
end
Expand Down Expand Up @@ -256,7 +256,7 @@ function partial_shift_graph(F::Field, complexes::Vector{T};
kwargs...) where T <: ComplexOrHypergraph
# Deal with trivial case
if length(complexes) <= 1
return (graph_from_adjacency_matrix(Directed, zeros(length(complexes),length(complexes))), EdgeLabels())
return (graph_from_adjacency_matrix(Directed, zeros(Int,length(complexes),length(complexes))), EdgeLabels())
end

n = n_vertices(complexes[1])
Expand Down
16 changes: 8 additions & 8 deletions experimental/AlgebraicStatistics/src/PhylogeneticModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1538,14 +1538,14 @@ Computes specialized Fourier transform from the matrix that represents the full
This matrix transforms the reduced probability coordinates (corresponding to the equivalent classes) to the reduced Fourier coordinates.
"""
function fourier_transform(PM::GroupBasedPhylogeneticModel)
FRp, p = Oscar.full_model_ring(phylogenetic_model(PM))
FRq, q = Oscar.full_model_ring(PM)
FRp, p = full_model_ring(phylogenetic_model(PM))
FRq, q = full_model_ring(PM)

Rp, rp = Oscar.model_ring(phylogenetic_model(PM))
Rq, rq = Oscar.model_ring(PM)
Rp, rp = model_ring(phylogenetic_model(PM))
Rq, rq = model_ring(PM)

p_classes = Oscar.equivalent_classes(phylogenetic_model(PM))
q_classes = Oscar.equivalent_classes(PM)
p_classes = equivalent_classes(phylogenetic_model(PM))
q_classes = equivalent_classes(PM)

np = length(p_classes)
nq = length(q_classes)
Expand All @@ -1556,7 +1556,7 @@ function fourier_transform(PM::GroupBasedPhylogeneticModel)
# keys_q_classes = collect(keys(q_classes))
# sort!(keys_q_classes, rev = true)
H = Rp.(hadamard(matrix_space(ZZ, n_states(PM), n_states(PM))))
M = Rp.(Int.(zeros(nq, np)))
M = Rp.(zeros(Int, nq, np))

for (i, q_index) in enumerate(sort(collect(keys(rq)); rev=true))
current_fourier_class = q_classes[q_index]
Expand Down Expand Up @@ -1609,7 +1609,7 @@ function inverse_fourier_transform(PM::GroupBasedPhylogeneticModel)
H = Rq.(hadamard(matrix_space(ZZ, n_states(PM), n_states(PM))))
Hinv = 1//n_states(PM) * H

M = zeros(base_ring(Rq), np, nq)
M = zero_matrix(base_ring(Rq), np, nq)
for (i, p_index) in enumerate(sort(collect(keys(rp)); rev=true))
current_prob_class = p_classes[p_index]
for (j, q_index) in enumerate(sort(collect(keys(rq)); rev=true))
Expand Down
2 changes: 0 additions & 2 deletions experimental/DoubleAndHyperComplexes/src/SpectralSequences.jl
Original file line number Diff line number Diff line change
Expand Up @@ -736,8 +736,6 @@ function produce_map(cssp::CSSPage, i::Int, j::Int)
return hom(dom, cod, elem_type(cod)[cod(v) for v in img_gens]; check=false)
end

relations(F::FreeMod) = elem_type(F)[]

function multiplication_map(
ctx::Union{PushForwardCtx, ToricCtx},
p::MPolyDecRingElem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ function _ideal_sheaf_to_minimal_supercone_coordinates(
defining_ideal = ideal_in_cox_ring(I)
all(in(gens(base_ring(defining_ideal))), gens(defining_ideal)) || return not_possible
R = coordinate_ring(X)
coords = zeros(QQ, n_rays(X))
coords = zeros(QQFieldElem, n_rays(X))
for i in 1:n_rays(X)
R[i] in gens(defining_ideal) && (coords[i] = 1)
end
coords == zeros(QQ, n_rays(X)) && return not_possible
is_zero(coords) && return not_possible
is_minimal_supercone_coordinate_vector(polyhedral_fan(X), coords) || return not_possible
return coords
end
Expand Down
6 changes: 3 additions & 3 deletions experimental/FTheoryTools/src/G4Fluxes/auxiliary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,21 +210,21 @@ julia> length(collect(keys(cdh22)))
(my_tuple[1] in bad_positions || my_tuple[2] in bad_positions)

# Represent first variable by list of coefficients, after plugging in the linear relation
var1 = zeros(QQ, ncols(my_mat))
var1 = zeros(QQFieldElem, ncols(my_mat))
var1[my_tuple[1]] = 1
if my_tuple[1] in bad_positions
var1 = lin_rels[my_tuple[1]]
end

# Represent second variable by list of coefficients, after plugging in the linear relation
var2 = zeros(QQ, ncols(my_mat))
var2 = zeros(QQFieldElem, ncols(my_mat))
var2[my_tuple[2]] = 1
if my_tuple[2] in bad_positions
var2 = lin_rels[my_tuple[2]]
end

# Compute the product of the two variables, which represents the new relation
prod = zeros(QQ, N_filtered_quadratic_elements)
prod = zeros(QQFieldElem, N_filtered_quadratic_elements)
for k in 1:length(var1)
if var1[k] != 0
for l in 1:length(var2)
Expand Down
2 changes: 1 addition & 1 deletion experimental/FTheoryTools/src/auxiliary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ function _construct_generic_sample(
)
ambient_space_vars = vcat(base_vars, ["x", "y", "z"])
coordinate_ring_ambient_space = polynomial_ring(QQ, ambient_space_vars; cached=false)[1]
ambient_space_grading = zero_matrix(Int, nrows(base_grading) + 1, ncols(base_grading) + 3)
ambient_space_grading = zeros(Int, nrows(base_grading) + 1, ncols(base_grading) + 3)
ambient_space_grading[1:nrows(base_grading), 1:ncols(base_grading)] = base_grading
ambient_space_grading[1, (ncols(base_grading) + 1):(ncols(base_grading) + 2)] = [2; 3]
ambient_space_grading[nrows(base_grading) + 1, (ncols(base_grading) + 1):(ncols(base_grading) + 3)] = [
Expand Down
4 changes: 2 additions & 2 deletions experimental/GModule/src/GaloisCohomology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1997,7 +1997,7 @@ function Hecke.structure_constant_algebra(CC::GrpCoh.CoChain{2, PermGroupElem, G
else
mp = id_hom(k)
end
M = zeros(base_field(k), n*n, n*n, n*n)
M = Hecke.zeros_array(base_field(k), n*n, n*n, n*n)
#basis is prod. basis of basis(k) and e_sigma sigma in G
# e_sigma * e_tau is via cocycle
# bas * bas is direct
Expand All @@ -2011,7 +2011,7 @@ function Hecke.structure_constant_algebra(CC::GrpCoh.CoChain{2, PermGroupElem, G
# -> a*b^A * (sigma(A, B)*AB)
c = a[1] * preimage(mp, mG(a[2])(mp(b[1]))) * preimage(mp, CC(a[2], b[2]).data)
C = a[2]*b[2]
z = zeros(base_field(k), n*n)
z = Hecke.zeros_array(base_field(k), n*n)
bk = basis(k)
for i=1:length(bk)
p = findfirst(isequal((bk[i], C)), B)
Expand Down
6 changes: 3 additions & 3 deletions experimental/GModule/src/Misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,19 @@ function relative_field(m::Map{<:AbstractAlgebra.Field, <:AbstractAlgebra.Field}
coordinates = function(x::FieldElem)
@assert parent(x) == K
c = collect(Hecke.coefficients(map_coefficients(k, Qt(x), parent = kt) % h))
c = vcat(c, zeros(k, degree(h)-length(c)))
c = vcat(c, Hecke.zeros_array(k, degree(h)-length(c)))
return c
end
rep_mat = function(x::FieldElem)
@assert parent(x) == K
c = map_coefficients(k, Qt(x), parent = kt) % h
m = collect(Hecke.coefficients(c))
m = vcat(m, zeros(k, degree(h) - length(m)))
m = vcat(m, Hecke.zeros_array(k, degree(h) - length(m)))
r = m
for i in 2:degree(h)
c = shift_left(c, 1) % h
m = collect(Hecke.coefficients(c))
m = vcat(m, zeros(k, degree(h) - length(m)))
m = vcat(m, Hecke.zeros_array(k, degree(h) - length(m)))
r = hcat(r, m)
end
return transpose(matrix(r))
Expand Down
9 changes: 5 additions & 4 deletions experimental/GaloisGrp/src/Subfields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,11 @@ function _subfields(K::AbsSimpleNumField; pStart = 2*degree(K)+1, prime = 0)
sf = get_attribute(K, :principal_subfields)
store = sf === nothing

f = Zx(mapreduce(denominator, lcm, coefficients(defining_polynomial(K)), init = ZZRingElem(1))*defining_polynomial(K))
f = divexact(f, content(f))
fQ = defining_polynomial(K)
fQ /= content(fQ)
f = change_base_ring(ZZ, fQ; parent = Zx)

p, ct = find_prime(Hecke.Globals.Qx(f), pStart = pStart, prime = prime,
p, ct = find_prime(fQ, pStart = pStart, prime = prime,
filter_pattern = x->any(t->degree(t) == 1, first.(collect(x))))
n = degree(K)
if primitive_by_shape(ct, n)
Expand All @@ -358,7 +359,7 @@ function _subfields(K::AbsSimpleNumField; pStart = 2*degree(K)+1, prime = 0)
b .*= inv(derivative(f)(gen(K)))
bt = [parent(defining_polynomial(K))(x) for x = b]
bd = map(denominator, bt)
bz = [Zx(bd[i]*bt[i]) for i=1:length(bd)]
bz = [change_base_ring(ZZ, bd[i]*bt[i]; parent = Zx) for i=1:length(bd)]
@assert parent(f) == parent(bz[1])

lf = Hecke.factor_mod_pk(Array, H, 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ function coefficients(N::SubquoModule{T}, p_F::FaceQ) where {T <: MonoidAlgebraE
# get socle degrees of indecomposable injectives kQ{a + F - Q}, i.e. compute a k[F]-basis of the localisation (0 :_M P_F)[ZZ F]
Bp = ZF_basis(N, p_F)
if is_empty(Bp)
return [], zeros(kQ, 1, 1)
return Bp, Hecke.zeros_array(kQ, 1, 1)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing [] by Bp is not strictly necessary, it's just a "drive-by" type stability fix.

end

R = relations(N) #get all relations of N
Expand Down
14 changes: 0 additions & 14 deletions experimental/InjectiveResolutions/src/MonoidAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -526,20 +526,6 @@ end
dim(I::MonoidAlgebraIdeal) = krull_dim(underlying_ideal(I))
krull_dim(I::MonoidAlgebraIdeal) = krull_dim(underlying_ideal(I))

# some generic functionality which should probably be elsewhere
function is_subset(I::T, J::T) where {T<:Ideal}
return all(x in J for x in gens(I))
end

function Base.:(==)(I::T, J::T) where {T <: Ideal}
return is_subset(I, J) && is_subset(J, I)
end

function Base.:*(I::T, J::T) where {T<:Ideal}
@assert base_ring(I) === base_ring(J)
return ideal(base_ring(I), [x*y for x in gens(I) for y in gens(J)])
end

# user facing constructor
ideal(A::MonoidAlgebra, v::Vector) = MonoidAlgebraIdeal(A, elem_type(A)[A(x) for x in v])

Expand Down
2 changes: 1 addition & 1 deletion experimental/InvariantTheory/src/InvariantTheory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ function inv_generators(I::MPolyIdeal, G::LinearlyReductiveGroup, ringg::MPolyRi
end

#map them to the required ring, ringg.
img_genss = vcat(gens(ringg), zeros(ringg, length(xyz)-n))
img_genss = vcat(gens(ringg), Hecke.zeros_array(ringg, length(xyz)-n))
mixed_to_ring = hom(mixed_ring_xy, ringg, img_genss)
new_gens = Vector{elem_type(ringg)}()
for elemm in new_gens_wrong_ring
Expand Down
2 changes: 1 addition & 1 deletion experimental/LieAlgebras/src/AbstractLieAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ such that $[x_i, x_j] = \sum_k a_{i,j,k} x_k$.

# Examples
```jldoctest
julia> struct_consts = zeros(QQ, 3, 3, 3);
julia> struct_consts = QQ.(zeros(Int, 3, 3, 3));
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe should be

Suggested change
julia> struct_consts = QQ.(zeros(Int, 3, 3, 3));
julia> struct_consts = zeros(QQFieldElem, 3, 3, 3);

What do we want here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want unaliased entries.
Background: these are later put into Hecke sparse matrices, and iirc they don't guarantee not to mutate any entry objects


julia> struct_consts[1, 2, 3] = QQ(1);

Expand Down
2 changes: 1 addition & 1 deletion experimental/LieAlgebras/test/AbstractLieAlgebra-test.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@testset "LieAlgebras.AbstractLieAlgebra" begin
function sl2_struct_consts(R::Field)
sc = zeros(R, 3, 3, 3)
sc = Hecke.zeros_array(R, 3, 3, 3)
sc[1, 2, 3] = R(1)
sc[2, 1, 3] = R(-1)
sc[3, 1, 1] = R(2)
Expand Down
2 changes: 1 addition & 1 deletion experimental/LieAlgebras/test/LieAlgebraIdeal-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
end

let # Example where ideal basis is only found after two steps
sc = zeros(QQ, 4, 4, 4)
sc = Hecke.zeros_array(QQ, 4, 4, 4)
sc[1, 2, 3] = 1
sc[2, 1, 3] = -1
sc[1, 3, 4] = 1
Expand Down
2 changes: 1 addition & 1 deletion experimental/LieAlgebras/test/iso_oscar_gap-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ end
@testset for RO in baserings
@testset "AbstractLieAlgebra" begin
function sl2_struct_consts(R::Field)
sc = zeros(R, 3, 3, 3)
sc = Hecke.zeros_array(R, 3, 3, 3)
sc[1, 2, 3] = R(1)
sc[2, 1, 3] = R(-1)
sc[3, 1, 1] = R(2)
Expand Down
6 changes: 3 additions & 3 deletions experimental/LieAlgebras/test/setup_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if !isdefined(Main, :lie_algebra_conformance_test) || isinteractive()
end

@testset "parent object call overload" begin
@test L() == zero(L) == L(zeros(coefficient_ring(L), dim(L)))
@test L() == zero(L) == L(Hecke.zeros_array(coefficient_ring(L), dim(L)))

for _ in 1:num_random_tests
coeffs = rand(-10:10, dim(L))
Expand Down Expand Up @@ -147,7 +147,7 @@ if !isdefined(Main, :lie_algebra_conformance_test) || isinteractive()
reduce(
hcat,
[coefficients.(es); coefficients.(fs); coefficients.(hs)];
init=zeros(coefficient_ring(L), dim(L), 0),
init=Hecke.zeros_array(coefficient_ring(L), dim(L), 0),
),
),
)
Expand Down Expand Up @@ -304,7 +304,7 @@ if !isdefined(Main, :lie_algebra_module_conformance_test) || isinteractive()
end

@testset "parent object call overload" begin
@test V() == zero(V) == V(zeros(coefficient_ring(V), dim(V)))
@test V() == zero(V) == V(Hecke.zeros_array(coefficient_ring(V), dim(V)))

for _ in 1:num_random_tests
coeffs = rand(-10:10, dim(V))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ end
function n_new_Sgens(
x::RingElem, t::RingElem, Sgens::Vector{<:RingElem}, R::Ring, xs::Vector{<:RingElem}
)
preSgens = unique!([sub_v(x, t, f, R, xs) for f in Sgens])
preSgens = unique!(elem_type(R)[sub_v(x, t, f, R, xs) for f in Sgens])
if R(0) in preSgens
return [R(0)]
end
Expand Down
2 changes: 1 addition & 1 deletion experimental/ModStd/src/ModStdQt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ end

function Base.setindex!(v::Vals{T}, c::T, i::Int, j::Int) where {T}
if i > length(v.v)
push!(v.v, zeros(parent(v.v[1][1]), length(v.v[1])))
push!(v.v, Hecke.zeros_array(parent(v.v[1][1]), length(v.v[1])))
end
if j > length(v.v[i])
while length(v.v[i]) < j-1
Expand Down
2 changes: 1 addition & 1 deletion experimental/Schemes/src/ToricBlowups/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Multivariate polynomial ring in 5 variables over QQ graded by
```
"""
function blow_up(X::NormalToricVarietyType, n::Int; coordinate_name::Union{VarName, Nothing} = nothing)
coords = zeros(QQ, n_rays(X))
coords = zeros(QQFieldElem, n_rays(X))
for i in 1:number_of_rays(X)
cones(X)[n, i] && (coords[i] = QQ(1))
end
Expand Down
Loading
Loading