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

matrix inversion R

I want to inverse a square symmetric positive definite matrix. I know there are two functions solve() and chol2inv() in R but their results is different. I need to know why this happen? Thank you.
Mohammad
  • 571
  • 1
  • 8
  • 24
3
votes
2 answers

solve() crashes when aimed at singular matrices

I am trying to solve a system of linear equations in the least-squares-style. Using armadillo and its solve function I want to calculate the three coefficients of a parabolic fit. vec coeffs = solve(CtC, Ctb) with CtC= 1.0e+009 * …
bogus
  • 867
  • 6
  • 14
  • 24
3
votes
3 answers

Matlab: Moore-Penrose pseudo inverse algorithm implementation

I am searching for a Matlab implementation of the Moore-Penrose algorithm computing pseudo-inverse matrix. I tried several algoithm, this one http://arxiv.org/ftp/arxiv/papers/0804/0804.4809.pdf appeared good at the first look. However, the problem…
justik
  • 4,145
  • 6
  • 32
  • 53
3
votes
2 answers

C++ library includes pseudo-inverse of a matrix?

I'm looking for a C++ library that includes pinv (pseudo inverse matrix operation in MATLAB). I tried to use Armadillo but it lacks of Multi-threaded debug DLL(/MDd), but I need that type of lib for my project . check this. I would be happy if you…
trante
  • 33,518
  • 47
  • 192
  • 272
3
votes
1 answer

Fastest method in inverse of matrix

I want to process Images with Inverse function and lot of functions. For code to run fastly can any one suggest fast method among the 3 inversion methods ? double cvInvert(const CvArr* src, CvArr* dst, int method=CV_LU) CV_LU Gaussian elimination…
nbsrujan
  • 1,179
  • 1
  • 12
  • 26
2
votes
2 answers

Calculating an inverse matrix in Matlab

I'm running an optimization algorithm that requires calculation of the inverse of a matrix. The goal of the algorithm is to eliminate negative values from the matrix A and obtain the new matrix B. Basically, I start with known square matrices B and…
2
votes
0 answers

Optimise matrix inversion in Python for impedance calculation

To get the impedance profile for a circuit, I am using its admittance (G) and capacitance (C) matrices. I am using Python to compute impedance profile at different frequencies but the issue is that I need to invert the matrix to get impedance from…
Dev
  • 21
  • 1
2
votes
1 answer

Haskell implementation of Determinant, Rank and Inverse Matrix calculation- input matrix size limitation

I'm new to Haskell. As a part of an academic course, I was requested to implement a function in Haskell that calculates the determinant, rank and inverse matrix of a given matrix. I use gaussian elimination (performing same row operations on both…
Menish
  • 21
  • 3
2
votes
2 answers

kdb matrix functions improvement

Did anyone come across using kdb’s matrix function? I found it quite slow compared to other tools. For inverse matrix function inv on a 1000 by 1000 float matrix , It took kdb+ 166,682 milliseconds for 10 executions. For matrix multiplication, it…
Polly
  • 603
  • 3
  • 13
2
votes
1 answer

Parallelise backslash matrix inversion using @distributed

I'm solving a PDE using an implicit scheme, which I can divide into two matrices at every time step, that are then connected by a boundary condition (also at every time step). I'm trying to speed up the process by using multi-processing to invert…
lhcgeneva
  • 1,981
  • 2
  • 21
  • 29
2
votes
1 answer

MSVC compiler with /arch:AVX2 /fp:fast breaks C++ matrix inversion algorithm

I have matrix inversion algorithm and a 19x19 matrix for testing. Running it in Windows Subsystem for Linux with g++ produces the correct inverted matrix. In Visual Studio 2017 on Windows it used to work as well. However after I upgraded to Visual…
ProjectPhysX
  • 4,535
  • 2
  • 14
  • 34
2
votes
1 answer

Solving linear system in Julia: Mismatch with solution found using R

I need to find a vector z such that Az = b; That is, z = inverse(A) x b. A = a 5 x 5 matrix. B = a 5 x 1 vector. I had earlier solved (correctly) for z in R. But now I am using Julia and can’t seem to get the correct answer. R code: # a 3 x 3…
2
votes
1 answer

Why inv(matrix)*matrix is not exact identity matrix in Octave?

Why inv(A)*A is not exact identity matrix? All the diagonal elements are correct but rest are not. I learnt that this is residual error, then how to deal with it? CODE: A = [1,2,0;0,5,6;7,0,9] A_inv = inv(A) A_invA = inv(A)*A OUTPUT:
2
votes
1 answer

How to use numpy functions in numba

I have to inverse my matrix. But I am getting an error. How to solve it? @njit def inv(): x = [[1,2],[9,0]] inverted = np.linalg.inv(x) return x inv() TypingError: Failed in nopython mode pipeline (step: nopython frontend) No…
2
votes
1 answer

Extend Euclid Algorithm with matrix inverse mod N

I am implementing an extended Eucilid algorithm with matrix mod N. This is my code implementation: def eea(a, b): if not isinstance(a, int) or not isinstance(b, int) or not a or not b: result = 'Error(eea): Invalid input num' else: …
余星佑
  • 71
  • 8