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
2
votes
4 answers

Test for invertability using Jama.Matrix

I have a program that uses JAMA and need to test is a matrix can be inverted. I know that I can just try it and catch an exception but that seems like a bad idea (having a catch block as part of the "normal" code path seems to be bad form). A test…
BCS
  • 75,627
  • 68
  • 187
  • 294
2
votes
3 answers

Condition number of a matrix using numpy

[python 2.7 and numpy v1.11.1] I am looking at matrix condition numbers and am trying to compute the condition number for a matrix without using the function np.linalg.cond(). Based on numpy's documentation, the definition of a matrix's condition…
jeffalltogether
  • 145
  • 1
  • 1
  • 8
2
votes
0 answers

what is closure in the context of mutator and accessor functions in R?

I am trying to write 2 functions in R, one that creates a matrix and defines mutator and accessor functions (I think that's the right terms) for that matrix and its inverse, and another that operates on the type of objects defined in the first…
user3299824
  • 43
  • 1
  • 4
2
votes
1 answer

logistic regression using statsmodels error in python

I am trying to implement a logistic regression using statsmodels (I need the summary) and I get this error: LinAlgError: Singular matrix My df is numeric and correlated, I deleted the non-numeric and constant features. I tried to implement regular…
anna
  • 91
  • 3
  • 10
2
votes
1 answer

Pseudo inverse matrix calculation

I try to repeat the example of calculation of pseudo inverse matrix from lectures: I use this code from numpy import * # https://classes.soe.ucsc.edu/cmps290c/Spring04/paps/lls.pdf x = np.array([[-11, 2],[2, 3],[2, -1]]) print(x) # computing the…
V. Gai
  • 450
  • 3
  • 9
  • 30
2
votes
1 answer

Is there an efficient way to compute the 2-norm of a matrix-inverse (Matlab)?

Context: I have some theoretical a posteriori error bounds for a two-grid finite-element scheme that I am using for the solution of the buckling eigenvalue problem. However, one of the terms is prohibitively costly to compute and I wonder if I am…
Kino
  • 206
  • 2
  • 6
2
votes
1 answer

Precise matrix inversion in Q

Given an invertible matrix M over the rationals Q, the inverse matrix M^(-1) is again a matrix over Q. Are their (efficient) libraries to compute the inverse precisely? I am aware of high-performance linear algebra libraries such as BLAS/LAPACK, but…
2
votes
0 answers

VCOV error message

Date: 24/04/2017 Version details: Windows 8.1 RStudio: Version 0.99.473 R: version 3.2.0 mirt package: version 1.10 In the R package mirt (see link below) I created an one dimensional mirt model. (In R-studio and in the original R…
A.Heine
  • 21
  • 1
  • 2
2
votes
4 answers

Matrix Inverse Code(c, c++, fortran or tksolver)

I need a code to determine the inverse of an nxn matrix A using row operations. I am having a ridiculous time writing this code. Anything helps, I am a grad student and havent taken a programming class in years. Thanks.
user517851
  • 21
  • 1
  • 2
2
votes
1 answer

How to make a matrix where its elements are functions, operate with them and the result still be a function?

I'm using Fortran I'm trying to create matrices where their elements are functions. Also I'd like to operate with them and the result still be a function. So here is what I try module Greeninverse use, intrinsic :: iso_fortran_env, only: dp =>…
2
votes
1 answer

Undefined reference to LAPACK and BLAS subroutines

I'm trying to understand how BLAS and LAPACK in Fortran work and so on, so I made a code that generates a matrix and inverts it. Here's the code program test Implicit none external ZGETRF external ZGETRI integer ::M …
Daniel
  • 105
  • 1
  • 9
2
votes
1 answer

Is there any possibility to invert a symmetric banded (7 diagonals) matrix in linear time?

I need to invert a p x p symmetric banded hessian matrix H, which has 7 diagonals. p may be very high (=1000 or 10000). H^{-1} can be considered as banded, and thus, I do not need to compute the complete inverse matrix, but rather its approximation.…
0spirit0
  • 83
  • 4
2
votes
1 answer

get wrong inverse matrix from both solve() and ginv() functions

I try to calculate the inverse of a covariance matrix in R. I use both solve and ginv functions however I can not find the identity matrix properly. I am wondering why is happening. Had anyone met this problem before? How to fix it? d <-…
2
votes
1 answer

numpy: broadcasting into multiple inner products and inverses

I have arrays e, (shape q by l) f (shape n by l), and w (shape n by l), and I want to create an array M where M[s,i,j] = np.sum(w[s, :] * e[i, :] * e[j, :]), and an array F, where F[s,j] = np.sum(w[s, :] * f[s, :] * e[j, :]). Both are easy enough to…
DathosPachy
  • 742
  • 1
  • 6
  • 17
2
votes
1 answer

How to deal with non-invertible matrix in multi-polynomial regression

I have stumbled upon a problem in cross-sectional regression in R using matrix-multiplication. New to R, with limited experience in statistics, have not been able to solve this myself - so grateful for any help received. I have an regression based…
Martin.El
  • 31
  • 5