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
2
votes
1 answer

Error inverting matrix in Ruby

I have the following matrix: [ [ 16.0, 23251143833701.0, 3.3788480598465756e+25, 4.9101301394821435e+37 ], [ 23251143833701.0, 3.3788480598465756e+25, 4.9101301394821435e+37, 7.135383882205603e+49 ], [ …
Truncarlos
  • 175
  • 2
  • 7
2
votes
2 answers

Calculate the inverse of a matrix : system is computationally singular [error]

I have a matrix m : (m <- matrix(c(26,14,24,14,20,42,24,42,90), 3)) # [,1] [,2] [,3] # [1,] 26 14 24 # [2,] 14 20 42 # [3,] 24 42 90 When i run solve(m) to calculate the inverse of the matrix, i get this error message…
Bilal
  • 2,883
  • 5
  • 37
  • 60
2
votes
0 answers

Inverting small matrix

I have a piece of code in Fortran 90 in which I have to solve both a non-linear (for which I have to invert the Jacobian matrix) and a linear system of equations. When I say small I mean n unknowns for both operations, with n<=4. Unfortunately, n is…
user2078621
  • 111
  • 3
  • 12
2
votes
1 answer

Pseudo inverse (SVD) of a singular complex square matrix in C/C++

Singular complex matrix is 2n x 2n where n is 3; 4 or 5. How to calculate Singular Value Decomposition in C/C++? Input matrix R is in the form Y*Y' where ()' is transjugate. Eigenvectors in U are the main output. Consider following Matlab…
renonsz
  • 571
  • 1
  • 4
  • 17
2
votes
1 answer

Efficiently Setting up Sparse Matrices in MATLAB for Matrix Inversion

Consider the following weighted solution to the normal equation for a least squares inverse problem: m = inv(G'*W'*W*G)*G'*W'*W*d I would like to set up the weighting matrix W, which is a square diagonal matrix with weights on the diagonal. As I…
TheodorBecker
  • 249
  • 1
  • 17
2
votes
3 answers

Whether to use Caffe or Theano for Moore-Penrose Pseudo inverse?

I need to use(in an application) Extreme Learning Machine(ELM) which is highly optimised for multiple CPUs or GPUs. As ELM main computation involves Moore-Penrose Pseudo inverse and matrix multiplication, what would be the best option to implement…
user3733814
  • 105
  • 1
  • 10
2
votes
1 answer

calculate minus power of given matrix in matlab

suppose that we have following formulas let say we have some matrix A=rand(3,3) A = 0.3922 0.7060 0.0462 0.6555 0.0318 0.0971 0.1712 0.2769 0.8235 i have calculate eigenvalue decomposition [V,D]=eig(A) V = …
user466534
2
votes
1 answer

Error in the matrix Inverse

I have a estimate of covariance matrix I want to take the inverse of this matrix, R gives me the following error A=[ 3529861.470 8785861.47 6920.344 17120.34; 8785861.470 26209861.47 17120.344 51920.34; 6920.344 17120.34 14.000 …
Spandyie
  • 914
  • 2
  • 11
  • 23
2
votes
1 answer

Fast inversion of a large number of small matrices

I have an NxN array of 2x2 matrices, and I need to invert each of them. Using Matlab (or user defined functions), is there a way to do this faster than just looping through each one and inverting it? I can assume that they are all invertable and…
5o3x
  • 41
  • 5
2
votes
2 answers

Most Efficient Way of Using mexCallMATLAB in Converting Double* to mxArray*

I am writing a MEX code in which I need to use pinv function. I am trying to find a way to pass the array of type double to pinv using mexCallMATLAB in the most efficient way. Let's for the sake of example say the array is named G and its size is…
afp_2008
  • 1,940
  • 1
  • 19
  • 46
2
votes
1 answer

Comparing matrix inversions in R - what is wrong with the Cholesky method?

I compared various methods to compute the inverse of a symmetric matrix: solve (from the package LAPCK) solve (but using a higher machine precision) qr.solve (said to be faster) ginv (MASS package, implementation of the Moore-Penrose algo) chol2inv…
Xavier Prudent
  • 1,570
  • 3
  • 25
  • 54
2
votes
1 answer

Checking which rows switched given an original and an altered matrix in Matlab

I've been trying to wrap my head around this for awhile and was hoping to get some insight. Suppose you have matrix A, then you switched rows until you ended up with matrix B; A = [1 3 1; 3 2 1; 2 3 1;]; B = [3 2 1; 1 3 1; 2 3 1;]; invA = …
2
votes
2 answers

Kalman filter innovation residual inversion

I'm trying to implement a Kalman filter in a computationally efficient way. The main issue is the inversion of the innovation residual: S=HPH^t+R K=PH^t*inv(S) My question is, can one assume that the S matrix in positive definite? This would…
staple
  • 125
  • 3
2
votes
0 answers

What's wrong with my perspective transform coefficient function (Python)?

Original Question So I've been reading up alot on how to do a Perspective transform on an image in pure Python but I can't get it to work. The transform itself is pretty simple, it's just a small equation, but I'm having trouble with the function…
Karim Bahgat
  • 2,781
  • 3
  • 21
  • 27
2
votes
1 answer

Eigen is Failing to Give Correct Matrix Inverse (c++)

I'm using Eigen (the free linear algebra package for use with c++) and trying to invert a small matrix. After following the official Eigen documentation, I get the following: #include using namespace std; #include #include…
user3358834
  • 31
  • 1
  • 2