Thread: i envy anybody who debugs this!

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    19

    i envy anybody who debugs this!

    ok my program doesnt run
    it reads from a file called points.txt
    it uses subroutines from linear_algebra.h and shared.h
    and it is supposed to output 9 points into a csv file called matrix

    i attached everything you need

    if i dont call the Min_Eigen_Vector() function then it runs fine so the problem has to do with that


    please help ... i hafta submit this 2moro

    thank you

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,613
    > i hafta submit this 2moro
    Why did you wait so long to debug your program?

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    num_rows read from the file is 7
    A has 9 rows
    you access upto 2*(num_rows-1)+1 rows ==13 is more than you allocate - memory overrun
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    Registered User
    Join Date
    Nov 2006
    Posts
    19
    ur right it does look like i have a malloc problem

    but i dont understand where you get 2*(num_rows-1)+1 rows ==13 is more than you allocate

    and how do i fix it?

  5. #5
    Registered User
    Join Date
    Nov 2006
    Posts
    19
    a is 7 x 6.........where (7=n)
    A is 14 x 9.......where (14=2*n )
    At is 9 x 14
    W is 9 x 9
    and W_in1d is an array of 81

  6. #6
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    I missed something... Allocation is OK

    But still there is a problem with dimentions
    A is 14x9
    and
    At is 14x9 but should be 9x14
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  7. #7
    Registered User
    Join Date
    Nov 2006
    Posts
    19
    ok yayyyyyyyyyyyyy


    i just fixed it!
    thank you soooooooooooooooooooooooooooooooo much
    now i can get some sleep!

    this will be my last post because that was my final assingment for my first and probly my last computer class ever!

  8. #8
    ex-samurai §áßø†æ™'s Avatar
    Join Date
    Nov 2006
    Location
    England
    Posts
    18
    congrats!
    Code:
    int val=0; while(val==0) printf("\a");

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Visual C++ 6.0 Debugs my computer lol
    By RoD in forum Tech Board
    Replies: 9
    Last Post: 03-30-2003, 05:13 PM