From: Ludovic Brenta <ludovic.brenta@insalien.org>
Subject: Re: unconstrained array type problems
Date: Wed, 21 Jul 2004 18:24:37 +0200
Date: 2004-07-21T18:23:43+02:00 [thread overview]
Message-ID: <87vfghl456.fsf@insalien.org> (raw)
In-Reply-To: mailman.36.1090425254.416.comp.lang.ada@ada-france.org
Marius Amado Alves writes:
>> How can i make them visible to one another? This is so easy to do in
>> c++/java.
>
> This is extremely easy in Ada with the proper design, namely with
> these two entities:
>
> type Matrix is array (Positive range <>, Positive range <>) of Real;
> function Read_File (Name : String) return Matrix;
>
> Then read all the matrices you want in the same place:
>
> Matrix_1 : Matrix := Read_Matrix ("One");
> Matrix_2 : Matrix := Read_Matrix ("Two");
> ...
Yes, this is as I suggested, move the declare block to its own
subprogram. But to answer more directly to the OP's question:
begin
Get (File, number_rows_1);
Get (File, number_columns_1);
Get (File, number_rows_2);
Get (File, number_columns_2);
declare
array1: Matrix_Type (1 .. number_rows, 1 .. number_columns);
array2: Matrix_Type (1 .. number_rows, 1 .. number_columns);
begin
-- read in array1
-- read in array2
-- multiply array1 by array2 (array multiplication)
end;
end;
--
Ludovic Brenta.
next prev parent reply other threads:[~2004-07-21 16:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-21 15:04 unconstrained array type problems zork
2004-07-21 15:09 ` Ludovic Brenta
2004-07-21 15:33 ` zork
2004-07-21 15:54 ` Marius Amado Alves
2004-07-21 16:24 ` Ludovic Brenta [this message]
2004-07-21 17:33 ` Georg Bauhaus
2004-07-21 17:35 ` zork
2004-07-21 18:30 ` tmoran
2004-07-21 23:11 ` zork
2004-07-22 7:57 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox