Shot in the dark: Anyone ever use CLAPACK routines?

Kevin D. Clark kevin_d_clark at comcast.net
Sat May 22 22:13:10 EDT 2010


Bruce Labitt writes:

> Well, I have something to try...  If one actually RTFM or in this case 
> the readme, one finds the following:
> 
> # As a final point, we must stress that there is a difference in the definition
> # of a two-dimensional array in Fortran and C.

The difference that you cite here -- the difference between
column-major order versus row-major order -- is sort-of a well-known
difference between C and Fortran.  


[...]
> # Instead, you must use a one-dimensional C array of size LDA X N
> # double-words (or else malloc the same amount of space).
> # We recommend using the following code to get the array CLAPACK will be 
> # expecting:
> #
> #    double *A;
> #    A = malloc( LDA*N*sizeof(double) );
> 
> Umm, yeah, I can do that!  My original code had that...  For some reason I got rid of it.
> So a SEG FAULT makes some sense for my 9x9.  Because in C the array (matrix) does not have 
> to be contiguous in memory.  But FORTRAN is assuming a column major contiguous array.  So it
> seems likely I could access unallocated memory, and hence a seg fault.  

In my opinion, you would do very well to start with a *known working
example* from whatever matrix library you are working
with...paying special attention to the memory allocation parts....and
then try to transmogrify this into whatever you are trying to do with
this program.

--kevin
-- 
alumni.unh.edu!kdc / http://kdc-blog.blogspot.com/
GnuPG: D87F DAD6 0291 289C EB1E 781C 9BF8 A7D8 B280 F24E

 Wipe him down with gasoline 'til his arms are hard and mean
 From now on boys this iron boat's your home
 So heave away, boys.
   -- Tom Waits



More information about the gnhlug-discuss mailing list