QUERY ON +.x ON NESTED ARRAYS IN APL2 
Author Message
 QUERY ON +.x ON NESTED ARRAYS IN APL2

Consider this nested vector in APL2

             .--------------.
             |  .---. .---. |
      V  =   |  | 1 | | 2 | |
             |  '~--' '~--' |
             '--------------'

which could be built by       c"  ,"  1 2

The depth of         V              is  2
The depth of         +/ V x V       is  2
But the depth of     V +.x V        is  3

Why ??

Bill Knight  /  University of New Brunswick  /  Canada



Tue, 09 Jan 1996 05:26:37 GMT  
 QUERY ON +.x ON NESTED ARRAYS IN APL2


Quote:

> Consider this nested vector in APL2

>              .--------------.
>              |  .---. .---. |
>       V  =   |  | 1 | | 2 | |
>              |  '~--' '~--' |
>              '--------------'

> which could be built by       c"  ,"  1 2

> The depth of         V              is  2
> The depth of         +/ V x V       is  2
> But the depth of     V +.x V        is  3

> Why ??

Many common cases of inner product do end up with what appears to be
an extra level of nesting. However, generality requires that the level
be there so that information is not lost in the general case.
In words, the definition of inner product says to take rows of the
left against columns of the right in all combinations and then reduce
each result by F. I'll use the following notation:

             " stands for dieresis  (each)
             c            left shoe (enclose)
             jot          jot       (outer product)
             rho          rho       (reshape)

For L and R rank 2 the definition may be written in zero origin
as follows:

   L F.G R
   F/" (c[1] jot.G c[0]R

The documentation contains a more general definition for any rank.

In many useful cases, the result of the outer product is an array of
vectors. Applying F reduction to each of these vectors gives scalars
and, in these examples, these scalars look like an extra level of
nesting. This level of nesting is needed whenever G produces an array
of rank N greater than 1. Then the reduction produces a result of rank
N-1 (rank is what reduction reduces) and the level of nesting is
required. Here's an example:

   (2 2 rho 2 3 1 2) ,.rho 2 2 rho 1 2 10 20

Jim



Fri, 12 Jan 1996 23:48:26 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. APL2: compress with nested arrays?

2. That nested nested nested if statement...

3. nested variant records query

4. Nested Loops (easy query)

5. Sharp APL (really SAPL and APL2 arrays)

6. How Convert MS EXCEL Spreadsheet to an APL2 Array

7. apl2 question: array item patterns

8. MySQL query in PHP: Not query zero amounts also removes null amounts from query

9. APL2 (was Re: Fortran90 and arrays)

10. APL Nested Array Questions

11. How are nested arrays internally stored?

12. APLASCII format of singleton nested arrays

 

 
Powered by phpBB® Forum Software