GAP (CAP) - Chapter 10: Technical Details

Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 Ind
[Top of Book] [Contents] [Previous Chapter] [Next Chapter]

[MathJax off]

10 Technical Details
10.1 The Category Cat
10.1-1 ObjectCache
10.1-2 MorphismCache
10.2 Install Functions for IsWellDefined
10.2-1 InstallMethodWithToDoForIsWellDefined
10.2-2 InstallSetWithToDoForIsWellDefined
10.2-3 DeclareAttributeWithToDoForIsWellDefined
10.2-4 DeclareFamilyProperty
10.2-5 CAP_INTERNAL_REPLACE_STRINGS_WITH_FILTERS
10.2-6 CAP_INTERNAL_MERGE_FILTER_LISTS
10.2-7 CAP_INTERNAL_RETURN_OPTION_OR_DEFAULT
10.2-8 CAP_INTERNAL_FIND_APPEARANCE_OF_SYMBOL_IN_FUNCTION
10.2-9 CAP_INTERNAL_MERGE_PRECONDITIONS_LIST
10.2-10 CachingStatistic
10.2-11 BrowseCachingStatistic

### 10 Technical Details

#### 10.1 The Category Cat

##### 10.1-1 ObjectCache

`‣ ObjectCache`( functor ) | ( attribute )

Returns: IsCachingObject

Retuns the caching object which stores the results of the functor functor applied to objects.

##### 10.1-2 MorphismCache

`‣ MorphismCache`( functor ) | ( attribute )

Returns: IsCachingObject

Retuns the caching object which stores the results of the functor functor applied to morphisms.

#### 10.2 Install Functions for IsWellDefined

##### 10.2-1 InstallMethodWithToDoForIsWellDefined

`‣ InstallMethodWithToDoForIsWellDefined`( arg ) | ( function )

The IsWellDefined filter is a basic function of CAP. For every categorial construction the outcome is well defined if and only if every input object or morphism of the construction is well defined. So for every implementation of a categorial construction a ToDoListEntry needs to be defined which propagates well definedness from the input cells to the output. For not writing this construction in every method, this function can be used to install a method which then installs the correct ToDoListEntries for the output. The input syntax works exactly like InstallMethod, with one extension: The method creates an auxilliary function which computes the output from the function given to InstallMethodWithToDoForIsWellDefined, then installs the ToDoListEntries, and then installs the auxilliary function instead of the original one. This is normally done with InstallMethod. However, one can change this via the option InstallMethod, which can be set to any other function which is then used instead of InstallMethod. This is used for the caching functions.

##### 10.2-2 InstallSetWithToDoForIsWellDefined

`‣ InstallSetWithToDoForIsWellDefined`( arg1, arg2, arg3 ) | ( operation )

For the caching one needs the possibility to install setters for functions with multiple arguments. This is a setter function which automatically adds ToDoListEntries for IsWellDefined like described above for the manually setted result of a method.

##### 10.2-3 DeclareAttributeWithToDoForIsWellDefined

`‣ DeclareAttributeWithToDoForIsWellDefined`( arg ) | ( function )

Since attributes install their setters themselfes, one needs to declare attributes in another way to ensure ToDoListEntries for IsWellDefined in the setter of an attribute. This function works like DeclareAttribute, but installs ToDoListEntries for the setter of the attribute. Please note that implementations still need to be done with InstallMethodWithToDoForIsWellDefined.

##### 10.2-4 DeclareFamilyProperty

`‣ DeclareFamilyProperty`( arg ) | ( function )

##### 10.2-5 CAP_INTERNAL_REPLACE_STRINGS_WITH_FILTERS

`‣ CAP_INTERNAL_REPLACE_STRINGS_WITH_FILTERS`( list, category ) | ( function )

Returns: Replaced list

The function takes a list (of lists) of filters or strings, where the strings can be category, cell, object, morphism, or twocell. The strings are then recursively replaced by the corresponding filters of the category. The replaced list is returned.

##### 10.2-6 CAP_INTERNAL_MERGE_FILTER_LISTS

`‣ CAP_INTERNAL_MERGE_FILTER_LISTS`( list, additional, list ) | ( function )

Returns: merged lists

The first argument should be a dense list with filters, the second a sparse list containing filters not longer then the first one. The filters of the second list are then appended (via and) to the filters in the first list at the corresponding position, and the resulting list is returned.

##### 10.2-7 CAP_INTERNAL_RETURN_OPTION_OR_DEFAULT

`‣ CAP_INTERNAL_RETURN_OPTION_OR_DEFAULT`( string, value ) | ( function )

Returns: option value

Returns the value of the option with name string, or, if this value is fail, the object value.

##### 10.2-8 CAP_INTERNAL_FIND_APPEARANCE_OF_SYMBOL_IN_FUNCTION

`‣ CAP_INTERNAL_FIND_APPEARANCE_OF_SYMBOL_IN_FUNCTION`( function, symbol_list, loop_multiple ) | ( function )

Returns: a list of symbols with multiples

The function searches for the appearance of the strings in symbol list on the function function and returns a list of pairs, containing the name of the symbol and the number of appearance. If the symbol appears in a loop, the number of appearance is counted times the loop multiple.

##### 10.2-9 CAP_INTERNAL_MERGE_PRECONDITIONS_LIST

`‣ CAP_INTERNAL_MERGE_PRECONDITIONS_LIST`( list1, list2 ) | ( function )

Returns: merge list

The function takes two lists containing pairs of symbols (strings) and multiples. The lists are merged that pairs where the string only appears in one list is then added to the return list, if a pair with a string appears in both lists, the resulting lists only contains this pair once, with the higher multiple from both lists.

##### 10.2-10 CachingStatistic

`‣ CachingStatistic`( category[, operation] ) | ( function )

Prints statistics for all caches in category. If operation is given (as a string), only statistics for the given operation cache is stored.

##### 10.2-11 BrowseCachingStatistic

`‣ BrowseCachingStatistic`( category ) | ( function )

Displays statistics for all caches in category. in a Browse window. Here "status" indicates if the cache is weak, strong, or inactive, "hits" is the number of successful cache accesses, "misses" the number of unsuccessful cache accesses, and "stored" the number of objects currently stored in the cache.

[Top of Book] [Contents] [Previous Chapter] [Next Chapter]
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 Ind

generated by GAPDoc2HTML