15
votes
Practical example of why it is not good to invert a matrix
Here is a quick example which is very practical related to memory usage in PDEs. When one discretizes the Laplace operator, $\Delta u$, for example, in the Heat Equation
$$ u_t = \Delta u + f(t,u) .$$...
13
votes
Accepted
Practical example of why it is not good to invert a matrix
Normally there are some principal reasons to prefer solve a linear system respect to use the inverse. Briefly:
problem with the conditional number (@GoHokies comment)
problem in the sparse case (@...
13
votes
Accepted
How to directly compute the inverse of an ill-conditioned dense matrix
Though it is a relatively rare situation when you actually have to calculate an inverse of the matrix, not all techniques were created equally.
I would use the term badly-conditioned instead of ill-...
11
votes
Accepted
Why is matrix inversion unstable when svd is stable?
The big issue is the condition number, which is defined as the ratio of the largest and smallest singular values. Suppose we expect:
$$
S = \begin{bmatrix}
10^{-15}\\
&1
\end{bmatrix}
$$
If we ...
11
votes
What algorithm(s) do numpy and scipy use to calculate matrix inverses?
Documentation to numpy.linalg.inv and scipy.linalg.inv does not mention the algorithm used.
Judging from the source, ...
11
votes
Accepted
Do I really need to invert this matrix
Since
$$
A = B(I-B)^{-1} = (I-B)^{-1}(I-B)B(I-B)^{-1} = (I-B)^{-1}B(I-B)(I-B)^{-1} =(I-B)^{-1}B
$$
So you want to solve
$$
(I-B)A=B
$$
You seem to need only the first three columns of $A$. Solve the ...
7
votes
Accepted
Fast algorithm for computing cofactor matrix
So, a cofactor matrix is a transpose of an adjugate matrix.
I know of the following paper:
G. W. Stewart, "On the adjugate matrix," Lin. Alg. Appl., vol. 283, no. 1–3, pp. 151–164, Nov. ...
6
votes
Approximately, at any given time, what proportion of the world's total HPC resources are dedicated towards inverting matrices?
The number is almost certainly unverifiable because every HPC system's overall user community is different and because there are so many systems around. I think that the number is vastly smaller than ...
6
votes
Inverting big symmetric and singular matrices
Think of your matrix as block-diagonal with blocks
$$
C_\ell = \begin{pmatrix} 0 & & \\ & D_\ell & \\ & & 0\end{pmatrix}.
$$
Then it is clear that
$$
C_\ell^{-1} = \begin{...
6
votes
Accurate way of getting the square root inverse of a positive definite symmetric matrix
As suggested in the comments, the eigendecomposition $\mathbf J = \mathbf Q \mathbf D \mathbf Q^{T}$ can be used to generate the matrix $\mathbf J^{-1/2}$, just take the eigenvectors from $\mathbf J$ (...
6
votes
Accepted
Which pseudo-inverse to compute when Inverse is not possible? (No linear solve)
Pseudoinverses typically will be computed via some truncation procedure to determine the rank, so they are not close to the original inverse. Example:
$$A = Q
\begin{bmatrix}
1\\ & 10^{-12} \\ &...
6
votes
Accepted
Computing the Inverse of a matrix, using the Cholesky decomposition
The Cholesky decomposition [the function dpotrf() in LAPACK] factors $\mathbf A = \mathbf L \mathbf L^{\mathrm T}$, or alternatively $\mathbf A^{-1} = \left(\mathbf L \mathbf L^\mathrm T \right)^{-1} =...
5
votes
approximate function such that the inverse of the approximation is "simple"
I think this is a really cool question, which might have a really cool answer, if someone was willing to think about it hard enough to publish on.
But when we're talking smooth functions which need ...
5
votes
How to Invert a Poorly Conditioned Matrix
There is no simple fix. For an ill-conditioned matrix $A$, the harm (loss of precision) is already done the moment you wrote those numbers in a numpy array, because that tiny $10^{-16}$ perturbation ...
5
votes
The fast, and The Backward-Stable (left) $3\times 3$ matrix inverse
I will try to give my thought on the first question regarding fast $3\times 3$ inverse. Consider
$$
A=\left[
\begin{array}{ccc}
a & d & g\\
b & e & h\\
c & f & i
\end{array}\...
5
votes
Accepted
The error propagation in calculating the inverse using a matrix decomposition
Irrespective of how you compute an approximate inverse $K\approx M^{-1}$, there is a limit to the (normwise) accuracy up to which $KM \approx I$ can hold: just because of the fact that $K$ and $M$ are ...
4
votes
Accepted
Is there an efficient way to compute the inverse of several symmetric matrices that share the same structure?
You don't need to compute the inverse, you just need to compute a factorization of the matrices, Cholesky factorization in this case since they are positive (semi-)definite. You can then reuse the ...
3
votes
Accepted
Inverse of ill-conditioned symmetric matrix
You don't need the inverse even with the goal of finding $K^{-1} h h^{T} K^{-1} - K^{-1}$. If you are interested to have this expression, I would explain how you can convert it to a matrix equation ...
3
votes
Inverting big symmetric and singular matrices
You might be better served by either the LDL' decomposition or the Cholesky decomposition (in the event that C's are positive definite in addition to symmetric, they probably are). Though all of the ...
2
votes
closed form approximation of matrix inverse with special properties
Unfortunately, the listed set of matrix properties does not give any hope on a closed-form of the matrix inverse or its reasonable approximation (for this specific case). It is too general, and ...
2
votes
Inverting small matrices: canned factorization versus explicit formula
Cramer's rule using a more stable determinant:
https://hal.archives-ouvertes.fr/hal-01500199/document
Implementation of the algorithm is consistently 2.5 times slower than LU factorization of matlab ...
2
votes
Accepted
optimize this python code that involves matrix inversion
Since S is SPD, you can (and should) use np.linalg.cholesky to get a cholesky factorization which will be ~2x faster than the LU ...
2
votes
What algorithm(s) do numpy and scipy use to calculate matrix inverses?
First of all, they don't take matrix inverses. They perform linear solves. Typically this is done via LU factorization.
1
vote
Accepted
MATLAB : find an algorithm to inverse quickly a large matrix of symbolic variables
The inverse of the (1,1) block of
$$
\begin{bmatrix}
A & B\\
C & D
\end{bmatrix}^{-1}
$$
is $A-BD^{-1}C$ (Schur complement). This is what you are trying to compute, if I understand correctly ...
1
vote
Inverse of ill-conditioned symmetric matrix
Based on Federico's suggestions and ideas, more straight forward formulation of extracting $K^{-1}hh^{T}K^{-1}-K^{-1}$ would be:
$$X = K^{-1}hh^{T}K^{-1}-K^{-1}$$
$$KXK = hh^{T}-K$$
$$Z = XK$$
...
1
vote
Accepted
What is the fastest method to invert millions of matrices?
I known that this is not a definitive answer, but it can give an idea how to move with CUDA. At this stage is difficult to give advice because for this is necessary a detailed know about the actually ...
1
vote
Sparse matrix inverse with reduced bandwidth
Three things immediately come to mind:
R might not take advantage of sparsity when using the solve command to compute the inverse of a matrix. Usually, the inverse ...
1
vote
closed form approximation of matrix inverse with special properties
Truncated Neumann series: let $D$ be the diagonal of your matrix, and $-N$ be the non-diagonal part. Then, $M=D-N=D(I-D^{-1}N)$, and $$M^{-1}=(I-D^{-1}N)D^{-1}=(I+D^{-1}N + D^{-1}ND^{-1}N + D^{-1}ND^{-...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
inverse × 44matrix × 28
linear-algebra × 15
numerics × 4
stability × 4
svd × 4
matlab × 3
python × 3
c++ × 3
numpy × 3
matrix-factorization × 3
sparse-matrix × 2
approximation × 2
precision × 2
accuracy × 2
condition-number × 2
r × 2
matrix-equations × 2
optimization × 1
algorithms × 1
linear-solver × 1
nonlinear-equations × 1
iterative-method × 1
eigenvalues × 1
constrained-optimization × 1