mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-11-10 20:25:28 +01:00
add AbstractMatrixGroup
This commit is contained in:
parent
f096a869b8
commit
a380959614
@ -1,6 +1,6 @@
|
||||
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
|
||||
alphabet::A
|
||||
gens::S
|
||||
|
@ -1,6 +1,6 @@
|
||||
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
|
||||
alphabet::A
|
||||
gens::S
|
||||
|
@ -1,5 +1,5 @@
|
||||
abstract type MatrixGroup{N,T} <: Groups.AbstractFPGroup end
|
||||
const MatrixGroupElement{N,T} = Groups.AbstractFPGroupElement{<:MatrixGroup{N,T}}
|
||||
abstract type AbstractMatrixGroup{N,T} <: Groups.AbstractFPGroup end
|
||||
const MatrixGroupElement{N,T} = Groups.AbstractFPGroupElement{<:AbstractMatrixGroup{N,T}}
|
||||
|
||||
Base.isone(g::MatrixGroupElement{N,T}) where {N,T} =
|
||||
isone(word(g)) || isone(matrix(g))
|
||||
@ -32,9 +32,9 @@ end
|
||||
|
||||
function Base.rand(
|
||||
rng::Random.AbstractRNG,
|
||||
rs::Random.SamplerTrivial{<:MatrixGroup},
|
||||
rs::Random.SamplerTrivial{<:AbstractMatrixGroup},
|
||||
)
|
||||
Mgroup = rs[]
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user