Questions tagged [matrix-inverse]

The matrix inverse, A^{-1}, is a mathematical relationship such that given a square n x n matrix A, A*A^{-1} = A^{-1}*A = I, where I is the identity matrix. Use this tag with regards to any numerical methods or computations that require the use or calculation of the matrix inverse.

Computation of the inverse of a square matrix, provided it is invertible (i.e., full-rank), is often via LU factorization. When the matrix is positive-definite, Cholesky factorization is often used. In standard numerical linear algebra library , dgesv and dpotrf respectively performs LU and Cholesky factorization.

In reality it is rare that a matrix inverse needs be explicitly formed, and matrix multiplications involving a matrix inverse is done by one of the factorizations above, and a triangular system solving.

509 questions
3
votes
2 answers

Inverting a matrix of any size

I'm using the GNU Scientific Library in implementing a calculator which needs to be able to raise matrices to powers. Unfortunately, there doesn't seem to be such a function available in the GSL for even multiplying matrices (the…
2mac
  • 1,609
  • 5
  • 20
  • 35
3
votes
1 answer

R inverting matrix with solve returning Error

I am studying R programming. I am trying to inverting matrix. Below is what I have tried. x <- matrix(1:16, 4, 4) x # [,1] [,2] [,3] [,4] # [1,] 1 5 9 13 # [2,] 2 6 10 14 # [3,] 3 7 11 15 # [4,] 4 8 12 …
Juneyoung Oh
  • 7,318
  • 16
  • 73
  • 121
3
votes
1 answer

Processing 2+ Create multiple italic text legends

I want to create a legends for a bar chart, which looks like: | | | | / / / / where | : data column, / : is a legend for each column I couldn't get the text legend right, try multiple maxtrix transformation, but none works correctly.…
vulh
  • 41
  • 3
3
votes
1 answer

numpy: Possible for zero determinant matrix to be inverted?

By definition, a square matrix that has a zero determinant should not be invertible. However, for some reason, after generating a covariance matrix, I take the inverse of it successfully, but taking the determinant of the covariance matrix ends up…
kk415kk
  • 1,227
  • 1
  • 14
  • 30
3
votes
1 answer

How to efficiently use inverse and determinant in Eigen?

In Eigen there are recommendations that warn against the explicit calculation of determinants and inverse matrices. I'm implementing the posterior predictive for the multivariate normal with a normal-inverse-wishart prior distribution. This can be…
Anne van Rossum
  • 3,091
  • 1
  • 35
  • 39
3
votes
1 answer

Armadillo complex sparse matrix inverse

I'm writing a program with Armadillo C++ (4.400.1) I have a matrix that has to be sparse and complex, and I want to calculate the inverse of such matrix. Since it is sparse it could be the pseudoinverse, but I can guarantee that the matrix has the…
Santi Peñate-Vera
  • 1,053
  • 4
  • 33
  • 68
3
votes
5 answers

What is the way to invert a triangular matrix in R?

I have an upper triangular matrix and I'd like to compute its inverse in a fast way. I tried qr.solve() but I have the feeling that it's equivalent to solve(), and that it does not exploit the triangular nature of the input matrix. What is the best…
Mark Morrisson
  • 2,543
  • 4
  • 19
  • 25
3
votes
2 answers

Accelerate the calculation of inv(X'*X)*Q*inv(X'*X) in Matlab?

I have to calculate Newey-West standard errors for large multiple regression models. The final step of this calculation is to obtain nwse = sqrt(diag(N.*inv(X'*X)*Q*inv(X'*X))); This file exchange contribution implements this as nwse =…
3
votes
2 answers

Compute matrix inverse using biogo?

I'm working on a Kalman filter implementation in Go. After reading this thread, I decided to use biogo for matrix operations. However, it appears from the documentation that biogo doesn't provide a function to calculate the inverse of a matrix.…
drautb
  • 505
  • 6
  • 12
3
votes
3 answers

iPhone matrix multiplication and inversion

I'm trying to apply a Kalman filter to the data coming out from the iPhone accelerometer. I need to perform matrix multiplication and inversion as fast as possible, so I was curious about the possibility of using the GPU to perform these two tasks.…
Rupert
  • 31
  • 1
  • 2
3
votes
2 answers

Calculate the inverse matrix of a diagonal blockwise matrix in matlab

I have a large matrix M like this M=[A1, Z, Z, Z, Z, Z ; Z, A2, Z, Z, Z, Z ; Z, Z, A3, Z, Z, Z ; Z, Z, Z, A4, Z, Z ; Z, Z, Z, Z, A5, Z ; Z, Z, Z, Z, Z, A6]; A1,A2,A3,A4,A5,A6 are 4×4 real symmetric…
f. c.
  • 1,095
  • 11
  • 26
3
votes
2 answers

Matrix inversion or Cholesky?

I am developing an algorithm which solves Ax= b, where A and b are known. There are two ways to do this x= A-1 b or using Cholesky. I know the matrix will always be square and positive definite although the det(A) maybe zero. In those rare…
user1876942
  • 1,411
  • 2
  • 20
  • 32
3
votes
2 answers

Choleski Decomposition in R to get the inverse when pivot = TRUE

I am using the choleski decomposition to compute the inverse of a matrix that is positive semidefinite. However, when my matrix becomes extremely large and has zeros in it I have that my matrix is no longer (numerically from the computers point of…
user2005253
3
votes
6 answers

PHP inverse of a matrix

I saw this question,and pop up this idea. Is there an efficient way to do this in PHP? EDIT Best with a demo?
Mask
  • 33,129
  • 48
  • 101
  • 125
3
votes
1 answer

What is the correct (stable, efficient) way to use matrix inversion in numpy?

In Matlab, using the inv() function is often discouraged due to numerical instability (see description section in http://www.mathworks.com/help/matlab/ref/inv.html). It is suggested to replace an expression like: inv(A)*B (where both A and B are…
Tomer Levinboim
  • 992
  • 12
  • 18