diff --git a/CompilerForCAP/gap/PrecompileCategory.gi b/CompilerForCAP/gap/PrecompileCategory.gi index 6a805bf48e..8c70173fd6 100644 --- a/CompilerForCAP/gap/PrecompileCategory.gi +++ b/CompilerForCAP/gap/PrecompileCategory.gi @@ -265,7 +265,7 @@ InstallGlobalFunction( "CapJitPrecompileCategory", function ( category_construct fi; # check that category_constructor supports `FinalizeCategory` and `enable_compilation` - cat := CallFuncList( category_constructor, given_arguments : FinalizeCategory := false, enable_compilation := true ); + cat := CallFuncList( category_constructor, given_arguments : FinalizeCategory := false, enable_compilation := true, no_precompiled_code := true ); if HasIsFinalized( cat ) then @@ -351,7 +351,7 @@ InstallGlobalFunction( "CapJitPrecompileCategory", function ( category_construct " \n", " \n", " \n", - " cat := category_constructor( ", parameters_string, " : FinalizeCategory := false );\n" + " cat := category_constructor( ", parameters_string, " : FinalizeCategory := false, no_precompiled_code := true );\n" ); output_string := Concatenation( output_string, current_string ); diff --git a/FreydCategoriesForCAP/gap/AdditiveClosure.gi b/FreydCategoriesForCAP/gap/AdditiveClosure.gi index 823d61dc6e..7c25bb236c 100644 --- a/FreydCategoriesForCAP/gap/AdditiveClosure.gi +++ b/FreydCategoriesForCAP/gap/AdditiveClosure.gi @@ -15,7 +15,7 @@ InstallMethod( AdditiveClosure, [ IsCapCategory ], function( underlying_category ) - local category, matrix_element_as_morphism, list_list_as_matrix, homalg_ring, to_be_finalized; + local precompiled_tower_constructors, constructors_in_tower, precompiled_category_getter, category, matrix_element_as_morphism, list_list_as_matrix, homalg_ring, to_be_finalized, info; if not ( HasIsAbCategory( underlying_category ) and IsAbCategory( underlying_category ) ) then @@ -23,6 +23,45 @@ InstallMethod( AdditiveClosure, fi; + # EXPERIMENTAL + precompiled_tower_constructors := [ ]; + + if IsBound( underlying_category!.compiler_hints ) and IsBound( underlying_category!.compiler_hints.precompiled_tower_constructors ) then + + for info in underlying_category!.compiler_hints.precompiled_tower_constructors do + + constructors_in_tower := info.constructors_in_tower; + precompiled_category_getter := info.precompiled_category_getter; + + if constructors_in_tower[1] = "AdditiveClosure" then + + if Length( constructors_in_tower ) = 1 and ValueOption( "no_precompiled_code" ) <> true then + + # try to get precompiled version + category := CallFuncList( precompiled_category_getter, [ underlying_category ] ); + + if category <> fail then + + return category; + + fi; + + else + + # pass information on to the next level + Add( precompiled_tower_constructors, rec( + constructors_in_tower := constructors_in_tower{[ 2 .. Length( constructors_in_tower ) ]}, + precompiled_category_getter := precompiled_category_getter, + ) ); + + fi; + + fi; + + od; + + fi; + category := CreateCapCategory( Concatenation( "Additive closure( ", Name( underlying_category )," )" ) ); category!.category_as_first_argument := true; @@ -31,6 +70,8 @@ InstallMethod( AdditiveClosure, category_attribute_names := [ "UnderlyingCategory", ], + # EXPERIMENTAL + precompiled_tower_constructors := precompiled_tower_constructors, ); matrix_element_as_morphism := ValueOption( "matrix_element_as_morphism" ); diff --git a/FreydCategoriesForCAP/gap/precompiled_categories/CategoryOfColumnsOfFieldPrecompiled.gi b/FreydCategoriesForCAP/gap/precompiled_categories/CategoryOfColumnsOfFieldPrecompiled.gi index b9c54555a6..c114365982 100644 --- a/FreydCategoriesForCAP/gap/precompiled_categories/CategoryOfColumnsOfFieldPrecompiled.gi +++ b/FreydCategoriesForCAP/gap/precompiled_categories/CategoryOfColumnsOfFieldPrecompiled.gi @@ -15,7 +15,7 @@ end; - cat := category_constructor( field : FinalizeCategory := false ); + cat := category_constructor( field : FinalizeCategory := false, no_precompiled_code := true ); ## AddAdditionForMorphisms( cat, diff --git a/FreydCategoriesForCAP/gap/precompiled_categories/OppositeOfCategoryOfRowsOfFieldPrecompiled.gi b/FreydCategoriesForCAP/gap/precompiled_categories/OppositeOfCategoryOfRowsOfFieldPrecompiled.gi index b9b068147a..c5cbb43570 100644 --- a/FreydCategoriesForCAP/gap/precompiled_categories/OppositeOfCategoryOfRowsOfFieldPrecompiled.gi +++ b/FreydCategoriesForCAP/gap/precompiled_categories/OppositeOfCategoryOfRowsOfFieldPrecompiled.gi @@ -15,7 +15,7 @@ end; - cat := category_constructor( field : FinalizeCategory := false ); + cat := category_constructor( field : FinalizeCategory := false, no_precompiled_code := true ); ## AddAdditionForMorphisms( cat, diff --git a/LinearAlgebraForCAP/gap/precompiled_categories/MatrixCategoryPrecompiled.gi b/LinearAlgebraForCAP/gap/precompiled_categories/MatrixCategoryPrecompiled.gi index 96ed0e45d0..f9a237d499 100644 --- a/LinearAlgebraForCAP/gap/precompiled_categories/MatrixCategoryPrecompiled.gi +++ b/LinearAlgebraForCAP/gap/precompiled_categories/MatrixCategoryPrecompiled.gi @@ -15,7 +15,7 @@ end; - cat := category_constructor( field : FinalizeCategory := false ); + cat := category_constructor( field : FinalizeCategory := false, no_precompiled_code := true ); ## AddAdditionForMorphisms( cat, diff --git a/LinearAlgebraForCAP/gap/precompiled_categories/OppositeOfMatrixCategoryPrecompiled.gi b/LinearAlgebraForCAP/gap/precompiled_categories/OppositeOfMatrixCategoryPrecompiled.gi index f77090b710..8b7242ce2a 100644 --- a/LinearAlgebraForCAP/gap/precompiled_categories/OppositeOfMatrixCategoryPrecompiled.gi +++ b/LinearAlgebraForCAP/gap/precompiled_categories/OppositeOfMatrixCategoryPrecompiled.gi @@ -16,7 +16,7 @@ end; - cat := category_constructor( field : FinalizeCategory := false ); + cat := category_constructor( field : FinalizeCategory := false, no_precompiled_code := true ); ## AddAdditionForMorphisms( cat,