Kronecker

class probnum.linops.Kronecker(A, B)

Bases: probnum.linops.LinearOperator

Kronecker product of two linear operators.

The Kronecker product 1 \(A \otimes B\) of two linear operators \(A\) and \(B\) is given by

\[\begin{split}A \otimes B = \begin{bmatrix} A_{11} B & \dots & A_{1 m_1} B \\ \vdots & \ddots & \vdots \\ A_{n_11} B & \dots & A_{n_1 m_1} B \end{bmatrix}\end{split}\]

where \(A_{ij}v=A(v_j e_i)\), where \(e_i\) is the \(i^{\text{th}}\) unit vector. The result is a new linear operator mapping from \(\mathbb{R}^{n_1n_2}\) to \(\mathbb{R}^{m_1m_2}\). By recognizing that \((A \otimes B)\operatorname{vec}(X) = AXB^{\top}\), the Kronecker product can be understood as “translation” between matrix multiplication and (row-wise) vectorization.

Parameters
  • A (np.ndarray or LinearOperator) – The first operator.

  • B (np.ndarray or LinearOperator) – The second operator.

  • dtype (dtype) – Data type of the operator.

References

1

Van Loan, C. F., The ubiquitous Kronecker product, Journal of Computational and Applied Mathematics, 2000, 123, 85-100

See also

SymmetricKronecker

The symmetric Kronecker product of two linear operators.

Attributes Summary

H

rtype

LinearOperator

T

rtype

LinearOperator

dtype

rtype

dtype

is_square

rtype

bool

ndim

rtype

int

shape

rtype

Tuple[int, int]

Methods Summary

__call__(x[, axis])

Call self as a function.

adjoint()

rtype

LinearOperator

astype(dtype[, order, casting, subok, copy])

rtype

LinearOperator

broadcast_matmat(matmat)

rtype

Callable[[ndarray], ndarray]

broadcast_matvec(matvec)

rtype

Callable[[ndarray], ndarray]

broadcast_rmatmat(rmatmat)

rtype

Callable[[ndarray], ndarray]

broadcast_rmatvec(rmatvec)

rtype

Callable[[ndarray], ndarray]

cond([p])

Compute the condition number of the linear operator.

conj()

rtype

LinearOperator

conjugate()

rtype

LinearOperator

det()

Determinant of the linear operator.

eigvals()

Eigenvalue spectrum of the linear operator.

inv()

Inverse of the linear operator.

logabsdet()

Log absolute determinant of the linear operator.

rank()

Rank of the linear operator.

todense([cache])

Dense matrix representation of the linear operator.

trace()

Trace of the linear operator.

transpose()

Transpose this linear operator.

Attributes Documentation

H
Return type

LinearOperator

T
Return type

LinearOperator

dtype
Return type

dtype

is_square
Return type

bool

ndim
Return type

int

shape
Return type

Tuple[int, int]

Methods Documentation

__call__(x, axis=None)

Call self as a function.

Return type

ndarray

adjoint()
Return type

LinearOperator

astype(dtype, order='K', casting='unsafe', subok=True, copy=True)
Return type

LinearOperator

classmethod broadcast_matmat(matmat)
Return type

Callable[[ndarray], ndarray]

classmethod broadcast_matvec(matvec)
Return type

Callable[[ndarray], ndarray]

classmethod broadcast_rmatmat(rmatmat)
Return type

Callable[[ndarray], ndarray]

classmethod broadcast_rmatvec(rmatvec)
Return type

Callable[[ndarray], ndarray]

cond(p=None)

Compute the condition number of the linear operator.

The condition number of the linear operator with respect to the p norm. It measures how much the solution \(x\) of the linear system \(Ax=b\) changes with respect to small changes in \(b\).

Parameters

p ({None, 1, , 2, , inf, 'fro'}, optional) –

Order of the norm:

p

norm for matrices

None

2-norm, computed directly via singular value decomposition

’fro’

Frobenius norm

np.inf

max(sum(abs(x), axis=1))

1

max(sum(abs(x), axis=0))

2

2-norm (largest sing. value)

Returns

The condition number of the linear operator. May be infinite.

Return type

cond

conj()
Return type

LinearOperator

conjugate()
Return type

LinearOperator

det()

Determinant of the linear operator.

Return type

inexact

eigvals()

Eigenvalue spectrum of the linear operator.

Return type

ndarray

inv()

Inverse of the linear operator.

Return type

LinearOperator

logabsdet()

Log absolute determinant of the linear operator.

Return type

inexact

rank()

Rank of the linear operator.

Return type

int64

todense(cache=True)

Dense matrix representation of the linear operator.

This method can be computationally very costly depending on the shape of the linear operator. Use with caution.

Returns

matrix – Matrix representation of the linear operator.

Return type

np.ndarray

trace()

Trace of the linear operator.

Computes the trace of a square linear operator \(\text{tr}(A) = \sum_{i-1}^n A_ii\).

Returns

trace – Trace of the linear operator.

Return type

float

:raises LinAlgError : If trace() is called on a non-square matrix.:

transpose()

Transpose this linear operator.

Can be abbreviated self.T instead of self.transpose().

Return type

LinearOperator