runlmc.linalg.bttb module

class runlmc.linalg.bttb.BTTB(top, sizes)[source]

Bases: runlmc.linalg.matrix.Matrix

Creates a class with a parsimonious representation of a symmetric, square block-Toeplitz matrix of Toeplitz blocks (BTTB).

The Toeplitz blocks requirement implies each block of this matrix is a Toeplitz matrix. See runlmc.linalg.toeplitz.Toeplitz for a description of how the top row of a Toeplitz matrix specifies the rest of it.

The block requirement specifies that each sub-block is further replicated in a Toeplitz manner. These matrices typically form when we have a stationary kernel applied to a multidimentional grid.

For instance, suppose we have a two dimensional grid of size \(x\times y\).

For a fixed \(x_i,x_j\), we have a one-dimensional square Toeplitz matrix of order \(y\) for pairs \((x_i, y_k),(x_j,y_m)\) and variable \(k,m\in[y]\). It is easy to see how this matrix is identical for \(x_{i+1},x_{j+1}\) if the \(x\) values are on a grid.

For higher dimensions, e.g., three, we can correspondingly construct block-Toeplitz matrices of BTTB blocks. Let’s call these third order BTTB matrices (with first order BTTB being Toeplitz). This class generalizes all BTTB orders.

Fix a \(P\)-dimensional grid of points \(U\) with points \(\{\textbf{z}_{i_1i_2\cdots i_P}\}\) where the multidimensional index \(i_1i_2\cdots i_P\) is flattened with \(P\) the fastest-changing dimension. Since we are on a grid, any point has an explicit form for fixed, positive \(\Delta_i\) and standard basis vectors \(\textbf{e}_i\):

\[\textbf{z}_{i_1i_2\cdots i_P}=\textbf{z}_{\textbf{0}}+\sum_{p=1}^P \Delta_pi_p\textbf{e}_p\]

Assuming we have grid size \(n_p\) along the \(p\)-th dimension, with \(N=\prod_pn_p\) the total grid size, we thus assume to have a stationary kernel \(k\) evaluated at distances \(k(\textbf{z}_j'-\textbf{z}_0')\) which make up element \(j\) of the parameter top, with the straightforward index-flattening conversion:

\[\textbf{z}_{j}'=\textbf{z}_{i_1i_2\cdots i_P} \big|_{i_p=j\bmod n_p'}; \;\;\;\;\;n_p'=\prod_{p'=p}^Pn_{p'}\]

We can still meaningfully define the BTTB without the context of the kernel, with top the flattened version of the nested len(sizes)-order BTTB matrix first row. In other words, we have the symmetric Toeplitz extension of \(N/n_P\) Toeplitz matrices.

For details, see Fast multiplication of a recursive block Toeplitz matrix by a vector and its application by David Lee 1986.

Parameters:
  • top – 1-dimensional numpy array, used as the underlying storage, which represents the first row \(t_{1j}\). Should be castable to a float64.
  • sizes – array of \(n_p\).
Raises:

ValueError – if top or shape aren’t of the right shape or are empty.

as_numpy()[source]
Returns:numpy matrix equivalent, as a 2D numpy.ndarray
matvec(x)[source]

Multiply a vector \(\textbf{x}\) by this matrix, \(K\), yielding \(K\textbf{x}\).

Parameters:x – a one-dimensional numpy array of the same size as this matrix
Returns:the matrix-vector product