- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
I am trying to write a simple matrix inversion program that takes a 3x3 matrix and inverts using sgetrf and sgetri. Below is my code:
Program InverterTest
Use lapack95, Only: getrf, getri
Implicit None
Real:: a(3,3)
Integer:: ipiv(1,3)
Integer:: i,j
a(1,:) = [1,3,5]
a(2,:) = [4,2,6]
a(3,:) = [9,4,1]
Print *, a
Call sgetrf(a,ipiv)
Print *, a
Call sgetri(a,ipiv)
Print *, a
End Program InverterTest
Use lapack95, Only: getrf, getri
Implicit None
Real:: a(3,3)
Integer:: ipiv(1,3)
Integer:: i,j
a(1,:) = [1,3,5]
a(2,:) = [4,2,6]
a(3,:) = [9,4,1]
Print *, a
Call sgetrf(a,ipiv)
Print *, a
Call sgetri(a,ipiv)
Print *, a
End Program InverterTest
Using VS2008 I have tried to follow all of the instructions to insure that all the libraries and include files are in the right place. The program compiles just fine and runs, but when it tries to call sgetrf it crashes and gives:
forrtl: severe (157): Program exception - access violation
Any ideas? Thanks in advance.
Mike
Link kopiert
2 Antworten
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
You can't use lapack95 argument list in direct calls to the f77 entry points. Of course, when you get that part right, it will complain that there are no specific subroutines to match ipiv with 2 subscripts where 1 is required (although that's only a cleanliness issue).
I trust you had already solved the problem that the lapack95.mod files aren't in the top level mklinclude folder where the compiler setup is looking for them (either by adding your own -I or by copying them, or by adding the folder in ifortvarsxx.bat or Fortran properties).
I trust you had already solved the problem that the lapack95.mod files aren't in the top level mklinclude folder where the compiler setup is looking for them (either by adding your own -I or by copying them, or by adding the folder in ifortvarsxx.bat or Fortran properties).
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi Mike,
Really, to call lapack95 interface you should use generic names and appropriate parameters:
Integer:: ipiv(3)
Callgetrf(a,ipiv)
Call getri(a,ipiv)
Otherwise you call lapack77 routine directly with insufficient parameters.
Thanks,
Vladimir
Antworten
Themen-Optionen
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite