How to find inverse of a sparse matrix ?

This is a discussion on How to find inverse of a sparse matrix ? within the C Programming forums, part of the General Programming Boards category; Hi, There are Numerical recipes (For C) functions namely ludcmp() and lubksb() to invert the matrix. I used them for ...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    7

    How to find inverse of a sparse matrix ?

    Hi,

    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?

    Regards,
    iamc

  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    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, 05: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, 06: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, 08: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, 10:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21