comp.lang.ada
 help / color / mirror / Atom feed
* Array/Matrix Help
@ 2012-04-04  2:55 Will
  2012-04-04 16:20 ` Adam Beneschan
  2012-04-04 20:00 ` Niklas Holsti
  0 siblings, 2 replies; 3+ messages in thread
From: Will @ 2012-04-04  2:55 UTC (permalink / 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







^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-04 20:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04  2:55 Array/Matrix Help Will
2012-04-04 16:20 ` Adam Beneschan
2012-04-04 20:00 ` Niklas Holsti

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