Thread: determinant?! HELP!!!

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    1

    determinant?! HELP!!!

    hey guys, i am having trouble writing a program to compute the determinant of a matrix. i need to write a function that'll find the determinant of matrix if reading from a file. the file has 6 matrices, each one no more than a 10x10 matrix. for each set of data, m, n, and its matrix is followed. for example, the file might contain:

    5 5

    1.0 3.4 5.3 5.4 1.8
    2.3 0.1 9.6 3.6 2.6
    3.4 5.3 1.3 4.2 1.1
    1.2 1.3 4.3 4.4 5.4
    8.8 7.9 8.3 5.9 6.2

    so this means its a 2x2 matrix: [1.0, 3.4, 5.3, 5.4, 1.8; 2.3, 0.1, 9.6, 3.6, 2.6; 3.4, 5.3, 1.3, 4.2, 1.1; 1.2, 1.3, 4.3, 4.4, 5.4; 8.8, 7.9 8.3, 5.9, 6.2] with m=5, and n=5.

    how would i get my program to understand that the first line is only the dimension of the matrix, and the lines below it are the matrix? im thinking of using a recursive function...
    thanks!!!

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Put some thought into it. It's not hard.
    Code:
    while not all done
        read size into y and x
        for yc = 0; yc < y; yc++
            for xc = 0; xc < x; xc++
                read into matrix[yc][xc]
    Wheeeeee.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fast Determinant evaluator
    By jack_carver in forum C Programming
    Replies: 2
    Last Post: 12-28-2009, 08:42 PM
  2. matrix determinant
    By roaan in forum C Programming
    Replies: 1
    Last Post: 06-30-2009, 12:44 PM
  3. Determinant Prob
    By dantu1985 in forum C Programming
    Replies: 2
    Last Post: 08-19-2007, 12:00 AM
  4. 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
  5. determinant
    By the Wookie in forum C++ Programming
    Replies: 3
    Last Post: 07-08-2003, 09:30 AM