Skip to content

Commit

Permalink
Comply with PackageJanitor
Browse files Browse the repository at this point in the history
  • Loading branch information
kamalsaleh authored and mohamed-barakat committed Sep 17, 2020
1 parent e31cb46 commit f698200
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 56 deletions.
10 changes: 7 additions & 3 deletions gap/Functors.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

#
# FunctorCategories: Categories of functors
#
# Declarations
#

####################################
#
Expand All @@ -8,7 +12,7 @@
####################################

#! @Description
#! The input is a Hom-category <A>H</A><C>:=Hom(B,C)</C> where <C>B</C> is an algebroid defined by some quiver algebra <C>A</C> and
#! The input is a Hom-category <A>H</A><C>:=Hom(B,C)</C> where <C>B</C> is an algebroid defined by some quiver algebra <C>A</C> and
#! <C>C</C> is a matrix category over some homalg field <C>K</C>.
#! The output is the isomorphism from <A>H</A> into <C>CategoryOfQuiverRepresentations(A)</C>.
#! @Arguments H
Expand All @@ -17,7 +21,7 @@ DeclareAttribute( "IsomorphismOntoCategoryOfQuiverRepresentations", IsCapHomCate


#! @Description
#! The input is a Hom-category <A>H</A><C>:=Hom(B,C)</C> where <C>B</C> is an algebroid defined by some quiver algebra <C>A</C> and
#! The input is a Hom-category <A>H</A><C>:=Hom(B,C)</C> where <C>B</C> is an algebroid defined by some quiver algebra <C>A</C> and
#! <C>C</C> is a matrix category over some homalg field <C>K</C>.
#! The output is the isomorphism from <C>CategoryOfQuiverRepresentations(A)</C> into <A>H</A>.
#! @Arguments H
Expand Down
47 changes: 26 additions & 21 deletions gap/Functors.gi
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#
# FunctorCategories: Categories of functors
#
# Implementations
#

BindGlobal( "FUNCTOR_CATEGORIES", rec( QQ := HomalgFieldOfRationals( ) ) );

##
InstallMethod( IsomorphismFromCategoryOfQuiverRepresentations,
[ IsCapHomCategory ],
function( functors )
function ( functors )
local B, matrix_cat, field, A, quiver, quiver_reps, name, F;

B := Source( functors );
Expand All @@ -30,7 +35,7 @@ InstallMethod( IsomorphismFromCategoryOfQuiverRepresentations,
F := CapFunctor( name, quiver_reps, functors );

AddObjectFunction( F,
function( rep )
function ( rep )
local obj, dimension_vec, mor, matrices, i;

obj := rec( );
Expand All @@ -39,7 +44,7 @@ InstallMethod( IsomorphismFromCategoryOfQuiverRepresentations,

for i in [ 1 .. Size( dimension_vec ) ] do

obj!.( String( Vertex( quiver, i ) ) ) := VectorSpaceObject( dimension_vec[ i ], field );
obj!.(String( Vertex( quiver, i ) )) := VectorSpaceObject( dimension_vec[i], field );

od;

Expand All @@ -48,18 +53,18 @@ InstallMethod( IsomorphismFromCategoryOfQuiverRepresentations,
matrices := MatricesOfRepresentation( rep );

matrices := List( matrices,
mat -> HomalgMatrix(
RowsOfMatrix( mat ),
mat -> HomalgMatrix(
RowsOfMatrix( mat ),
DimensionsMat( mat )[ 1 ],
DimensionsMat( mat )[ 2 ], field ) );

for i in [ 1 .. Size( matrices ) ] do;
for i in [ 1 .. Size( matrices ) ] do

mor!.( String( Arrow( quiver, i ) ) ) :=
mor!.(String( Arrow( quiver, i ) )) :=
VectorSpaceMorphism(
obj!.( String( Source( Arrow( quiver, i ) ) ) ),
matrices[ i ],
obj!.( String( Target( Arrow( quiver, i ) ) ) ) );
obj!.(String( Source( Arrow( quiver, i ) ) )),
matrices[i],
obj!.(String( Target( Arrow( quiver, i ) ) )) );

od;

Expand All @@ -68,7 +73,7 @@ InstallMethod( IsomorphismFromCategoryOfQuiverRepresentations,
end );

AddMorphismFunction( F,
function( source, rep_mor, range )
function ( source, rep_mor, range )
local matrices, mor, i;

matrices := MatricesOfRepresentationHomomorphism( rep_mor );
Expand All @@ -83,11 +88,11 @@ InstallMethod( IsomorphismFromCategoryOfQuiverRepresentations,

for i in [ 1 .. Size( matrices ) ] do

mor!.( String( Vertex( quiver, i ) ) ) :=
mor!.(String( Vertex( quiver, i ) )) :=
VectorSpaceMorphism(
VectorSpaceObject( NrRows( matrices[ i ] ), field ),
matrices[ i ],
VectorSpaceObject( NrColumns( matrices[ i ] ), field ) );
VectorSpaceObject( NrRows( matrices[i] ), field ),
matrices[i],
VectorSpaceObject( NrColumns( matrices[i] ), field ) );

od;

Expand All @@ -102,7 +107,7 @@ end );
##
InstallMethod( IsomorphismOntoCategoryOfQuiverRepresentations,
[ IsCapHomCategory ],
function( functors )
function ( functors )
local B, matrix_cat, A, field, quiver, quiver_reps, name, G;

B := Source( functors );
Expand All @@ -128,7 +133,7 @@ InstallMethod( IsomorphismOntoCategoryOfQuiverRepresentations,
G := CapFunctor( name, functors, quiver_reps );

AddObjectFunction( G,
function( func )
function ( func )
local U, V, L;

U := UnderlyingCapTwoCategoryCell( func );
Expand Down Expand Up @@ -158,7 +163,7 @@ InstallMethod( IsomorphismOntoCategoryOfQuiverRepresentations,
end );

AddMorphismFunction( G,
function( source, mor, range )
function ( source, mor, range )
local U, V;

U := UnderlyingCapTwoCategoryCell( mor );
Expand Down Expand Up @@ -193,7 +198,7 @@ end );
##
InstallMethod( YonedaEmbedding,
[ IsAlgebroid ],
function( algebroid )
function ( algebroid )
local k, matrix_cat, algebroid_op, objs, mors, functors_cat, name, Yoneda;

k := CommutativeRingOfLinearCategory( algebroid );
Expand All @@ -213,7 +218,7 @@ InstallMethod( YonedaEmbedding,
Yoneda := CapFunctor( name, algebroid, functors_cat );

AddObjectFunction( Yoneda,
function( o )
function ( o )
local m, Yo;

o := OppositePath( UnderlyingVertex( o ) ) / algebroid_op;
Expand All @@ -231,7 +236,7 @@ InstallMethod( YonedaEmbedding,
end );

AddMorphismFunction( Yoneda,
function( s, m, r )
function ( s, m, r )

m := OppositeAlgebraElement( UnderlyingQuiverAlgebraElement( m ) ) / algebroid_op;

Expand Down
6 changes: 5 additions & 1 deletion gap/HomStructure.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

#
# FunctorCategories: Categories of functors
#
# Declarations
#

DeclareProperty( "IsQuiverVertexWithLoop", IsQuiverVertex );

Expand Down
67 changes: 36 additions & 31 deletions gap/HomStructure.gi
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
#
# FunctorCategories: Categories of functors
#
# Implementations
#

##
InstallMethod( IsQuiverVertexWithLoop,
[ IsQuiverVertex ],
function( v )
function ( v )
return ForAny( OutgoingArrows( v ), a -> Target( a ) = v );
end );

##
InstallMethodWithCache( AuxiliaryMorphism,
[ IsCapCategoryObjectInHomCategory, IsCapCategoryObjectInHomCategory ],
function( S, R )
function ( S, R )
local cat, algebroid, A, quiver, nr_vertices, nr_arrows, S_o_vals, S_m_vals, R_o_vals, R_m_vals, loops, nr_loops, left_coeffs, right_coeffs, S_o_val_i, R_o_val_i, new_left_coeff, new_right_coeff, arrow, s, t, H, i, j, k;

cat := CapCategory( S );
Expand Down Expand Up @@ -38,40 +43,40 @@ InstallMethodWithCache( AuxiliaryMorphism,

nr_loops := Size( loops );

S_o_vals := Concatenation( S_o_vals, S_o_vals{ loops } );
S_o_vals := Concatenation( S_o_vals, S_o_vals{loops} );

R_o_vals := Concatenation( R_o_vals, R_o_vals{ loops } );
R_o_vals := Concatenation( R_o_vals, R_o_vals{loops} );

left_coeffs := [ ];

right_coeffs := [ ];

for i in [ 1 .. nr_loops ] do

S_o_val_i := S_o_vals[ loops[ i ] ];
S_o_val_i := S_o_vals[loops[i]];

R_o_val_i := R_o_vals[ loops[ i ] ];
R_o_val_i := R_o_vals[loops[i]];

new_left_coeff := [ ];

new_right_coeff := [ ];

for k in [ 1 .. nr_vertices + nr_loops ] do

if k = loops[ i ] then
if k = loops[i] then

Add( new_left_coeff, IdentityMorphism( S_o_val_i ), k );
Add( new_right_coeff, IdentityMorphism( R_o_val_i ), k );

elif k = nr_vertices + i then

Add( new_left_coeff, IdentityMorphism( S_o_val_i ), k );
Add( new_right_coeff, -IdentityMorphism( R_o_val_i ), k );
Add( new_right_coeff, - IdentityMorphism( R_o_val_i ), k );

else

Add( new_left_coeff, ZeroMorphism( S_o_val_i, S_o_vals[ k ] ), k );
Add( new_right_coeff, ZeroMorphism( R_o_vals[ k ], R_o_val_i ), k );
Add( new_left_coeff, ZeroMorphism( S_o_val_i, S_o_vals[k] ), k );
Add( new_right_coeff, ZeroMorphism( R_o_vals[k], R_o_val_i ), k );

fi;

Expand Down Expand Up @@ -104,19 +109,19 @@ InstallMethodWithCache( AuxiliaryMorphism,
for k in [ 1 .. nr_vertices + nr_loops ] do

if k = s then
Add( new_left_coeff, IdentityMorphism( S_o_vals[ s ] ), s );
Add( new_right_coeff, R_m_vals[ i ], s );
Add( new_left_coeff, IdentityMorphism( S_o_vals[s] ), s );
Add( new_right_coeff, R_m_vals[i], s );
fi;

if k = t then
Add( new_left_coeff, S_m_vals[ i ], t );
Add( new_right_coeff, AdditiveInverse( IdentityMorphism( R_o_vals[ t ] ) ), t );
Add( new_left_coeff, S_m_vals[i], t );
Add( new_right_coeff, AdditiveInverse( IdentityMorphism( R_o_vals[t] ) ), t );
fi;

if k <> s and k <> t then
Add( new_left_coeff, ZeroMorphism( S_o_vals[ s ], S_o_vals[ k ] ), k );
Add( new_right_coeff, ZeroMorphism( R_o_vals[ k ], R_o_vals[ t ] ), k );
fi;
Add( new_left_coeff, ZeroMorphism( S_o_vals[s], S_o_vals[k] ), k );
Add( new_right_coeff, ZeroMorphism( R_o_vals[k], R_o_vals[t] ), k );
fi;

od;

Expand All @@ -136,7 +141,7 @@ end );

##
InstallGlobalFunction( ADD_FUNCTIONS_FOR_HOMOMORPHISM_STRUCTURE_TO_FUNCTORS_CATEGORY,
function( Hom )
function ( Hom )
local A, quiver, nr_vertices, loops, range_category, range_category_of_hom, D;

A := UnderlyingQuiverAlgebra( Source( Hom ) );
Expand All @@ -157,7 +162,7 @@ InstallGlobalFunction( ADD_FUNCTIONS_FOR_HOMOMORPHISM_STRUCTURE_TO_FUNCTORS_CATE

range_category_of_hom := RangeCategoryOfHomomorphismStructure( range_category );

if not ( HasIsAbelianCategory( range_category_of_hom ) and IsAbelianCategory( range_category_of_hom ) ) then
if not (HasIsAbelianCategory( range_category_of_hom ) and IsAbelianCategory( range_category_of_hom )) then

return;

Expand All @@ -177,14 +182,14 @@ InstallGlobalFunction( ADD_FUNCTIONS_FOR_HOMOMORPHISM_STRUCTURE_TO_FUNCTORS_CATE

##
AddInterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure( Hom,
function( eta )
function ( eta )
local maps;

maps := ValuesOnAllObjects( eta );

maps := List( maps, InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure );

maps := Concatenation( maps, maps{ loops } );
maps := Concatenation( maps, maps{loops} );

maps := MorphismBetweenDirectSums( [ maps ] );

Expand All @@ -196,16 +201,16 @@ InstallGlobalFunction( ADD_FUNCTIONS_FOR_HOMOMORPHISM_STRUCTURE_TO_FUNCTORS_CATE

##
AddInterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism( Hom,
function( S, R, iota )
function ( S, R, iota )
local S_o_vals, R_o_vals, map, summands;

S_o_vals := ValuesOnAllObjects( S );

S_o_vals := Concatenation( S_o_vals, S_o_vals{ loops } );
S_o_vals := Concatenation( S_o_vals, S_o_vals{loops} );

R_o_vals := ValuesOnAllObjects( R );

R_o_vals := Concatenation( R_o_vals, R_o_vals{ loops } );
R_o_vals := Concatenation( R_o_vals, R_o_vals{loops} );

map := AuxiliaryMorphism( S, R );

Expand All @@ -219,22 +224,22 @@ InstallGlobalFunction( ADD_FUNCTIONS_FOR_HOMOMORPHISM_STRUCTURE_TO_FUNCTORS_CATE

iota := ListN( S_o_vals, R_o_vals, iota, InterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism );

return AsMorphismInHomCategory( S, iota, R );
return AsMorphismInHomCategory( S, iota, R );

end );

##
AddHomomorphismStructureOnMorphismsWithGivenObjects( Hom,
function( s, eta, mu, r )
function ( s, eta, mu, r )
local eta_maps, mu_maps, maps, r_eta_s_mu, s_eta_r_mu;

eta_maps := ValuesOnAllObjects( eta );

eta_maps := Concatenation( eta_maps, eta_maps{ loops } );
eta_maps := Concatenation( eta_maps, eta_maps{loops} );

mu_maps := ValuesOnAllObjects( mu );

mu_maps := Concatenation( mu_maps, mu_maps{ loops } );
mu_maps := Concatenation( mu_maps, mu_maps{loops} );

maps := ListN( eta_maps, mu_maps, HomomorphismStructureOnMorphisms );

Expand All @@ -252,7 +257,7 @@ InstallGlobalFunction( ADD_FUNCTIONS_FOR_HOMOMORPHISM_STRUCTURE_TO_FUNCTORS_CATE

##
AddBasisOfExternalHom( Hom,
function( S, R )
function ( S, R )
local iota, K, D, S_o_vals, R_o_vals, summands, direct_sum, iotas, basis;

iota := KernelEmbedding( AuxiliaryMorphism( S, R ) );
Expand Down Expand Up @@ -286,8 +291,8 @@ InstallGlobalFunction( ADD_FUNCTIONS_FOR_HOMOMORPHISM_STRUCTURE_TO_FUNCTORS_CATE
S,
List( [ 1 .. nr_vertices ], i ->
InterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism(
S_o_vals[ i ],
R_o_vals[ i ],
S_o_vals[i],
R_o_vals[i],
iotas[i][j] )
),
R
Expand Down

0 comments on commit f698200

Please sign in to comment.