# Data-Sparse LinearOperators

## BlockDiagLinearOperator

class linear_operator.operators.BlockDiagLinearOperator(base_linear_op: LinearOperator, block_dim=-3)[source]

Represents a lazy tensor that is the block diagonal of square matrices. The block_dim attribute specifies which dimension of the base LinearOperator specifies the blocks. For example, (with block_dim=-3 a k x n x n tensor represents k n x n blocks (a kn x kn matrix). A b x k x n x n tensor represents k b x n x n blocks (a b x kn x kn batch matrix).

Args:
base_linear_op (LinearOperator or Tensor):

Must be at least 3 dimensional.

block_dim (int):

The dimension that specifies the blocks.

## CholLinearOperator

class linear_operator.operators.CholLinearOperator(chol, upper=False)[source]

A LinearOperator that represents a positive definite matrix given a lower trinagular Cholesky factor $$\mathbf L$$ (or upper triangular Cholesky factor $$\mathbf R$$).

Parameters:
• chol (TriangularLinearOperator) – The Cholesky factor $$\mathbf L$$ (or $$\mathbf R$$).

• upper (bool) – If the orientation of the cholesky factor is an upper triangular matrix (i.e. $$\mathbf R^\top \mathbf R$$). If false, then the orientation is assumed to be a lower triangular matrix (i.e. $$\mathbf L \mathbf L^\top$$).

inverse()[source]

Returns the inverse of the CholLinearOperator.

Return type:

CholLinearOperator

## ConstantDiagLinearOperator

class linear_operator.operators.ConstantDiagLinearOperator(diag_values, diag_shape)[source]

Diagonal lazy tensor with constant entries. Supports arbitrary batch sizes. Used e.g. for adding jitter to matrices.

Parameters:
• diag_values (torch.Tensor) – A … 1 Tensor, representing a of (batch of) diag_shape x diag_shape diagonal matrix.

• diag_shape (int) – The (non-batch) dimension of the (square) matrix

abs()[source]

Returns a DiagLinearOperator with the absolute value of all diagonal entries.

Return type:

ConstantDiagLinearOperator

exp()[source]

Returns a DiagLinearOperator with all diagonal entries exponentiated.

Return type:

ConstantDiagLinearOperator

inverse()[source]

Returns the inverse of the DiagLinearOperator.

Return type:

ConstantDiagLinearOperator

log()[source]

Returns a DiagLinearOperator with the log of all diagonal entries.

Return type:

ConstantDiagLinearOperator

sqrt()[source]

Returns a DiagLinearOperator with the square root of all diagonal entries.

Return type:

ConstantDiagLinearOperator

## DiagLinearOperator

class linear_operator.operators.DiagLinearOperator(diag)[source]

Diagonal linear operator. Supports arbitrary batch sizes.

Parameters:

diag (torch.Tensor) – A … x N tensor, representing a (batch of) N x N diagonal matrices.

abs()[source]

Returns a DiagLinearOperator with the absolute value of all diagonal entries.

Return type:

DiagLinearOperator

exp()[source]

Returns a DiagLinearOperator with all diagonal entries exponentiated.

Return type:

DiagLinearOperator

inverse()[source]

Returns the inverse of the DiagLinearOperator.

Return type:

DiagLinearOperator

log()[source]

Returns a DiagLinearOperator with the log of all diagonal entries.

Return type:

DiagLinearOperator

sqrt()[source]

Returns a DiagLinearOperator with the square root of all diagonal entries.

Return type:

DiagLinearOperator

## IdentityLinearOperator

class linear_operator.operators.IdentityLinearOperator(diag_shape, batch_shape=torch.Size([]), dtype=None, device=None)[source]

Identity linear operator. Supports arbitrary batch sizes.

Parameters:
• diag_shape (int) – The size of the identity matrix (i.e. $$N$$).

• batch_shape (torch.Size, optional) – The size of the batch dimensions. It may useful to set these dimensions for broadcasting.

• dtype (torch.dtype, optional) – Dtype that the LinearOperator will be operating on. (Default: torch.get_default_dtype()).

• device (torch.device, optional) – Device that the LinearOperator will be operating on. (Default: CPU).

## RootLinearOperator

class linear_operator.operators.RootLinearOperator(root)[source]

## ToeplitzLinearOperator

class linear_operator.operators.ToeplitzLinearOperator(column)[source]

## ZeroLinearOperator

class linear_operator.operators.ZeroLinearOperator(*sizes, dtype=None, device=None)[source]

Special LinearOperator representing zero.

Parameters:
• sizes ((int, ...)) – The size of each dimension (including batch dimensions).

• dtype (torch.dtype, optional) – Dtype that the LinearOperator will be operating on. (Default: torch.get_default_dtype()).

• device (torch.device, optional) – Device that the LinearOperator will be operating on. (Default: CPU).