- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Link kopiert
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Dmitri,
Thanks for your post. I'm afraid I don't have any exampleson hand of calling LAPACK from C++ with 2 dimensionalarrays. When I call LAPACK from C, I usually use a 1D array. I'll see what I can cook up.
Anyone else have a quick example?
Todd
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
DmR
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Yes. I store matrices in a single dimension arrays with data stored in columns (columns are stored contiguously in Fortran as opposed to the row-major format of C++). The LDA parameter (stands forleading dimension of the matrix A)found in many BLAS and LAPACK functions determines the distance between elements of the same row. LDA thereby imposes the 2D structure of the matrix on the 1 dimensional array.
Todd
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi Todd,
could you please help me in the following problem. I noticed you could pass arrays to fortan.
thanks
Farid
> In the following code when I pass the array to the fortran code I have a
> problem
> When I change the array in FORTRAN for each entry such as FA(4)=4 I don't
> receive any error messages and it's ok, but when I 'm using loop for
> chaning the content of array such as FA(i)=i*6 or copying FA array to
> another array I'm receiving following error message I've already tried
> __cdecl and __stdcall.
> Could you please tell me your idea about this problem or give me some code
> which work properly on your machine, I have VS 6 and have no problem with
> version of software (In passing single parameters to fortran I have no
> problem).
> I do really appriciate your help and unerstand you are very busy esp in
> these days.
>
>
> Thanks & Regards
> Farid
>
>
>
>
> ERRORs:
> NTR2CALL error LNK2019: unresolved external symbol _ALI@12 referenced in
> function _main
> NTR2CALL fatal error LNK1120: 1 unresolved externals
>
> =====================================================FORTRAN
> SUBROUTINE ALI(a,b,FA)
> Real*8 a,b
> integer i
> Real*8 FA(10)
>
> b=110+a
>
> DO i = 1, 6
> FA(i)=1
> enddo
>
> END SUBROUTINE ALI
> =====================================================VC++
> // external Fortran function prototype
> #include "stdafx.h"
> using namespace std;
> #include "iostream"
>
> extern "C" {void ALI(double&,double&,double*);}
> #pragma comment(lib, "Lib1.lib")
>
> void main()
> {
> double a,b;
> int i=0;
> double FA[10]={1,2,3,4,5,6,7,8,9,10};
> cout<
> <<"Enter a"
> <
> <
> ALI(a,b,FA);
>
> cout<
> <<"b=a+110= "
> <
> <
> <
> <
> {
> cout<<" "<
> }
> cout<
> <
> <
> }
>

- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite