- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DmR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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<
> <
> <
> }
>
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page