* my cheat sheet note on installation of the Ada binding to Blas and Lapack @ 2012-07-06 9:26 Nasser M. Abbasi 2012-07-06 11:29 ` shai.lesh 2012-07-08 0:50 ` Nasser M. Abbasi 0 siblings, 2 replies; 6+ messages in thread From: Nasser M. Abbasi @ 2012-07-06 9:26 UTC (permalink / raw) fyi; I wrote a small note on the installation of the Ada binding to Blas and Lapack, in case they might be useful for someone. Added the note to my Ada web page below http://12000.org/my_notes/ada/index.htm The note shows the steps to just install and build the bindings, and run the tests that came with them. This was using GNAT 2012 on Linux. Thanks to Duncan Sands and Wasu Chaopanon for writing the Blas and Lapack Ada bindings. --Nasser ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: my cheat sheet note on installation of the Ada binding to Blas and Lapack 2012-07-06 9:26 my cheat sheet note on installation of the Ada binding to Blas and Lapack Nasser M. Abbasi @ 2012-07-06 11:29 ` shai.lesh 2012-07-06 19:55 ` Simon Wright 2012-07-08 0:50 ` Nasser M. Abbasi 1 sibling, 1 reply; 6+ messages in thread From: shai.lesh @ 2012-07-06 11:29 UTC (permalink / raw) Cc: nma On Friday, July 6, 2012 10:26:58 AM UTC+1, Nasser M. Abbasi wrote: > fyi; > > I wrote a small note on the installation of the Ada binding > to Blas and Lapack, in case they might be useful for someone. > Thanks for your efforts. I need to find a way to get LAPACK/BLAS on Windows. YC ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: my cheat sheet note on installation of the Ada binding to Blas and Lapack 2012-07-06 11:29 ` shai.lesh @ 2012-07-06 19:55 ` Simon Wright 0 siblings, 0 replies; 6+ messages in thread From: Simon Wright @ 2012-07-06 19:55 UTC (permalink / raw) shai.lesh@gmx.com writes: > On Friday, July 6, 2012 10:26:58 AM UTC+1, Nasser M. Abbasi wrote: >> fyi; >> >> I wrote a small note on the installation of the Ada binding >> to Blas and Lapack, in case they might be useful for someone. >> > > Thanks for your efforts. I need to find a way to get LAPACK/BLAS on Windows. I went to [1]; down a page or so to the line "Ref BLAS LAPACK LAPACKE" and downloaded the BLAS and LAPACK 'win32.dll' links. These worked fine with the under-work version of gnat-math-extn\test\demo_extensions (you can check it out using Mercurial from SF at [2]). This was on an XP Pro SP3 VM under VMware and GNAT GPL 2011. It has Cygwin installed but the build was OK in a Windows shell. [1] http://icl.cs.utk.edu/lapack-for-windows/lapack/#libraries_mingw [2] http://gnat-math-extn.hg.sourceforge.net:8000/hgroot/gnat-math-extn/gnat-math-extn ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: my cheat sheet note on installation of the Ada binding to Blas and Lapack 2012-07-06 9:26 my cheat sheet note on installation of the Ada binding to Blas and Lapack Nasser M. Abbasi 2012-07-06 11:29 ` shai.lesh @ 2012-07-08 0:50 ` Nasser M. Abbasi 2012-07-08 7:06 ` Simon Wright 2012-07-10 5:14 ` Ada novice 1 sibling, 2 replies; 6+ messages in thread From: Nasser M. Abbasi @ 2012-07-08 0:50 UTC (permalink / raw) On 7/6/2012 4:26 AM, Nasser M. Abbasi wrote: > fyi; > > I wrote a small note on the installation of the Ada binding > to Blas and Lapack, in case they might be useful for someone. > > Added the note to my Ada web page below > > http://12000.org/my_notes/ada/index.htm > fyi; This is my first program using the lapack binding! I tried to make it as simple as I can. It solves A x = b. (one can do this also using Ada own solve() function ofcourse, but with Lapack, one can do much more). I show the Ada code, and the matlab equivalent to show they give the same result. I'll update my cheat sheet above with these examples later on. ---------------------------------- 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 := ((9.0,others=>0.0), (2.0,others=>0.0), (-2.0,others=>0.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; -------------------------- output is >gnatmake -gnat2012 -I../ada mysolve.adb gcc -c -gnat2012 -I../ada mysolve.adb gnatbind -I../ada -x mysolve.ali gnatlink mysolve.ali >./mysolve -1.31250E+00 3.50000E+00 1.12500E+00 > Matlab -------- EDU>> A=[2 3 1;2 1 1;4 -1 6]; EDU>> b=[9;2;-2]; EDU>> A\b -- This is Matlab API to SGESV ans = -1.312500000000000 3.500000000000000 1.125000000000000 ------------ So we see that Matlab is correct, as confirmed by Ada :) --Nasser ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: my cheat sheet note on installation of the Ada binding to Blas and Lapack 2012-07-08 0:50 ` Nasser M. Abbasi @ 2012-07-08 7:06 ` Simon Wright 2012-07-10 5:14 ` Ada novice 1 sibling, 0 replies; 6+ messages in thread From: Simon Wright @ 2012-07-08 7:06 UTC (permalink / raw) "Nasser M. Abbasi" <nma@12000.org> writes: > This is my first program using the lapack binding! Great! > 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); Better to use 'Length rather than 'Last (just in case your matrices' index range doesn't start at 1). > if ( not(INFO = 0) ) then > raise PROGRAM_ERROR; > end if; As a matter of style, better as if INFO /= 0 then ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: my cheat sheet note on installation of the Ada binding to Blas and Lapack 2012-07-08 0:50 ` Nasser M. Abbasi 2012-07-08 7:06 ` Simon Wright @ 2012-07-10 5:14 ` Ada novice 1 sibling, 0 replies; 6+ messages in thread From: Ada novice @ 2012-07-10 5:14 UTC (permalink / raw) Cc: nma On Sunday, July 8, 2012 1:50:03 AM UTC+1, Nasser M. Abbasi wrote: > On 7/6/2012 4:26 AM, Nasser M. Abbasi wrote: > > fyi; > > > > I wrote a small note on the installation of the Ada binding > > to Blas and Lapack, in case they might be useful for someone. > This is my first program using the lapack binding! > I am still struggling to have Lapack/blas on Windows and perhaps they will never work! I am happy of your motivation and persistence in showing how to interface these libraries and Ada. Here are some examples that you may want to try: http://www.nag.com/lapack-ex/lapack-ex.html YC ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-07-10 5:20 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-07-06 9:26 my cheat sheet note on installation of the Ada binding to Blas and Lapack Nasser M. Abbasi 2012-07-06 11:29 ` shai.lesh 2012-07-06 19:55 ` Simon Wright 2012-07-08 0:50 ` Nasser M. Abbasi 2012-07-08 7:06 ` Simon Wright 2012-07-10 5:14 ` Ada novice
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox