Thread: How to find inverse of a sparse matrix ?

  1. #1
    Registered User
    Join Date
    May 2010

    How to find inverse of a sparse matrix ?


    There are Numerical recipes (For C) functions namely ludcmp() and lubksb() to invert the matrix. I used them for a simple 3x3 matrix. I got the inverse. Then I mulitiplied that inverse with the original matrix. As expected I got the identity matrix.

    Now the same thing I tried for my 100x100 sparse matrix. I got the inverse. So to check, I multiplied this inverse by original matrix. But I did not get Identity matrix.

    Please tell efficient and correct way to invert a sparse matrix?


  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    London, United Kingdom
    Time to pick up the good ol' math book and remind yourself some matrix algebra.

    The inverse of an nxn matrix
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory Leak in AppWizard-Generated Code
    By jrohde in forum Windows Programming
    Replies: 4
    Last Post: 05-19-2010, 04:24 PM
  2. program to find the saddle point of a matrix ??
    By intermediatech in forum C Programming
    Replies: 28
    Last Post: 05-05-2010, 05:26 PM
  3. crosslist to cope with sparse matrix
    By kiss in forum C Programming
    Replies: 2
    Last Post: 12-28-2009, 11:59 PM
  4. Matrix Inverse Problem
    By chottachatri in forum C++ Programming
    Replies: 3
    Last Post: 03-10-2008, 07:02 AM
  5. Recursive algorithm to find the determinant of a matrix
    By mahesh.mach in forum C Programming
    Replies: 3
    Last Post: 06-07-2007, 09:13 AM