Cython module: gauss_c

The functions in this module are called by the BQ object, and in most cases shouldn’t need to be called directly by user code. However, they are provided here for reference.

bayesian_quadrature.gauss_c.approx_int_K(__Pyx_memviewslice out, __Pyx_memviewslice xo, __Pyx_memviewslice Kxxo, __Pyx_memviewslice mu, __Pyx_memviewslice cov) → int

Approximates integrals of the form:

\[\int K(x^\prime, x) \mathcal{N}(x^\prime \big\vert \mu, \Sigma)\ \mathrm{d}x^\prime\]

where \(K\) is a kernel.

Parameters :

out : float64_t[::1]

\(m\) output vector

xo : float64_t[::1, :]

\(d\times n\) vector of approximation locations

Kxxo : float64_t[::1, :]

\(n\times m\) kernel matrix

mu : float64_t[::1]

\(d\) mean

cov : float64_t[::1, :]

\(d\times d\) covariance

Returns :

out : 0 on success, -1 on failure

bayesian_quadrature.gauss_c.approx_int_K1_K2(__Pyx_memviewslice out, __Pyx_memviewslice xo, __Pyx_memviewslice K1xxo, __Pyx_memviewslice K2xxo, __Pyx_memviewslice mu, __Pyx_memviewslice cov) → int

Approximates integrals of the form:

\[\int K_1(x_1, x^\prime) K_2(x^\prime, x_2) \mathcal{N}(x^\prime \big\vert \mu, \Sigma)\ \mathrm{d}x^\prime\]

where \(K_1\) and \(K_2\) are kernels.

Parameters :

out : float64_t[::1, :]

\(m_1\times m_2\) output matrix

xo : float64_t[::1, :]

\(d\times n\) vector of approximation locations

K1xxo : float64_t[::1, :]

\(m_1\times n\) matrix produced by \(K_1\)

K2xxo : float64_t[::1, :]

\(m_2\times n\) matrix produced by \(K_2\)

mu : float64_t[::1]

\(d\) mean

cov : float64_t[::1, :]

\(d\times d\) covariance

Returns :

out : 0 on success, -1 on failure

bayesian_quadrature.gauss_c.approx_int_int_K(__Pyx_memviewslice xo, __Pyx_memviewslice Kxoxo, __Pyx_memviewslice mu, __Pyx_memviewslice cov) → float64_t

Approximates integrals of the form:

\[\int \int K(x_1^\prime, x_2^\prime) \mathcal{N}(x_1^\prime \big\vert \mu, \Sigma) \mathcal{N}(x_2^\prime \big\vert \mu, \Sigma)\ \mathrm{d}x_1^\prime \ \mathrm{d}x_2^\prime\]

where \(K_1\) and \(K_2\) are kernels.

Parameters :

xo : float64_t[::1, :]

\(d\times n\) vector of approximation locations

Kxoxo : float64_t[::1, :]

\(n\times n\) kernel matrix

mu : float64_t[::1]

\(d\) mean

cov : float64_t[::1, :]

\(d\times d\) covariance

Returns :

out : value of the integral

bayesian_quadrature.gauss_c.approx_int_int_K1_K2(__Pyx_memviewslice out, __Pyx_memviewslice xo, __Pyx_memviewslice K1xoxo, __Pyx_memviewslice K2xxo, __Pyx_memviewslice mu, __Pyx_memviewslice cov) → int

Approximates integrals of the form:

\[\int \int K_1(x_2^\prime, x_1^\prime) K_2(x_1^\prime, x) \mathcal{N}(x_1^\prime \big\vert \mu, \Sigma) N(x_2^\prime \big\vert \mu, \Sigma)\ \mathrm{d}x_1^\prime \ \mathrm{d}x_2^\prime\]

where \(K_1\) and \(K_2\) are kernels.

Parameters :

out : float64_t[::1]

\(m\) output vector

xo : float64_t[::1, :]

\(d\times n\) vector of approximation locatinos

K1xoxo : float64_t[::1, :]

\(n\times n\) matrix produced by \(K_1\)

K2xxo : float64_t[::1, :]

\(m\times n\) matrix produced by \(K_2\)

mu : float64_t[::1]

\(d\) mean

cov : float64_t[::1, :]

\(d\times d\) covariance

Returns :

out : 0 on success, -1 on failure

bayesian_quadrature.gauss_c.approx_int_int_K1_K2_K1(__Pyx_memviewslice out, __Pyx_memviewslice xo, __Pyx_memviewslice K1xxo, __Pyx_memviewslice K2xoxo, __Pyx_memviewslice mu, __Pyx_memviewslice cov) → int

Computes integrals of the form:

\[\int \int K_1(x, x_1^\prime) K_2(x_1^\prime, x_2^\prime) K_1(x_2^\prime, x) N(x_1^\prime | \mu, \Sigma) N(x_2^\prime | \mu, \Sigma) \ \mathrm{d}x_1^\prime \ \mathrm{d}x_2^\prime\]

where \(K_1\) and \(K_2\) are kernels.

Parameters :

out : float64_t[::1, :]

\(m\times m\) output matrix

xo : float64_t[::1, :]

\(d\times n\) vector of approximation locations

K1xxo : float64_t[::1, 1]

\(m\times n\) matrix produced by \(K1\)

K2xoxo : float64_t[::1, 1]

\(n\times n\) matrix produced by \(K2\)

mu : float64_t[::1]

\(d\) mean

cov : float64_t[::1, :]

\(d\times d\) covariance

Returns :

out : 0 on success, -1 on failure

bayesian_quadrature.gauss_c.int_K(__Pyx_memviewslice out, __Pyx_memviewslice x, float64_t h, __Pyx_memviewslice w, __Pyx_memviewslice mu, __Pyx_memviewslice cov) → int

Computes integrals of the form:

\[\int K(x^\prime, x) \mathcal{N}(x^\prime \big\vert \mu, \Sigma)\ \mathrm{d}x^\prime\]

where \(K\) is a Gaussian kernel matrix parameterized by \(h\) and \(w\).

The result is:

\[\mathrm{out}_i = h^2 \mathcal{N}(x_i \big\vert \mu, Iw + \Sigma)\]
Parameters :

out : float64_t[::1]

\(n\) output vector

x : float64_t[::1, :]

\(d\times n\) input vector

h : float64_t

output scale kernel parameter

w : float64_t[::1]

\(d\) vector of lengthscales

mu : float64_t[::1]

\(d\) mean

cov : float64_t[::1, :]

\(d\times d\) covariance

Returns :

out : 0 on success, -1 on failure

bayesian_quadrature.gauss_c.int_K1_K2(__Pyx_memviewslice out, __Pyx_memviewslice x1, __Pyx_memviewslice x2, float64_t h1, __Pyx_memviewslice w1, float64_t h2, __Pyx_memviewslice w2, __Pyx_memviewslice mu, __Pyx_memviewslice cov) → int

Computes integrals of the form:

\[\int K_1(x_1, x^\prime) K_2(x^\prime, x_2) \mathcal{N}(x^\prime \big\vert \mu, \Sigma)\ \mathrm{d}x^\prime\]

where \(K_1\) is a Gaussian kernel matrix parameterized by \(h_1\) and \(w_1\), and \(K_2\) is a Gaussian kernel matrix parameterized by \(h_2\) and \(w_2\).

The result is:

\[\mathrm{out}_{i,j} = h_1^2 h_2^2 \mathcal{N}([x_{1,i}, x_{2,j}] \big\vert [\mu, \mu], [Iw_1 + \Sigma, \Sigma; \Sigma, Iw_2 + \Sigma])\]
Parameters :

out : float64_t[::1, :]

\(n_1\times n_2\) output matrix

x1 : float64_t[::1, :]

\(d\times n_1\) input vector

x2 : float64_t[::1, :]

\(d\times n_2\) input vector

h1 : float64_t

output scale kernel parameter for \(K_1\)

w1 : float64_t[::1]

\(d\) vector of lengthscales for \(K_1\)

h2 : float64_t

output scale kernel parameter for \(K_2\)

w2 : float64_t[::1]

\(d\) vector of lengthscales for \(K_2\)

mu : float64_t[::1]

\(d\) mean

cov : float64_t[::1, :]

\(d\times d\) covariance

Returns :

out : 0 on success, -1 on failure

bayesian_quadrature.gauss_c.int_exp_norm(float64_t c, float64_t m, float64_t S) → float64_t

Computes integrals of the form:

\[\int \exp(cx) \mathcal{N}(x \big\vert m, S)\ \mathrm{d}x = \exp\left(cm + \frac{1}{2} c^2 S\right)\]
Parameters :

c : float64_t

constant \(c\)

m : float64_t

mean parameter

S : float64_t

variance parameter

Returns :

out : value of the integral

bayesian_quadrature.gauss_c.int_int_K(int32_t d, float64_t h, __Pyx_memviewslice w, __Pyx_memviewslice mu, __Pyx_memviewslice cov) → float64_t

Computes integrals of the form:

\[\int \int K(x_1^\prime, x_2^\prime) \mathcal{N}(x_1^\prime \big\vert \mu, \Sigma) \mathcal{N}(x_2^\prime \big\vert \mu, \Sigma)\ \mathrm{d}x_1^\prime \ \mathrm{d}x_2^\prime\]

where \(K_1\) is a Gaussian kernel matrix parameterized by \(h_1\) and \(w_1\), and \(K_2\) is a Gaussian kernel matrix parameterized by \(h_2\) and \(w_2\).

The result is:

\[\mathrm{out} = h^2 \mathcal{N}(0 \big\vert 0, Iw + 2\Sigma)\]
Parameters :

d : int32_t

dimensionality of the Gaussians

h : float64_t

output scale kernel parameter

w : float64_t[::1]

\(d\) vector of lengthscales

mu : float64_t[::1]

\(d\) mean

cov : float64_t[::1, :]

\(d\times d\) covariance

Returns :

out : value of the integral

bayesian_quadrature.gauss_c.int_int_K1_K2(__Pyx_memviewslice out, __Pyx_memviewslice x, float64_t h1, __Pyx_memviewslice w1, float64_t h2, __Pyx_memviewslice w2, __Pyx_memviewslice mu, __Pyx_memviewslice cov) → int

Computes integrals of the form:

\[\int \int K_1(x_2^\prime, x_1^\prime) K_2(x_1^\prime, x) \mathcal{N}(x_1^\prime \big\vert \mu, \Sigma) N(x_2^\prime \big\vert \mu, \Sigma)\ \mathrm{d}x_1^\prime \ \mathrm{d}x_2^\prime\]

where \(K_1\) is a Gaussian kernel matrix parameterized by \(h_1\) and \(w_1\), and \(K_2\) is a Gaussian kernel matrix parameterized by \(h_2\) and \(w_2\).

The result is:

\[\mathrm{out}_i = h_1^2 h_2^2 \mathcal{N}(0 \big\vert 0, Iw_1 + 2\Sigma) \mathcal{N}(x_i \big\vert \mu, Iw_2 + \Sigma - \Sigma(Iw_1 + 2\Sigma)^{-1}\Sigma)\]
Parameters :

out : float64_t[::1]

\(n\) output vector

x : float64_t[::1, :]

\(d\times n\) input vector

h1 : float64_t

output scale kernel parameter for \(K_1\)

w1 : float64_t[::1]

\(d\) vector of lengthscales for \(K_1\)

h2 : float64_t

output scale kernel parameter for \(K_2\)

w2 : float64_t[::1]

\(d\) vector of lengthscales for \(K_2\)

mu : float64_t[::1]

\(d\) mean

cov : float64_t[::1, :]

\(d\times d\) covariance

Returns :

out : 0 on success, -1 on failure

bayesian_quadrature.gauss_c.int_int_K1_K2_K1(__Pyx_memviewslice out, __Pyx_memviewslice x, float64_t h1, __Pyx_memviewslice w1, float64_t h2, __Pyx_memviewslice w2, __Pyx_memviewslice mu, __Pyx_memviewslice cov) → int

Computes integrals of the form:

\[\int \int K_1(x, x_1^\prime) K_2(x_1^\prime, x_2^\prime) K_1(x_2^\prime, x) N(x_1^\prime | \mu, \Sigma) N(x_2^\prime | \mu, \Sigma) \ \mathrm{d}x_1^\prime \ \mathrm{d}x_2^\prime\]

where \(K_1\) is a Gaussian kernel matrix parameterized by \(h_1\) and \(w_1\), and \(K_2\) is a Gaussian kernel matrix parameterized by \(h_2\) and \(w_2\).

The result is:

\[\mathrm{out}_{i,j} = h_1^4 h_2^2 \big\vert{}\Gamma\big\vert{}^{-1} \mathcal{N}(x_i \big\vert{} \mu, Iw_1 + \Sigma) \mathcal{N}(x_j \big\vert{} \mu, Iw_1 + \Sigma) \mathcal{N}(\Gamma x_i \big\vert{} \Gamma x_j, Iw_2 + 2\Sigma - 2\Gamma\Sigma)\]

where \(\Gamma = \Sigma(Iw_1 + \Sigma)^{-1}\).

Parameters :

out : float64_t[::1, :]

\(n\times n\) output matrix

x : float64_t[::1, :]

\(d\times n\) input vector

h1 : float64_t

output scale kernel parameter for \(K_1\)

w1 : float64_t[::1]

\(d\) vector of lengthscales for \(K_1\)

h2 : float64_t

output scale kernel parameter for \(K_2\)

w2 : float64_t[::1]

\(d\) vector of lengthscales for \(K_2\)

mu : float64_t[::1]

\(d\) mean

cov : float64_t[::1, :]

\(d\times d\) covariance

Returns :

out : 0 on success, -1 on failure

bayesian_quadrature.gauss_c.mvn_logpdf(__Pyx_memviewslice x, __Pyx_memviewslice m, __Pyx_memviewslice L, float64_t logdet) → float64_t

Computes the log-PDF for a multivariate normal distribution for a single point \(x\).

\[\mathcal{N}(x \big\vert{} m, C) = -\frac{1}{2} \left(d\log(2\pi) + \log \big\vert{}C\big\vert{} + (x-m)C^{-1}(x-m)^T\right)\]
Parameters :

x : float64_t[::1]

\(d\) input location

m : float64_t[::1]

\(d\) mean parameter

L : float64_t[::1, :]

\(d\times d\) lower-triangular Cholesky factor of the covariance \(C\)

logdet : float64_t

log determinant of the covariance \(C\)

Returns :

out : log PDF evaluated at \(x\)

Previous topic

Cython module: bq_c

Next topic

Cython module: linalg_c

This Page