From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,79a5986379126078 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.180.103.197 with SMTP id fy5mr1186234wib.1.1344263509298; Mon, 06 Aug 2012 07:31:49 -0700 (PDT) Received: by 10.180.106.199 with SMTP id gw7mr1186782wib.0.1344263509247; Mon, 06 Aug 2012 07:31:49 -0700 (PDT) Path: n2ni69501013win.0!nntp.google.com!7no2979555wig.0!news-out.google.com!q11ni72526241wiw.1!nntp.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!border1.nntp.ams2.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news.panservice.it!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: fyi, small update to Ada LAPACK and BLAS binding Date: Tue, 31 Jul 2012 11:59:56 +0300 Organization: Tidorum Ltd Message-ID: References: Mime-Version: 1.0 X-Trace: individual.net I6tyeKNFAmYpzVuquoaEFQ3Ocii6O6dJ56L+Le/ukrJZxJb6+gF1ng6Bel+em81s4K Cancel-Lock: sha1:8Tf+q4Fi1WYaHauuDXRZisvkyk4= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Date: 2012-07-31T11:59:56+03:00 List-Id: 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 . @ .