Prev: Dhrystone
Next: Learning Ada
From: Ada novice on
Hi,
Having some background in C and in Ada, I would like to have some
examples on how to interface codes between these two languages. I
loved Ada but scientific computing libraries are not available. So I
was thinking to use an available numeric library in C to do some
mathematical operations such as calculations of eigenvalues and
eigenvectors from data in an Ada program. Ada does provide some
routines for eigenvalues and eigenvectors computations but they aren't
suitable for a non-symmetric matrix.

Information on interfacing Ada with C is scarce on the web and it
would help much if I can get some simple examples here from which I
can build up.

So in essence I'm looking for examples which illustrate how to pass
some data (e.g a matrix) from Ada to C, do some computations on the
matrix and return the results to the Ada environment. I understand
that a matrix can always be converted into a sequential row of data
which can be stored say in a file and then be passed to a C numerical
routine for some mathematical operation and then be returned back to
Ada likewise in the form of a data stored sequentially in a file.


Thanks
YC
From: Robert A Duff on
Ada novice <posts(a)gmx.us> writes:

> Hi,
> Having some background in C and in Ada, I would like to have some
> examples on how to interface codes between these two languages. I
> loved Ada but scientific computing libraries are not available. So I
> was thinking to use an available numeric library in C...

Or Fortran?

Look at 2.10, "Mixed Language Programming" in the GNAT
User's Guide.

- Bob
From: Ada novice on
On Jul 24, 2:08 pm, Robert A Duff <bobd...(a)shell01.TheWorld.com>
wrote:
>
> Or Fortran?
>
> Look at 2.10, "Mixed Language Programming" in the GNAT
> User's Guide.
>
> - Bob

I have a good numeric library (IMSL from Visual Numerical) in C. As I
don't know Fortran at all, I prefer to use languages (C and Ada) that
I have some experiences with. Thanks I shall take a look at the GNAT
User's Guide.

YC
From: Marco on
On Jul 24, 5:08 am, Robert A Duff <bobd...(a)shell01.TheWorld.com>
wrote:
> Ada novice <po...(a)gmx.us> writes:
> > Hi,
> >     Having some background in C and in Ada, I would like to have some
> > examples on how to interface codes between these two languages. I
> > loved Ada but scientific computing libraries are not available. So I
> > was thinking to use an available numeric library in C...
>
> Or Fortran?
>
> Look at 2.10, "Mixed Language Programming" in the GNAT
> User's Guide.

http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/

Curiously they only mention C not Fortran

From: Simon Wright on
Ada novice <posts(a)gmx.us> writes:

> Having some background in C and in Ada, I would like to have some
> examples on how to interface codes between these two languages. I
> loved Ada but scientific computing libraries are not available. So I
> was thinking to use an available numeric library in C to do some
> mathematical operations such as calculations of eigenvalues and
> eigenvectors from data in an Ada program. Ada does provide some
> routines for eigenvalues and eigenvectors computations but they aren't
> suitable for a non-symmetric matrix.
>
> Information on interfacing Ada with C is scarce on the web and it
> would help much if I can get some simple examples here from which I
> can build up.

I think you have GNAT? Assuming that, you'll find their implementation
of Ada.Numerics.Generic_Real_Arrays in their Ada standard library;
you'll find this under the installation directory. On my Mac it's
/opt/gnat-gpl-2010-x86_64/lib/gcc/x86_64-apple-darwin9.6.0/4.3.6/adainclude/a-ngrear.ad[sb]
but on a Windows machine it'll be something li
<install-dir>\<gnat-release>\lib\gcc\<architecture>\<gcc-release>\adainclude\a-ngrear.ad[sb]

This will lead you to System.Generic_Real_BLAS (s-gerebl.ad[sb]) and
System.Generic_Real_LAPACK (s-gerela.ad[sb]), which are interfaces to
the corresponding external libraries.


Not sure that these will fit your 'simple' criterion, though!

--S
 |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11
Prev: Dhrystone
Next: Learning Ada