Skip to content

Commit

Permalink
Compile operations from tensor structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Kuhmichel committed Jun 12, 2022
1 parent 001bb26 commit d665138
Show file tree
Hide file tree
Showing 5 changed files with 397 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,52 +16,52 @@ EEE := KoszulDualRing( QQxy * "a,b" );;
operations_for_arbitrary_ring := [
"AdditionForMorphisms",
"AdditiveInverseForMorphisms",
#"AssociatorLeftToRightWithGivenTensorProducts",
#"AssociatorRightToLeftWithGivenTensorProducts",
#"BraidingWithGivenTensorProducts",
#"CoevaluationMorphismWithGivenRange",
"CokernelColiftWithGivenCokernelObject",
"CokernelProjection",
#"Colift",
#"ColiftOrFail",
"DirectSum",
"EpimorphismFromSomeProjectiveObject",
#"EvaluationMorphismWithGivenSource",
"IdentityMorphism",
"InjectionOfCofactorOfDirectSumWithGivenDirectSum",
#"InternalHomOnMorphismsWithGivenInternalHoms",
#"InternalHomOnObjects",
#"IsColiftable",
"IsCongruentForMorphisms",
"IsEqualForMorphisms",
#"IsEqualForObjects",
#"IsLiftable",
#"IsWellDefinedForMorphisms",
#"IsWellDefinedForObjects",
"IsZeroForMorphisms",
#"KernelEmbedding",
#"LeftUnitorWithGivenTensorProduct",
#"Lift",
#"LiftAlongMonomorphism",
#"LiftOrFail",
#"MultiplyWithElementOfCommutativeRingForMorphisms",
#"PreCompose",
"ProjectionInFactorOfDirectSumWithGivenDirectSum",
#"RightUnitorWithGivenTensorProduct",
#"TensorProductOnMorphismsWithGivenTensorProducts",
#"TensorProductOnObjects",
#"TensorUnit",
"UniversalMorphismFromDirectSumWithGivenDirectSum",
"UniversalMorphismFromZeroObjectWithGivenZeroObject",
"UniversalMorphismIntoDirectSumWithGivenDirectSum",
"UniversalMorphismIntoZeroObjectWithGivenZeroObject",
"ZeroMorphism",
"ZeroObject"
"ZeroObject",
];;

operations_for_commutative_ring := Concatenation(
operations_for_arbitrary_ring,
[ "MultiplyWithElementOfCommutativeRingForMorphisms" ]
[ "AssociatorLeftToRightWithGivenTensorProducts",
"AssociatorRightToLeftWithGivenTensorProducts",
"BraidingWithGivenTensorProducts",
#"CoevaluationMorphismWithGivenRange",
#"Colift",
#"ColiftOrFail",
#"EvaluationMorphismWithGivenSource",
#"InternalHomOnMorphismsWithGivenInternalHoms",
#"InternalHomOnObjects",
#"IsColiftable",
#"IsLiftable",
"LeftUnitorWithGivenTensorProduct",
#"Lift",
#"LiftOrFail",
"MultiplyWithElementOfCommutativeRingForMorphisms",
"RightUnitorWithGivenTensorProduct",
"TensorProductOnMorphismsWithGivenTensorProducts",
#"TensorProductOnObjects",
"TensorUnit",
]
);;

precompile_LeftPresentations := function( ring, name, operations )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,64 @@ end

, 100 );

##
AddAssociatorLeftToRightWithGivenTensorProducts( cat,

########
function ( cat_1, s_1, a_1, b_1, c_1, r_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, r_1, UnderlyingMatrix, HomalgIdentityMatrix( NumberColumns( UnderlyingMatrix( s_1 ) ), UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddAssociatorRightToLeftWithGivenTensorProducts( cat,

########
function ( cat_1, s_1, a_1, b_1, c_1, r_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, r_1, UnderlyingMatrix, HomalgIdentityMatrix( NumberColumns( UnderlyingMatrix( s_1 ) ), UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddBraidingWithGivenTensorProducts( cat,

########
function ( cat_1, s_1, a_1, b_1, r_1 )
local hoisted_1_1, hoisted_2_1, deduped_3_1, deduped_4_1, deduped_5_1;
deduped_5_1 := NumberColumns( UnderlyingMatrix( b_1 ) );
deduped_4_1 := NumberColumns( UnderlyingMatrix( a_1 ) );
deduped_3_1 := deduped_4_1 * deduped_5_1;
hoisted_2_1 := deduped_4_1;
hoisted_1_1 := deduped_5_1;
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, r_1, UnderlyingMatrix, HomalgMatrix( PermutationMat( PermList( List( [ 1 .. deduped_3_1 ], function ( i_2 )
local deduped_1_2;
deduped_1_2 := i_2 - 1;
return REM_INT( deduped_1_2, hoisted_1_1 ) * hoisted_2_1 + QUO_INT( deduped_1_2, hoisted_1_1 ) + 1;
end ) ), deduped_3_1 ), deduped_3_1, deduped_3_1, UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddLeftUnitorWithGivenTensorProduct( cat,

########
function ( cat_1, a_1, s_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, a_1, UnderlyingMatrix, HomalgIdentityMatrix( NumberColumns( UnderlyingMatrix( a_1 ) ), UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddMultiplyWithElementOfCommutativeRingForMorphisms( cat,

Expand All @@ -276,6 +334,42 @@ function ( cat_1, r_1, a_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, Source( a_1 ), Range( a_1 ), UnderlyingMatrix, r_1 * UnderlyingMatrix( a_1 ) );
end
########

, 100 );

##
AddRightUnitorWithGivenTensorProduct( cat,

########
function ( cat_1, a_1, s_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, a_1, UnderlyingMatrix, HomalgIdentityMatrix( NumberColumns( UnderlyingMatrix( a_1 ) ), UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddTensorProductOnMorphismsWithGivenTensorProducts( cat,

########
function ( cat_1, s_1, alpha_1, beta_1, r_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, r_1, UnderlyingMatrix, KroneckerMat( UnderlyingMatrix( alpha_1 ), UnderlyingMatrix( beta_1 ) ) );
end
########

, 100 );

##
AddTensorUnit( cat,

########
function ( cat_1 )
return ObjectifyObjectForCAPWithAttributes( rec(
), cat_1, UnderlyingMatrix, HomalgZeroMatrix( 0, 1, UnderlyingRing( cat_1 ) ) );
end
########

, 100 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,64 @@ end

, 100 );

##
AddAssociatorLeftToRightWithGivenTensorProducts( cat,

########
function ( cat_1, s_1, a_1, b_1, c_1, r_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, r_1, UnderlyingMatrix, HomalgIdentityMatrix( NumberColumns( UnderlyingMatrix( s_1 ) ), UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddAssociatorRightToLeftWithGivenTensorProducts( cat,

########
function ( cat_1, s_1, a_1, b_1, c_1, r_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, r_1, UnderlyingMatrix, HomalgIdentityMatrix( NumberColumns( UnderlyingMatrix( s_1 ) ), UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddBraidingWithGivenTensorProducts( cat,

########
function ( cat_1, s_1, a_1, b_1, r_1 )
local hoisted_1_1, hoisted_2_1, deduped_3_1, deduped_4_1, deduped_5_1;
deduped_5_1 := NumberColumns( UnderlyingMatrix( b_1 ) );
deduped_4_1 := NumberColumns( UnderlyingMatrix( a_1 ) );
deduped_3_1 := deduped_4_1 * deduped_5_1;
hoisted_2_1 := deduped_4_1;
hoisted_1_1 := deduped_5_1;
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, r_1, UnderlyingMatrix, HomalgMatrix( PermutationMat( PermList( List( [ 1 .. deduped_3_1 ], function ( i_2 )
local deduped_1_2;
deduped_1_2 := i_2 - 1;
return REM_INT( deduped_1_2, hoisted_1_1 ) * hoisted_2_1 + QUO_INT( deduped_1_2, hoisted_1_1 ) + 1;
end ) ), deduped_3_1 ), deduped_3_1, deduped_3_1, UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddLeftUnitorWithGivenTensorProduct( cat,

########
function ( cat_1, a_1, s_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, a_1, UnderlyingMatrix, HomalgIdentityMatrix( NumberColumns( UnderlyingMatrix( a_1 ) ), UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddMultiplyWithElementOfCommutativeRingForMorphisms( cat,

Expand All @@ -276,6 +334,42 @@ function ( cat_1, r_1, a_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, Source( a_1 ), Range( a_1 ), UnderlyingMatrix, r_1 * UnderlyingMatrix( a_1 ) );
end
########

, 100 );

##
AddRightUnitorWithGivenTensorProduct( cat,

########
function ( cat_1, a_1, s_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, a_1, UnderlyingMatrix, HomalgIdentityMatrix( NumberColumns( UnderlyingMatrix( a_1 ) ), UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddTensorProductOnMorphismsWithGivenTensorProducts( cat,

########
function ( cat_1, s_1, alpha_1, beta_1, r_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, r_1, UnderlyingMatrix, KroneckerMat( UnderlyingMatrix( alpha_1 ), UnderlyingMatrix( beta_1 ) ) );
end
########

, 100 );

##
AddTensorUnit( cat,

########
function ( cat_1 )
return ObjectifyObjectForCAPWithAttributes( rec(
), cat_1, UnderlyingMatrix, HomalgZeroMatrix( 0, 1, UnderlyingRing( cat_1 ) ) );
end
########

, 100 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,64 @@ end

, 100 );

##
AddAssociatorLeftToRightWithGivenTensorProducts( cat,

########
function ( cat_1, s_1, a_1, b_1, c_1, r_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, r_1, UnderlyingMatrix, HomalgIdentityMatrix( NumberRows( UnderlyingMatrix( s_1 ) ), UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddAssociatorRightToLeftWithGivenTensorProducts( cat,

########
function ( cat_1, s_1, a_1, b_1, c_1, r_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, r_1, UnderlyingMatrix, HomalgIdentityMatrix( NumberRows( UnderlyingMatrix( s_1 ) ), UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddBraidingWithGivenTensorProducts( cat,

########
function ( cat_1, s_1, a_1, b_1, r_1 )
local hoisted_1_1, hoisted_2_1, deduped_3_1, deduped_4_1, deduped_5_1;
deduped_5_1 := NumberRows( UnderlyingMatrix( b_1 ) );
deduped_4_1 := NumberRows( UnderlyingMatrix( a_1 ) );
deduped_3_1 := deduped_4_1 * deduped_5_1;
hoisted_2_1 := deduped_4_1;
hoisted_1_1 := deduped_5_1;
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, r_1, UnderlyingMatrix, HomalgMatrix( PermutationMat( PermList( List( [ 1 .. deduped_3_1 ], function ( i_2 )
local deduped_1_2;
deduped_1_2 := (i_2 - 1);
return (REM_INT( deduped_1_2, hoisted_1_1 ) * hoisted_2_1 + QUO_INT( deduped_1_2, hoisted_1_1 ) + 1);
end ) ) ^ -1, deduped_3_1 ), deduped_3_1, deduped_3_1, UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddLeftUnitorWithGivenTensorProduct( cat,

########
function ( cat_1, a_1, s_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, a_1, UnderlyingMatrix, HomalgIdentityMatrix( NumberRows( UnderlyingMatrix( a_1 ) ), UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddMultiplyWithElementOfCommutativeRingForMorphisms( cat,

Expand All @@ -276,6 +334,42 @@ function ( cat_1, r_1, a_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, Source( a_1 ), Range( a_1 ), UnderlyingMatrix, r_1 * UnderlyingMatrix( a_1 ) );
end
########

, 100 );

##
AddRightUnitorWithGivenTensorProduct( cat,

########
function ( cat_1, a_1, s_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, a_1, UnderlyingMatrix, HomalgIdentityMatrix( NumberRows( UnderlyingMatrix( a_1 ) ), UnderlyingRing( cat_1 ) ) );
end
########

, 100 );

##
AddTensorProductOnMorphismsWithGivenTensorProducts( cat,

########
function ( cat_1, s_1, alpha_1, beta_1, r_1 )
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(
), cat_1, s_1, r_1, UnderlyingMatrix, KroneckerMat( UnderlyingMatrix( alpha_1 ), UnderlyingMatrix( beta_1 ) ) );
end
########

, 100 );

##
AddTensorUnit( cat,

########
function ( cat_1 )
return ObjectifyObjectForCAPWithAttributes( rec(
), cat_1, UnderlyingMatrix, HomalgZeroMatrix( 1, 0, UnderlyingRing( cat_1 ) ) );
end
########

, 100 );
Expand Down
Loading

0 comments on commit d665138

Please sign in to comment.