3
""" Test functions for maximum entropy module.
5
Author: Ed Schofield, 2003-2005
6
Copyright: Ed Schofield, 2003-2005
10
from numpy.testing import *
11
from numpy import arange, add, array, dot, zeros, identity, log, exp, ones
13
from scipy.maxentropy.maxentropy import *
19
class test_maxentropy(ScipyTestCase):
20
"""Test whether logsumexp() function correctly handles large
23
def check_logsumexp(self, level=1):
25
desired = log(sum(exp(a)))
26
assert_almost_equal(logsumexp(a), desired)
28
# Now test with large numbers
30
desired = 1000.0 + log(2.0)
31
assert_almost_equal(logsumexp(b), desired)
35
desired = 10000.0 + log(n)
36
assert_almost_equal(logsumexp(b), desired)
38
def check_simple(self, level=1):
43
if __name__ == "__main__":