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

How to find the inverse of a Rectangular Matrix in C using GSL

I searched on Google and I couldn't find a function to calculate the inverse of Rectangular Matrix using GSL. Being that it was hard to find, an answer here would help others when they need to find an inverse of a rectangular matrix. If it is not…
5
votes
1 answer

How to do inverse on complex matrix in OpenCV?

I have trouble in doing inverse of a complex matrix. As far as I know, complex matrix is simply a two-channel matrix (CV_32FC2 / CV_64FC2). Let's say I have a matrix C: Mat C(2, 2, CV_64FC2); C.at(0,0)[0] = 1; C.at(0,0)[1] =…
user2223228
  • 93
  • 2
  • 5
5
votes
2 answers

Boost Library, how to get determinant from lu_factorize()?

I am trying to calculate a determinant using the boost c++ libraries. I found the code for the function InvertMatrix() which I have copied below. Every time I calculate this inverse, I want the determinant as well. I have a good idea how to…
phoganuci
  • 4,984
  • 9
  • 39
  • 50
5
votes
1 answer

How to perform matrix inverse operation using the accelerate framework?

I would like to find the inverse of a matrix. I know this involves first LU factorisation then the inversion step but I cannot find the required function by searching apple's docs of 10.7! This seems like a useful post Symmetric Matrix Inversion in…
Daniel Farrell
  • 9,316
  • 8
  • 39
  • 62
5
votes
1 answer

Issues with calculating the determinant of a matrix

I am trying to calculate the determinant of the inverse of a matrix. The inverse of the matrix exists. However, when I try to calculate the determinant of the inverse, it gives me Inf value in matlab. What is the reason behind this?
rajan sthapit
  • 4,194
  • 10
  • 42
  • 66
4
votes
2 answers

C++ invert matrix

The following dynamic array contains a non-symmetric n*n matrix (with n <=100): int **matrix; matrix = new int*[n]; for (int i = 0; i < n; i++) matrix[i] = new int[n]; Is there an extremely easy way to invert it? Ideally I'd only use something…
pockethook
  • 122
  • 1
  • 2
  • 10
4
votes
1 answer

Numpy vs Eigen vs Xtensor Linear Algebra Benchmark Oddity

I recently was trying to compare different python and C++ matrix libraries against each other for their linear algebra performance in order to see which one(s) to use in an upcoming project. While there are multiple types of linear algebra…
stillQuestioning
  • 105
  • 3
  • 10
4
votes
0 answers

Normal Equation and pinv() in Matlab/Octave

I'm studing the fundamentals of Machine Learning and, when I was reading about the use of Normal Equation in Matlab, I had a question. If the Normal Equation is: And Is the Pseudo Inverse, so: And pinv(X) compute the pseudo inverse of X. Why, in…
4
votes
2 answers

Why is cholesky decomposition not giving me the same result as simply inverting the matrix?

Setting to reproduce my Minimal Working Example I have the following matrix K <- matrix(c(1.250000e+00, 3.366892e-07, 4.641930e-10, 1.455736e-08, 1.049863e-06, 3.366892e-07, 1.250000e+00, 5.482775e-01, 8.606555e-01, 9.776887e-01, …
Euler_Salter
  • 3,271
  • 8
  • 33
  • 74
4
votes
1 answer

Calculating spinv with SVD

Background I'm working on a project involving solving large underdetermined systems of equations. My current algorithm calculates SVD (numpy.linalg.svd) of a matrix representing the given system, then uses its results to calculate the Moore-Penrose…
Rushabh Mehta
  • 1,529
  • 1
  • 13
  • 29
4
votes
1 answer

MatLab : chol Matrix must be positive definite

I am trying to fit t copula in MatLab to my data and my function is: u = ksdensity(range_1, range_1,'function','cdf'); v = ksdensity(range_2, range_2,'function','cdf'); %fit a t-copula to returns rng default ; % For reproducibility [Rho,nu] =…
mk_sch
  • 1,060
  • 4
  • 16
  • 31
4
votes
0 answers

How to efficiently calculate 160146 by 160146 matrix inverse in python?

My research is into structural dynamics and i am dealing with large symmetric sparse matrix calculation. Recently, i have to calculate the stiffness matrix (160146 by 160146) inverse with 4813762 non zero elements. I did calculate a smaller…
Paul Thomas
  • 477
  • 1
  • 7
  • 15
4
votes
1 answer

Matrix Inversion in CBLAS/LAPACK vs Python

The matrix I am trying to invert is: [ 1 0 1] A = [ 2 0 1] [-1 1 1] The true inverse is: [-1 1 0] A^-1 = [-3 2 1] [ 2 -1 0] Using Python's numpy.linalg.inv, I get the correct answer. One of my routines for matrix…
The Dude
  • 661
  • 2
  • 11
  • 20
4
votes
2 answers

OpenGL ,World to Object coordinate mapping ? (inverse matrix)

Greetings all, As seen in the image, I have an object named O (set of linestripes).Its object-coordinate system is (x',y',z'). I translate,rotate this object in my OpenGL scene using following code snippet: glPushMatrix(); glTranslatef(Oz,…
Ashika Umanga Umagiliya
  • 8,988
  • 28
  • 102
  • 185
4
votes
1 answer

Solving a large-scale linear system in Apache Spark

I am currently looking to solve a large-scale linear system, Ax=b using Spark. I have done a lot of search in order to find a solution and this link has been the only solution I have found for calculating the pseudo-inverse of A in order to inverse…
EdgeRover
  • 195
  • 1
  • 15