Skip to content

Commit

Permalink
Install BasisOfExternalHom &
Browse files Browse the repository at this point in the history
CoefficientsOfMorphismWithGivenBasisOfExternalHom

as primitive methods in additive closure category.
  • Loading branch information
kamalsaleh committed Apr 4, 2021
1 parent cddfb2c commit 1008afd
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions FreydCategoriesForCAP/gap/AdditiveClosure.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,84 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_ADDITIVE_CLOSURE,

fi;

if ForAll( [ "BasisOfExternalHom",
"CoefficientsOfMorphismWithGivenBasisOfExternalHom",
"ZeroMorphism" ],
f -> CanCompute( underlying_category, f ) ) then

##
AddBasisOfExternalHom( category,
function( object_1, object_2 )
local size_i, size_j, listlist, L;

size_i := Size( ObjectList( object_1 ) );
size_j := Size( ObjectList( object_2 ) );

listlist := List( [ 1 .. size_i ], i ->
List( [ 1 .. size_j ], j ->
ZeroMorphism( object_1[i], object_2[j] )
)
);

return
Concatenation(
List( [ 1 .. size_i ], i ->
Concatenation(
List( [ 1 .. size_j ],
function( j )
local current_basis;

current_basis := BasisOfExternalHom( object_1[ i ], object_2[ j ] );

return List( current_basis,
function( m )
local z;
z := listlist[ i, j ];
listlist[ i, j ] := m;
m := AdditiveClosureMorphismListList( object_1, listlist, object_2 );
listlist[ i, j ] := z;
return m;
end
);

end
)
)
)
);
end );

##
AddCoefficientsOfMorphismWithGivenBasisOfExternalHom( category,
function( morphism, basis )
local object_1, object_2, nr_rows, nr_cols;

object_1 := Source( morphism );

object_2 := Range( morphism );

nr_rows := NumberRows( morphism );

nr_cols := NumberColumns( morphism );

return
Concatenation(
List( [ 1 .. nr_rows ],
i -> Concatenation(
List( [ 1 .. nr_cols ],
j -> CoefficientsOfMorphismWithGivenBasisOfExternalHom(
morphism[ i, j ],
BasisOfExternalHom( object_1[ i ], object_2[ j ] )
)
)
)
)
);

end );

fi;

end );

####################################
Expand Down

0 comments on commit 1008afd

Please sign in to comment.