Re: using a lapack routine
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: using a lapack routine         

Group: comp.lang.fortran · Group Profile
Author: e p chandler
Date: Sep 18, 2008 22:03

On Sep 18, 9:37 pm, Ron Ford wrote:
> I downloaded lapack recently and wanted to put a dent in it by calling one
> of its subroutines.  I hoped to call one that would determine the
> eigenvalues of a real matrix, but that doesn't seem to be on the menu.  A
> person seems to need to put quite a bit of effort to determine exactly what
> the subroutines do, and deciphering the titles is one step on that path.
>
> I found SGEHRD.f

[snip]
> I'm hoping to get this done by putting sgehrd.f where I keep the source for
> gfortran.  I would like to write the caller in f90 or f95 but certainly in
> free form.  sgehrd.f looks like fixed form f77.
>
> My first question is how do I deal with calling an f77 routine with main
> compiled in contemporary gfortran?

gfortran (like g95) will compile both types of source from the same
command line:

C:\Users\epc\temp>type main.f90
k = 1
print *, k
call sub(k)
print *, k
end

C:\Users\epc\temp>type sub.f
c234567
subroutine sub(i)
i = i * 2
return
end

C:\Users\epc\temp>g95 main.f90 sub.f

C:\Users\epc\temp>a
1
2

You probably want to put your subroutines in a module and USE that
module. Just write your module as fixed-format source and use an
extension of .f for the source file.

A second issue is do you want to compile individual files, adding more
files until you have exhausted dependencies, OR build the whole
library? I've had zero luck building large ANYTHING on Windows from
source, so I add pieces until it works.

A third issue is precision. Some libraries include a file which sets
default integer ...... default double precision ........
one include file for SP, a second one for DP.

[rant]

ICK. I like conditional compilation as much as I like wading through C
header files. :-(. [Bad memories of assembling 8080 code. One version
for I/O via IN and OUT, another for memory mapped I/O.... /* I
actually _liked_ memory mapped I/O */ ]

[/rant]

So I usually just add what the include file would have added to the
source file myself.

YMMV.

- e
no comments
diggit! del.icio.us! reddit!