Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!uw-june!uw-entropy!mica!charlie From: charlie@mica.stat.washington.edu (Charlie Geyer) Newsgroups: comp.lang.c,comp.lang.fortran Subject: Calling FORTRAN from C (Was: Need matrix inversion C routine). Message-ID: <1399@uw-entropy.ms.washington.edu> Date: 28 Apr 89 18:56:14 GMT References: <2846@tank.uchicago.edu> <5785@cbnews.ATT.COM> <10087@smoke.BRL.MIL> <2692@tekcae.CAX.TEK.COM> <307@cbnewsh.ATT.COM> Sender: news@uw-entropy.ms.washington.edu Reply-To: charlie@mica.stat.washington.edu (Charlie Geyer) Distribution: usa Organization: UW Statistics, Seattle Lines: 24 Summary: Expires: Sender: Followup-To: Xref: utzoo comp.lang.c:18122 comp.lang.fortran:1984 In article <307@cbnewsh.ATT.COM> georg@cbnewsh.ATT.COM (georg.k.karawas) writes: > The book 'Numerical Recipes in C' should contain a routine > for matrix inversion. As it was already pointed in other > articles, it is a hassle to work with pointers. > A better solution might be to take a 'canned' FORTRAN routine > from a standard package, like LINPACK, and call it from C. > Be careful though that C stores arrays row-by-row. > UNIX f77 compilers can produce object code which can be linked > with a C calling program. Yes this is the right answer and it applies even more so to algorithms more complicated than matrix inversion for which reinventing the wheel would be crazy. I worry about portability though. I hate to tell sombody I'm giving software to "This is portable except the calls of FORTRAN from C and C from FORTRAN; they work on our machines; you'll have to figure out how to make them work on yours. Here is a copy of message <14081@mimsy.UUCP> in comp.lang.c by Chris Torek that tells how to do it on a VAX running BSD 4.x. Have fun." Is there anything in pANS C, Fortran 8x, and POSIX that will alleviate this situation? It's very annoying, especially these days when all of the really high quality numerical stuff is still in FORTRAN and all of the good user interface stuff is in C.