volcapy.covariance package

Submodules

volcapy.covariance.exponential module

volcapy.covariance.exponential.compute_cov(lambda0, cells_coords, i, j)[source]

Compute the covariance between two points.

Note that, as always, sigma0 has been stripped.

Parameters
lambda0: float

Lenght-scale parameter

cells_coords: tensor

n_cells * n_dims: cells coordinates

i: int

Index of first cell (index in the cells_coords array).

j: int

Index of second cell.

Returns
Tensor

(Stripped) covariance between cell nr i and cell nr j.

volcapy.covariance.exponential.compute_cov_pushforward(lambda0, F, cells_coords, device, n_chunks=200, n_flush=50)[source]

Compute the covariance pushforward.

The covariance pushforward is just KF^T, where K is the model covariance matrix.

Note that the sigam0^2 is not included, and one has to manually add it when using the covariance pushforward computed here.

Parameters
lambda0: float

Lenght-scale parameter

F: tensor

Forward operator matrix

cells_coords: tensor

n_cells * n_dims: cells coordinates

device: toch.Device

Device to perform the computation on, CPU or GPU.

n_chunks: int

Number of chunks to split the matrix into. Default is 200. Increase if get OOM errors.

n_flush: int

Synchronize threads and flush GPU cache every n_flush iterations. This is necessary to avoid OOM errors. Default is 50.

Returns
Tensor

n_model * n_data covariance pushforward K F^t.

volcapy.covariance.matern32 module

volcapy.covariance.matern32.compute_cov(lambda0, cells_coords, i, j)[source]

Compute the covariance between two points.

Note that, as always, sigma0 has been stripped.

Parameters
lambda0: float

Lenght-scale parameter

cells_coords: tensor

n_cells * n_dims: cells coordinates

i: int

Index of first cell (index in the cells_coords array).

j: int

Index of second cell.

Returns
Tensor

(Stripped) covariance between cell nr i and cell nr j.

volcapy.covariance.matern32.compute_cov_pushforward(lambda0, F, cells_coords, device, n_chunks=200, n_flush=50)[source]

Compute the covariance pushforward.

The covariance pushforward is just KF^T, where K is the model covariance matrix.

Note that the sigam0^2 is not included, and one has to manually add it when using the covariance pushforward computed here.

Parameters
lambda0: float

Lenght-scale parameter

F: tensor

Forward operator matrix

cells_coords: tensor

n_cells * n_dims: cells coordinates

device: toch.Device

Device to perform the computation on, CPU or GPU.

n_chunks: int

Number of chunks to split the matrix into. Default is 200. Increase if get OOM errors.

n_flush: int

Synchronize threads and flush GPU cache every n_flush iterations. This is necessary to avoid OOM errors. Default is 50.

Returns
Tensor

n_model * n_data covariance pushforward K F^t.

volcapy.covariance.matern32.compute_full_cov(lambda0, cells_coords, device, n_chunks=200, n_flush=50)[source]

Compute the full covariance matrix.

Note that the sigam0^2 is not included, and one has to manually add it when using the covariance pushforward computed here.

Parameters
lambda0: float

Lenght-scale parameter

cells_coords: tensor

n_cells * n_dims: cells coordinates

device: toch.Device

Device to perform the computation on, CPU or GPU.

n_chunks: int

Number of chunks to split the matrix into. Default is 200. Increase if get OOM errors.

n_flush: int

Synchronize threads and flush GPU cache every n_flush iterations. This is necessary to avoid OOM errors. Default is 50.

Returns
Tensor

n_cells * n_cells covariance matrix.

volcapy.covariance.matern52 module

volcapy.covariance.matern52.compute_cov(lambda0, cells_coords, i, j)[source]

Compute the covariance between two points.

Note that, as always, sigma0 has been stripped.

Parameters
lambda0: float

Lenght-scale parameter

cells_coords: tensor

n_cells * n_dims: cells coordinates

i: int

Index of first cell (index in the cells_coords array).

j: int

Index of second cell.

Returns
Tensor

(Stripped) covariance between cell nr i and cell nr j.

volcapy.covariance.matern52.compute_cov_pushforward(lambda0, F, cells_coords, device, n_chunks=200, n_flush=50)[source]

Compute the covariance pushforward.

The covariance pushforward is just KF^T, where K is the model covariance matrix.

Note that the sigam0^2 is not included, and one has to manually add it when using the covariance pushforward computed here.

Parameters
lambda0: float

Lenght-scale parameter

F: tensor

Forward operator matrix

cells_coords: tensor

n_cells * n_dims: cells coordinates

device: toch.Device

Device to perform the computation on, CPU or GPU.

n_chunks: int

Number of chunks to split the matrix into. Default is 200. Increase if get OOM errors.

n_flush: int

Synchronize threads and flush GPU cache every n_flush iterations. This is necessary to avoid OOM errors. Default is 50.

Returns
Tensor

n_model * n_data covariance pushforward K F^t.

volcapy.covariance.periodic module

volcapy.covariance.periodic.compute_cov(lambda0, cells_coords, i, j)[source]

Compute the covariance between two points.

Note that, as always, sigma0 has been stripped.

Parameters
lambda0: float

Lenght-scale parameter

cells_coords: tensor

n_cells * n_dims: cells coordinates

i: int

Index of first cell (index in the cells_coords array).

j: int

Index of second cell.

Returns
Tensor

(Stripped) covariance between cell nr i and cell nr j.

volcapy.covariance.periodic.compute_full_cov(lambda0, cells_coords, device, n_chunks=200, n_flush=50)[source]

Compute the full covariance matrix.

Note that the sigam0^2 is not included, and one has to manually add it when using the covariance pushforward computed here.

Parameters
lambda0: float

Lenght-scale parameter

cells_coords: tensor

n_cells * n_dims: cells coordinates

device: toch.Device

Device to perform the computation on, CPU or GPU.

n_chunks: int

Number of chunks to split the matrix into. Default is 200. Increase if get OOM errors.

n_flush: int

Synchronize threads and flush GPU cache every n_flush iterations. This is necessary to avoid OOM errors. Default is 50.

Returns
Tensor

n_cells * n_cells covariance matrix.

volcapy.covariance.periodic.compute_full_cov_gradient(lambda0, cells_coords, device, n_chunks=200, n_flush=50)[source]

Compute the full covariance matrix.

Note that the sigam0^2 is not included, and one has to manually add it when using the covariance pushforward computed here.

Parameters
lambda0: float

Lenght-scale parameter

cells_coords: tensor

n_cells * n_dims: cells coordinates

device: toch.Device

Device to perform the computation on, CPU or GPU.

n_chunks: int

Number of chunks to split the matrix into. Default is 200. Increase if get OOM errors.

n_flush: int

Synchronize threads and flush GPU cache every n_flush iterations. This is necessary to avoid OOM errors. Default is 50.

Returns
Tensor

n_cells * n_cells covariance matrix.

volcapy.covariance.squared_exponential module

volcapy.covariance.squared_exponential.compute_cov(lambda0, cells_coords, i, j)[source]

Compute the covariance between two points.

Note that, as always, sigma0 has been stripped.

Parameters
lambda0: float

Lenght-scale parameter

cells_coords: tensor

n_cells * n_dims: cells coordinates

i: int

Index of first cell (index in the cells_coords array).

j: int

Index of second cell.

Returns
Tensor

(Stripped) covariance between cell nr i and cell nr j.

volcapy.covariance.squared_exponential.compute_cov_pushforward(lambda0, F, cells_coords, device, n_chunks=200, n_flush=50)[source]

Compute the covariance pushforward.

The covariance pushforward is just KF^T, where K is the model covariance matrix.

Note that the sigam0^2 is not included, and one has to manually add it when using the covariance pushforward computed here.

Parameters
lambda0: float

Lenght-scale parameter

F: tensor

Forward operator matrix

cells_coords: tensor

n_cells * n_dims: cells coordinates

device: toch.Device

Device to perform the computation on, CPU or GPU.

n_chunks: int

Number of chunks to split the matrix into. Default is 200. Increase if get OOM errors.

n_flush: int

Synchronize threads and flush GPU cache every n_flush iterations. This is necessary to avoid OOM errors. Default is 50.

Returns
Tensor

n_model * n_data covariance pushforward K F^t.

volcapy.covariance.squared_exponential.compute_full_cov(lambda0, cells_coords, device, n_chunks=200, n_flush=50)[source]

Compute the full covariance matrix.

Note that the sigam0^2 is not included, and one has to manually add it when using the covariance pushforward computed here.

Parameters
lambda0: float

Lenght-scale parameter

cells_coords: tensor

n_cells * n_dims: cells coordinates

device: toch.Device

Device to perform the computation on, CPU or GPU.

n_chunks: int

Number of chunks to split the matrix into. Default is 200. Increase if get OOM errors.

n_flush: int

Synchronize threads and flush GPU cache every n_flush iterations. This is necessary to avoid OOM errors. Default is 50.

Returns
Tensor

n_cells * n_cells covariance matrix.

volcapy.covariance.squared_exponential.compute_full_cov_gradient(lambda0, cells_coords, device, n_chunks=200, n_flush=50)[source]

Compute the full covariance matrix.

Note that the sigam0^2 is not included, and one has to manually add it when using the covariance pushforward computed here.

Parameters
lambda0: float

Lenght-scale parameter

cells_coords: tensor

n_cells * n_dims: cells coordinates

device: toch.Device

Device to perform the computation on, CPU or GPU.

n_chunks: int

Number of chunks to split the matrix into. Default is 200. Increase if get OOM errors.

n_flush: int

Synchronize threads and flush GPU cache every n_flush iterations. This is necessary to avoid OOM errors. Default is 50.

Returns
Tensor

n_cells * n_cells covariance matrix.

volcapy.covariance.squared_exponential.compute_full_sqeuclidean_cov(cells_coords, device, n_chunks=200, n_flush=50)[source]

Compute the full matrix of pairwise squared euclidean distances.

Parameters
cells_coords: tensor

n_cells * n_dims: cells coordinates

device: toch.Device

Device to perform the computation on, CPU or GPU.

n_chunks: int

Number of chunks to split the matrix into. Default is 200. Increase if get OOM errors.

n_flush: int

Synchronize threads and flush GPU cache every n_flush iterations. This is necessary to avoid OOM errors. Default is 50.

Returns
Tensor

n_cells * n_cells covariance matrix.

Module contents