Package teamwork :: Package test :: Package math :: Module testPWL
[hide private]
[frames] | no frames]

Module testPWL

source code

Utility functions and base testing class for verifying PWL code


Author: David V. Pynadath <pynadath@isi.edu>

Classes [hide private]
  TestPWL
Base class for testing PWL code.
Functions [hide private]
KeyedVector
makeVector(keys, fillProb=0.5)
Generate a random vector, with random constant field
source code
KeyedMatrix instance
makeDynamics(keys, fillProb=0.5)
Constructs a random dynamics matrix
source code
KeyedVector
makeState(keys, fillProb=0.5)
Generate a random vector, with constant field of 1
source code
KeyedPlane
makePlane(keys, fillProb=0.5)
Generate a random hyperplane
source code
KeyedTree instance
makeTree(keys, depth=0, fillProb=0.5)
Constructs a random dynamics tree
source code
KeyedTree instance
_makeTree(keys, depth=0, fillProb=0.5)
Constructs a random dynamics tree
source code
Variables [hide private]
  EMPTY_NAMESPACE = None
  EMPTY_PREFIX = None
  StringTypes = (<type 'str'>, <type 'unicode'>)
  XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'
Function Details [hide private]

makeVector(keys, fillProb=0.5)

source code 

Generate a random vector, with random constant field

Parameters:
  • keys (Key[]) - the keys to consider using in the vector
  • fillProb (float) - the probability that each key will be present in the vector (default is 0.5)
Returns: KeyedVector

makeDynamics(keys, fillProb=0.5)

source code 

Constructs a random dynamics matrix

Parameters:
  • keys (Key[]) - the keys to consider using in the matrix and component vectors
Returns: KeyedMatrix instance

makeState(keys, fillProb=0.5)

source code 

Generate a random vector, with constant field of 1

Parameters:
  • keys (Key[]) - the keys to consider using in the vector
  • fillProb (float) - the probability that each key will be present in the vector (default is 0.5)
Returns: KeyedVector

makePlane(keys, fillProb=0.5)

source code 

Generate a random hyperplane

Parameters:
  • keys (Key[]) - the keys to consider using in the vector
  • fillProb (float) - the probability that a given key will be present in the weights vector (default is 0.5)
Returns: KeyedPlane

makeTree(keys, depth=0, fillProb=0.5)

source code 

Constructs a random dynamics tree

Parameters:
  • keys (Key[]) - the keys to consider using in the vector
  • depth (int) - the depth of the tree to return
Returns: KeyedTree instance

_makeTree(keys, depth=0, fillProb=0.5)

source code 

Constructs a random dynamics tree

Parameters:
  • keys (Key[]) - the keys to consider using in the vector
  • depth (int) - the depth of the tree to return
Returns: KeyedTree instance