GAP (ToolsForHomalg) - Chapter 3: Caches

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

[MathJax on]

3 Caches
3.1 Object constructors
3.1-1 CachingObject
3.1-2 CachingObject
3.2 Setters, getters
3.2-1 CacheValue
3.2-2 SetCacheValue
3.2-3 IsEqualForCache
3.3 Managing functions
3.3-1 SetCachingObjectCrisp

### 3 Caches

#### 3.1 Object constructors

Caches are objects which store for a fixed number of keys a value, so they are a map Obj^k -> Obj, while the k is fixed. A cache ususally stores the result in a weak pointer list, which means that if the value which the cache should store is not referenced in the system anymore, it will not be remembered by the cache. However, caches can be set to store the value permanently (crisp), or not to store any new value at all (inaktive). In that case, already stored values are still in the cache and can be accessed once the cache is set active again.

##### 3.1-1 CachingObject

`‣ CachingObject`( [k, ][is_crisp] ) | ( operation )

`‣ CachingObject`( arg ) | ( operation )

`‣ CachingObject`( arg1, arg2 ) | ( operation )

Returns: a cache

If no argument is given, the function returns a weak cache with key length one, if an integer k is given, a weak cache with key length k, and if the bool is_crisp is true, a crisp cache with the corresponding length.

##### 3.1-2 CachingObject

`‣ CachingObject`( object, cache_name, length[, is_crisp] ) | ( operation )

`‣ CachingObject`( arg1, arg2, arg3, arg4 ) | ( operation )

This methods are not installed, they serve as an interface for InstallMethodWithCacheFromObject.

#### 3.2 Setters, getters

##### 3.2-1 CacheValue

`‣ CacheValue`( cache, key ) | ( operation )

Returns: stored value

If there is a value stored in the cache for key, which can be a single key for caches with key length one or a list of keys depending on the key length of the cache, this method returns the value, otherwise SuPeRfail.

##### 3.2-2 SetCacheValue

`‣ SetCacheValue`( cache, key, value ) | ( operation )

Sets the value of key of the cache to value.

##### 3.2-3 IsEqualForCache

`‣ IsEqualForCache`( obj1, obj2 ) | ( operation )

Returns: true or false

This function is used to compare objects for the caches. The standard way is IsIdenticalObj, and lists are compared recursive with this function. It is possible and recommended to overload this function as needed.

#### 3.3 Managing functions

##### 3.3-1 SetCachingObjectCrisp

`‣ SetCachingObjectCrisp`( cache ) | ( function )

`‣ SetCachingObjectWeak`( arg ) | ( function )

`‣ DeactivateCachingObject`( arg ) | ( function )

`‣ InstallMethodWithCache`( Like, InstallMethod ) | ( function )

`‣ InstallMethodWithCrispCache`( arg ) | ( function )

`‣ InstallMethodWithCacheFromObject`( Like, InstallMethod ) | ( function )

`‣ FunctionWithCache`( func ) | ( function )

`‣ ToDoListEntryToMaintainEqualAttributes`( indicator, objects, attributes ) | ( operation )

`‣ ToDoListEntryToMaintainFollowingAttributes`( indicator, objects, attributes ) | ( operation )

`‣ ToDoListEntry`( source, target_list ) | ( operation )

`‣ ToDoList_this_object` | ( global variable )

`‣ ToDoListEntryToMaintainEqualAttributesBlueprint`( filter, indicator, objects, attributes ) | ( operation )

`‣ ToDoListEntryToMaintainFollowingAttributesBlueprint`( arg1, arg2, arg3, arg4 ) | ( operation )

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

`‣ AddToToDoList`( E ) | ( operation )

`‣ SourcePart`( entry ) | ( operation )

`‣ TargetPart`( entry ) | ( operation )

`‣ ProcessAToDoListEntry`( arg ) | ( operation )

`‣ ToDoListEntry`( arg1, arg2, arg3, arg4 ) | ( operation )

`‣ ToDoListEntry`( arg1, arg2 ) | ( operation )

`‣ SetTargetValueObject`( entry, value ) | ( operation )

`‣ SetTargetObject`( entry, obj ) | ( operation )

`‣ ToDoListEntryWithContraposition`( sobj, source_prop, sval, tobj, target, tval ) | ( operation )

`‣ DescriptionOfImplication`( arg ) | ( attribute )

`‣ ToDoListEntryForEqualAttributes`( arg1, arg2, arg3, arg4 ) | ( operation )

`‣ ToDoListEntryForEquivalentAttributes`( arg1, arg2, arg3, arg4, arg5, arg6 ) | ( operation )

`‣ IsToDoList`( arg ) | ( filter )

`‣ NewToDoList`( arg ) | ( operation )

`‣ Process_A_ToDo_List_Entry`( arg ) | ( function )

`‣ ToDoList`( arg ) | ( attribute )

`‣ ProcessToDoList`( A ) | ( attribute )

`‣ TraceProof`( obj, name, val ) | ( operation )

`‣ ActivateToDoList`( arg ) | ( operation )

`‣ ActivateToDoList`( arg ) | ( operation )

`‣ DeactivateToDoList`( arg ) | ( operation )

`‣ DeactivateToDoList`( arg ) | ( operation )

`‣ ActivateWhereInfosInEntries`( arg ) | ( function )

`‣ DeactivateWhereInfosInEntries`( arg ) | ( function )

`‣ HOMALG_TOOLS` | ( global variable )

`‣ IsStructureObjectOrObjectOrMorphism`( arg ) | ( filter )

`‣ IsStructureObjectOrObject`( arg ) | ( filter )

`‣ IsStructureObject`( arg ) | ( filter )

`‣ IsStructureObjectMorphism`( arg ) | ( filter )

`‣ IsHomalgRingOrModule`( arg ) | ( filter )

`‣ IsContainerForWeakPointers`( arg ) | ( filter )

`‣ IsContainerForPointers`( arg ) | ( filter )

`‣ ContainerForWeakPointers`( arg ) | ( function )

`‣ homalgTotalRuntimes`( arg ) | ( function )

`‣ AddLeftRightLogicalImplicationsForHomalg`( arg ) | ( function )

`‣ LogicalImplicationsForOneHomalgObject`( arg ) | ( function )

`‣ LogicalImplicationsForTwoHomalgBasicObjects`( arg ) | ( function )

`‣ InstallLogicalImplicationsForHomalgBasicObjects`( arg ) | ( function )

`‣ LeftRightAttributesForHomalg`( arg ) | ( function )

`‣ InstallLeftRightAttributesForHomalg`( arg ) | ( function )

`‣ MatchPropertiesAndAttributes`( arg ) | ( function )

`‣ InstallImmediateMethodToPullPropertyOrAttribute`( arg ) | ( function )

`‣ InstallImmediateMethodToConditionallyPullPropertyOrAttribute`( arg ) | ( function )

`‣ InstallImmediateMethodToPullPropertyOrAttributeWithDifferentName`( arg ) | ( function )

`‣ InstallImmediateMethodToPullPropertiesOrAttributes`( arg ) | ( function )

`‣ InstallImmediateMethodToPullTrueProperty`( arg ) | ( function )

`‣ InstallImmediateMethodToConditionallyPullTrueProperty`( arg ) | ( function )

`‣ InstallImmediateMethodToPullTruePropertyWithDifferentName`( arg ) | ( function )

`‣ InstallImmediateMethodToPullTrueProperties`( arg ) | ( function )

`‣ InstallImmediateMethodToPullFalseProperty`( arg ) | ( function )

`‣ InstallImmediateMethodToConditionallyPullFalseProperty`( arg ) | ( function )

`‣ InstallImmediateMethodToPullFalsePropertyWithDifferentName`( arg ) | ( function )

`‣ InstallImmediateMethodToPullFalseProperties`( arg ) | ( function )

`‣ InstallImmediateMethodToPushPropertyOrAttribute`( arg ) | ( function )

`‣ InstallImmediateMethodToConditionallyPushPropertyOrAttribute`( arg ) | ( function )

`‣ InstallImmediateMethodToPushPropertyOrAttributeWithDifferentName`( arg ) | ( function )

`‣ InstallImmediateMethodToPushPropertiesOrAttributes`( arg ) | ( function )

`‣ InstallImmediateMethodToPushTrueProperty`( arg ) | ( function )

`‣ InstallImmediateMethodToPushTruePropertyWithDifferentName`( arg ) | ( function )

`‣ InstallImmediateMethodToPushTrueProperties`( arg ) | ( function )

`‣ InstallImmediateMethodToPushFalseProperty`( arg ) | ( function )

`‣ InstallImmediateMethodToPushFalsePropertyWithDifferentName`( arg ) | ( function )

`‣ InstallImmediateMethodToPushFalseProperties`( arg ) | ( function )

`‣ DeclareAttributeWithCustomGetter`( arg ) | ( function )

`‣ AppendToAhomalgTable`( arg ) | ( function )

`‣ homalgNamesOfComponentsToIntLists`( arg ) | ( function )

`‣ IncreaseExistingCounterInObject`( arg ) | ( function )

`‣ IncreaseExistingCounterInObjectWithTiming`( arg ) | ( function )

`‣ IncreaseCounterInObject`( arg ) | ( function )

`‣ MemoryToString`( arg ) | ( function )

`‣ PrimePowerExponent`( n, p ) | ( function )

`‣ ViewList`( L ) | ( operation )

`‣ homalgLaTeX`( arg ) | ( operation )

`‣ ExamplesForHomalg`( arg ) | ( operation )

`‣ ExamplesForHomalg`( arg ) | ( operation )

`‣ UpdateContainerOfWeakPointers`( arg ) | ( operation )

`‣ _AddElmWPObj_ForHomalg`( arg ) | ( function )

`‣ _AddTwoElmWPObj_ForHomalg`( arg ) | ( function )

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

`‣ ContainerForPointers`( arg ) | ( function )

`‣ UpdateContainerOfPointers`( arg ) | ( operation )

`‣ _AddElmPObj_ForHomalg`( arg ) | ( function )

`‣ _AddTwoElmPObj_ForHomalg`( arg ) | ( function )

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

`‣ TOOLS_FOR_HOMALG_GET_REAL_TIME_OF_FUNCTION_CALL`( function, args ) | ( function )

`‣ IsTree`( arg ) | ( filter )

`‣ Content`( arg ) | ( attribute )

`‣ ListOfSuccessors`( arg ) | ( operation )

`‣ Predecessor`( arg ) | ( operation )

`‣ ListOfSentinels`( arg ) | ( operation )

`‣ RemoveHead`( arg ) | ( operation )

`‣ Tree`( arg ) | ( operation )

`‣ Tree`( obj ) | ( operation )

`‣ Add`( tree, new_tree ) | ( operation )

`‣ ContentListFromSentinelToHead`( sent ) | ( operation )

`‣ PostOrder`( arg ) | ( operation )

Returns: nothing

Sets the caching to crisp, weak, or deativates the cache completely.
Installs a method like InstallMethod, but additionally puts a cache layer around it so that the result is cached. It is possible to give the cache as the option Cache, to use the same cache for more than one method or store it somewhere to have access to the cache. Like InstallMethodWithCache, but with a crisp cache. This works just like InstallMethodWithCache, but it extracts the cache via the CachingObject method from one of its arguments. The CachingObject must then be implemented for one of the arguments, and the option ArgumentNumber can specify which option to be used. As second argument for CachingObject a string is used, which can identify the cache. Standard is the name of the operation, for which the method is installed, but it can be specified using the CacheName option. Creates a cached function out of a given function func. If the option Cache is a cache, this cache is used. If the option Cache is the string crisp, a crisp cache is used. All other values for this option lead to a single weak cache. The first argument is the indicator. It is a list of sources like in ToDoListEntry. Each entry SP has to be a threetuple. First entry of SP has to an object, for which the second entry of SP, which has to be the name of an attribute, must become known. Once the attribute is known to the object, it will be compared to the third entry of the list. This can be a value, which is compared directly a function, which is launched and its return value is compared, or a list, consisting of a function and arguments, so the return value of the function with given arguments is compared. If there is no third entry in SP, it is only looked up if the value is known. Once all entries in indicator are processed like this, and all returned true in the comparasion, a list of ToDoListEntryForEqualAttributes is installed. They are installed for the two entries of the list objects which can either be the objects itself or a list containing a function and arguments, which return value is used. For each entry in attributes such an entry is installed. Such an entry can be the name of an attribute, if both objects in objects should share the value between attributes with the same name, or a list of two names, if the attributes do not have the same name. This function creates a ToDoListEntry which can install several ToDoListEntries. The first two arguments, indicator and objects except that there will be only ToDoListEntries installed between the two objects in objects. Each entry in attributes can either be a string which means that the attribute with the given name will be set from the first to the second object in objects once it is known. The third argument attributes is a list of attributes that will be propagated by ToDoListEntries. Each entry TP can either be a list consisting of a DescriptionOfImplication string and one of the following or just one of the following lists: It can be a string, which means that the Attribute with the given name will be propagated from the first to the second object. It can be a list, consisting of two entries, where the first entry is a list of sources like in ToDoListEntry and the second might be a function which will be launched once the first part is fulfilled. It can also be a threetuple which will serve as second to fourth argument of ToDoListEntry. Or it can be a string, which will set the attribute named like this of the first object to the one named in the second object This function allows to create more than one ToDoListEntry with identical list of sources at one time. First argument is a list of sources like in the other ToDoListEntry functions Second argument is a list of threetuples, which serve as second to fourth argument of ToDoListEntry or a function, which serves as second argument for ToDoListEntry or a tuple with a description string and one of the above. Represents the objects for which the blueprint is created in the arguments This function installs an immediate method which can install ToDoListEntryToMaintainEqualAttributes. First argument must be a filter, and once the filter becomes true the ToDoListEntryToMaintainEqualAttributes is installed with the second to fourth argument as first to third. In those attributes, at any point, the variable ToDoList_this_object can be used. When the entry is installed This will be replaced with the object to which the filters became known, i.e. the one which triggered the immediate method. The same as ToDoListEntryToMaintainEqualAttributesBlueprint for ToDoListEntryToMaintainFollowingAttributes The same as ToDoListEntryToMaintainEqualAttributesBlueprint for ToDoListEntry Adds the ToDo-list entry E to the ToDo-lists of it's source objects and creates a new one, if this is needed. This function might be called with lists of entries Returns the a list of source parts of the ToDo-list entry entry. This is a triple of an object, a name of a filter/attribute, and a value to which the attribute has to be set to activate the entry Returns the target part of the ToDo-list entry entry. This is a triple of an object, a name of a filter/attribute, and a value to which the specific filter/attribute should be set. The third entry of the list might also be a function to which return value the attribute is set. Processes a ToDo-list entry, i.e. sets the information given in TargetPart if the definitions in SourcePart are fulfilled. Returns a function if the entry could be processed, false if not, and fail if SourcePart or TargetPart weren't availible anymore. The first argument must be a list consisting of two, three or four-tuples where the first entry must be the object to which the attribute given as a string in the second entry must be known to process this entry. The second entry can also be a list of strings, in that case all the attributes given as names must be known. Also, in this case, only two entries in this tuple are allowed. The third part can be a value or a list, consisting of a function followed by arguments which will be computed by the time the attribute given as second entry becomes known to the first entry. If the second part is only a string, and there is a third entry in the tuple the attribute is compared to the third entry. One can set a comparating function as fourth entry, which must take two entries and return false or true. If the value of the attribute matches the (computed) value in the third entry for all members of the list in the first argument the attribute given as third argument, also by name, of the second argument is set to the value of the fourth argument. This can also be a list which has to be computed, or a function, which retun value is used in this case. The first argument is a list of three-tubles like above. Once all preconditions become fulfilled the function given as second argument is launched. If the given value of the target part is the return value of a function this command sets the target value of the entry to a function. This is done to keep proof tracking availible. If the target object, i.e. the first entry of the target part, was given as a function, this method can set this entry to the return value computed in ProcessToDoListEntry. This happens atomatically, do not worry about it. Creates a ToDoListEntry which also installs a contraposition. The arguments source_prop and target need to be strings which name a property, and sval and tval need to be boolean values, i.e. true or false. Has to be set to a string, which describes the reason for the conclusion. If the ToDo-list entry is displayed, the given string will be displayed with a because before it. Creates a ToDoListEntry for two equal attributes, which means that both values of the two attributes will be propagated in both directions. Creates a ToDoListEntry for two equivalent attributes, which means that both values of the two attributes will be propagated in both directions. Please note that this one does NOT implement contrapositions. This is the category of ToDo-lists. Every ToDo-list is an object of this category, which basically contains the ToDo-lists. Creates a new empty ToDo-list. Gets a ToDo-list entry, which is a pair of a list of strings and a weak pointer object, and processes it. If the action was done, it returns true, if not, it returns false, and it returns fail if the action is not possible anymore due to deleted objects. Returns the ToDo-list of an object, or creates a new one. This is the magic! This attribute is never set. Creating an ToDo-list entry installs an ImmediateMethod for this attribute for the specific category of the object to which ToDo-list is added, and the filter the entry contains. It is then triggert if the filters become applicable, so the ToDo-list is processed If the object obj has the attribute name, and its value is val, and the knowledge has been obtained trough ToDoList-entries, this method traces the way the property was set, and returns a tree which describes the full way of how the attribute became known. This operation activates ToDoLists for the argument. This operation activates ToDoLists for all objects. This operation deactivates ToDoLists for the argument. This operation deactivates ToDoLists for all objects. Note that it is not possible to activate ToDoList for a single object while they are not activated. ToDoListEntries will yet be stored for all objects that can have ToDoLists. All objects created while ToDoLists are deactivated have by default no ToDoList. Stores the result of Where( 100 ) in an entry if the entry is triggered. This is not activated by default, since it might slow down the system. Deactives the storage of the result of Where( 100 ) if an entry is triggered. This is the default. A central place for configurations. ChapterInfo Basics, Variables This is the super super GAP-category which will include the GAP-categories IsStructureObjectOrObject and IsHomalgObjectOrMorphism This is the super GAP-category which will include the GAP-categories IsHomalgRing, IsHomalgModule, IsHomalgRingOrModule and IsHomalgComplex This is the super GAP-category which will include the GAP-categories IsHomalgRing we need this GAP-category to define things like Hom(M,R) as easy as Hom(M,N) without distinguishing between structure objects (e.g. rings) and objects (e.g. modules) This is the super GAP-category which will include the GAP-categories IsHomalgRingMap, etc. this is the super GAP-category which will include the GAP-categories IsHomalgRing, IsHomalgModule: The category for weak pointer objects The category for pointer objects The constructor for lists of weak pointers. A tool to compute the runtime of several methods. A tool to install equivalence between filters. Installs a logical implication for one type with all it's contrapositions.
A method to match the properties and attributes of two objects. Installs methods to pull new known properties and attributes from one object to another Installs methods to pull new known properties and attributes under certain conditions from one object to another. Installs an immediate method which can pull a property from one object to another with different names. Installs an immediate method to pull several properties or attributes from one object to another. Installs an immediate method to pull a property if it is true. Installs an immediate method which conditionally pulls a property if it is true. Installs an immediate method which pulls a property with a different name if it is true. Installs an immediate method which pulls several properties if they are true Installs an immediate method to pull a property if it is false. Installs an immediate method which conditionally pulls a property if it is false. Installs an immediate method which pulls a property with a different name if it is false. Installs an immediate method which pulls several properties if they are false. Installs an immediate method to push a property from one object to another. Installs an immediate method to conditionally push a property from one object to another. Installs an immediate method which can push a property from one object to another with different names. Installs an immediate method to push several properties or attributes from one object to another. Installs an immediate method to push a property if it is true. Installs an immediate method which pushes a property with a different name if it is true. Installs an immediate method which pushes several properties if they are true Installs an immediate method to push a property if it is false. Installs an immediate method which pushes a property with a different name if it is false. Installs an immediate method which push several properties if they are false. Installs an attribute with a coustom getter function. Appends an entry to a homalg table. Creates a list of integers out of the names of components. Increases an existing counter in an object. Increases an existiing counter on an object with timing. Increases a counter in an object and creates one if it not exists Converts the current memory state to a string Returns the p-exponent of the integer n, where p is a rational prime. Apply ViewObj to the list L.
Runs the examples for homalg if the package is loadable. Runs the named example for homalg Updates the weak pointers in a container and deletes the empty ones Adds a weak pointer of an objects to a weak pointer list. Adds a weak pointer which depends on two objects to a list of weak pointers Creates a weak pointer depending on two objects and adds it to the container. Creates a container for pointers. Updates the container of pointers, removes old. Adds a pointer to an object to a container for pointers. Adds a pointer to two objects to a container for pointers Returns an object which a pointer refers to. Returns real time seconds of the call function( args ) as first entry of list, result of call as second. The category of trees. A tree may have a content, a list of successors, a predecessor and it knows if it is a leave of a tree or not. The content of the tree. May be any object. Returns the list of successors of a tree. Returns the predecessor of a tree, or fail if there is none. Returns a list of leaves of the tree. Returns the first successor of the tree, and adds all other successors of the tree to the tree that is returned. If the tree is a leave, it returns an empty tree. If the tree is empty, it returns the tree itself. Returns an empty tree. Returns a tree with argument obj. Adds the [list of] tree[s] new_tree as successor to the tree tree. Returns a list of the contents of the trees from the leave sent up to the content of the head of the tree. Returns the contents of the nodes of the tree in post-order.

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

generated by GAPDoc2HTML