Skip to content

Commit

Permalink
Excise GroupsCore dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Jan 17, 2024
1 parent e656065 commit 172d4d3
Show file tree
Hide file tree
Showing 11 changed files with 601 additions and 26 deletions.
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ uuid = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
version = "0.35.2"

[deps]
GroupsCore = "d5909c97-4eac-4ecc-a3dc-fdd0858a4120"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
Expand All @@ -14,7 +13,6 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
GroupsCore = "0.4.0"
InteractiveUtils = "1.6"
LinearAlgebra = "1.6"
MacroTools = "0.5"
Expand Down
1 change: 0 additions & 1 deletion docs/src/perm.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ sign(::Perm)
permtype(::Perm)
```

Additionally [`GroupsCore.jl`](https://github.com/kalmarek/GroupsCore.jl) package provides more functionality, notably functions `gens` and `order`. You may consult its [documentation](https://kalmarek.github.io/GroupsCore.jl/stable/).
Note that even an `Int64` can be easily overflowed when computing with symmetric groups.
Thus, by default, `order` returns (always correct) `BigInt`s.
If you are sure that the computation will not overflow, you may use `order(::Type{T}, ...)` to perform computations with machine integers.
Expand Down
37 changes: 23 additions & 14 deletions src/AbstractAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ using Preferences

using Test # for "interface-conformance" functions

import GroupsCore
import GroupsCore: gens, ngens, order, mul!, istrivial

# A list of all symbols external packages should not import from AbstractAlgebra
const import_exclude = [:import_exclude, :QQ, :ZZ,
:RealField, :number_field, :NumberField, :GF,
Expand Down Expand Up @@ -235,11 +232,13 @@ export FracField
export FreeAssAlgebra
export FreeAssAlgElem
export FunctionalMap
export Group
export GroupElem
export hgcd
export Ideal
export IdealSet
export IdentityMap
export InfiniteOrderError
export is_irreducible
export is_squarefree
export is_perfect
Expand Down Expand Up @@ -300,7 +299,19 @@ include("AliasMacro.jl")
include("PrintHelper.jl")

# alternative names for some functions from Base
export is_empty, is_even, is_equal, is_finite, is_inf, is_integer, is_less, is_odd, is_one, is_real, is_subset, is_valid, is_zero
export is_empty
export is_equal
export is_even
export is_finite
export is_inf
export is_integer
export is_less
export is_odd
export is_one
export is_real
export is_subset
export is_valid
export is_zero

@alias is_empty isempty
@alias is_even iseven
Expand All @@ -316,16 +327,11 @@ export is_empty, is_even, is_equal, is_finite, is_inf, is_integer, is_less, is_o
@alias is_valid isvalid
@alias is_zero iszero

# alternative names for some functions from GroupsCore
export is_trivial

@alias is_trivial istrivial
function order end

# alternative names for some functions from LinearAlgebra
# we don't use the `@alias` macro here because we provide custom
# docstrings for these aliases
export is_diagonal, is_hermitian, is_symmetric, is_upper_triangular, is_lower_triangular

const is_diagonal = isdiag
const is_hermitian = ishermitian
const is_symmetric = issymmetric
Expand Down Expand Up @@ -823,6 +829,7 @@ export coefficients
export coefficients_of_univariate
export collength
export combine_like_terms!
export comm
export compose
export constant_coefficient
export content
Expand Down Expand Up @@ -888,6 +895,7 @@ export get_attribute!
export gram
export has_attribute
export has_bottom_neighbor
export has_gens
export has_left_neighbor
export hash
export hessenberg
Expand Down Expand Up @@ -926,13 +934,16 @@ export is_diagonal
export is_divisible_by
export is_domain_type
export is_exact_type
export is_finiteorder
export is_gen
export is_hermitian
export is_hessenberg
export is_hnf
export is_homogeneous
export is_invertible
export is_invertible_with_inverse
export is_isomorphic
export is_lower_triangular
export is_monic
export is_monomial
export is_monomial_recursive
Expand All @@ -949,6 +960,7 @@ export is_submodule
export is_symmetric
export is_term
export is_term_recursive
export is_trivial
export is_unicode_allowed
export is_unit
export is_univariate
Expand Down Expand Up @@ -1268,10 +1280,7 @@ getindex(R::Union{Tuple{PolyRing, PolyRingElem}, Tuple{NCPolyRing, NCPolyRingEle
#
################################################################################

# Unfortunately `Group` is not a subtype of Set because we derive it from the
# GroupsCore package (oh, if only Julia allowed inheritance from multiple
# abstract types...)
getindex(S::Union{Set, Group}, i::Int) = gen(S, i)
getindex(S::Set, i::Int) = gen(S, i)

###############################################################################
#
Expand Down
4 changes: 2 additions & 2 deletions src/AbstractTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

abstract type Set end

const Group = GroupsCore.Group # with * as operation
abstract type Group <: Set end # with * as operation

abstract type AdditiveGroup <: Set end # with + as operation

Expand All @@ -25,7 +25,7 @@ abstract type Field <: Ring end

abstract type SetElem end

const GroupElem = GroupsCore.GroupElement # with * as operation
abstract type GroupElem <: SetElem end # with * as operation

abstract type AdditiveGroupElem <: SetElem end # with + as operation

Expand Down
1 change: 1 addition & 0 deletions src/Aliases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ Base.@deprecate_binding DirectSum direct_sum
# Deprecated in 0.34.*
Base.@deprecate_binding PuiseuxSeriesField puiseux_series_field
Base.@deprecate_binding PuiseuxSeriesRing puiseux_series_ring
Base.@deprecate_binding istrivial is_trivial
1 change: 1 addition & 0 deletions src/Generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ import ..AbstractAlgebra: inv
import ..AbstractAlgebra: is_constant
import ..AbstractAlgebra: is_domain_type
import ..AbstractAlgebra: is_exact_type
import ..AbstractAlgebra: is_finite
import ..AbstractAlgebra: is_gen
import ..AbstractAlgebra: is_monomial
import ..AbstractAlgebra: is_square
Expand Down
Loading

0 comments on commit 172d4d3

Please sign in to comment.