homalg-project / CAP_project

CAP project -- Categories, Algorithms, and Programming
https://homalg-project.github.io/docs/CAP_project-based/
24 stars 18 forks source link

Bug in MorphismBetweenDirectSums in opposite categories #1428

Closed kamalsaleh closed 1 year ago

kamalsaleh commented 1 year ago
LoadPackage( "FunctorCategories" );

q := RightQuiver( "q(4)[x:1->1,a:1->2,b:2->4,c:1->3,d:3->4,y:4->4]" );
F := FreeCategory( q );
k := HomalgFieldOfRationals( );
kF := k[F];
C := kF / [ kF.x^3, kF.y^2 ];
PSh := PreSheaves( C );
coPSh := CoPreSheaves( C );

MorphismBetweenDirectSums( PSh, [], [], [PSh.1] );
#! <(1)->0x3, (2)->0x0, (3)->0x0, (4)->0x0>

MorphismBetweenDirectSums( coPSh, [], [], [coPSh.1] );
Error, in function MorphismBetweenDirectSumsWithGivenDirectSums
       of category FunctorCategory( Algebroid( Q, FreeCategory( RightQuiver( "q(4)[x:1->1,a:1->2,b:2->4,c:1->3,d:3->4,y:\
4->4]" ) ) ) / relations, Rows( Q ) ):
       the number of rows does not match the length of the source diagram
 at /home/kamal/.gap/pkg/CAP_project/CAP/gap/InstallAdds.gi:36 called from
kamalsaleh commented 1 year ago

@zickgraf Can this issue be resolved by the same mechanism that allows DirectSum(cat, []), SumOfMorphisms(cat,s,[],r) or PreComposeList(cat,s,[],r)?

Edit: I see now that all these mentioned operations can be computed iteratively starting with something which suits as an output for the special empty input.

zickgraf commented 1 year ago

@zickgraf Can this issue be resolved by the same mechanism that allows DirectSum(cat, []), SumOfMorphisms(cat,s,[],r) or PreComposeList(cat,s,[],r)?

Edit: I see now that all these mentioned operations can be computed iteratively starting with something which suits as an output for the special empty input.

As just discussed verbally, for the record:

MorphismBetweenDirectSums also works in this way:

https://github.com/homalg-project/CAP_project/blob/275dbc640350c04dbe75544745fd79697b2b0e58/CAP/gap/DerivedMethods.gi#L2614-L2628

This code works fine if all inputs are empty. But in the example above, the range diagram is not empty.