Skip to content

Commit 3281118

Browse files
More cleaning
1 parent 3f7c1cf commit 3281118

File tree

1 file changed

+53
-12
lines changed

1 file changed

+53
-12
lines changed

Diff for: Mathematics-Groups/Group.class.st

+53-12
Original file line numberDiff line numberDiff line change
@@ -98,28 +98,34 @@ Group >> \ aSubgroup [
9898
{ #category : #operations }
9999
Group >> \\ aSubgroup [
100100
"Answer the set of right cosets of the receiver by aSubgroup."
101+
101102
| answer |
102103
answer := Set new.
103-
self do: [:each| answer add: (RightCoset on: aSubgroup representative: each)].
104+
self
105+
do: [ :each | answer add: (RightCoset on: aSubgroup representative: each) ].
104106
^ answer
105107
]
106108

107109
{ #category : #operations }
108110
Group >> abelianization [
109111
"Answer the receiver 'made abelian'."
112+
110113
^ (self / self commutator)
111114
propertyAt: #isCommutative put: true;
112115
yourself
113116
]
114117

115118
{ #category : #private }
116119
Group >> additiveInverseMap [
117-
^ (self to: self evaluating: [:each| each negated]) name: '-id'
120+
^ (self to: self evaluating: [ :each | each negated ]) name: '-id'
118121
]
119122

120123
{ #category : #private }
121124
Group >> additiveOperation [
122-
^ (GroupAction from: (self, self) to: self evaluatingWithArguments: [:x :y| x + y]) name: '+'
125+
^ (GroupAction
126+
from: self , self
127+
to: self
128+
evaluatingWithArguments: [ :x :y | x + y ]) name: '+'
123129
]
124130

125131
{ #category : #morphisms }
@@ -139,8 +145,13 @@ Group >> adjointAction [
139145

140146
{ #category : #random }
141147
Group >> atRandom: aRandom bits: bitSize [
142-
self propertyAt: #elements ifPresent: [:aCollection| ^ aCollection atRandom: aRandom bits: bitSize].
143-
self generators notNil ifTrue: [^ (GroupRandomGenerator on: self random: aRandom) bits: bitSize; next].
148+
self
149+
propertyAt: #elements
150+
ifPresent: [ :aCollection | ^ aCollection atRandom: aRandom bits: bitSize ].
151+
self generators notNil
152+
ifTrue: [ ^ (GroupRandomGenerator on: self random: aRandom)
153+
bits: bitSize;
154+
next ].
144155
^ self subclassResponsibility
145156
]
146157

@@ -167,15 +178,31 @@ Group >> cayleyGraphMorph [
167178
Group >> cayleyGraphMorph: generators [
168179
"Answer the colored Cayley graph of the receiver for the given set of generators.
169180
The set of generators is usually assumed to be symmetric (contains all inverses too) and to not contain the identity."
181+
170182
| G answer colors |
171183
G := self cayleyGraph: generators.
172184
answer := G asMorph.
173185
colors := AutomaticPalette new.
174-
answer nodesDo: [:each| each color: Color transparent; radius: 0].
175-
generators do: [:each| colors at: each].
176-
generators do: [:each| (answer nodeAt: each) color: (colors at: each); radius: 10].
177-
answer edgesAndLabelsDo: [:each :label| each hideLabel; color: (colors at: label)].
178-
(answer nodeAt: self identity) color: Color white; shape: #square; radius: 10.
186+
answer
187+
nodesDo: [ :each |
188+
each
189+
color: Color transparent;
190+
radius: 0 ].
191+
generators do: [ :each | colors at: each ].
192+
generators
193+
do: [ :each |
194+
(answer nodeAt: each)
195+
color: (colors at: each);
196+
radius: 10 ].
197+
answer
198+
edgesAndLabelsDo: [ :each :label |
199+
each
200+
hideLabel;
201+
color: (colors at: label) ].
202+
(answer nodeAt: self identity)
203+
color: Color white;
204+
shape: #square;
205+
radius: 10.
179206
^ answer
180207
]
181208

@@ -188,22 +215,36 @@ Group >> center [
188215
Group >> centralizerOf: aCollection [
189216
| op |
190217
op := self operation.
191-
^ self select: [:x| aCollection allSatisfy: [:y| (op value: {x. y}) = (op value: {y. x})]]
218+
^ self
219+
select: [ :x |
220+
aCollection
221+
allSatisfy: [ :y |
222+
(op
223+
value:
224+
{x.
225+
y})
226+
=
227+
(op
228+
value:
229+
{y.
230+
x}) ] ]
192231
]
193232

194233
{ #category : #enumerating }
195234
Group >> collect: aBlock [
196235
"Answer the subgroup resulting of mapping the elements of the receiver by aBlock."
236+
197237
| elements |
198238
elements := Set new.
199-
self do: [:each| elements add: (aBlock value: each)].
239+
self do: [ :each | elements add: (aBlock value: each) ].
200240
^ self copyEmpty elements: elements
201241
]
202242

203243
{ #category : #operations }
204244
Group >> commutator [
205245
"Answer the commutator group [G,G] of the receiver G, also called the derived group and noted G'.
206246
This is the smallest normal subgroup of G such that the quotient G / [G,G] is commutative."
247+
207248
^ self commutator: self
208249
]
209250

0 commit comments

Comments
 (0)