|
Boost : |
From: John Barnard (barnard_at_[hidden])
Date: 2000-12-11 12:12:11
This is getting embarrassing. I forgot the Python script:
import grid
class testPI(grid.LogPI):
def __init__(self, mu = 0.0, sigma=1.0):
self.mu = mu
self.sigma = sigma
def logP(self, x):
mu = self.mu
sigma = self.sigma
if(x>0):
return -0.5*(x-mu)*(x-mu)/(sigma*sigma)
else:
return -0.5*(x+mu)*(x+mu)/(sigma*sigma)
if __name__ == '__main__':
import grid
gen = grid.CRobLib(10)
lnorm = testPI(3,1)
sg = grid.StochasticGrid(lnorm, -10, 10, 20)
for i in xrange(0,100):
print sg.draw(gen)
where grid is the Python module containing the wrapped C++ classes.
-- John Barnard Assistant Professor Department of Statistics Harvard University Phone: (617) 495-1603 Fax: (617) 496-8057 Email: barnard_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk