Symmetrize¶
- class probnum.linops.Symmetrize(n, dtype=<class 'numpy.float64'>)¶
Bases:
probnum.linops.LinearOperator
Symmetrizes a vector in its matrix representation.
Given a vector x=vec(X) representing a square matrix X, this linear operator computes y=vec(1/2(X + X^T)).
- Parameters
dim (int) – Dimension of matrix X.
Attributes Summary
- rtype
- rtype
- rtype
- rtype
- rtype
Methods Summary
__call__
(x[, axis])Call self as a function.
adjoint
()- rtype
astype
(dtype[, order, casting, subok, copy])- rtype
broadcast_matmat
(matmat)broadcast_matvec
(matvec)broadcast_rmatmat
(rmatmat)broadcast_rmatvec
(rmatvec)cond
([p])Compute the condition number of the linear operator.
conj
()- rtype
- rtype
det
()Determinant of the linear operator.
eigvals
()Eigenvalue spectrum of the linear operator.
inv
()Inverse of the linear operator.
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 this linear operator.
Attributes Documentation
- H¶
- Return type
- T¶
- Return type
Methods Documentation
- adjoint()¶
- Return type
- astype(dtype, order='K', casting='unsafe', subok=True, copy=True)¶
- Return type
- 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
- conjugate()¶
- Return type
- inv()¶
Inverse of the linear operator.
- Return type
- 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
: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