Goto Chapter: Top 1 2 3 Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

3 Examples and tests
 3.1 Examples
 3.2 Tests

3 Examples and tests

3.1 Examples

gap> LoadPackage( "FreydCategoriesForCAP", false );
true
gap> LoadPackage( "LinearAlgebraForCAP", false );
true
gap> Q := HomalgFieldOfRationals();;
gap> vec := MatrixCategory_as_CategoryOfRows( Q : no_precompiled_code := true );;
gap> V := MatrixCategoryObject( vec, 2 );;
gap> alpha := ZeroMorphism( V, V );;
gap> beta := IdentityMorphism( V );;
gap> W := DirectSum( V, V );;
gap> morphism_matrix := [ [ alpha, beta ], [ beta, alpha ] ];;
gap> # compile the derivation of MorphismBetweenDirectSumsWithGivenDirectSums
> Print(
>     vec!.operations.MorphismBetweenDirectSumsWithGivenDirectSums.func,
>     "\n"
> );
function ( cat, S, diagram_S, morphism_matrix, diagram_T, T )
    local test_diagram_product, test_diagram_coproduct;
    test_diagram_coproduct := ListN( diagram_S, morphism_matrix, 
       function ( source, row )
            return UniversalMorphismIntoDirectSumWithGivenDirectSum( cat, 
               diagram_T, source, row, T );
        end );
    return UniversalMorphismFromDirectSumWithGivenDirectSum( cat, diagram_S, 
       T, test_diagram_coproduct, S );
end
gap> compiled_func2 := CapJitCompiledFunction(
>     vec!.operations.MorphismBetweenDirectSumsWithGivenDirectSums.func,
>     vec
> );;
gap> Display( compiled_func2 );
function ( cat_1, S_1, diagram_S_1, morphism_matrix_1, diagram_T_1, T_1 )
    local deduped_2_1;
    deduped_2_1 := UnderlyingRing( cat_1 );
    return AsCapCategoryMorphism( cat_1, S_1, 
       UnionOfRows( deduped_2_1, AsInteger( T_1 ), 
         ListN( diagram_S_1, morphism_matrix_1, function ( source_2, row_2 )
                return UnionOfColumns( deduped_2_1, AsInteger( source_2 ), 
                   List( row_2, AsHomalgMatrix ) );
            end ) ), T_1 );
end
gap> Display( ENHANCED_SYNTAX_TREE_CODE( CAP_JIT_INTERNAL_POST_PROCESSED_TREE(
>     CapJitCompiledCAPOperationAsEnhancedSyntaxTree(
>         vec, "KernelEmbedding"
>     ),
>     vec
> ) ) );
function ( cat_1, alpha_1 )
    local deduped_1_1;
    deduped_1_1 := SyzygiesOfRows( AsHomalgMatrix( alpha_1 ) );
    return 
     AsCapCategoryMorphism( cat_1, 
       AsCapCategoryObject( cat_1, NumberRows( deduped_1_1 ) ), deduped_1_1, 
       Source( alpha_1 ) );
end
gap> LoadPackage( "FreydCategoriesForCAP", false );
true
gap> LoadPackage( "LinearAlgebraForCAP", false );
true
gap> ReadPackage( "LinearAlgebraForCAP", "gap/CompilerLogic.gi" );
true
gap> CAP_INTERNAL_DUMMY_HOMALG_FIELD_COUNTER := 1;;
gap> homalg_field := DummyHomalgField( );;
gap> category_constructor := field -> MatrixCategory_as_CategoryOfRows( field );;
gap> given_arguments := [ homalg_field ];;
gap> compiled_category_name := "MatrixCategory_precompiled";;
gap> package_name := "LinearAlgebraForCAP";;
gap> CapJitPrecompileCategoryAndCompareResult(
>     category_constructor,
>     given_arguments,
>     package_name,
>     compiled_category_name :
>     number_of_objectified_objects_in_data_structure_of_object := 1,
>     number_of_objectified_morphisms_in_data_structure_of_object := 0,
>     number_of_objectified_objects_in_data_structure_of_morphism := 2,
>     number_of_objectified_morphisms_in_data_structure_of_morphism := 1
> );;
gap> MatrixCategory_precompiled( homalg_field );
Category of matrices over Dummy homalg field 1
gap> MatrixCategory( homalg_field )!.precompiled_functions_added;
true

3.2 Tests

gap> LoadPackage( "FreydCategoriesForCAP", false );
true
gap> ReadPackage( "FreydCategoriesForCAP",
>     "gap/CategoryOfRows_as_AdditiveClosure_RingAsCategory_CompilerLogic.gi");
true
gap> homalg_field := DummyHomalgField( );;
gap> commutative_homalg_ring := DummyCommutativeHomalgRing( );;
gap> homalg_ring := DummyHomalgRing( );;
gap> QQ := HomalgFieldOfRationalsInSingular( );;
gap> QQxy := QQ * "x,y";;
gap> EQQxy := KoszulDualRing( QQxy );;
gap> precompile_CategoryOfColumns := function( homalg_ring, name )
>     
>     CapJitPrecompileCategoryAndCompareResult(
>         homalg_ring -> CategoryOfColumns(
>             homalg_ring
>         ),
>         [ homalg_ring ],
>         "FreydCategoriesForCAP",
>         Concatenation(
>             "CategoryOfColumns_as_Opposite_CategoryOfRows_",
>             name,
>             "_precompiled"
>         ) :
>         operations := "primitive",
>         number_of_objectified_objects_in_data_structure_of_object := 1,
>         number_of_objectified_morphisms_in_data_structure_of_object := 0,
>         number_of_objectified_objects_in_data_structure_of_morphism := 2,
>         number_of_objectified_morphisms_in_data_structure_of_morphism := 1
>     ); end;;
gap> precompile_CategoryOfColumns( homalg_field, "Field" );;
gap> precompile_CategoryOfColumns( commutative_homalg_ring, "CommutativeRing" );;
gap> precompile_CategoryOfColumns( EQQxy, "HomalgExteriorRingOverField" );;
gap> precompile_CategoryOfColumns( homalg_ring, "ArbitraryRing" );;
gap> CategoryOfColumns( homalg_field )!.precompiled_functions_added;
true
gap> CategoryOfColumns( commutative_homalg_ring )!.precompiled_functions_added;
true
gap> CategoryOfColumns( EQQxy )!.precompiled_functions_added;
true
gap> CategoryOfColumns( homalg_ring )!.precompiled_functions_added;
true
gap> LoadPackage( "FreydCategoriesForCAP", false );
true
gap> ReadPackage( "FreydCategoriesForCAP",
>     "gap/CategoryOfRows_as_AdditiveClosure_RingAsCategory_CompilerLogic.gi");
true
gap> homalg_field := DummyHomalgField( );;
gap> commutative_homalg_ring := DummyCommutativeHomalgRing( );;
gap> homalg_ring := DummyHomalgRing( );;
gap> QQ := HomalgFieldOfRationalsInSingular( );;
gap> QQxy := QQ * "x,y";;
gap> EQQxy := KoszulDualRing( QQxy );;
gap> precompile_CategoryOfRows := function( homalg_ring, name )
>     
>     CapJitPrecompileCategoryAndCompareResult(
>         homalg_ring -> CategoryOfRows(
>             homalg_ring
>         ),
>         [ homalg_ring ],
>         "FreydCategoriesForCAP",
>         Concatenation(
>             "CategoryOfRows_as_AdditiveClosure_RingAsCategory_",
>             name,
>             "_precompiled"
>         ) :
>         operations := "primitive",
>         number_of_objectified_objects_in_data_structure_of_object := 1,
>         number_of_objectified_morphisms_in_data_structure_of_object := 0,
>         number_of_objectified_objects_in_data_structure_of_morphism := 2,
>         number_of_objectified_morphisms_in_data_structure_of_morphism := 1
>     ); end;;
gap> precompile_CategoryOfRows( homalg_field, "Field" );;
gap> precompile_CategoryOfRows( commutative_homalg_ring, "CommutativeRing" );;
gap> precompile_CategoryOfRows( EQQxy, "HomalgExteriorRingOverField" );;
gap> precompile_CategoryOfRows( homalg_ring, "ArbitraryRing" );;
gap> CategoryOfRows( homalg_field )!.precompiled_functions_added;
true
gap> CategoryOfRows( commutative_homalg_ring )!.precompiled_functions_added;
true
gap> CategoryOfRows( EQQxy )!.precompiled_functions_added;
true
gap> CategoryOfRows( homalg_ring )!.precompiled_functions_added;
true
gap> LoadPackage( "FreydCategoriesForCAP", false );
true
gap> dummy := DummyCategory( rec(
>     list_of_operations_to_install := [
>         # general category
>         "PreCompose",
>         "IdentityMorphism",
>         "IsEqualForMorphisms",
>         "IsEqualForMorphismsOnMor",
>         "IsWellDefinedForMorphisms",
>         
>         # computable
>         "IsCongruentForMorphisms",
>         
>         # pre-additive
>         "AdditionForMorphisms",
>         "SubtractionForMorphisms",
>         "AdditiveInverseForMorphisms",
>         "ZeroMorphism",
>         
>         # with zero object
>         "ZeroObject",
>         "UniversalMorphismIntoZeroObject",
>         "UniversalMorphismFromZeroObject",
>         "ZeroObjectFunctorial",
>         
>         # additive
>         "DirectSum",
>         "DirectSumFunctorial",
>         "ProjectionInFactorOfDirectSum",
>         "UniversalMorphismIntoDirectSum",
>         "InjectionOfCofactorOfDirectSum",
>         "UniversalMorphismFromDirectSum",
>         
>         # colifts
>         "IsColiftable"
>     ],
>     properties := [
>         "IsAdditiveCategory",
>     ],
> ) );;
gap> StopCompilationAtPrimitivelyInstalledOperationsOfCategory( dummy );
gap> CapJitPrecompileCategoryAndCompareResult(
>     underlying_category -> CoFreydCategory_as_Opposite_FreydCategory_Opposite(
>         underlying_category
>     ),
>     [ dummy ],
>     "FreydCategoriesForCAP",
>     "CoFreydCategory_as_Opposite_FreydCategory_Opposite_precompiled" :
>     operations := "primitive",
>     number_of_objectified_objects_in_data_structure_of_object := 1,
>     number_of_objectified_morphisms_in_data_structure_of_object := 0,
>     number_of_objectified_objects_in_data_structure_of_morphism := 2,
>     number_of_objectified_morphisms_in_data_structure_of_morphism := 1
> );
gap> CoFreydCategory( dummy )!.precompiled_functions_added;
true
gap> LoadPackage( "ModulePresentationsForCAP", false );
true
gap> LoadPackage( "FreydCategoriesForCAP", false );
true
gap> ReadPackage( "LinearAlgebraForCAP", "gap/CompilerLogic.gi" );
true
gap> homalg_field := DummyHomalgField( );;
gap> commutative_homalg_ring := DummyCommutativeHomalgRing( );;
gap> homalg_ring := DummyHomalgRing( );;
gap> # CAUTION: when adding new operations make sure that they are compatible
> # with the ones added manually in `ADD_FUNCTIONS_FOR_LEFT/RIGHT_PRESENTATION`.
> operations_for_arbitrary_ring := [
>     "AdditionForMorphisms",
>     "AdditiveInverseForMorphisms",
>     "CokernelColiftWithGivenCokernelObject",
>     "CokernelProjection",
>     "DirectSum",
>     "EpimorphismFromSomeProjectiveObject",
>     "IdentityMorphism",
>     "InjectionOfCofactorOfDirectSumWithGivenDirectSum",
>     "IsCongruentForMorphisms",
>     "IsEqualForMorphisms",
>     "IsEqualForObjects",
>     #"IsWellDefinedForMorphisms",
>     #"IsWellDefinedForObjects",
>     "IsZeroForMorphisms",
>     #"KernelEmbedding",
>     #"LiftAlongMonomorphism",
>     "PreCompose",
>     "ProjectionInFactorOfDirectSumWithGivenDirectSum",
>     "UniversalMorphismFromDirectSumWithGivenDirectSum",
>     "UniversalMorphismFromZeroObjectWithGivenZeroObject",
>     "UniversalMorphismIntoDirectSumWithGivenDirectSum",
>     "UniversalMorphismIntoZeroObjectWithGivenZeroObject",
>     "ZeroMorphism",
>     "ZeroObject",
> ];;
gap> operations_for_commutative_ring := Concatenation(
>     operations_for_arbitrary_ring,
>     [ #"AssociatorLeftToRightWithGivenTensorProducts",
>       #"AssociatorRightToLeftWithGivenTensorProducts",
>       #"BraidingWithGivenTensorProducts",
>       #"CoevaluationMorphismWithGivenRange",
>       #"Colift",
>       #"EvaluationMorphismWithGivenSource",
>       #"InternalHomOnMorphismsWithGivenInternalHoms",
>       #"InternalHomOnObjects",
>       #"IsColiftable",
>       #"IsLiftable",
>       #"LeftUnitorWithGivenTensorProduct",
>       #"Lift",
>       "MultiplyWithElementOfCommutativeRingForMorphisms",
>       #"RightUnitorWithGivenTensorProduct",
>       #"TensorProductOnMorphismsWithGivenTensorProducts",
>       #"TensorProductOnObjects",
>       #"TensorUnit",
>     ]
> );;
gap> precompile_LeftPresentations := function( ring, name, operations )
>     
>     CapJitPrecompileCategoryAndCompareResult(
>         ring -> LeftPresentations_as_FreydCategory_CategoryOfRows( ring ),
>         [ ring ],
>         "ModulePresentationsForCAP",
>         Concatenation(
>             "LeftPresentations_as_FreydCategory_CategoryOfRows_",
>             name,
>             "_precompiled"
>         ) :
>         operations := operations
>     ); end;;
gap> precompile_LeftPresentations(
>     homalg_field, "Field", operations_for_commutative_ring
> );;
gap> precompile_LeftPresentations(
>     commutative_homalg_ring, "CommutativeRing", operations_for_commutative_ring
> );;
gap> precompile_LeftPresentations(
>     homalg_ring, "ArbitraryRing", operations_for_arbitrary_ring
> );;
gap> precompile_RightPresentations := function( ring, name, operations )
>     
>     CapJitPrecompileCategoryAndCompareResult(
>         ring -> RightPresentations_as_FreydCategory_CategoryOfColumns( ring ),
>         [ ring ],
>         "ModulePresentationsForCAP",
>         Concatenation(
>             "RightPresentations_as_FreydCategory_CategoryOfColumns_",
>             name,
>             "_precompiled"
>         ) :
>         operations := operations,
>         number_of_objectified_objects_in_data_structure_of_object := 1,
>         number_of_objectified_morphisms_in_data_structure_of_object := 0,
>         number_of_objectified_objects_in_data_structure_of_morphism := 2,
>         number_of_objectified_morphisms_in_data_structure_of_morphism := 1
>     ); end;;
gap> precompile_RightPresentations(
>     homalg_field, "Field", operations_for_commutative_ring
> );;
gap> precompile_RightPresentations(
>     commutative_homalg_ring, "CommutativeRing", operations_for_commutative_ring
> );;
gap> precompile_RightPresentations(
>     homalg_ring, "ArbitraryRing", operations_for_arbitrary_ring
> );;
gap> LeftPresentations( homalg_field )!.precompiled_functions_added;
true
gap> LeftPresentations( commutative_homalg_ring )!.precompiled_functions_added;
true
gap> LeftPresentations( homalg_ring )!.precompiled_functions_added;
true
gap> RightPresentations( homalg_field )!.precompiled_functions_added;
true
gap> RightPresentations( commutative_homalg_ring )!.precompiled_functions_added;
true
gap> RightPresentations( homalg_ring )!.precompiled_functions_added;
true
gap> # put the letter 'V' here to work around
> # https://github.com/frankluebeck/GAPDoc/pull/61
> 
gap> LoadPackage( "LinearAlgebraForCAP", false );
true
gap> LoadPackage( "RingsForHomalg", false );
true
gap> CAP_INTERNAL_DUMMY_HOMALG_FIELD_COUNTER := 1;;
gap> homalg_field := DummyHomalgField( );;
gap> category_constructor := function( field )
>     return Opposite(
>         MatrixCategory(
>             field :
>             no_precompiled_code := false, FinalizeCategory := true
>         ) :
>         only_primitive_operations := true
>     ); end;;
gap> given_arguments := [ homalg_field ];;
gap> compiled_category_name := "Opposite_MatrixCategory_precompiled";;
gap> package_name := "LinearAlgebraForCAP";;
gap> CapJitPrecompileCategoryAndCompareResult(
>     category_constructor,
>     given_arguments,
>     package_name,
>     compiled_category_name :
>     operations := "primitive",
>     number_of_objectified_objects_in_data_structure_of_object := 2,
>     number_of_objectified_morphisms_in_data_structure_of_object := 0,
>     number_of_objectified_objects_in_data_structure_of_morphism := 6,
>     number_of_objectified_morphisms_in_data_structure_of_morphism := 2
> );;
gap> ReadPackage(
>     "LinearAlgebraForCAP",
>     "gap/precompiled_categories/Opposite_MatrixCategory_precompiled.gi"
> );;
gap> Opposite_MatrixCategory_precompiled( homalg_field );
Opposite( Category of matrices over Dummy homalg field 1 )
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 Ind

generated by GAPDoc2HTML