Skip to content

Commit 469cffc

Browse files
committed
Remove legacy constructors in CategoryOfColumns again
1 parent c3ae66b commit 469cffc

File tree

2 files changed

+65
-93
lines changed

2 files changed

+65
-93
lines changed

FreydCategoriesForCAP/gap/CategoryOfColumns.gi

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,16 @@ end );
106106
InstallMethodForCompilerForCAP( CategoryOfColumnsObjectOp,
107107
[ IsCategoryOfColumns, IsInt ],
108108

109-
function( category, rank )
109+
function( cat, rank )
110110

111-
return ObjectConstructor( category, rank );
111+
if not IsInt( rank ) or rank < 0 then
112+
113+
Error( "the object datum must be a non-negative integer" );
114+
115+
fi;
116+
117+
return ObjectifyObjectForCAPWithAttributes( rec( ), cat,
118+
RankOfObject, rank );
112119

113120
end );
114121

@@ -143,7 +150,35 @@ InstallOtherMethodForCompilerForCAP( CategoryOfColumnsMorphism,
143150

144151
function( cat, source, homalg_matrix, range )
145152

146-
return MorphismConstructor( cat, source, homalg_matrix, range );
153+
if not IsHomalgMatrix( homalg_matrix ) then
154+
155+
Error( "the morphism datum must be a homalg matrix" );
156+
157+
fi;
158+
159+
if not IsIdenticalObj( HomalgRing( homalg_matrix ), UnderlyingRing( cat ) ) then
160+
161+
Error( "the matrix is defined over a different ring than the category" );
162+
163+
fi;
164+
165+
if NrColumns( homalg_matrix ) <> RankOfObject( source ) then
166+
167+
Error( "the number of columns has to be equal to the dimension of the source" );
168+
169+
fi;
170+
171+
if NrRows( homalg_matrix ) <> RankOfObject( range ) then
172+
173+
Error( "the number of rows has to be equal to the dimension of the range" );
174+
175+
fi;
176+
177+
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec( ), cat,
178+
source,
179+
range,
180+
UnderlyingMatrix, homalg_matrix
181+
);
147182

148183
end );
149184

FreydCategoriesForCAP/gap/CategoryOfColumnsAsOppositeOfCategoryOfRows.gi

Lines changed: 27 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -127,69 +127,6 @@ InstallMethod( CategoryOfColumnsAsOppositeOfCategoryOfRows,
127127

128128
end );
129129

130-
# legacy constructors used below
131-
BindGlobal( "LegacyCategoryOfColumnsObject", function( cat, rank )
132-
#% CAP_JIT_RESOLVE_FUNCTION
133-
134-
if not IsInt( rank ) or rank < 0 then
135-
136-
Error( "the object datum must be a non-negative integer" );
137-
138-
fi;
139-
140-
return ObjectifyObjectForCAPWithAttributes( rec( ), cat,
141-
RankOfObject, rank );
142-
143-
end );
144-
145-
BindGlobal( "LegacyCategoryOfColumnsMorphism", function( cat, source, homalg_matrix, range )
146-
#% CAP_JIT_RESOLVE_FUNCTION
147-
148-
if not IsHomalgMatrix( homalg_matrix ) then
149-
150-
Error( "the morphism datum must be a homalg matrix" );
151-
152-
fi;
153-
154-
if not IsIdenticalObj( HomalgRing( homalg_matrix ), UnderlyingRing( cat ) ) then
155-
156-
Error( "the matrix is defined over a different ring than the category" );
157-
158-
fi;
159-
160-
if NrColumns( homalg_matrix ) <> RankOfObject( source ) then
161-
162-
Error( "the number of columns has to be equal to the dimension of the source" );
163-
164-
fi;
165-
166-
if NrRows( homalg_matrix ) <> RankOfObject( range ) then
167-
168-
Error( "the number of rows has to be equal to the dimension of the range" );
169-
170-
fi;
171-
172-
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec( ), cat,
173-
source,
174-
range,
175-
UnderlyingMatrix, homalg_matrix
176-
);
177-
178-
end );
179-
180-
BindGlobal( "LegacyAsCategoryOfColumnsMorphism", function( homalg_matrix, category )
181-
local source, range;
182-
#% CAP_JIT_RESOLVE_FUNCTION
183-
184-
source := CategoryOfColumnsObject( category, NrColumns( homalg_matrix ) );
185-
186-
range := CategoryOfColumnsObject( category, NrRows( homalg_matrix ) );
187-
188-
return LegacyCategoryOfColumnsMorphism( CapCategory( source ), source, homalg_matrix, range );
189-
190-
end );
191-
192-
193130
####################################
194131
##
195132
## Basic operations
@@ -212,7 +149,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
212149
AddMultiplyWithElementOfCommutativeRingForMorphisms( category,
213150
function( cat, r, alpha )
214151

215-
return LegacyCategoryOfColumnsMorphism( cat, Source( alpha ), r * UnderlyingMatrix( alpha ), Range( alpha ) );
152+
return CategoryOfColumnsMorphism( cat, Source( alpha ), r * UnderlyingMatrix( alpha ), Range( alpha ) );
216153

217154
end );
218155

@@ -224,15 +161,15 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
224161
AddHomomorphismStructureOnObjects( category,
225162
function( cat, object_1, object_2 )
226163

227-
return LegacyCategoryOfColumnsObject( cat, RankOfObject( object_1 ) * RankOfObject( object_2 ) );
164+
return CategoryOfColumnsObject( cat, RankOfObject( object_1 ) * RankOfObject( object_2 ) );
228165

229166
end );
230167

231168
##
232169
AddHomomorphismStructureOnMorphismsWithGivenObjects( category,
233170
function( cat, source, alpha, beta, range )
234171

235-
return LegacyCategoryOfColumnsMorphism( cat, source,
172+
return CategoryOfColumnsMorphism( cat, source,
236173
KroneckerMat( TransposedMatrix( UnderlyingMatrix( alpha ) ), UnderlyingMatrix( beta ) ),
237174
range );
238175

@@ -242,7 +179,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
242179
AddDistinguishedObjectOfHomomorphismStructure( category,
243180
function( cat )
244181

245-
return LegacyCategoryOfColumnsObject( cat, 1 );
182+
return CategoryOfColumnsObject( cat, 1 );
246183

247184
end );
248185

@@ -255,7 +192,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
255192

256193
underlying_matrix := ConvertMatrixToColumn( underlying_matrix );
257194

258-
return LegacyCategoryOfColumnsMorphism( cat,
195+
return CategoryOfColumnsMorphism( cat,
259196
DistinguishedObjectOfHomomorphismStructure( cat ),
260197
underlying_matrix,
261198
HomomorphismStructureOnObjects( Source( alpha ), Range( alpha ) )
@@ -276,7 +213,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
276213

277214
underlying_matrix := ConvertColumnToMatrix( underlying_matrix, nr_rows, nr_columns );
278215

279-
return LegacyCategoryOfColumnsMorphism( cat, A, underlying_matrix, B );
216+
return CategoryOfColumnsMorphism( cat, A, underlying_matrix, B );
280217

281218
end );
282219

@@ -290,15 +227,15 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
290227
AddTensorProductOnObjects( category,
291228
function( cat, a, b )
292229

293-
return LegacyCategoryOfColumnsObject( cat, RankOfObject( a ) * RankOfObject( b ) );
230+
return CategoryOfColumnsObject( cat, RankOfObject( a ) * RankOfObject( b ) );
294231

295232
end );
296233

297234
##
298235
AddTensorProductOnMorphismsWithGivenTensorProducts( category,
299236
function( cat, s, alpha, beta, r )
300237

301-
return LegacyCategoryOfColumnsMorphism( cat, s,
238+
return CategoryOfColumnsMorphism( cat, s,
302239
KroneckerMat( UnderlyingMatrix( alpha ), UnderlyingMatrix( beta ) ),
303240
r );
304241

@@ -307,7 +244,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
307244
AddTensorUnit( category,
308245
function( cat )
309246

310-
return LegacyCategoryOfColumnsObject( cat, 1 );
247+
return CategoryOfColumnsObject( cat, 1 );
311248

312249
end );
313250

@@ -328,7 +265,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
328265
rank
329266
);
330267

331-
return LegacyCategoryOfColumnsMorphism( cat, object_1_tensored_object_2,
268+
return CategoryOfColumnsMorphism( cat, object_1_tensored_object_2,
332269
HomalgMatrix( permutation_matrix, rank, rank, ring ),
333270
object_2_tensored_object_1
334271
);
@@ -342,7 +279,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
342279
AddDualOnMorphismsWithGivenDuals( category,
343280
function( cat, dual_source, morphism, dual_range )
344281

345-
return LegacyCategoryOfColumnsMorphism( cat, dual_source,
282+
return CategoryOfColumnsMorphism( cat, dual_source,
346283
TransposedMatrix( UnderlyingMatrix( morphism ) ),
347284
dual_range );
348285

@@ -363,7 +300,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
363300

364301
id := HomalgIdentityMatrix( rank, ring );
365302

366-
return LegacyCategoryOfColumnsMorphism( cat, tensor_object,
303+
return CategoryOfColumnsMorphism( cat, tensor_object,
367304
UnionOfColumns( List( [ 1 .. rank ], i -> CertainRows( id, [i] ) ) ),
368305
unit );
369306

@@ -385,7 +322,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
385322

386323
id := HomalgIdentityMatrix( rank, ring );
387324

388-
return LegacyCategoryOfColumnsMorphism( cat, unit,
325+
return CategoryOfColumnsMorphism( cat, unit,
389326
UnionOfRows( List( [ 1 .. rank ], i -> CertainColumns( id, [i] ) ) ),
390327
tensor_object );
391328

@@ -404,7 +341,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
404341
function( cat, alpha, i )
405342

406343
return
407-
LegacyCategoryOfColumnsMorphism( cat,
344+
CategoryOfColumnsMorphism( cat,
408345
Source( alpha ),
409346
CATEGORY_OF_COLUMNS_SimplificationSourceAndRangeTuple( alpha )[1],
410347
Range( alpha )
@@ -417,7 +354,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
417354
function( cat, alpha, i )
418355

419356
return
420-
LegacyCategoryOfColumnsMorphism( cat,
357+
CategoryOfColumnsMorphism( cat,
421358
Range( alpha ),
422359
CATEGORY_OF_COLUMNS_SimplificationSourceAndRangeTuple( alpha )[4],
423360
Range( alpha )
@@ -430,7 +367,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
430367
function( cat, alpha, i )
431368

432369
return
433-
LegacyCategoryOfColumnsMorphism( cat,
370+
CategoryOfColumnsMorphism( cat,
434371
Range( alpha ),
435372
CATEGORY_OF_COLUMNS_SimplificationSourceAndRangeTuple( alpha )[2],
436373
Range( alpha )
@@ -443,7 +380,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
443380
function( cat, alpha, i )
444381

445382
return
446-
LegacyCategoryOfColumnsMorphism( cat,
383+
CategoryOfColumnsMorphism( cat,
447384
Source( alpha ),
448385
CATEGORY_OF_COLUMNS_SimplificationSourceAndRangeTuple( alpha )[3],
449386
Source( alpha )
@@ -456,7 +393,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
456393
function( cat, alpha, i )
457394

458395
return
459-
LegacyCategoryOfColumnsMorphism( cat,
396+
CategoryOfColumnsMorphism( cat,
460397
Source( alpha ),
461398
CATEGORY_OF_COLUMNS_SimplificationSourceAndRangeTuple( alpha )[5],
462399
Source( alpha )
@@ -470,7 +407,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
470407
function( cat, alpha, i )
471408

472409
return
473-
LegacyCategoryOfColumnsMorphism( cat,
410+
CategoryOfColumnsMorphism( cat,
474411
Source( alpha ),
475412
CATEGORY_OF_COLUMNS_SimplificationSourceTuple( alpha )[1],
476413
Range( alpha )
@@ -483,7 +420,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
483420
function( cat, alpha, i )
484421

485422
return
486-
LegacyCategoryOfColumnsMorphism( cat,
423+
CategoryOfColumnsMorphism( cat,
487424
Source( alpha ),
488425
CATEGORY_OF_COLUMNS_SimplificationSourceTuple( alpha )[2],
489426
Source( alpha )
@@ -496,7 +433,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
496433
function( cat, alpha, i )
497434

498435
return
499-
LegacyCategoryOfColumnsMorphism( cat,
436+
CategoryOfColumnsMorphism( cat,
500437
Source( alpha ),
501438
CATEGORY_OF_COLUMNS_SimplificationSourceTuple( alpha )[3],
502439
Source( alpha )
@@ -510,7 +447,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
510447
function( cat, alpha, i )
511448

512449
return
513-
LegacyCategoryOfColumnsMorphism( cat,
450+
CategoryOfColumnsMorphism( cat,
514451
Source( alpha ),
515452
CATEGORY_OF_COLUMNS_SimplificationRangeTuple( alpha )[1],
516453
Range( alpha )
@@ -523,7 +460,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
523460
function( cat, alpha, i )
524461

525462
return
526-
LegacyCategoryOfColumnsMorphism( cat,
463+
CategoryOfColumnsMorphism( cat,
527464
Range( alpha ),
528465
CATEGORY_OF_COLUMNS_SimplificationRangeTuple( alpha )[3],
529466
Range( alpha )
@@ -536,7 +473,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
536473
function( cat, alpha, i )
537474

538475
return
539-
LegacyCategoryOfColumnsMorphism( cat,
476+
CategoryOfColumnsMorphism( cat,
540477
Range( alpha ),
541478
CATEGORY_OF_COLUMNS_SimplificationRangeTuple( alpha )[2],
542479
Range( alpha )
@@ -548,23 +485,23 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_COLUMNS_AS_OPPOSITE_OF_
548485
AddSomeReductionBySplitEpiSummand( category,
549486
function( cat, alpha )
550487

551-
return LegacyAsCategoryOfColumnsMorphism( CATEGORY_OF_COLUMNS_ReductionBySplitEpiSummandTuple( alpha )[1], category );
488+
return AsCategoryOfColumnsMorphism( CATEGORY_OF_COLUMNS_ReductionBySplitEpiSummandTuple( alpha )[1], category );
552489

553490
end );
554491

555492
##
556493
AddSomeReductionBySplitEpiSummand_MorphismFromInputRange( category,
557494
function( cat, alpha )
558495

559-
return LegacyAsCategoryOfColumnsMorphism( CATEGORY_OF_COLUMNS_ReductionBySplitEpiSummandTuple( alpha )[2], category );
496+
return AsCategoryOfColumnsMorphism( CATEGORY_OF_COLUMNS_ReductionBySplitEpiSummandTuple( alpha )[2], category );
560497

561498
end );
562499

563500
##
564501
AddSomeReductionBySplitEpiSummand_MorphismToInputRange( category,
565502
function( cat, alpha )
566503

567-
return LegacyAsCategoryOfColumnsMorphism( CATEGORY_OF_COLUMNS_ReductionBySplitEpiSummandTuple( alpha )[3], category );
504+
return AsCategoryOfColumnsMorphism( CATEGORY_OF_COLUMNS_ReductionBySplitEpiSummandTuple( alpha )[3], category );
568505

569506
end );
570507

0 commit comments

Comments
 (0)