From 589e1882cd970f2bf3757cc286283d216834d465 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Sun, 8 Apr 2018 22:46:28 +0200 Subject: [PATCH] fix indentation --- src/Projections.jl | 86 +++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/src/Projections.jl b/src/Projections.jl index 79ab4fa..0a44df0 100644 --- a/src/Projections.jl +++ b/src/Projections.jl @@ -183,54 +183,54 @@ function rankOne_projections(BN::WreathProduct, T::Type=Rational{Int}) return all_projs end - ############################################################################## - # - # General Groups Misc - # - ############################################################################## +############################################################################## +# +# General Groups Misc +# +############################################################################## - doc""" - products(X::Vector{GroupElem}, Y::Vector{GroupElem}, op=*) - > Returns a vector of all possible products (or `op(x,y)`), where $x\in X$ and - > $y\in Y$ are group elements. You may specify which operation is used when - > forming 'products' by adding `op` (which is `*` by default). - """ - function products{T<:GroupElem}(X::AbstractVector{T}, Y::AbstractVector{T}, op=*) - result = Vector{T}() - seen = Set{T}() - for x in X - for y in Y - z = op(x,y) - if !in(z, seen) - push!(seen, z) - push!(result, z) - end +doc""" +products(X::Vector{GroupElem}, Y::Vector{GroupElem}, op=*) +> Returns a vector of all possible products (or `op(x,y)`), where $x\in X$ and +> $y\in Y$ are group elements. You may specify which operation is used when +> forming 'products' by adding `op` (which is `*` by default). +""" +function products{T<:GroupElem}(X::AbstractVector{T}, Y::AbstractVector{T}, op=*) + result = Vector{T}() + seen = Set{T}() + for x in X + for y in Y + z = op(x,y) + if !in(z, seen) + push!(seen, z) + push!(result, z) end end - return result end + return result +end - doc""" - generateGroup(gens::Vector{GroupElem}, r=2, Id=parent(first(gens))(), op=*) - > Produces all elements of a group generated by elements in `gens` in ball of - > radius `r` (word-length metric induced by `gens`). - > If `r(=2)` is specified the procedure will terminate after generating ball - > of radius `r` in the word-length metric induced by `gens`. - > The identity element `Id` and binary operation function `op` can be supplied - > to e.g. take advantage of additive group structure. - """ - function generateGroup{T<:GroupElem}(gens::Vector{T}, r=2, Id::T=parent(first(gens))(), op=*) - n = 0 - R = 1 - elts = gens - gens = [Id; gens] - while n ≠ length(elts) && R < r - # @show elts - R += 1 - n = length(elts) - elts = products(elts, gens, op) - end - return elts +doc""" +generateGroup(gens::Vector{GroupElem}, r=2, Id=parent(first(gens))(), op=*) +> Produces all elements of a group generated by elements in `gens` in ball of +> radius `r` (word-length metric induced by `gens`). +> If `r(=2)` is specified the procedure will terminate after generating ball +> of radius `r` in the word-length metric induced by `gens`. +> The identity element `Id` and binary operation function `op` can be supplied +> to e.g. take advantage of additive group structure. +""" +function generateGroup{T<:GroupElem}(gens::Vector{T}, r=2, Id::T=parent(first(gens))(), op=*) + n = 0 + R = 1 + elts = gens + gens = [Id; gens] + while n ≠ length(elts) && R < r + # @show elts + R += 1 + n = length(elts) + elts = products(elts, gens, op) end + return elts +end end # of module Projections