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
1
vote
0 answers

Matrix Inversion method/Handling 0 in the pivot element

I'm currently working on a implementing a matrix inversion method for a Matrix class in C++. One thing that isn't implemented is a check for when the pivot element is 0, meaning I will need to swap its values with those of another acceptable row. I…
1
vote
1 answer

Recover a matrix after matrix multiplication

I am given two matrices (A and B), where the second has rows with unit length. For example in R: k <- 1000 m <- 10 n <- 100 A <- matrix(rnorm(m*k), m, k) # m x k B <- matrix(rnorm(k*n), k, n) # k x n B <- B/sqrt(rowSums(B^2)) # make rows have unit…
Erik Wright
  • 135
  • 1
  • 5
1
vote
1 answer

Why is this simple Fortran matrix inversion code not returning the expected value with LAPACK?

I'm trying to use the LAPACK package to compute the inverse of a matrix. For this end, I've employed the routines sgetrf and sgetri. However, when testing the code, it doesn't return the expected values for the inverse or (from what I can understand…
1
vote
0 answers

Maximum size to inverse a matrix?

I want to inverse a 401x401 (upper triangular square) matrix in python but run into issues when the matrix size exceeds 153x153. For all sizes below this, everything works like a charm but then the product of the inverted matrix by the initial…
Jep
  • 59
  • 7
1
vote
1 answer

CUDA: Matrix inversion slower on GPU than on CPU

I have a stable, simple Gauss-Jordan algorithm for calculating the matrix inversion on the CPU. I tried to transfer this algorithm to the GPU, it works fine, but the speed has dropped significantly, about 10 times. I understand that I am not well…
1
vote
0 answers

Why does numpy not raise an error when inverting a singular matrix?

I am writing a tutorial, as part of which I wanted to show some of the issues that occur when analyzing data that has a singular covariance matrix. I came across some odd behavior in numpy. The behavior in question is this: Given a singular matrix…
Harry Matthews
  • 143
  • 1
  • 10
1
vote
1 answer

Why my matrix inverse implementation is less accurate? C++

I have a transformation matrix of type Eigen::Matrix4d. And I would like to get its inverse. I write a function my self to compute it by the following formular. . And here is my code: Eigen::Matrix4d inverseTransformation(Eigen::Matrix4d T) { …
KillerBee
  • 11
  • 3
1
vote
2 answers

How to inverse a matrix in CODESYS?

Is it possible to calculate the inverse of a matrix in CODEYS? I am trying to write the code for the following equation.
1
vote
1 answer

how to code inverse of a 3 X 3 matrix in tcl scripting?

I'm finding difficulty in coding for inverse of a 3x3 matrix in tcl. do we really need packages to code for matrix , i need clear explanation for the following parts with minimal simpler coding 1.how to create matrix ? 2.how to find…
lucky
  • 11
  • 2
1
vote
0 answers

CVXPY) Maximum diagonal entry of the inverse matrix

Currently what I am doing is: S(v) is a d-dimensional positive definite matrix determined by the d-dimensional vector v. I want to optimize the maximum diagonal entry of the inverse of S(v) subject to entrywise-sum of v equal to 1. (See…
1
vote
1 answer

Matrix inversion using Neumann Series giving funny loss function

According to (steward,1998). A matrix A which is invertible can be approximated by the formula A^{-1} = \sum^{inf}_{n=0} (I- A)^{n} I tried implementing an algorithm to approximate a simple matrix's inverse, the loss function showed funny results.…
Quad
  • 11
  • 3
1
vote
1 answer

Finding inverse of an ill-conditioned matrix

I am trying to implement a numerical method, which requires me to compute the inverse of a 6x6 matrix (A) at some point. This matrix consists of four 3x3 matrices (B1...4) A = [[B1, B2], [B3, B4]]. While the magnitude of the entries within a 3x3…
Nicdew
  • 11
  • 1
1
vote
1 answer

chol2inv(chol(x)) and solve(x)

I assumed that chol2inv(chol(x)) and solve(x) are two different methods that arrive at the same conclusion in all cases. Consider for instance a matrix S A <- matrix(rnorm(3*3), 3, 3) S <- t(A) %*% A where the following two commands will give…
yrx1702
  • 1,619
  • 15
  • 27
1
vote
1 answer

Segmentation Fault in Matrix Inverse

I am trying to calculate the inverse of a matrix but I get a segmentation fault error in my code but I am not sure where and why this occurs. This is my code: double** inverse(double *mat[], int n){ //identity matrix double **I =…
user15409086
1
vote
0 answers

WinGDI SetWorldTransform Inverse

I need an inverse transformation. I start with a CPoint(x0, y0); I do a rotation and translation so that in my new coordinate system, (x0, y0) becomes (0,0) and I draw everything in the new coordinate system (which may have other that right-angle…
flounder
  • 141
  • 6