def test_gauss_hermite_3d(self):
     if self.writeData:
         p,w = gq.gauss_hermite([3,3,4])
         np.savez('data/test_gauss_hermite_3d.npz',p=p,w=w)
         
     data = helper.load_test_npz('test_gauss_hermite_3d.npz')
     p,w = gq.gauss_hermite([3,3,4])
     np.testing.assert_almost_equal(p, data['p'])
     np.testing.assert_almost_equal(w, data['w'])
 def test_gauss_hermite_1d_int_arg(self):
     if self.writeData:
         p,w = gq.gauss_hermite(7)
         np.savez('data/test_gh1d_7pts.npz',p=p,w=w)
         
     data = helper.load_test_npz('test_gh1d_7pts.npz')
     p,w = gq.gauss_hermite(7)
     np.testing.assert_almost_equal(p, data['p'])
     np.testing.assert_almost_equal(w, data['w'])
Exemple #3
0
def av_quadrature_rule(avmap, N):
    """Get a quadrature rule on the space of active variables.

    Parameters
    ----------
    avmap : ActiveVariableMap 
        a domains.ActiveVariableMap
    N : int 
        the number of quadrature nodes in the active variables
        
    Returns
    -------
    Yp : ndarray 
        quadrature nodes on the active variables
    Yw : ndarray
        quadrature weights on the active variables

    See Also
    --------
    integrals.quadrature_rule
    """
    m, n = avmap.domain.subspaces.W1.shape

    if isinstance(avmap.domain, UnboundedActiveVariableDomain):
        NN = [int(np.floor(np.power(N, 1.0/n))) for i in range(n)]
        Yp, Yw = gq.gauss_hermite(NN)

    elif isinstance(avmap.domain, BoundedActiveVariableDomain):
        if n == 1:
            Yp, Yw = interval_quadrature_rule(avmap, N)
        else:
            Yp, Yw = zonotope_quadrature_rule(avmap, N)
    else:
        raise Exception('There is a problem with the avmap.domain.')
    return Yp, Yw
Exemple #4
0
def gauss_hermite_design(N):
    """Tensor product Gauss-Hermite quadrature points.

    Parameters
    ----------
    N : int[]
        contains the number of points per dimension in the tensor product design

    Returns
    -------
    design : ndarray
        N-by-m matrix that contains the design points
    """
    design = gauss_hermite(N)[0]
    return design
 def test_gauss_hermite_3d(self):
     p,w = gq.gauss_hermite([3,3,4])
 def test_gauss_hermite_2d(self):
     p,w = gq.gauss_hermite([3,3])
 def test_gauss_hermite_1d_int_arg(self):
     p,w = gq.gauss_hermite(7)
 def test_gauss_hermite_1d_array_arg(self):
     p,w = gq.gauss_hermite([7])
Exemple #9
0
 def test_gauss_hermite_3d(self):
     data = helper.load_test_npz('test_gauss_hermite_3d.npz')
     p,w = gq.gauss_hermite([3,3,4])
     np.testing.assert_equal(p, data['p'])
     np.testing.assert_equal(w, data['w'])
Exemple #10
0
 def test_gauss_hermite_1d_int_arg(self):
     data = helper.load_test_npz('test_gh1d_7pts.npz')
     p,w = gq.gauss_hermite(7)
     np.testing.assert_equal(p, data['p'])
     np.testing.assert_equal(w, data['w'])
 def test_gauss_hermite_3d(self):
     p, w = gq.gauss_hermite([3, 3, 4])
 def test_gauss_hermite_2d(self):
     p, w = gq.gauss_hermite([3, 3])
 def test_gauss_hermite_1d_int_arg(self):
     p, w = gq.gauss_hermite(7)
 def test_gauss_hermite_1d_array_arg(self):
     p, w = gq.gauss_hermite([7])