comp.lang.ada
 help / color / mirror / Atom feed
From: Will <willmann817@gmail.com>
Subject: Array/Matrix Help
Date: Tue, 3 Apr 2012 19:55:26 -0700 (PDT)
Date: 2012-04-03T19:55:26-07:00	[thread overview]
Message-ID: <eef91ea3-652f-47e4-8de2-f26a3d8ae1ce@f6g2000vbc.googlegroups.com> (raw)

I need to create function Create_Matrix that  accepts four
Int_Arrays.  It must determine if all 4 Int_Arrays are of equal length
and then creates and returns an Int_Matrix of the 2 or more arrays
with equal length.

Here is what I am thinking so far, I believe it will work but seems
inefficient and I am looking for efficiency in my coding.  I am not
sure how to determine which ones are equal other than a bunch of if/
elsif statement that cover every possible combination of them being
equal then write the code that will create the matrix for that given
combination of arrays.   Any ideas on something better than the
following.  I am assuming that there will not be 2 sets of arrays that
are equal (i.e. 2 arrays of length 5 , and another 2 of length 7)
There would only be 1 common length.

  function Create_Matrix (A, B, C, D : Int_Array) return Int_Matrix

       begin

           if A'Length = B'Length and A'Length = C'Length and A'Length
= D'Length then

 Then continue to do this all the way until I cover every combination
of 2 or more arrays that are equal length and then whichever if
statement it satisfies create the Int_Matrix by each array being its
own line inside the matrix.

Can anyone offer help or ideas.  Any hints/help is greatly
appreciated... I prefer that over just giving me the code.


-Will







             reply	other threads:[~2012-04-04  2:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-04  2:55 Will [this message]
2012-04-04 16:20 ` Array/Matrix Help Adam Beneschan
2012-04-04 20:00 ` Niklas Holsti
replies disabled

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