From: "Nasser M. Abbasi" <nma@12000.org>
Subject: How to initialize a matrix of one column only?
Date: Sat, 07 Jul 2012 19:08:41 -0500
Date: 2012-07-07T19:08:41-05:00 [thread overview]
Message-ID: <jtaj2c$18k$1@speranza.aioe.org> (raw)
So trivial, yet Ada is giving me hard time with this
because I am a newbie.
I am trying to call SGESV in Lapack
http://www.netlib.org/lapack/single/sgesv.f
One of the arguments must be a matrix (the 'B' argument there).
I want to pass it a one column matrix. (i.e. I can't use a
Vector, it must be a matrix, since this is what the Ada Lapack
binding requires).
But I can't get the syntax to simply initialize the required
matrix to be a one column matrix. I keep getting the error
nested array aggregate expected
I am sure this is trivial, but after tried all the
combinations I can think of, and googling around, I
give up. It works with the B matrix is (1..N,1..N)
but not when I write it as (1..N,1..1) to make it one
column matrix.
Here is the code, I write
----------------------
with Interfaces.Fortran;
use Interfaces.Fortran;
with lbase;
....
N: Fortran_Integer := 3;
B: labase.Fortran_Real_Matrix ( 1..N, 1..1 );
BEGIN
B := ((9.0) , -- here is the problem
(2.0) ,
(-2.0));
....
--------------------------------------------
where the labase package simply introduces a type for
Fortran_Real_Matrix as follows
----------------------------
type Fortran_Real_Matrix is array (Fortran_Integer range <>,
Fortran_Integer range <>)
of Real;
pragma Convention (Fortran, Fortran_Real_Matrix);
--------------------
>gnatmake -I../ada lap42.adb
gcc -c -I../ada lap42.adb
lap42.adb:35:16: nested array aggregate expected
lap42.adb:35:16: if single-component aggregate is intended, write e.g. (1 => ...)
gnatmake: "lap42.adb" compilation error
>
I tried B:=(1=>9.0,2=>2.03=>-2.0);
and B := ((9.0 ,2.0 , 3));
but non working.
What is the correct syntax to use?
thanks,
--Nasser
next reply other threads:[~2012-07-08 0:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-08 0:08 Nasser M. Abbasi [this message]
2012-07-08 0:20 ` How to initialize a matrix of one column only? Nasser M. Abbasi
2012-07-08 1:47 ` John B. Matthews
2012-07-08 2:09 ` Nasser M. Abbasi
2012-07-08 17:05 ` Brian Drummond
2012-07-13 15:19 ` Robert A Duff
2012-07-13 16:11 ` gautier_niouzes
2012-07-08 7:27 ` Simon Wright
2012-07-08 7:43 ` Stephen Leake
2012-07-08 22:56 ` Jerry
2012-07-09 9:35 ` Simon Wright
2012-07-12 4:13 ` Jerry
2012-07-12 8:50 ` Simon Wright
2012-07-13 23:15 ` Jerry
2012-07-14 9:46 ` 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