Skip to content

Commit 1008afd

Browse files
committed
Install BasisOfExternalHom &
CoefficientsOfMorphismWithGivenBasisOfExternalHom as primitive methods in additive closure category.
1 parent cddfb2c commit 1008afd

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

FreydCategoriesForCAP/gap/AdditiveClosure.gi

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,84 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_ADDITIVE_CLOSURE,
10811081

10821082
fi;
10831083

1084+
if ForAll( [ "BasisOfExternalHom",
1085+
"CoefficientsOfMorphismWithGivenBasisOfExternalHom",
1086+
"ZeroMorphism" ],
1087+
f -> CanCompute( underlying_category, f ) ) then
1088+
1089+
##
1090+
AddBasisOfExternalHom( category,
1091+
function( object_1, object_2 )
1092+
local size_i, size_j, listlist, L;
1093+
1094+
size_i := Size( ObjectList( object_1 ) );
1095+
size_j := Size( ObjectList( object_2 ) );
1096+
1097+
listlist := List( [ 1 .. size_i ], i ->
1098+
List( [ 1 .. size_j ], j ->
1099+
ZeroMorphism( object_1[i], object_2[j] )
1100+
)
1101+
);
1102+
1103+
return
1104+
Concatenation(
1105+
List( [ 1 .. size_i ], i ->
1106+
Concatenation(
1107+
List( [ 1 .. size_j ],
1108+
function( j )
1109+
local current_basis;
1110+
1111+
current_basis := BasisOfExternalHom( object_1[ i ], object_2[ j ] );
1112+
1113+
return List( current_basis,
1114+
function( m )
1115+
local z;
1116+
z := listlist[ i, j ];
1117+
listlist[ i, j ] := m;
1118+
m := AdditiveClosureMorphismListList( object_1, listlist, object_2 );
1119+
listlist[ i, j ] := z;
1120+
return m;
1121+
end
1122+
);
1123+
1124+
end
1125+
)
1126+
)
1127+
)
1128+
);
1129+
end );
1130+
1131+
##
1132+
AddCoefficientsOfMorphismWithGivenBasisOfExternalHom( category,
1133+
function( morphism, basis )
1134+
local object_1, object_2, nr_rows, nr_cols;
1135+
1136+
object_1 := Source( morphism );
1137+
1138+
object_2 := Range( morphism );
1139+
1140+
nr_rows := NumberRows( morphism );
1141+
1142+
nr_cols := NumberColumns( morphism );
1143+
1144+
return
1145+
Concatenation(
1146+
List( [ 1 .. nr_rows ],
1147+
i -> Concatenation(
1148+
List( [ 1 .. nr_cols ],
1149+
j -> CoefficientsOfMorphismWithGivenBasisOfExternalHom(
1150+
morphism[ i, j ],
1151+
BasisOfExternalHom( object_1[ i ], object_2[ j ] )
1152+
)
1153+
)
1154+
)
1155+
)
1156+
);
1157+
1158+
end );
1159+
1160+
fi;
1161+
10841162
end );
10851163

10861164
####################################

0 commit comments

Comments
 (0)