comp.lang.ada
 help / color / mirror / Atom feed
* fyi, small update to Ada LAPACK and BLAS binding
@ 2012-07-31  6:37 Nasser M. Abbasi
  2012-07-31  8:59 ` Niklas Holsti
  2012-07-31 12:39 ` Ada novice
  0 siblings, 2 replies; 8+ messages in thread
From: Nasser M. Abbasi @ 2012-07-31  6:37 UTC (permalink / raw)



FYI;

I've added  more documentation and made a little cleanup of the
current Ada LAPACK and BLAS bindings.

As per earlier thread, this snap shot of the LAPACK binding now
uses one package to interface to LAPACK so it is easier to use.

The location is still the same as before, and with more
documentation now how to use the bindings.

http://12000.org/my_notes/ada/index.htm

I have a zip file the the LAPACK and BLAS updates I made there
with links to the original versions

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),
       NRHS => b'Last (2),
       A    => A,
       LDA  => A'Last (1),
       IPIV => ipiv,
       B    => b,
       LDB  => b'Last (1),
       INFO => info);

    if (info /= 0) then
       raise Program_Error;
    end if;

    declare
       package real_IO is new Ada.Text_IO.Float_IO (Real);
    begin
       for I in b'Range (1) loop
          real_IO.Put (b (I, 1));
          New_Line;
       end loop;
    end;

end mysolve;
-----------------------

--Nasser



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fyi, small update to Ada LAPACK and BLAS binding
  2012-07-31  6:37 fyi, small update to Ada LAPACK and BLAS binding Nasser M. Abbasi
@ 2012-07-31  8:59 ` Niklas Holsti
  2012-07-31 10:53   ` Nasser M. Abbasi
  2012-07-31 12:39 ` Ada novice
  1 sibling, 1 reply; 8+ messages in thread
From: Niklas Holsti @ 2012-07-31  8:59 UTC (permalink / raw)


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
      .      @       .



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fyi, small update to Ada LAPACK and BLAS binding
  2012-07-31  8:59 ` Niklas Holsti
@ 2012-07-31 10:53   ` Nasser M. Abbasi
  0 siblings, 0 replies; 8+ messages in thread
From: Nasser M. Abbasi @ 2012-07-31 10:53 UTC (permalink / raw)


On 7/31/2012 3:59 AM, Niklas Holsti wrote:
> On 12-07-31 09:37 , Nasser M. Abbasi wrote:

>>
>>     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...
>

Yes, you are right. 'Length(2) would be better. I am still an Ada newbie :)

--Nasser




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fyi, small update to Ada LAPACK and BLAS binding
  2012-07-31  6:37 fyi, small update to Ada LAPACK and BLAS binding Nasser M. Abbasi
  2012-07-31  8:59 ` Niklas Holsti
@ 2012-07-31 12:39 ` Ada novice
  2012-07-31 13:00   ` Nasser M. Abbasi
  1 sibling, 1 reply; 8+ messages in thread
From: Ada novice @ 2012-07-31 12:39 UTC (permalink / raw)
  Cc: nma

On Tuesday, July 31, 2012 7:37:05 AM UTC+1, Nasser M. Abbasi wrote:
> FYI;

> 
> I've added  more documentation and made a little cleanup of the
> 
> current Ada LAPACK and BLAS bindings.
> 

Ada novice to Ada newbie :) : Apart the re-organisation of the folders, are there changes in the bindings themselves?

Thanks,
YC



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fyi, small update to Ada LAPACK and BLAS binding
  2012-07-31 12:39 ` Ada novice
@ 2012-07-31 13:00   ` Nasser M. Abbasi
  2012-07-31 13:37     ` Ada novice
  0 siblings, 1 reply; 8+ messages in thread
From: Nasser M. Abbasi @ 2012-07-31 13:00 UTC (permalink / raw)


On 7/31/2012 7:39 AM, Ada novice wrote:
> On Tuesday, July 31, 2012 7:37:05 AM UTC+1, Nasser M. Abbasi wrote:
>> FYI;
>
>>
>> I've added  more documentation and made a little cleanup of the
>>
>> current Ada LAPACK and BLAS bindings.
>>
>

> Ada novice to Ada newbie :) : Apart the re-organisation of the folders, are
>there changes in the bindings themselves?
>

The actual API did not change. All the code is the same. Just moved all packages
into one package so it is easier to use.

Now you just need to do

with lapack;

To use the biding, then just do lapack.this and lapack.that to use it.

Or you can just type

with lapack; use lapack;

Whatever form you like.

i.e. you do not need to know which package has which functions like before.
The driver, computational, aux, and IO packages are now in one package.

This is based on suggestion given in this news group and I think it
was a good idea and made the API simpler to use.

Again no actual code was changed in the API itself (i.e the signature of the
API)was changed.

on a side note:
----------------
I think these bindings should really be taken up by some one like
Ada Core and be part of GNAT own packages as axillary GNAT things/packages,
like they have now at the Libre site, with the other packages. They are
important, and large (over 20,000 lines of Ada code for Lapack bindings alone).

They still needs more work, and more maintainance to make sure all Lapack
functions are supported (now, not all Lapack functions are supported, but
many seem to, according to the documentation).

And more testing done, and such. I hope Ada core would adopt these
bindings, so they a little more 'official' that way. I do not know
how the copyright thing works here, they would have to contact
the authors of these bindings. I understand that these are in the public
domain, or GPL'ed, but I really do not know about these things. someone
would know better than me the status of the source code.

--Nasser



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fyi, small update to Ada LAPACK and BLAS binding
  2012-07-31 13:00   ` Nasser M. Abbasi
@ 2012-07-31 13:37     ` Ada novice
       [not found]       ` <8r5g18h74q8mpqubmu93d5d1ubkmeoepjr@invalid.netcom.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Ada novice @ 2012-07-31 13:37 UTC (permalink / raw)
  Cc: nma

Thanks Nasser. You're right in hoping that AdaCore would show interest in lapack/blas. These libraries are important.

I do wonder why there has been little interest so far from the Ada Community in general.

YC




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fyi, small update to Ada LAPACK and BLAS binding
       [not found]       ` <8r5g18h74q8mpqubmu93d5d1ubkmeoepjr@invalid.netcom.com>
@ 2012-07-31 18:35         ` Ada novice
  2012-07-31 19:40         ` Simon Wright
  1 sibling, 0 replies; 8+ messages in thread
From: Ada novice @ 2012-07-31 18:35 UTC (permalink / raw)


On Tuesday, July 31, 2012 6:36:53 PM UTC+1, Dennis Lee Bieber wrote:
> 	If AdaCore did include them as part of their standard release, it
> 
> would mean they'd also have to offer full support for them to their
> 
> paying clients. In essence, they'd have to take over full maintenance of
> 
> the packages.

Anyway, the Ada community should really consider whether they still want people to use Ada to do numerical computations. (Newer) languages like Python and F# knows how to motivate people to use them for numerical computations and have good numerical libraries. Ada is perhaps the one language who appeared to be strong in the 80's in the numerical computation domain and a few Ada books were out there in this field. As from the 1990's, though the Ada standards are adding new features for scientific computation, people do not seem to have interest for them.

What good is a language for numerical computation if there is no proper support for libraries like Lapack/blas? Good that people like Nasser exists. He is to be commended for his efforts.

YC



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fyi, small update to Ada LAPACK and BLAS binding
       [not found]       ` <8r5g18h74q8mpqubmu93d5d1ubkmeoepjr@invalid.netcom.com>
  2012-07-31 18:35         ` Ada novice
@ 2012-07-31 19:40         ` Simon Wright
  1 sibling, 0 replies; 8+ messages in thread
From: Simon Wright @ 2012-07-31 19:40 UTC (permalink / raw)


Dennis Lee Bieber <wlfraed@ix.netcom.com> writes:

> On Tue, 31 Jul 2012 06:37:12 -0700 (PDT), Ada novice <shai.lesh@gmx.com>
> declaimed the following in comp.lang.ada:
>
>> Thanks Nasser. You're right in hoping that AdaCore would show
>> interest in lapack/blas. These libraries are important.
>>
> 	If AdaCore did include them as part of their standard release,
> it would mean they'd also have to offer full support for them to their
> paying clients. In essence, they'd have to take over full maintenance
> of the packages.

And the fact that AdaCore don't include them is a pretty strong
indication that their paying customers[1] don't need them (or, perhaps,
need the facilities but are happy with in-house bindings, or even the
ones that Nasser has been working on).

[1] http://www.adacore.com/customers



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-08-07  6:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-31  6:37 fyi, small update to Ada LAPACK and BLAS binding Nasser M. Abbasi
2012-07-31  8:59 ` Niklas Holsti
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox