🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.apl
Article #52

interesting identity involving grade down

#52
From: utzoodecvaxdukeharposeismouwvaxg...
Date: Thu, 09 Dec 1982 12:10
38 lines
1593 bytes
I read about a fascinating characteristic of grade-down in a back
issue of APL News (right now I can't find my pile of back issues,
so I can't give a reference).  Consider a random arrangement of
the positive integers 1 through N.  For concreteness let us take
N to be 4, and our arrangement to be 3 1 2 4.  Form an N by N matrix
with zeroes in every slot of each column except for the position
indicated by the corresponding slot of our vector.  In other words,
for each i from 1 to N, m[ vec[ i ]; i ] is 1, and all the other
locations of m are zero.  For our sample, we have:

vec:  3 1 2 4
m:    0 1 0 0
      0 0 1 0
      1 0 0 0
      0 0 0 1

The (zero-origin) function named 'mat' takes a vector m and
produces the desired matrix:

z { mat n
z { (2 rho rho n) take (1, rho n) rho 1
z { (-n-1) reverse[ 0 ] z

Now for the punch line:  'mat grade-down vec' produces a matrix which
is the same as 'mat vec', but rotated 90 degrees clock-wise!

grade-down vec:  4 1 3 2
m':              0 1 0 0
		 0 0 0 1
		 0 0 1 0
		 1 0 0 0

(The proof is left to the reader.)  :-)
A corollary of the above is that 'gd gd gd gd' is the identity function
for permutation vectors.

			- Greg Johnson
			  U Wis - Madison
Technical Details
Message-ID: <bnews.uwvax.714>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
From: utzoo!decvax!duke!harpo!seismo!uwvax!greg
Newsgroups: net.lang.apl
Title: interesting identity involving grade down
Article-I.D.: uwvax.714
Posted: Thu Dec  9 12:10:38 1982
Received: Sat Dec 11 11:00:00 1982
Subject: interesting identity involving grade down
Date: Thu, 09 Dec 1982 12:10:38 +0000
Message-ID: <bnews.uwvax.714>