This file is indexed.

/usr/share/gap/lib/fastendo.gi is in gap-libs 4r6p5-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#############################################################################
##
#W  fastendo.gi           GAP library                    Andrew Solomon
##
##
#Y  Copyright (C)  1997,  Lehrstuhl D für Mathematik,  RWTH Aachen,  Germany
#Y  (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland
#Y  Copyright (C) 2002 The GAP Group
##
##  Conversion to, and fast methods for, transformation representation
##  of EndoMappings.
##



############################################################################
##
#R  IsTransformationRepOfEndo(<obj>)
##
##  An endomorphism of a finite domain <D> with EnumeratorSorted can be 
##  represented as transformation on  [1 .. Length(EnumeratorSorted(D))]
##
DeclareRepresentation("IsTransformationRepOfEndo", 
IsComponentObjectRep and IsAttributeStoringRep,
["transformation"]);

############################################################################
##
#F  EndoMappingByTransformation(<dom>, <gmfam>, <trans>)
##
##  Creates an endo general mapping from <dom> to itself 
##  in the general mappings family <gmfam>, described by transformation
##  <trans>. At present this is a private function.
##
BindGlobal("EndoMappingByTransformation",
function(dom, gmfam, trans)
 local tmap;

 tmap :=  Objectify(gmfam!.transtype,
    rec( transformation := trans));
  SetSource(tmap,dom);
  SetRange(tmap,dom);
	SetIsEndoMapping(tmap, true);

  return tmap;
end);




############################################################################
##
#A  TransformationRepresentation(<obj>)
##
##  The user must deliberately put endomorphisms into this representation
##  since it calls enumerator sorted on the Source.
##
InstallMethod(TransformationRepresentation, 
"for an endo general mapping", true,
[IsEndoMapping], 0,
function(m)
	local trans;

  if not (HasIsFinite(Source(m)) and IsFinite(Source(m))) then
    	TryNextMethod();
  fi;

	# create the type if necessary
	if not IsBound(FamilyObj(m)!.transtype) then
		FamilyObj(m)!.transtype := NewType(FamilyObj(m), 
			IsEndoMapping and IsNonSPGeneralMapping 
			and IsTransformationRepOfEndo);
	fi;

	trans:= Transformation(List([1 .. Size(Source(m))], 
		i -> Position(EnumeratorSorted(Source(m)), 
			EnumeratorSorted(Source(m))[i]^m)));

	return EndoMappingByTransformation(Source(m),FamilyObj(m), trans);

end);

InstallMethod(TransformationRepresentation, 
"for an endo general mapping", true,
[IsEndoMapping and IsTransformationRepOfEndo], 0,m->m);

#############################################################################
##
#M  CompositionMapping2( <endo>, <endo> )  . . for IsTransformationRepOfEndo
##
##  Note: this is the dual of \*
##
InstallMethod(CompositionMapping2, 
	"IsTransformationRepOfEndo, IsTransformationRepOfEndo", IsIdenticalObj,
  [IsTransformationRepOfEndo and IsEndoMapping, 
	IsTransformationRepOfEndo and IsEndoMapping], 0,
function(n, m)
  local mntrans;

  if Source(n) <> Source(m) then
		TryNextMethod();
  fi;

  mntrans := m!.transformation* n!.transformation;

	return EndoMappingByTransformation(Source(m),FamilyObj(m), mntrans);
end);


InstallMethod( CompositionMapping2,
    "IsEndoMapping, IsTransformationRepOfEndo", IsIdenticalObj,
    [ IsEndoMapping, IsTransformationRepOfEndo and IsEndoMapping ],
    function( n, m )
    if Source(n) <> Source(m) then
#T Is this really necessary?
      TryNextMethod();
    fi;

    return EndoMappingByTransformation( Source(m), FamilyObj(m),
               m!.transformation
               * TransformationRepresentation( n )!.transformation );
    end );


InstallMethod( CompositionMapping2,
    "IsTransformationRepOfEndo, IsEndoMapping", IsIdenticalObj,
    [ IsTransformationRepOfEndo and IsEndoMapping, IsEndoMapping ],
    function( n, m )
    if Source(n) <> Source(m) then
#T Is this really necessary?
      TryNextMethod();
    fi;

    return EndoMappingByTransformation( Source(m), FamilyObj(m),
               TransformationRepresentation( m )!.transformation
               * n!.transformation );
    end );


#############################################################################
##
#M  \=( <endo>, <endo> )  . . . for IsTransformationRepOfEndo
##
InstallMethod(\=, 
	"IsTransformationRepOfEndo, IsTransformationRepOfEndo", IsIdenticalObj,
  [IsTransformationRepOfEndo and IsEndoMapping, 
	IsTransformationRepOfEndo and IsEndoMapping], 0,
function(m, n)

  if Source(n) <> Source(m) then
    return false;
  fi;

  return m!.transformation = n!.transformation;
end);


InstallMethod(\=, 
	"IsTransformationRepOfEndo, IsEndoMapping", IsIdenticalObj,
  [IsTransformationRepOfEndo and IsEndoMapping, 
	IsEndoMapping], 0,
function(m, n)

  if Source(n) <> Source(m) then
    return false;
  fi;

  return m!.transformation = TransformationRepresentation(n)!.transformation;
end);


InstallMethod(\=, 
	"IsEndoMapping, IsTransformationRepOfEndo", IsIdenticalObj,
  [IsEndoMapping, 
	IsTransformationRepOfEndo and IsEndoMapping], 0,
function(m, n)

	if Source(n) <> Source(m) then
		return false;
	fi;

  return TransformationRepresentation(m)!.transformation = n!.transformation;
end);


#############################################################################
##
#M  \<( <endo>, <endo> )  . . . for IsTransformationRepOfEndo
##
InstallMethod(\<, 
	"IsTransformationRepOfEndo, IsTransformationRepOfEndo", IsIdenticalObj,
  [IsEndoMapping and IsTransformationRepOfEndo, 
	IsEndoMapping and IsTransformationRepOfEndo], 0,
function(m, n)
  return TransformationRepresentation(m)!.transformation < 
		TransformationRepresentation(n)!.transformation;
end);


InstallMethod(\<, 
	"IsEndoMapping, IsTransformationRepOfEndo", IsIdenticalObj,
  [IsEndoMapping, 
	IsEndoMapping and IsTransformationRepOfEndo], 0,
function(m, n)
	if Source(n) <> Source(m) then
		TryNextMethod();
	fi;
	if not HasEnumeratorSorted(Source(m)) then
		TryNextMethod();
	fi;

  return TransformationRepresentation(m)!.transformation < 
		TransformationRepresentation(n)!.transformation;
end);


InstallMethod(\<, 
	"IsTransformationRepOfEndo, IsEndoMapping", IsIdenticalObj,
  [IsEndoMapping and IsTransformationRepOfEndo, 
	IsEndoMapping], 0,
function(m, n)
	if Source(n) <> Source(m) then
		TryNextMethod();
	fi;
	if not HasEnumeratorSorted(Source(m)) then
		TryNextMethod();
	fi;

  return TransformationRepresentation(m)!.transformation < 
		TransformationRepresentation(n)!.transformation;
end);

#############################################################################
##
#M  ImagesElm( <endo>, <elm> )  . . . for IsTransformationRepOfEndo
##
InstallMethod( ImagesElm,
    "IsTransformationRepOfEndo",
    FamSourceEqFamElm,
    [IsTransformationRepOfEndo and IsEndoMapping, IsObject ], 0,
function( endo, elm )
	local poselm;

	poselm := Position(EnumeratorSorted(Source(endo)), elm);
	return [EnumeratorSorted(Source(endo))[poselm^(endo!.transformation)]];
end);

############################################################################
##
#E