-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDirectProductGroup.class.st
More file actions
130 lines (108 loc) · 3.31 KB
/
Copy pathDirectProductGroup.class.st
File metadata and controls
130 lines (108 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
"
Direct products of groups. Elements are tuples, and multiplication and addition are defined component wise.
"
Class {
#name : #DirectProductGroup,
#superclass : #Group,
#instVars : [
'components'
],
#category : #'Mathematics-Groups'
}
{ #category : #'instance creation' }
DirectProductGroup class >> components: anArray [
^ self new components: anArray
]
{ #category : #comparing }
DirectProductGroup >> = anObject [
^ (anObject isKindOf: DirectProductGroup) and: [anObject components = components]
]
{ #category : #accessing }
DirectProductGroup >> ambient [
^ self propertyAt: #ambient ifAbsentPut: [(components noneSatisfy: [:each| each isEmbedded]) ifTrue: [self] ifFalse: [self class components: (components collect: [:each| each ambient])]]
]
{ #category : #accessing }
DirectProductGroup >> arity [
^ components size
]
{ #category : #converting }
DirectProductGroup >> asCartesianProduct [
^ CartesianProduct components: components
]
{ #category : #accessing }
DirectProductGroup >> at: anInteger [
^ components at: anInteger
]
{ #category : #random }
DirectProductGroup >> atRandom: aRandom [
^ self asCartesianProduct atRandom: aRandom
]
{ #category : #random }
DirectProductGroup >> atRandom: aRandom bits: bits [
^ self asCartesianProduct atRandom: aRandom bits: bits
]
{ #category : #'accessing-private' }
DirectProductGroup >> components [
^ components
]
{ #category : #'accessing-private' }
DirectProductGroup >> components: anArray [
components := anArray
]
{ #category : #private }
DirectProductGroup >> computeGenerators [
| answer |
answer := OrderedCollection new.
1 to: self arity do: [:i|
| p |
p := self projection: i.
(self at: i) generators do: [:each| answer add: (p value: each)]].
^ answer
]
{ #category : #enumerating }
DirectProductGroup >> do: aBlock [
self asCartesianProduct do: aBlock
]
{ #category : #morphisms }
DirectProductGroup >> embedding: i [
^ ((self at: i) to: self evaluating: [:x| components withIndexCollect: [:each :k| k = i ifTrue: [x] ifFalse: [each identity]]]) name: 'i', i printText sub
]
{ #category : #comparing }
DirectProductGroup >> hash [
^ components hash
]
{ #category : #accessing }
DirectProductGroup >> identity [
^ components collect: [:each| each identity]
]
{ #category : #testing }
DirectProductGroup >> includes: anObject [
anObject isSequenceable ifFalse: [^ false].
anObject size = components size ifFalse: [^ false].
components with: anObject do: [:G :x| (G includes: x) ifFalse: [^ false]].
^ true
]
{ #category : #accessing }
DirectProductGroup >> inverseMap [
^ self to: self evaluating: [:x| x withIndexCollect: [:xi :i| (self at: i) inverseMap value: xi]]
]
{ #category : #testing }
DirectProductGroup >> isProduct [
^ true
]
{ #category : #accessing }
DirectProductGroup >> operation [
^ GroupAction from: (self, self) to: self evaluatingWithArguments: [:x :y| x withIndexCollect: [:xi :i| (self at: i) operation value: {xi. y at: i}]]
]
{ #category : #printing }
DirectProductGroup >> printOn: aStream [
components do: [:each| aStream print: each] separatedBy: [aStream nextPut: Character times]
]
{ #category : #morphisms }
DirectProductGroup >> projection: i [
^ (self to: (self at: i) evaluating: [:x| x at: i]) name: 'Pi', i printString
]
{ #category : #accessing }
DirectProductGroup >> size [
^ components product: [:each| each size]
]