From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: fyi, small update to Ada LAPACK and BLAS binding
Date: Tue, 31 Jul 2012 11:59:56 +0300
Date: 2012-07-31T11:59:56+03:00 [thread overview]
Message-ID: <a7pl4aFs3lU1@mid.individual.net> (raw)
In-Reply-To: <jv7uei$2jl$1@speranza.aioe.org>
On 12-07-31 09:37 , Nasser M. Abbasi wrote:
> Here is a complete example using LAPACK from Ada, with the gnatmake
> command to build it:
>
> gnatmake -Iada_lapack/binding mysolve.adb -largs -L/usr/lib -lblas -llapack
>
> ------ mysolve.adb -------------------------------------
> with Ada.Text_IO; use Ada.Text_IO;
>
> with Interfaces.Fortran; use Interfaces.Fortran;
> with lapack;
>
> procedure mysolve is
>
> A : lapack.Fortran_Real_Matrix (1 .. 3, 1 .. 3);
> b : lapack.Fortran_Real_Matrix (1 .. 3, 1 .. 1);
> info : Fortran_Integer;
> ipiv : lapack.Fortran_Integer_Vector (1 .. A'Last (2));
>
> begin -- solve A x=b
>
> A := ((2.0, 3.0, 1.0), (2.0, 1.0, 1.0), (4.0, -1.0, 6.0));
> b := ((1 => 9.0), (1 => 2.0), (1 => -2.0));
>
> lapack.SGESV
> (N => A'Last (2),
Wouldn't A'Length(2) be more to the point? And the same for the other
uses of 'Last below. Of course, when 'First = 1 then 'Length = 'Last,
but just as a general point of principle...
> NRHS => b'Last (2),
> A => A,
> LDA => A'Last (1),
> IPIV => ipiv,
> B => b,
> LDB => b'Last (1),
> INFO => info);
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
next prev parent reply other threads:[~2012-08-06 14:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-31 6:37 fyi, small update to Ada LAPACK and BLAS binding Nasser M. Abbasi
2012-07-31 8:59 ` Niklas Holsti [this message]
2012-07-31 10:53 ` Nasser M. Abbasi
2012-07-31 12:39 ` Ada novice
2012-07-31 13:00 ` Nasser M. Abbasi
2012-07-31 13:37 ` Ada novice
[not found] ` <8r5g18h74q8mpqubmu93d5d1ubkmeoepjr@invalid.netcom.com>
2012-07-31 18:35 ` Ada novice
2012-07-31 19:40 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox