Package parsimony :: Package datasets :: Package simulate :: Module utils
[hide private]
[frames] | no frames]

Module utils

source code

Created on Thu Sep 26 10:50:17 2013

Copyright (c) 2013-2014, CEA/DSV/I2BM/Neurospin. All rights reserved.


Author: Tommy Löfstedt

License: BSD 3-clause.

Classes [hide private]
  RandomUniform
Example...
  ConstantValue
Random-like number generator that returns a constant value.
Functions [hide private]
 
norm2(x) source code
 
bisection_method(f, low=0.0, high=1.0, maxiter=30, eps=5e-08)
Finds the value of x such that |f(x)|_2 < eps, for x > 0 and where |.|_2 is the 2-norm.
source code
Variables [hide private]
  TOLERANCE = 5e-08
  __package__ = 'parsimony.datasets.simulate'
Function Details [hide private]

bisection_method(f, low=0.0, high=1.0, maxiter=30, eps=5e-08)

source code 
Finds the value of x such that |f(x)|_2 < eps, for x > 0 and where
|.|_2 is the 2-norm.

Parameters
----------
f : The function for which a root is found. The function must be increasing
        for increasing x, and decresing for decreasing x.

low : A value for which f(low) < 0. If f(low) >= 0, a lower value, low',
        will be found such that f(low') < 0 and used instead of low.

high : A value for which f(high) > 0. If f(high) <= 0, a higher value,
        high', will be found such that f(high') < 0 and used instead of
        high.

maxiter : The maximum number of iterations.

eps : A positive value such that |f(x)|_2 < eps. Only guaranteed if
        |f(x)|_2 < eps in less than maxiter iterations.

Returns
-------
x : The value such that |f(x)|_2 < eps.