Package InversionTest :: Module InversionDistribution :: Class InversionCountsCache
[hide private]
[frames] | no frames]

Class InversionCountsCache

object --+
         |
        InversionCountsCache

A cache for managing stored inversion count calculations

Instance Methods [hide private]

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
cacheRawInversionCounts(cls, n, counts)
Cache a value from the cache at index n
 
clear(cls)
Clear all cached values.
list of int or None
fetchCachedRawInversionCounts(cls, n)
Fetch a value from the cache by index n, if available.
int
getCacheSize(cls)
Get the cache size
 
setCacheSize(cls, n=100)
Set the cache size
Class Variables [hide private]
  DEFAULT_CACHE_SIZE = 100
  EXACT_DISTRIBUTION_CACHE = [None, None, None, None, None, None...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

cacheRawInversionCounts(cls, n, counts)
Class Method

 

Cache a value from the cache at index n

Parameters:
  • n (int) - Index of the cache to write
  • counts (list of int) - List of counts of permutations with k inversions

clear(cls)
Class Method

 

Clear all cached values. For general use, this should be unnecessary.

fetchCachedRawInversionCounts(cls, n)
Class Method

 

Fetch a value from the cache by index n, if available.

Parameters:
  • n (int) - Index of the cache to read
Returns: list of int or None
Cached value at index n, or None if out of bounds

getCacheSize(cls)
Class Method

 

Get the cache size

Returns: int
Size of the cache

setCacheSize(cls, n=100)
Class Method

 

Set the cache size

Parameters:
  • n (int) - New size of the cache. By default, resets to DEFAULT_CACHE_SIZE

Class Variable Details [hide private]

EXACT_DISTRIBUTION_CACHE

Value:
[None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
...