From: "zork" <zork@nospam.com>
Subject: Re: unconstrained array type problems
Date: Thu, 22 Jul 2004 01:33:34 +1000
Date: 2004-07-22T01:33:34+10:00 [thread overview]
Message-ID: <40fe8ce1@dnews.tpgi.com.au> (raw)
In-Reply-To: 87zn5tl7n1.fsf@insalien.org
Hi thanks for that!
Yes that works for one array (just tried it) thanks!. What i forgot to
mention was that i need to read in a number of arrays from the text file,
and perform various operations between the arrays (multiplication). If i
define a 'declare' then each matrix will only be visible to itself ( i.e.
wont be visible to one another), hence the following wont work?
begin
Get (File, number_rows);
Get (File, number_columns);
declare
array1: Matrix_Type (1 .. number_rows, 1 .. number_columns);
begin
-- read in array1
end;
Get (File, number_rows);
Get (File, number_columns);
declare
array2: Matrix_Type (1 .. number_rows, 1 .. number_columns);
begin
-- read in array2
end;
-- multiply array1 by array2 (array multiplication)
end;
How can i make them visible to one another? This is so easy to do in
c++/java. ADD so tight.
Thanks again!
zork
"Ludovic Brenta" <ludovic.brenta@insalien.org> wrote in message
news:87zn5tl7n1.fsf@insalien.org...
> "zork" writes:
> > procedure Matrix is
> >
> > type Matrix_Type is array ( Integer range <>, Integer range <> ) of
> > Float;
> > ..
> > ..
> > begin
> > ..
> > Get ( File, number_rows ); -- read the number of rows from file
> > Get ( File, number_columns ); -- read the number of columns from
file
> > array1 : Matrix_Type ( 1 .. number_rows, 1 .. number_columns );
> > ..
> > end Matrix;
> > ------------------
> >
> > I cant seem to define my array1 in the begin / end block. This is a bit
> > frustrating. How does one get around this? Is an unconstrained array the
> > best choice?
> >
> > Any help most appreciated!
>
> You can do it with a declare block:
>
> begin
> Get (File, number_rows);
> Get (File, number_columns);
> declare
> array1: Matrix_Type (1 .. number_rows, 1 .. number_columns);
> begin
> -- process array1
> end;
> end;
>
> But if your processing is long, consider changing the declare block to
> a subprogram, and passing number_columns and number_rows to it.
>
> --
> Ludovic Brenta.
next prev parent reply other threads:[~2004-07-21 15:33 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 [this message]
2004-07-21 15:54 ` Marius Amado Alves
2004-07-21 16:24 ` Ludovic Brenta
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