mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2025-01-08 13:22:33 +01:00
add AbstractMatrixGroup
This commit is contained in:
parent
f096a869b8
commit
a380959614
@ -1,6 +1,6 @@
|
|||||||
include("eltary_matrices.jl")
|
include("eltary_matrices.jl")
|
||||||
|
|
||||||
struct SpecialLinearGroup{N,T,R,A,S} <: MatrixGroup{N,T}
|
struct SpecialLinearGroup{N,T,R,A,S} <: AbstractMatrixGroup{N,T}
|
||||||
base_ring::R
|
base_ring::R
|
||||||
alphabet::A
|
alphabet::A
|
||||||
gens::S
|
gens::S
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
include("eltary_symplectic.jl")
|
include("eltary_symplectic.jl")
|
||||||
|
|
||||||
struct SymplecticGroup{N,T,R,A,S} <: MatrixGroup{N,T}
|
struct SymplecticGroup{N,T,R,A,S} <: AbstractMatrixGroup{N,T}
|
||||||
base_ring::R
|
base_ring::R
|
||||||
alphabet::A
|
alphabet::A
|
||||||
gens::S
|
gens::S
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
abstract type MatrixGroup{N,T} <: Groups.AbstractFPGroup end
|
abstract type AbstractMatrixGroup{N,T} <: Groups.AbstractFPGroup end
|
||||||
const MatrixGroupElement{N,T} = Groups.AbstractFPGroupElement{<:MatrixGroup{N,T}}
|
const MatrixGroupElement{N,T} = Groups.AbstractFPGroupElement{<:AbstractMatrixGroup{N,T}}
|
||||||
|
|
||||||
Base.isone(g::MatrixGroupElement{N,T}) where {N,T} =
|
Base.isone(g::MatrixGroupElement{N,T}) where {N,T} =
|
||||||
isone(word(g)) || isone(matrix(g))
|
isone(word(g)) || isone(matrix(g))
|
||||||
@ -32,9 +32,9 @@ end
|
|||||||
|
|
||||||
function Base.rand(
|
function Base.rand(
|
||||||
rng::Random.AbstractRNG,
|
rng::Random.AbstractRNG,
|
||||||
rs::Random.SamplerTrivial{<:MatrixGroup},
|
rs::Random.SamplerTrivial{<:AbstractMatrixGroup},
|
||||||
)
|
)
|
||||||
Mgroup = rs[]
|
Mgroup = rs[]
|
||||||
S = gens(Mgroup)
|
S = gens(Mgroup)
|
||||||
return prod(g -> rand(Bool) ? g : inv(g), rand(S, rand(1:30)))
|
return prod(g -> rand(rng, Bool) ? g : inv(g), rand(rng, S, rand(rng, 1:30)))
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user