diff --git a/PackageInfo.g b/PackageInfo.g
index 08610f5..57ed9c9 100644
--- a/PackageInfo.g
+++ b/PackageInfo.g
@@ -11,7 +11,7 @@ SetPackageInfo( rec(
PackageName := "CatReps",
Subtitle := "Representations and cohomology of finite categories",
Version := Maximum( [
- "2020.02.19", ## Mohamed's version
+ "2020.02.20", ## Mohamed's version
## this line prevents merge conflicts
"2020.01.01", ## Tibor's version
## this line prevents merge conflicts
diff --git a/examples/ConcreteCategoryWithEndomorphismGroups.g b/examples/ConcreteCategoryWithEndomorphismGroups.g
index d8be7d5..fa6b0c6 100644
--- a/examples/ConcreteCategoryWithEndomorphismGroups.g
+++ b/examples/ConcreteCategoryWithEndomorphismGroups.g
@@ -22,6 +22,9 @@ Perform( gmorphisms, Display );
#! [ [ 1, 2, 3 ], [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ], [ 4, 5, 6 ] ]
#! A morphism in subcategory given by:
#! [ [ 4, 5, 6 ], [ [ 4, 5 ], [ 5, 6 ], [ 6, 4 ] ], [ 4, 5, 6 ] ]
+#! @EndExample
+
+#! @Example
qc3c3 := RightQuiver( "q(2)[a:1->1,b:1->2,c:2->2]" );
#! q(2)[a:1->1,b:1->2,c:2->2]
HOMALG_MATRICES.PreferDenseMatrices := true;
@@ -596,4 +599,72 @@ Display( iso );
#! . . . . . . . . . . . 1 . . . .
#!
#! An isomorphism in Category of matrices over GF(3)
+proj1 := YonedaProjective( CatReps, kq.1 );
+#! 1,b:1->2,c:2->2]
+#! -> Category of matrices over GF(3)>
+Display( proj1 );
+#! An object in The category of functors: Bialgebroid generated by the
+#! right quiver q(2)[a:1->1,b:1->2,c:2->2] -> Category of matrices
+#! over GF(3) defined by the following data:
+#!
+#!
+#! Image of (1):
+#! A vector space object over GF(3) of dimension 3
+#!
+#! Image of (2):
+#! A vector space object over GF(3) of dimension 3
+#!
+#! Image of (1)-[{ Z(3)^0*(a) }]->(1):
+#! . 1 .
+#! . . 1
+#! 1 . .
+#!
+#! A morphism in Category of matrices over GF(3)
+#!
+#!
+#! Image of (1)-[{ Z(3)^0*(b) }]->(2):
+#! 1 . .
+#! . 1 .
+#! . . 1
+#!
+#! A morphism in Category of matrices over GF(3)
+#!
+#!
+#! Image of (2)-[{ Z(3)^0*(c) }]->(2):
+#! . 1 .
+#! . . 1
+#! 1 . .
+#!
+#! A morphism in Category of matrices over GF(3)
+proj2 := YonedaProjective( CatReps, kq.2 );
+#! 1,b:1->2,c:2->2]
+#! -> Category of matrices over GF(3)>
+Display( proj2 );
+#! An object in The category of functors: Bialgebroid generated by the
+#! right quiver q(2)[a:1->1,b:1->2,c:2->2] -> Category of matrices
+#! over GF(3) defined by the following data:
+#!
+#!
+#! Image of (1):
+#! A vector space object over GF(3) of dimension 0
+#!
+#! Image of (2):
+#! A vector space object over GF(3) of dimension 3
+#!
+#! Image of (1)-[{ Z(3)^0*(a) }]->(1):
+#! (an empty 0 x 0 matrix)
+#!
+#!
+#! Image of (1)-[{ Z(3)^0*(b) }]->(2):
+#! (an empty 0 x 3 matrix)
+#!
+#!
+#! Image of (2)-[{ Z(3)^0*(c) }]->(2):
+#! . 1 .
+#! . . 1
+#! 1 . .
+#!
+#! A morphism in Category of matrices over GF(3)
#! @EndExample
diff --git a/gap/CatRepsWithCAP.gd b/gap/CatRepsWithCAP.gd
index bc137b0..e85bd63 100644
--- a/gap/CatRepsWithCAP.gd
+++ b/gap/CatRepsWithCAP.gd
@@ -115,6 +115,15 @@ DeclareOperation( "EmbeddingOfSubRepresentation",
DeclareOperation( "WeakDirectSumDecomposition",
[ IsCapCategoryObjectInHomCategory ] );
+#! @Description
+#! Return Yoneda's projective representation given by the object o,
+#! i.e., the submodule of the category algebra consisting of all arrows
+#! starting at o.
+#! @Arguments H, o
+#! @Returns IsCapCategoryObjectInHomCategory
+DeclareOperation( "YonedaProjective",
+ [ IsCapHomCategory, IsCapCategoryObject ] );
+
####################################
#
#! @Section Tools
diff --git a/gap/CatRepsWithCAP.gi b/gap/CatRepsWithCAP.gi
index cd26f27..43be698 100644
--- a/gap/CatRepsWithCAP.gi
+++ b/gap/CatRepsWithCAP.gi
@@ -189,7 +189,80 @@ InstallMethod( WeakDirectSumDecomposition,
k := CommutativeRingOfLinearCategory( kq );
d := List( d, eta -> List( [ 1 .. Length( eta ) ], i -> VectorSpaceMorphism( VectorSpaceObject( Length( eta[i] ), k ), eta[i], F( kq.(i) ) ) ) );
-
+
return List( d, eta -> EmbeddingOfSubRepresentation( eta, F ) );
end );
+
+##
+InstallMethod( YonedaProjective,
+ "for a Hom-category and a CAP object",
+ [ IsCapHomCategory, IsCapCategoryObject ],
+
+ function( CatReps, o )
+ local kq, k, basis_list, A, basis, dimensions, a, arrows, matrices,
+ source, target, dim_source, dim_target, b, b_source, b_target,
+ matrix, b_a_path, b_a, coeffs, yproj;
+
+ kq := Source( CatReps );
+
+ o := Position( SetOfObjects( kq ), o );
+
+ k := CommutativeRingOfLinearCategory( CatReps );
+
+ ## code from QPA2/lib/special-representations.gi
+
+ A := UnderlyingQuiverAlgebra( kq );
+
+ basis_list := BasisOfProjectives( A );
+ basis := basis_list[ o ];
+
+ dimensions := List( basis, Length );
+ arrows := Arrows( QuiverOfAlgebra( A ) );
+ matrices := [ ];
+
+ for a in arrows do
+
+ source := VertexIndex( Source( a ) );
+ target := VertexIndex( Target( a ) );
+
+ dim_source := dimensions[ source ];
+ dim_target := dimensions[ target ];
+
+ if dim_source = 0 or dim_target = 0 then
+
+ matrix := HomalgZeroMatrix( dim_source, dim_target, k );
+
+ else
+
+ b_source := List( basis[ source ], b -> Paths(b)[ 1 ] );
+ b_target := List( basis[ target ], b -> Paths(b)[ 1 ] );
+
+ matrix := [ ];
+
+ for b in b_source do
+ b_a_path := ComposePaths( b, a );
+ b_a := PathAsAlgebraElement( A, b_a_path );
+ coeffs := CoefficientsOfPaths( b_target, b_a );
+ Add( matrix, coeffs );
+ od;
+
+ matrix := HomalgMatrix( matrix, dim_source, dim_target, k );
+
+ matrix := VectorSpaceMorphism( VectorSpaceObject( dim_source, k ), matrix, VectorSpaceObject( dim_target, k ) );
+
+ fi;
+
+ Add( matrices, matrix );
+
+ od;
+
+ dimensions := List( dimensions, dim -> VectorSpaceObject( dim, k ) );
+
+ yproj := AsObjectInHomCategory( kq, dimensions, matrices );
+
+ SetIsProjective( yproj, true );
+
+ return yproj;
+
+end );