- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
I want to write a 1000x1000 complex matrix "mat" in a direct access file.
When the matrix is in simple precision, my code works.
When the matrix is in double precision, my code fails, with a segmentation fault.
Attached is a very short test program which :
- initializes a complex matrix (the working precision "wp" can be made equal to "sp" (single precision) or "dp" (double precision))
- computes the length of the record rlength
- open a direct access file "mat.dat" with RECL=rlength
- writes mat in mat.dat
Something is wrong but I have no idea of what it is...
Thanks a lot if you can answer me !
Natacha
I want to write a 1000x1000 complex matrix "mat" in a direct access file.
When the matrix is in simple precision, my code works.
When the matrix is in double precision, my code fails, with a segmentation fault.
Attached is a very short test program which :
- initializes a complex matrix (the working precision "wp" can be made equal to "sp" (single precision) or "dp" (double precision))
- computes the length of the record rlength
- open a direct access file "mat.dat" with RECL=rlength
- writes mat in mat.dat
Something is wrong but I have no idea of what it is...
Thanks a lot if you can answer me !
Natacha
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're getting a stack overflow. The compiler is creating a temporary copy of the array on the stack because you wrote mat(:). Change that to just mat and it should work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot. I changed mat(:,:) to mat and it works.
Natacha
Natacha

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page