Skip to content

Commit

Permalink
Merge pull request #1052 from zickgraf/master
Browse files Browse the repository at this point in the history
Add more manually precompiled functions to MatrixCategory/CategoryOfRowsAsAdditiveClosureOfRingAsCategory
  • Loading branch information
zickgraf authored Sep 22, 2022
2 parents 7a1c3e3 + 5580ff3 commit 992320d
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CAP/PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SetPackageInfo( rec(

PackageName := "CAP",
Subtitle := "Categories, Algorithms, Programming",
Version := "2022.09-15",
Version := "2022.09-16",
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
License := "GPL-2.0-or-later",

Expand Down
18 changes: 17 additions & 1 deletion CAP/gap/InstallAdds.gi
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,23 @@ InstallGlobalFunction( CapInternalInstallAdd,
# set name for debugging purposes
if NameFunction( i[ 1 ] ) in [ "unknown", "_EVALSTRINGTMP" ] then

SetNameFunction( i[ 1 ], Concatenation( "Function added to ", Name( category ), " for ", function_name ) );
if is_derivation then

SetNameFunction( i[ 1 ], Concatenation( "Derivation (first added to ", Name( category ), ") of ", function_name ) );

elif is_final_derivation then

SetNameFunction( i[ 1 ], Concatenation( "Final derivation (first added to ", Name( category ), ") of ", function_name ) );

elif is_precompiled_derivation then

SetNameFunction( i[ 1 ], Concatenation( "Precompiled derivation added to ", Name( category ), " for ", function_name ) );

else

SetNameFunction( i[ 1 ], Concatenation( "Function added to ", Name( category ), " for ", function_name ) );

fi;

fi;

Expand Down
2 changes: 1 addition & 1 deletion FreydCategoriesForCAP/PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SetPackageInfo( rec(

PackageName := "FreydCategoriesForCAP",
Subtitle := "Freyd categories - Formal (co)kernels for additive categories",
Version := "2022.09-06",
Version := "2022.09-07",
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
License := "GPL-2.0-or-later",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,83 @@ InstallMethod( CategoryOfRowsAsAdditiveClosureOfRingAsCategory,

end );

##
AddIsLiftable( wrapper,
function( cat, alpha, beta )

return IsZero( DecideZeroRows( UnderlyingMatrix( alpha ), UnderlyingMatrix( beta ) ) );

end );

##
if HasIsCommutative( homalg_ring ) and IsCommutative( homalg_ring ) then

## Operations related to homomorphism structure

Assert( 0, IsCategoryOfRows( RangeCategoryOfHomomorphismStructure( wrapper ) ) );

##
AddHomomorphismStructureOnObjects( wrapper,
function( cat, object_1, object_2 )

return CategoryOfRowsObject( RangeCategoryOfHomomorphismStructure( cat ), RankOfObject( object_1 ) * RankOfObject( object_2 ) );

end );

##
AddHomomorphismStructureOnMorphismsWithGivenObjects( wrapper,
function( cat, source, alpha, beta, range )

return CategoryOfRowsMorphism( RangeCategoryOfHomomorphismStructure( cat ), source,
KroneckerMat( TransposedMatrix( UnderlyingMatrix( alpha ) ), UnderlyingMatrix( beta ) ),
range );

end );

##
AddDistinguishedObjectOfHomomorphismStructure( wrapper,
function( cat )

return CategoryOfRowsObject( RangeCategoryOfHomomorphismStructure( cat ), 1 );

end );

##
AddInterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructureWithGivenObjects( wrapper,
function( cat, distinguished_object, alpha, r )
local underlying_matrix;

underlying_matrix := UnderlyingMatrix( alpha );

underlying_matrix := ConvertMatrixToRow( underlying_matrix );

return CategoryOfRowsMorphism( RangeCategoryOfHomomorphismStructure( cat ),
distinguished_object,
underlying_matrix,
r
);

end );

##
AddInterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism( wrapper,
function( cat, A, B, morphism )
local nr_rows, nr_columns, underlying_matrix;

nr_rows := RankOfObject( A );

nr_columns := RankOfObject( B );

underlying_matrix := UnderlyingMatrix( morphism );

underlying_matrix := ConvertRowToMatrix( underlying_matrix, nr_rows, nr_columns );

return CategoryOfRowsMorphism( cat, A, underlying_matrix, B );

end );

fi;

Finalize( wrapper );

return wrapper;
Expand Down
2 changes: 1 addition & 1 deletion LinearAlgebraForCAP/PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SetPackageInfo( rec(

PackageName := "LinearAlgebraForCAP",
Subtitle := "Category of Matrices over a Field for CAP",
Version := "2022.09-08",
Version := "2022.09-09",
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
License := "GPL-2.0-or-later",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,78 @@ InstallMethod( MatrixCategoryAsAdditiveClosureOfRingAsCategory,

end );

##
AddIsLiftable( wrapper,
function( cat, alpha, beta )

return IsZero( DecideZeroRows( UnderlyingMatrix( alpha ), UnderlyingMatrix( beta ) ) );

end );

## Operations related to homomorphism structure

Assert( 0, IsCategoryOfRows( RangeCategoryOfHomomorphismStructure( wrapper ) ) );

##
AddHomomorphismStructureOnObjects( wrapper,
function( cat, object_1, object_2 )

return CategoryOfRowsObject( RangeCategoryOfHomomorphismStructure( cat ), RankOfObject( object_1 ) * RankOfObject( object_2 ) );

end );

##
AddHomomorphismStructureOnMorphismsWithGivenObjects( wrapper,
function( cat, source, alpha, beta, range )

return CategoryOfRowsMorphism( RangeCategoryOfHomomorphismStructure( cat ), source,
KroneckerMat( TransposedMatrix( UnderlyingMatrix( alpha ) ), UnderlyingMatrix( beta ) ),
range );

end );

##
AddDistinguishedObjectOfHomomorphismStructure( wrapper,
function( cat )

return CategoryOfRowsObject( RangeCategoryOfHomomorphismStructure( cat ), 1 );

end );

##
AddInterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructureWithGivenObjects( wrapper,
function( cat, distinguished_object, alpha, r )
local underlying_matrix;

underlying_matrix := UnderlyingMatrix( alpha );

underlying_matrix := ConvertMatrixToRow( underlying_matrix );

return CategoryOfRowsMorphism( RangeCategoryOfHomomorphismStructure( cat ),
distinguished_object,
underlying_matrix,
r
);

end );

##
AddInterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism( wrapper,
function( cat, A, B, morphism )
local nr_rows, nr_columns, underlying_matrix;

nr_rows := Dimension( A );

nr_columns := Dimension( B );

underlying_matrix := UnderlyingMatrix( morphism );

underlying_matrix := ConvertRowToMatrix( underlying_matrix, nr_rows, nr_columns );

return VectorSpaceMorphism( cat, A, underlying_matrix, B );

end );

Finalize( wrapper );

return wrapper;
Expand Down

0 comments on commit 992320d

Please sign in to comment.