matrix code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rajkumar123
    New Member
    • Oct 2006
    • 1

    matrix code

    i am looking for code to find inverse of N*N matrix .
    i will be grateful to you if you mail me code at
    <email snipped for security reasons>
    Last edited by Banfa; Jan 10 '07, 08:30 PM. Reason: Removed email address
  • dschulenburg
    New Member
    • Oct 2006
    • 40

    #2
    I could use the same one !! <email snipped for security reasons>

    Thanks

    Originally posted by rajkumar123
    i am looking for code to find inverse of N*N matrix .
    i will be grateful to you if you mail me code at
    <email snipped for security reasons>
    Last edited by Banfa; Jan 10 '07, 08:30 PM. Reason: Removed email addresses

    Comment

    • D_C
      Contributor
      • Jun 2006
      • 293

      #3
      (Wiki) Gaussian Elimination. Create a second matrix which is an NxN identity matrix (all diagonal entries are 1, everything else is 0). For example, a 3x3 identity matrix is
      Code:
      1 0 0
      0 1 0
      0 0 1
      Use Gaussian elimination to convert your NxN matrix into the identity matrix. However, for every operation you perform on your NxN matrix, also perform on the newly created identity matrix. Whatever matrix the identity matrix turns into is the inverse, assuming that your NxN matrix is invertible.

      Comment

      • ajeetbaraskar
        New Member
        • Dec 2006
        • 4

        #4
        i am looking for code in c to find inverse of N*N matrix .
        if u have it .
        i will be grateful to you if you mail me code at

        <email snipped for security reasons>
        Last edited by Banfa; Jan 10 '07, 08:31 PM. Reason: Removed email address

        Comment

        • DeMan
          Top Contributor
          • Nov 2006
          • 1799

          #5
          This problem has been addressed MANY times, so you may do well to look through earlier posts.

          D_C has provided you with a method you could implement.

          Using this method on a matrix with variable placeholders, certain properties become evident to more simply evaluate a matrix inverse. I would suggest you search some/all/different combinations of, the following terms (which may or may not have much to do with inverses - I leave that to you to work out) in google (inverse, determinant, eigenvalue, eigenvector, matrix) , which might be able to help you find a method/formula. Once you have attempted this method, post any code you have (or at least where you are having difficulties starting) and help may be forthcoming

          Comment

          • macklin01
            New Member
            • Aug 2005
            • 145

            #6
            One other thing to consider:

            If you're solving the system Ax = b, it is not necessary to find the inverse of A to solve for x. In fact, it's computationally more efficient not to.

            So, before you code anything, the first step is to make sure you're solving the right problem. If the problem is to find the actual matrix inverse, go for Gaussian elimination with partial or full pivoting, as was mentioned above. If the problem is to actually solve linear systems, look for iterative techniques, like conjugate gradient, successive overrelaxation, Jacobi, Gauss-Seidel, etc. -- Paul

            Comment

            Working...