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

Numpy Matrix inverse with float128 type

I got a matrix 'x' of float128 values and I am getting the next error when: > q = (inv(xt * x) * xt) * n > array type float128 is unsupported in linalg Where xt is transposed x and n other float128 matrix. All Other operations with that matrix…
gerosalesc
  • 2,983
  • 3
  • 27
  • 46
4
votes
5 answers

Large matrix inversion methods

Hi I've been doing some research about matrix inversion (linear algebra) and I wanted to use C++ template programming for the algorithm , what i found out is that there are number of methods like: Gauss-Jordan Elimination or LU Decomposition and I…
Ismail Marmoush
  • 13,140
  • 25
  • 80
  • 114
4
votes
1 answer

Matrix multiplication inverse rounding error in Julia

julia> A = [1 2; 3 4] 2x2 Array{Int64,2}: 1 2 3 4 julia> A * inv(A) 2x2 Array{Float64,2}: 1.0 0.0 8.88178e-16 1.0 Why is the result in the lower left corner 8.88178e-16 rather than 0.0 like in the upper right? How can I perform the…
Arthur Collé
  • 2,541
  • 5
  • 27
  • 39
4
votes
1 answer

How to invert a matrix of matrices in Matlab?

The problem is as follows: I have a set of 20 equations: r1 = s1*h1_1 + s2*h1_2 + ... s20*h1_20 r2 = s1*h2_1 + ... ... r20 = s1*h20_1 + ... where r, s and h are matrices and * symbolizes pointwise product. It can be rewritten in the matrix form…
4
votes
1 answer

Matlab: Calculating inverse of covariance matrix for time series model

is an univariate autoregressive AR model of order p = 2 and data samples N excited by u which is a Gaussian zero mean noise and variance sigma_u^2. I am aware of the function cov(x) but how do I use it to get the pxp covariance matrix C(n) and its…
SKM
  • 959
  • 2
  • 19
  • 45
4
votes
2 answers

Numpy/Scipy pinv and pinv2 behave differently

I am working with bidimensional arrays on Numpy for Extreme Learning Machines. One of my arrays, H, is random, and I want to compute its pseudoinverse. If I use scipy.linalg.pinv2 everything runs smoothly. However, if I use scipy.linalg.pinv,…
marcotama
  • 1,991
  • 2
  • 19
  • 24
4
votes
2 answers

Matrix inversion in Swift using Accelerate Framework

Following the good instructions that I found here: https://github.com/haginile/SwiftAccelerate I verified that matrix inversion works. In fact it did for the example given. But I get a EXC_BAD_ACCESS error for any other matrix (bigger than 2x2) for…
Nicholas
  • 1,915
  • 31
  • 55
4
votes
2 answers

Python, simultaneous pseudo-inversion of many 3x3, singular, symmetric, matrices

I have a 3D image with dimensions rows x cols x deps. For every voxel in the image, I have computed a 3x3 real symmetric matrix. They are stored in the array D, which therefore has shape (rows, cols, deps, 6). D stores the 6 unique elements of the…
NLi10Me
  • 3,182
  • 2
  • 13
  • 15
4
votes
1 answer

CUBLAS: Incorrect inversion for matrix with zero pivot

Since CUDA 5.5, the CUBLAS library contains routines for batched matrix factorization and inversion (cublasgetrfBatched and cublasgetriBatched respectively). Getting guide from the documentation, I wrote a test code for inversion of an N x N…
sgarizvi
  • 16,623
  • 9
  • 64
  • 98
4
votes
1 answer

Cublas Matrix LU Decomposition

I'm having some trouble with calling dgetrf in cuda. From what I've found I can only called the batched version (http://docs.nvidia.com/cuda/cublas/#cublas-lt-t-gt-getrfbatched). When I do call it, I get an error value of 7 returned, which I haven't…
David
  • 696
  • 6
  • 19
4
votes
2 answers

Calculate inverse of a non-square matrix in R

I'm pretty new to the R language and trying to find out how you can calculate the inverse of a matrix that isn't square. (non-square? irregular? I'm unsure of the correct terminology). From my book and a quick google search, (see source), I've found…
Reanimation
  • 3,151
  • 10
  • 50
  • 88
4
votes
2 answers

Speeding up some matrix arithmetic operation

I have two matrices A and B. B is just a matrix with only one of the diagonal elements non zero. All the non diagonal elements are zero as well. I have to calculate $A^{-1}B$. My $A^{-1}B$ matrix is sparse. In matlab I can do A\B. But is there any…
user34790
  • 2,020
  • 7
  • 30
  • 37
4
votes
2 answers

Linear Regression - What algorithm to use to solve least squares method - inverse or LU or ...?

I am working on algorithm to perform linear regression for one or more independent variables. that is: (if I have m real world values and in the case of two independent variables a and b) C + D*a1 + E* b1 = y1 C + D*a2 + E* b2 = y2 ... C + D*am +…
Saher Ahwal
  • 9,015
  • 32
  • 84
  • 152
4
votes
1 answer

Finding matrix inverse by Gaussian Elimination With Partial Pivoting

Hello guys I am writing program to compute determinant(this part i already did) and Inverse matrix with GEPP. Here problem arises since i have completely no idea how to inverse Matrix using GEPP, i know how to inverse using Gauss Elimination…
e0n
  • 41
  • 2
  • 3
4
votes
4 answers

Matlab inverse of large matrix

This is the equation I am trying to solve: h = (X'*X)^-1*X'*y where X is a matrix and y is a vector ((X'X)^-1 is the inverse of X-transpose times X). I have coded this in Matlab as: h = (X'*X)\X'*y which I believe is correct. The problem is that X…
Jordan
  • 3,998
  • 9
  • 45
  • 81