Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SetPackageInfo( rec(

PackageName := "GradientBasedLearningForCAP",
Subtitle := "Gradient Based Learning via Category Theory",
Version := "2026.02-01",
Version := "2026.04-01",
Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ),
License := "GPL-2.0-or-later",

Expand Down Expand Up @@ -70,13 +70,13 @@ Dependencies := rec(
GAP := ">= 4.13.0",
NeededOtherPackages := [
[ "GAPDoc", ">= 1.5" ],
[ "CAP", ">= 2026.02-01" ],
[ "MonoidalCategories", ">= 2024.04-01" ],
[ "CartesianCategories", ">= 2024.04-01" ],
[ "ToolsForCategoricalTowers", ">= 2024.06-02" ],
[ "CAP", ">= 2026.04-02" ],
[ "MonoidalCategories", ">= 2025.12-01" ],
[ "CartesianCategories", ">= 2025.12-01" ],
[ "ToolsForCategoricalTowers", ">= 2026.04-01" ],
],
SuggestedOtherPackages := [
[ "ToolsForHigherHomologicalAlgebra", ">= 2023.01-01" ], # for 'Show'ing latex-strings
[ "ToolsForHigherHomologicalAlgebra", ">= 2026.04-01" ], # for 'Show'ing latex-strings
],
ExternalConditions := [ ],
),
Expand Down
4 changes: 2 additions & 2 deletions examples/CategoryOfSkeletalSmoothMaps.g
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Smooth := SkeletalCategoryOfSmoothMaps( );
Display( Smooth );
#! A CAP category with name SkeletalSmoothMaps:
#!
#! 49 primitive operations were used to derive 93 operations for this category wh\
#! 49 primitive operations were used to derive 92 operations for this category wh\
#! ich algorithmically
#! * IsLinearCategoryOverCommutativeSemiring
#! * IsCartesianCategory
#! * IsLinearCategoryOverCommutativeRing
#! * IsSymmetricMonoidalCategory
#! and furthermore mathematically
#! * IsStrictMonoidalCategory
Expand Down
16 changes: 8 additions & 8 deletions gap/CategoryOfLenses.gi
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,8 @@ InstallOtherMethod( \.,
p3 := ProjectionInFactorOfDirectProductWithGivenDirectProduct( Smooth, [ P, P, P ], 3, P3 );

s := AdditionForMorphisms( Smooth,
MultiplyWithElementOfCommutativeRingForMorphisms( Smooth, learning_rate, p3 ),
MultiplyWithElementOfCommutativeRingForMorphisms( Smooth, momentum, p1 ) );
MultiplyWithElementOfCommutativeSemiringForMorphisms( Smooth, learning_rate, p3 ),
MultiplyWithElementOfCommutativeSemiringForMorphisms( Smooth, momentum, p1 ) );

put := UniversalMorphismIntoDirectProductWithGivenDirectProduct( Smooth,
[ P, P ], P3, [ s, AdditionForMorphisms( Smooth, p2, s ) ], P2 );
Expand Down Expand Up @@ -742,7 +742,7 @@ InstallOtherMethod( \.,
p2 := ProjectionInFactorOfDirectProductWithGivenDirectProduct( Smooth, [ P, P ], 2, P2 );

put := AdditionForMorphisms( Smooth,
p1, MultiplyWithElementOfCommutativeRingForMorphisms( Smooth, learning_rate, p2 ) );
p1, MultiplyWithElementOfCommutativeSemiringForMorphisms( Smooth, learning_rate, p2 ) );

S := ObjectConstructor( Lenses, Pair( P, P ) );

Expand Down Expand Up @@ -838,8 +838,8 @@ InstallOtherMethod( \.,
put_1 := AdditionForMorphisms( Smooth, p1, SmoothMap( Smooth, TxP4, [ 1 ], Smooth.( 1 ) ) );

m := AdditionForMorphisms( Smooth,
MultiplyWithElementOfCommutativeRingForMorphisms( Smooth, beta_1, p2 ),
MultiplyWithElementOfCommutativeRingForMorphisms( Smooth, 1 - beta_1, p5 ) );
MultiplyWithElementOfCommutativeSemiringForMorphisms( Smooth, beta_1, p2 ),
MultiplyWithElementOfCommutativeSemiringForMorphisms( Smooth, 1 - beta_1, p5 ) );

put_2 := m;

Expand All @@ -856,9 +856,9 @@ InstallOtherMethod( \.,
m_hat := MultiplicationForMorphisms( Smooth, m, b );

v := AdditionForMorphisms( Smooth,
MultiplyWithElementOfCommutativeRingForMorphisms( Smooth,
MultiplyWithElementOfCommutativeSemiringForMorphisms( Smooth,
beta_2, p3 ),
MultiplyWithElementOfCommutativeRingForMorphisms( Smooth,
MultiplyWithElementOfCommutativeSemiringForMorphisms( Smooth,
1 - beta_2, MultiplicationForMorphisms( Smooth, p5, p5 ) ) );

put_3 := v;
Expand Down Expand Up @@ -888,7 +888,7 @@ InstallOtherMethod( \.,
DirectProductFunctorial( Smooth, ListWithIdenticalEntries( n, Smooth.Sqrt ) ) ) ),
DirectProductFunctorial( Smooth, ListWithIdenticalEntries( n, Smooth.Power( -1 ) ) ) );

s := MultiplyWithElementOfCommutativeRingForMorphisms( Smooth, learning_rate, MultiplicationForMorphisms( Smooth, s, m_hat ) );
s := MultiplyWithElementOfCommutativeSemiringForMorphisms( Smooth, learning_rate, MultiplicationForMorphisms( Smooth, s, m_hat ) );

put_4 := AdditionForMorphisms( Smooth, p4, s );

Expand Down
3 changes: 1 addition & 2 deletions gap/SkeletalCategoryOfSmoothMaps.autogen.gd
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,12 @@
#! * <Ref BookName="MonoidalCategories" Func="LeftUnitorInverse" Label="for Is" />
#! * <Ref BookName="MonoidalCategories" Func="LeftUnitorInverseWithGivenTensorProduct" Label="for Is" />
#! * <Ref BookName="MonoidalCategories" Func="LeftUnitorWithGivenTensorProduct" Label="for Is" />
#! * <Ref BookName="CAP" Func="LinearCombinationOfMorphisms" Label="for Is" />
#! * <Ref BookName="ToolsForCategoricalTowers" Func="MorphismBetweenDirectProducts" Label="for Is" />
#! * <Ref BookName="ToolsForCategoricalTowers" Func="MorphismBetweenDirectProductsWithGivenDirectProducts" Label="for Is" />
#! * <Ref BookName="CAP" Func="MorphismConstructor" Label="for Is" />
#! * <Ref BookName="CAP" Func="MorphismDatum" Label="for Is" />
#! * <Ref BookName="GradientBasedLearningForCAP" Func="MultiplicationForMorphisms" Label="for Is" />
#! * <Ref BookName="CAP" Func="MultiplyWithElementOfCommutativeRingForMorphisms" Label="for Is" />
#! * <Ref BookName="CAP" Func="MultiplyWithElementOfCommutativeSemiringForMorphisms" Label="for Is" />
#! * <Ref BookName="CAP" Func="ObjectConstructor" Label="for Is" />
#! * <Ref BookName="CAP" Func="ObjectDatum" Label="for Is" />
#! * <Ref BookName="CAP" Func="PostCompose" Label="for Is" />
Expand Down
14 changes: 7 additions & 7 deletions gap/SkeletalCategoryOfSmoothMaps.gi
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ InstallGlobalFunction( SkeletalCategoryOfSmoothMaps,
SetIsCartesianCategory( Smooth, true );
SetIsStrictMonoidalCategory( Smooth, true );
SetIsSymmetricMonoidalCategory( Smooth, true );
SetIsLinearCategoryOverCommutativeRing( Smooth, true );
SetIsLinearCategoryOverCommutativeSemiring( Smooth, true );

##

Expand All @@ -38,12 +38,12 @@ InstallGlobalFunction( SkeletalCategoryOfSmoothMaps,
reals!.Name := "Reals";

# or IsFloat
reals!.RingElementFilter := IsRingElement;
reals!.SemiringElementFilter := IsRingElement;

# or Float
reals!.interpret_rationals_func := IdFunc;

SetCommutativeRingOfLinearCategory( Smooth, reals );
SetCommutativeSemiringOfLinearCategory( Smooth, reals );

##
AddObjectConstructor( Smooth,
Expand Down Expand Up @@ -311,7 +311,7 @@ InstallGlobalFunction( SkeletalCategoryOfSmoothMaps,

end );

AddMultiplyWithElementOfCommutativeRingForMorphisms( Smooth,
AddMultiplyWithElementOfCommutativeSemiringForMorphisms( Smooth,

function ( Smooth, a, f )
local map, jacobian_matrix;
Expand Down Expand Up @@ -1092,7 +1092,7 @@ InstallOtherMethod( \.,

s := PreComposeList( Smooth, [ SubtractionForMorphisms( Smooth, f, m ), squares, Smooth.Sum( n ) ] );

return MultiplyWithElementOfCommutativeRingForMorphisms( Smooth, 1 / n, s );
return MultiplyWithElementOfCommutativeSemiringForMorphisms( Smooth, 1 / n, s );

end;

Expand Down Expand Up @@ -1365,7 +1365,7 @@ InstallOtherMethod( \.,
total_sum := PreComposeList( Smooth, [ diff, square, sum ] );

# return the average
return MultiplyWithElementOfCommutativeRingForMorphisms( Smooth, 1 / n, total_sum );
return MultiplyWithElementOfCommutativeSemiringForMorphisms( Smooth, 1 / n, total_sum );

end;

Expand Down Expand Up @@ -1486,7 +1486,7 @@ InstallOtherMethod( \.,
total_sum := PreCompose( Smooth, mul, Smooth.Sum( n ) );

# return the average
return MultiplyWithElementOfCommutativeRingForMorphisms( Smooth, -1 / n, total_sum );
return MultiplyWithElementOfCommutativeSemiringForMorphisms( Smooth, -1 / n, total_sum );

end;

Expand Down
Loading