Invariants, inner products, and divergences¶
Condition number¶
Returns the two-norm condition number
- typename Base<F>::type ConditionNumber(const Matrix<F>& A)¶
- typename Base<F>::type ConditionNumber(const DistMatrix<F, U, V>& A)¶
Determinant¶
Though there are many different possible definitions of the determinant of a matrix \(A \in \mathbb{F}^{n \times n}\), the simplest one is in terms of the product of the eigenvalues (including multiplicity):
Since \(\mbox{det}(AB)=\mbox{det}(A)\mbox{det}(B)\), we can compute the determinant of an arbitrary matrix in \(\mathcal{O}(n^3)\) work by computing its LU decomposition (with partial pivoting), \(PA=LU\), recognizing that \(\mbox{det}(P)=\pm 1\) (the signature of the permutation), and computing
where \(\upsilon_{i,i}\) is the i’th diagonal entry of \(U\).
- F Determinant(const Matrix<F>& A)¶
- F Determinant(const DistMatrix<F>& A)¶
- F Determinant(Matrix<F>& A, bool canOverwrite=false )¶
- F Determinant(DistMatrix<F>& A, bool canOverwrite=false )¶
Returns the determinant of the (fully populated) square matrix A. Some of the variants allow for overwriting the input matrix in order to avoid forming another temporary matrix.
- type struct SafeProduct<F>¶
Represents the product of n values as \(\rho \exp(\kappa n)\), where \(|\rho| \le 1\) and \(\kappa \in \mathbb{R}\).
- F rho¶
For nonzero values, rho is the modulus and lies on the unit circle; in order to represent a value that is precisely zero, rho is set to zero.
- typename Base<F>::type kappa¶
kappa can be an arbitrary real number.
- int n¶
The number of values in the product.
- SafeProduct<F> SafeDeterminant(const Matrix<F>& A)¶
- SafeProduct<F> SafeDeterminant(const DistMatrix<F>& A)¶
- SafeProduct<F> SafeDeterminant(Matrix<F>& A, bool canOverwrite=false )¶
- SafeProduct<F> SafeDeterminant(DistMatrix<F>& A, bool canOverwrite=false )¶
Returns the determinant of the square matrix A in an expanded form which is less likely to over/under-flow.
HPDDeterminant¶
A version of the above determinant specialized for Hermitian positive-definite matrices (which will therefore have all positive eigenvalues and a positive determinant).
- typename Base<F>::type HPDDeterminant(UpperOrLower uplo, const Matrix<F>& A)¶
- typename Base<F>::type HPDDeterminant(UpperOrLower uplo, const DistMatrix<F>& A)¶
- typename Base<F>::type HPDDeterminant(UpperOrLower uplo, Matrix<F>& A, bool canOverwrite=false )¶
- typename Base<F>::type HPDDeterminant(UpperOrLower uplo, DistMatrix<F>& A, bool canOverwrite=false )¶
Returns the determinant of the (fully populated) Hermitian positive-definite matrix A. Some of the variants allow for overwriting the input matrix in order to avoid forming another temporary matrix.
- SafeProduct<F> SafeHPDDeterminant(UpperOrLower uplo, const Matrix<F>& A)¶
- SafeProduct<F> SafeHPDDeterminant(UpperOrLower uplo, const DistMatrix<F>& A)¶
- SafeProduct<F> SafeHPDDeterminant(UpperOrLower uplo, Matrix<F>& A, bool canOverwrite=false )¶
- SafeProduct<F> SafeHPDDeterminant(UpperOrLower uplo, DistMatrix<F>& A, bool canOverwrite=false )¶
Returns the determinant of the Hermitian positive-definite matrix A in an expanded form which is less likely to over/under-flow.
LogBarrier¶
Uses a careful calculation of the log of the determinant in order to return the log barrier of a Hermitian positive-definite matrix A, \(-\log(\mbox{det}(A))\).
- typename Base<F>::type LogBarrier(UpperOrLower uplo, const Matrix<F>& A)¶
- typename Base<F>::type LogBarrier(UpperOrLower uplo, const DistMatrix<F>& A)¶
- typename Base<F>::type LogBarrier(UpperOrLower uplo, Matrix<F>& A, bool canOverwrite=false )¶
- typename Base<F>::type LogBarrier(UpperOrLower uplo, DistMatrix<F>& A, bool canOverwrite=false )¶
LogDetDivergence¶
The log-det divergence of a pair of \(n \times n\) Hermitian positive-definite matrices \(A\) and \(B\) is
which can be greatly simplified using the Cholesky factors of \(A\) and \(B\). In particular, if we set \(Z = L_B^{-1} L_A\), where \(A=L_A L_A^H\) and \(B=L_B L_B^H\) are Cholesky factorizations, then
- typename Base<F>::type LogDetDivergence(UpperOrLower uplo, const Matrix<F>& A, const Matrix<F>& B)¶
- typename Base<F>::type LogDetDivergence(UpperOrLower uplo, const DistMatrix<F>& A, const DistMatrix<F>& B)¶
Norm¶
The following routines can return either \(\|A\|_1\), \(\|A\|_\infty\), \(\|A\|_F\) (the Frobenius norm), the maximum entrywise norm, \(\|A\|_2\), or \(\|A\|_*\) (the nuclear/trace norm) of fully-populated matrices.
- typename Base<F>::type Norm(const Matrix<F>& A, NormType type=FROBENIUS_NORM )¶
- typename Base<F>::type Norm(const DistMatrix<F, U, V>& A, NormType type=FROBENIUS_NORM )¶
HermitianNorm¶
Same as Norm(), but the (distributed) matrix is implicitly Hermitian with the data stored in the triangle specified by UpperOrLower. Also, while Norm() supports every type of distribution, HermitianNorm() currently only supports the standard matrix distribution.
- typename Base<F>::type HermitianNorm(UpperOrLower uplo, const Matrix<F>& A, NormType type=FROBENIUS_NORM )¶
- typename Base<F>::type HermitianNorm(UpperOrLower uplo, const DistMatrix<F>& A, NormType type=FROBENIUS_NORM )¶
SymmetricNorm¶
Same as Norm(), but the (distributed) matrix is implicitly symmetric with the data stored in the triangle specified by UpperOrLower. Also, while Norm() supports every type of distribution, SymmetricNorm() currently only supports the standard matrix distribution.
- typename Base<F>::type SymmetricNorm(UpperOrLower uplo, const Matrix<F>& A, NormType type=FROBENIUS_NORM )¶
- typename Base<F>::type SymmetricNorm(UpperOrLower uplo, const DistMatrix<F>& A, NormType type=FROBENIUS_NORM )¶
Two-norm estimates¶
Since the two-norm is extremely useful, but expensive to compute, it is useful to be able to compute rough lower and upper bounds for it. The following routines provide cheap, rough estimates. The ability to compute sharper estimates will likely be added later.
- typename Base<F>::type TwoNormLowerBound(const Matrix<F>& A)¶
- typename Base<F>::type TwoNormLowerBound(const DistMatrix<F>& A)¶
Return the tightest lower bound on \(\|A\|_2\) implied by the following inequalities:
\[\|A\|_2 \ge \|A\|_{\mathrm{max}},\]\[\|A\|_2 \ge \frac{1}{\sqrt{n}} \|A\|_{\infty},\]\[\|A\|_2 \ge \frac{1}{\sqrt{m}} \|A\|_1,\;\;\mathrm{and}\]\[\|A\|_2 \ge \frac{1}{\mathrm{min}(m,n)} \|A\|_F.\]
- typename Base<F>::type TwoNormUpperBound(const Matrix<F>& A)¶
- typename Base<F>::type TwoNormUpperBound(const DistMatrix<F>& A)¶
Return the tightest upper bound on \(\|A\|_2\) implied by the following inequalities:
\[\|A\|_2 \le \sqrt{m n} \|A\|_{\mathrm{max}},\]\[\|A\|_2 \le \sqrt{m} \|A\|_{\infty},\]\[\|A\|_2 \le \sqrt{n} \|A\|_1,\;\;\mathrm{and}\]\[\|A\|_2 \le \sqrt{ \|A\|_1 \|A\|_{\infty} }.\]
Trace¶
The two equally useful definitions of the trace of a square matrix \(A \in \mathbb{F}^{n \times n}\) are
where \(\alpha_{i,i}\) is the i’th diagonal entry of \(A\) and \(\lambda_i\) is the i’th eigenvalue (counting multiplicity) of \(A\).
Clearly the former equation is easier to compute, but the latter is an important characterization.
- F Trace(const Matrix<F>& A)¶
- F Trace(const DistMatrix<F>& A)¶
Return the trace of the square matrix A.
HilbertSchmidt¶
The Hilbert-Schmidt inner-product of two \(m \times n\) matrices \(A\) and \(B\) is \(\mbox{tr}(A^H B)\).
- F HilbertSchmidt(const Matrix<F>& A, const Matrix<F>& B)¶
- F HilbertSchmidt(const DistMatrix<F, U, V>& A, const DistMatrix<F, U, V>& B)¶