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=2.0 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,222ed89632aabb93 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.180.14.169 with SMTP id q9mr812576wic.0.1343148116203; Tue, 24 Jul 2012 09:41:56 -0700 (PDT) Path: q11ni55795924wiw.1!nntp.google.com!goblin3!goblin.stu.neva.ru!gegeweb.org!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: Re: Free AMD Core Math Library (BLAS/LAPACK) + Ada Date: Tue, 24 Jul 2012 11:41:52 -0500 Organization: Aioe.org NNTP Server Message-ID: References: <41b74e89-f112-4791-883d-236080652dbf@googlegroups.com> <87txx8yl8t.fsf@ludovic-brenta.org> <87pq7wyek7.fsf@ludovic-brenta.org> <16a6786f-6de5-49c4-90b7-a55cb238d52a@googlegroups.com> <509991f4-bcb4-45a0-84f3-b8393db64da4@googlegroups.com> <374bd898-5683-4350-8812-e3cae186ab2b@googlegroups.com> <87k3y3jxgj.fsf@ludovic-brenta.org> <23edac82-3e0e-47f5-85b7-36473e4a44ed@googlegroups.com> <8d88395a-9e03-4880-9728-aa0489dbc62f@googlegroups.com> Reply-To: nma@12000.org NNTP-Posting-Host: 6xfnQf8NWYR0Ab23/pVebQ.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-07-24T11:41:52-05:00 List-Id: On 7/24/2012 10:40 AM, Ada novice wrote: > In http://12000.org/my_notes/ada/index.htm point 13 where a complete >example is given to solve the system Ax=b, on running the code I get an error due to a line almost at the bottom of the code: > > for x of b loop > > The error message is "too few subscripts in array reference". > > The b vector is a 3 rows 1 column vector. > > YC > It works fine here. May be you copied the source from the page wrong. (I'll make a text file of this later and add it later, for now you can use the mouse to copy it, it is verbatim text) -------------------------------- cd lapada/test -- this is where you'll have the test program sit >gnatmake -gnat2012 -I../ada mysolve.adb gcc -c -gnat2012 -I../ada mysolve.adb gnatbind -I../ada -x mysolve.ali gnatlink mysolve.ali >ls -lrt -rwxrwxrwx 1 me me 552678 Jul 24 11:35 mysolve >./mysolve -1.31250E+00 3.50000E+00 1.12500E+00 ------------------------- Make sure to copy the source correct. Here it is again >cat mysolve.adb ----------------------------------- with Ada.Text_IO; use Ada.Text_IO; with Interfaces.Fortran; use Interfaces.Fortran; with labase; -- from LAPACK binding with ladrv; -- from LAPACK binding procedure mySolve is A: labase.Fortran_Real_Matrix ( 1..3, 1..3 ); b: labase.Fortran_Real_Matrix ( 1..3, 1..1 ); package Real_IO is new Ada.Text_IO.Float_IO( Real ); INFO : Fortran_Integer; IPIV : labase.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 ) ); ladrv.SGESV (N => A'Last(2), NRHS => b'Last(2), A => A, LDA => A'Last(1), IPIV => IPIV, B => b, LDB => b'Last(1), INFO => INFO); if ( not(INFO = 0) ) then raise PROGRAM_ERROR; end if; for x of b loop -- print solution real_io.PUT ( x ); new_line; end loop; end mySolve; -------------------------------------- --Nasser