simple_cache module¶
Caching module to store only one entry.
- class gemseo.caches.simple_cache.SimpleCache(tolerance=0.0, name=None)[source]
Bases:
AbstractCache
Dictionary-based cache storing a unique entry.
- Parameters:
tolerance (float) –
The tolerance below which two input arrays are considered equal:
norm(new_array-cached_array)/(1+norm(cached_array)) <= tolerance
. If this is the case for all the input names, then the cached output data shall be returned rather than re-evaluating the discipline. This tolerance could be useful to optimize CPU time. It could be something like2 * numpy.finfo(float).eps
.By default it is set to 0.0.
name (str | None) – A name for the cache. If
None
, use the class name.
- cache_jacobian(input_data, jacobian_data)[source]
Cache the input and Jacobian data.
- cache_outputs(input_data, output_data)[source]
Cache input and output data.
- clear()[source]
Clear the cache.
- Return type:
None
- property last_entry: CacheEntry
The last cache entry.
- name: str
The name of the cache.
- tolerance: float
The tolerance below which two input arrays are considered equal.