Inverse of a large sparse matrix in Matlab

I create matrix A following an algorithm that theoretically guarantees it to be inverse negative. In other words, A is always invertible and all elements of A^-1 are negative. When A is small, I can easily calculate its inverse in Matlab. When it is large (15,000 by 15,000, for example), Matlab fails to calculate the inverse correctly. I have uploaded an example of A here on my Google Drive. I use the following line of code to calculate the inverse:inverse = sparse(A) \ speye(size(A));The inverse I get has positive elements (in the order of 10^12, which theoretically is wrong) and even A *A^-1 is far from I. It seems the miscalculations occur due to IEEE double-precision arithmetic used in Matlab. However, I am not an expert in this field and don't know how to handle this issue. I was wondering if someone could help me with finding a package/tool that could do the calculation correctly for me.

Background: Let Ξ© be the state space of an absorbing Markov chain with Ξ©a being the set of absorbing states, and its complement Ξ©t, being the set of transient states. The element ij of the matrix A that I have is the transition rate between states i and j, where both i and j belong to Ξ©t. The element ij of the matrix B = -A^{-1} is the expected time the system spends in transient state j before absorption, given it started from the transient state i. I need to calculate the inverse, because I need the expected time spent in some specific transient states before absorption, given the system started from some other specific transient states.

πŸ‘︎ 10
πŸ’¬︎
πŸ‘€︎ u/asaval
πŸ“…︎ Jul 09 2019
🚨︎ report
[Question] Inverse of a matrix using backsubstitution

I am trying to calculate the inverse of an upper triangular matrix (R from a QR decomposition) using back substitution and equating U = I. U being an upper triangular matrix, X being the matrix I want, and I being an identity matrix.

I am programming in R and have everything set up. Right now, all that is left is programming a back substitution function in order to get the inverse of a triangular matrix, as we cannot use the R Base function.

However, all programming examples I have found online only use vectors as the outcome. My matrix algebra is not super sharp, so I am having trouble translating these examples to my problem.

Here is one implementation in Fortran that I have managed to translate to R (see below). Now, this code obviously doesn't work if b is a matrix (and x, consequently also a matrix)

# b = outcome matrix (in this case an identity matrix)
# A = the input matrix
# x = A'

# Solve last element
x[n, n] <- b[n, n] / A[n, n]
    
# Do backward substitution
for (i in (n - 1):1) {
    sum = b[i]
    for (j in (i + 1):n) {
        sum <- sum - (A[i, j] %*% x[j])
    }
    x[i] <- sum / A[i, i]
}

return (A %*% x)
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/Morpheyz
πŸ“…︎ Mar 19 2020
🚨︎ report
[Linear Algebra] Change of Basis. If I want to go from Basis B (a 2x2) to Standard coordinates. Do I set up my matrix as [B|Identity] ? Isn't that just inverse though?
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/EpicPwn_343
πŸ“…︎ Dec 14 2019
🚨︎ report
Hi, in this video I will explain what is the Inverse of a Matrix and how to calculate the Inverse of a Matrix. I hope it will help! youtu.be/rUA_dWaN3sk
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/PaoLa2508
πŸ“…︎ Feb 13 2020
🚨︎ report
Does swapping columns of a matrix cause the rows of the inverse matrix to be swapped? twitter.com/fermatslibrar…
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/creinaldo
πŸ“…︎ Nov 15 2018
🚨︎ report
[Matrix Algebra] Vector rows of a matrix are perpendicular. The inverse of this matrix has scalar coefficients. Find the scalars. Full text and work in comments.

This is the full text of the problem.

This is what I have.

I know the answer is 17, but I have -17. Am I on the right track?

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/NumberMuncher
πŸ“…︎ Feb 01 2016
🚨︎ report
Inverse of matrix in modulo 2

Is it possible to prove a matrix is invertible when in modulo 2?

πŸ‘︎ 7
πŸ’¬︎
πŸ‘€︎ u/OneAstronautMilk
πŸ“…︎ Mar 29 2019
🚨︎ report
How to obtain the right inverse given a matrix equation Ax=y

https://hbfs.wordpress.com/2017/01/17/choosing-the-right-pseudoinverse/

I saw the answer here but I don't understand why you can pre-multiply right hand side with A transpose but not do the same on the left hand side (for wide matrix, as explained in the link)

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/zimmer550king
πŸ“…︎ Jan 18 2020
🚨︎ report
My first library! a generic matrix library with multiplication, inverses, and more!

You can find it here.

I would love any feedback you have as well! I'm curious where to go in order to increase the speed and performance, so if you have any ideas on that please share!

πŸ‘︎ 16
πŸ’¬︎
πŸ‘€︎ u/maoiljong
πŸ“…︎ May 27 2018
🚨︎ report
[First Year Uni ] Linear Algebra - Inverse of An Elemntary Matrix

Q:

https://gyazo.com/8a8feea31fd86f7973ae6ea27b5b417d

Given Elementary Matrix x Matrix = Matrix.

In this situation, I've been thaught that here is a short cut to find the inverse of an elemntary matrix. If you perform a multiplication operaito on a row, you can find the inverse by converting the elemntary matrix into an identity matrix and perorm a division on the row of the identity matrix. Not sure what it's called. But in this case, I already found the elemntary matrix, shouldn't the inverse be the identity matrix? I don't want to solve this by the 'ad-bc' formula.

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/badboyzpwns
πŸ“…︎ Oct 01 2018
🚨︎ report
[University Linear Algebra] Solving for a matrix using the inverse matrices.

Given an equation

AX^tr = 5B

where A, X, and B, are invertible matrices, find an expression for X.

the first step, according to the solution, is to say X^tr = A^(-1)5B.

Why can't I say X^tr = 5BA^-1 ?

I guess more generally, why does

AX = B imply A=X^(-1)B and not A=BX^(-1) ?

I know AB != BA when it comes to matrices.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/hoes_and_tricks
πŸ“…︎ Jan 03 2017
🚨︎ report
[Linear Algebra] Finding column of inverse matrix

Let A=

4 -2 3

8 -3 5

7 -2 4

Find the 2nd column of A^-1 without finding the entire A^-1

I know how to find the inverse by attaching the identity matrix to A and completing row operations until I get the Identity matrix on the left side but Im not sure how to find just the 2nd column of A^-1

Any Insight would be appreciated. Ive tried a couple things but can never seem to get the right answer.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/Kierchon
πŸ“…︎ May 08 2016
🚨︎ report
Wrong matrix inverse calculation - did i do something wrong?

Hello! I have a trouble with MINVERSE function. Excel calculated inverse matrix, but it's wrong: Inverse matrix * Original one does not result in E. At a loss, what to do. Could anyone explain, if i did something wrong? https://imgur.com/tDta9Qs

πŸ‘︎ 12
πŸ’¬︎
πŸ‘€︎ u/andrewwewwka
πŸ“…︎ Aug 11 2019
🚨︎ report
Why do we often assume that the inverse covariance matrix is sparse when we try to estimate it?

I'm reading about the graphical lasso and one the interpretations of this method is to assume a sparse prior on the inverse covariance (precision) matrix, i.e. that the distribution of the inverse covariance is Laplace which has a high probability around zero. I'm wondering if this is a reasonable assumption or if it's just something to make our life a lot easier.

Thanks

πŸ‘︎ 12
πŸ’¬︎
πŸ‘€︎ u/eardzz
πŸ“…︎ Jun 19 2019
🚨︎ report
Tutorial: How to implement Inverse Kinematics (Jacobian Matrix) epiphany.pub/@shi-yan/inv…
πŸ‘︎ 10
πŸ’¬︎
πŸ‘€︎ u/adeeplearner
πŸ“…︎ Oct 24 2019
🚨︎ report
I need to do matrix inversion of a 200x200 matrix using gauss joradan method in CUDA. How do i make sure the result i get is correct?

I'm new to CUDA and want to implement matrix inversion in CUDA for large matrices. I do not know how to verify the results. Can anyone please guide me how to go about this?

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/redditgampa
πŸ“…︎ Jul 19 2019
🚨︎ report
Moder control systems: inverse matrix method? Whats the next step to get x1 and x2 to get the transfer equation.
πŸ‘︎ 13
πŸ’¬︎
πŸ‘€︎ u/Dune_17_97
πŸ“…︎ Feb 25 2019
🚨︎ report
[D] Inverse Projective Transformation - Single matrix transformation

Hi all,

I want to do inverse projective transformation of each pixel from one image to another, given the intrinsics of both matrix, the relative projection matrix P (R, T) and the depth values of each pixel in image 1.

The ask is that I have to create a single projective transformation matrix for all pixels. i.e.

x' = Hx, where x' = [u', v', d'] and x = [u, v, d]

Generally the transformation takes place as:

x'' = [u, v, 1]

x''' = D * K^-1 * x', where K is intrinsic matrix, and D is the depth vector of all pixels.

X''' = Px'''

x''' = x''' / x'''[2], divides by depth

x'''' = K * x''', this denotes final step.

Now doing this using single matrix would involve removing the operations involving multiplication by D and divide by D.

So one way is as below: (Note here d is inverse depth (not depth, not disparity))

https://preview.redd.it/f17j2gkh8qo41.png?width=596&format=png&auto=webp&s=03f7ed725760830c11326410eec7319652d2f862

Can I do this task in some other way using depth instead of inverse depth ?

Would really appreciate any help. [Studying perspective geometry] Thanks !!

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/WillingCucumber
πŸ“…︎ Mar 25 2020
🚨︎ report
Analogy for matrix multiplication and inverse

I am just curious looking for real examples(which can be very basic) that are analogous to matrix multiplication and matrix inverse.

Your answers mean a lot to me.Thanks in Advance <3

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Saisree311
πŸ“…︎ Mar 23 2019
🚨︎ report
[Linear Algebra] Solving y = mx + b via matrix inverse

I want to find the least squares solution to the matrix equation y = mx + b via an inverse / pseudo-inverse approach. In my case, I have the inputs x and outputs y, so I want to find the coefficient m and constant b. This in in an over-determined situation.

There's a million articles that talk about this (such as here: https://courses.lumenlearning.com/ivytech-collegealgebra/chapter/solving-a-system-of-linear-equations-using-the-inverse-of-a-matrix/) but they never seem to include the constant. I.e, its always just y = mx. How do I recover both the weights m and constant b?

Thanks...I'm sure its probably something stupid.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/QuasiEvil
πŸ“…︎ Jan 29 2019
🚨︎ report
Aruco marker's Rvec and Tvec, convert to rotation matrix, then inverse the transformation matrix, somewhere along the way I got lost

I'm trying to find the camera's position from an aruco marker.

(https://i.stack.imgur.com/3FyQ4.png) is what the camera sees, and (https://i.stack.imgur.com/068VO.png) is also what the camera sees. The Z-axis of the marker flips back and forth. I only captured Rvec and Tvec for one of the above situations.

A. These are what Aruco returned:

rotation vector Rvec: [1.98895, 1.67426, -0.570106] translation vector Tvec: [0.00876591, 0.100794, 0.630018]

B. This is rotation matrix R, converted from Rvec:

0.16674686138210792, 0.9859319291786623, -0.011563530830037305, 0.7881094090430687, -0.14031913821875497, 0.5993280394135843, -0.5925192347907373, -0.09082274206159546, -0.8004200059515079

C. This is the inverse transformation matrix [R|t]^-1, the R part is the rotation matrix R above, the T part is the Tvec mentioned above:

0.5532041267642692, 2.62162273212768, 1.9549923883934333, -1.5007735737997756, 0.9146872306386324, -0.46552676124283743, -0.36178537886158296, 0.2668355392503998, -0.513303622140676, -1.8878607068233544, -2.6554961620678954, 1.8677949864716032, 0, 0, 0, 1

And the final result is incorrect. The final result looks like: i.stack.imgur.com/RPDoo.png The dummyeye(or eye1) is the camera, it's way off. eye3 and eye4 are in the correct position.

So I was wondering what's wrong. Is Aruco lib giving noise? Or is the rotation matrix in B calculated wrong? Or is the inverse wrong?

Thanks!

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/neowww
πŸ“…︎ Sep 17 2017
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.