comp.lang.ada
 help / color / mirror / Atom feed
From: "vincent.diemunsch@gmail.com" <vincent.diemunsch@gmail.com>
Subject: Interfacing Ada to C for linear algebra
Date: Fri, 2 Sep 2011 05:46:20 -0700 (PDT)
Date: 2011-09-02T05:46:20-07:00	[thread overview]
Message-ID: <2cc811c2-e805-4407-8f2e-d1b5804782c9@i21g2000yqd.googlegroups.com> (raw)

Hello everybody,

I would like to use in Ada some linear algebra libraries written in C,
especially the SuiteSparse :
 http://www.cise.ufl.edu/research/sparse/SuiteSparse/
These libraries handle Sparse Matrices that are in the format used
internally by MatLab : a column-
compressed version of the standard matrices.

Ada defines Generic_Real_Arrays to handle vectors and matrices. So I
would like to simply create a
Generic_Real_Sparse_Arrays package to define MatLab compatible
matrices. Since the internal
format of MatLab matrices is in C, in need to do a conversion between
my Sparse_Matrix and the C
arrays that represent the Sparse Matrix in MatLab.

Looking at the implementation of Generic_Real_Arrays in GNAT, I see
that they internally call the
BLAS and LAPACK packages, written in Fortran, through the use of two
packages :
System.Generic_Real_BLAS and System.Generic_Real_LAPACK. These package
do exactly the
same as what I want to do : they convert Ada arrays of Ada floating
point type in Fortran arrays
of Fortran Float type and back, without using copying, so that the
compiler produces no code
for this conversion (using pragma Inline_Always and so on). This is
important because if we
use optimized versions of linear algebra packages it is because we
manipulate huge arrays
and we don't want to loose time in copying values from on
representation to another !

I suppose that since C is very common, there must already exist a very
good implementation of
conversion of Ada arrays of floating point types in C arrays of
C.Float, idealy using the GNAT
implementation. This could save me a lot of time doing interfaces...

Thank you for your responses,

Vincent







             reply	other threads:[~2011-09-02 12:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-02 12:46 vincent.diemunsch [this message]
2011-09-02 14:53 ` Interfacing Ada to C for linear algebra Simon Wright
2011-09-06  6:53   ` vincent.diemunsch
2011-09-06 16:56     ` Pascal Obry
2011-09-06 18:54       ` Simon Wright
replies disabled

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