capytaine.matrices.block_toeplitz module

This modules implements block Toeplitz matrices to be used in Hierarchical Toeplitz matrices.

The module also contains several special cases such as block symmetric Toeplitz matrices and block circulant matrices. All classes inherits from the BlockMatrix class.

class capytaine.matrices.block_toeplitz.BlockCirculantMatrix(blocks, _stored_block_shapes=None, check=True)[source]

Bases: BlockToeplitzMatrix

A (2D) block circulant matrix, stored as a list of blocks. All blocks should have the same shape.

Stored in the backend as a 1×N array of arrays.

block_diagonalize()[source]

Returns a vector of matrices

matvec(other)[source]

Matrix vector product. Named as such to be used as scipy LinearOperator.

rmatvec(other)[source]

Matrix vector product. Named as such to be used as scipy LinearOperator.

class capytaine.matrices.block_toeplitz.BlockSymmetricToeplitzMatrix(blocks, _stored_block_shapes=None, check=True)[source]

Bases: BlockToeplitzMatrix

A (2D) block symmetric Toeplitz matrix, stored as a list of blocks. All blocks should have the same shape.

Stored in the backend as a 1×N array of arrays.

property circulant_super_matrix
class capytaine.matrices.block_toeplitz.BlockToeplitzMatrix(blocks, _stored_block_shapes=None, check=True)[source]

Bases: BlockMatrix

A (2D) block Toeplitz matrix, stored as a list of blocks. All blocks should have the same shape.

Stored in the backend as a 1×(2N-1) array of arrays.

property all_blocks

The matrix of matrices. For a full block matrix, all the blocks are stored in memory.

property block_shape: Tuple[int, int]

The shape of any of the blocks.

property block_shapes: Tuple[List[int], List[int]]

The shapes of the blocks composing the block matrix. Actually, they should be all the same.

property circulant_super_matrix
matvec(other)[source]

Matrix vector product. Named as such to be used as scipy LinearOperator.

rmatvec(other)[source]

Matrix vector product. Named as such to be used as scipy LinearOperator.

class capytaine.matrices.block_toeplitz.EvenBlockSymmetricCirculantMatrix(blocks, _stored_block_shapes=None, check=True)[source]

Bases: BlockCirculantMatrix, BlockSymmetricToeplitzMatrix

A block symmetric circulant matrix, with an even number of blocks.

Examples:

ABCB
BABC
CBAB
BCBA

ABCDCB
BABCDB
CBABCD
DCBABC
CDCBAB
BCDCBA

Stored in the backend as a 1×(N/2+1) array of arrays.

class capytaine.matrices.block_toeplitz.OddBlockSymmetricCirculantMatrix(blocks, _stored_block_shapes=None, check=True)[source]

Bases: BlockCirculantMatrix, BlockSymmetricToeplitzMatrix

A block symmetric circulant matrix, with an odd number of blocks.

Examples:

ABCCB
BABCC
CBABC
CCBAB
BCCBA

ABCDDCB
BABCDDB
CBABCDD
DCBABCD
DDCBABC
CDDCBAB
BCDDCBA

Stored in the backend as a 1×(N+1)/2 array of arrays.