def update_precomputed_data( self, level ): for l in xrange( self.level+1, level+1 ): x, w = gauss_legendre_pts_wts_1D( self.num_nodal_points( l ), -1., 1. ) self.abscissa.append( x ) self.weights.append( w ) self.level = level
def quadrature_sub_sampling( num_dims, num_pts, max_order ): pts = numpy.empty( ( num_dims, num_pts ), numpy.double ) I = numpy.random.randint( 0, max_order, ( num_dims, num_pts ) ) x, w = gauss_legendre_pts_wts_1D( max_order, 0., 1. ) for dim in xrange( num_dims ): pts[dim,:] = x[I[dim,:]] return pts
def quadrature_latin_hypercube( I ): num_dims, num_pts = I.shape pts = numpy.empty( ( num_dims, num_pts ), numpy.double ) x, w = gauss_legendre_pts_wts_1D( num_pts, 0., 1. ) for dim in xrange( num_dims ): pts[dim,:] = x[I[dim,:]] return pts
def fixed_level_quadrature_latin_hypercube( I, max_order ): num_dims, num_pts = I.shape I = I % max_order I = unique_matrix_rows( I.T ).T while ( I.shape[1] != num_pts ): I = numpy.hstack( ( I, numpy.random.randint( 0, max_order, ( num_dims, num_pts - I.shape[1] ) ) ) ) I = unique_matrix_rows( I.T ).T pts = numpy.empty( ( num_dims, num_pts ), numpy.double ) x, w = gauss_legendre_pts_wts_1D( max_order, 0., 1. ) for dim in xrange( num_dims ): pts[dim,:] = x[I[dim,:]] return pts