def test_fun_ubnd_int(self): np.random.seed(42) X0 = np.random.normal(size=(50,3)) f0 = np.random.normal(size=(50,1)) df0 = np.random.normal(size=(50,3)) sub = ss.Subspaces() sub.compute(df=df0) sub.partition(1) avd = dom.UnboundedActiveVariableDomain(sub) avm = dom.UnboundedActiveVariableMap(avd) mu, lb, ub = asi.integrate(self.quad_fun, avm, 10)
def test_fun_bnd_int(self): data = helper.load_test_npz('test_rs_1.npz') X, f, df = data['X'], data['f'], data['df'] sub = ss.Subspaces() sub.compute(df) avd = dom.BoundedActiveVariableDomain(sub) avm = dom.BoundedActiveVariableMap(avd) np.random.seed(43) mu, lb, ub = asi.integrate(self.quad_fun, avm, 10) if self.writeData: np.savez('data/test_int_1_2',mu=mu,lb=lb,ub=ub) data_test = helper.load_test_npz('test_int_1_2.npz') np.testing.assert_almost_equal(mu, data_test['mu']) np.testing.assert_almost_equal(lb, data_test['lb']) np.testing.assert_almost_equal(ub, data_test['ub']) print '\n' print 'fun bnd: {:6.4f}, {:6.4f}, {:6.4f}'.format(lb,mu,ub)