Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!jvnc.net!darwin.sura.net!haven.umd.edu!socrates!socrates!rockwell
From: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Subject: Re: APL2 question
In-Reply-To: andrew@rentec.com's message of 18 Mar 92 21:15:19 GMT
Message-ID: <ROCKWELL.92Mar19015421@socrates.umd.edu>
Sender: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Organization: Traveller
References: <1992Mar16.173450.1067@csi.jpl.nasa.gov> <730@kepler1.rentec.com>
	<1992Mar17.185047.8403@csi.jpl.nasa.gov> <732@kepler1.rentec.com>
Date: Thu, 19 Mar 1992 06:54:21 GMT
Lines: 49

Andrew Mullhaupt:
   In the problem I proposed (see below) almost all the time will be
   spent checking the bandwidth of the matrix, unless the matrix is
   too dense. Since interpreted APL will probably have to use again as
   much storage as the input, where compiled languages (APL possibly
   included) will act in-place.  At that point, the interpreted APL
   will pay heinous penalties for problems involving inputs about the
   maximum workspace size, if they can be done at all. So why not
   worry about it in the first place and not use APL...

Yes, if performance is a problem, use a language that gets good
performance.  If you don't need to do much in the way of design work,
there might not be a good reason to use APL.  But APL (or at least, J)
does have a simple way of checking the 'bandwidth' of a matrix.  For
example,

   ]MAT=.  > 1 2 0 0 0 ; 3 4 5 0 0 ; 0 6 7 8 0 ; 0 0 9 1 2 ; 0 0 0 3 4
1 2 0 0 0
3 4 5 0 0
0 6 7 8 0
0 0 9 1 2
0 0 0 3 4

   ]band=.  +.//. |. 0~: MAT
0 0 0 1 1 1 0 0 0

   ]width=.  +/ (+./\ *. +./\.) band
3

Now, the current implementations of J aren't particularly speedy.  But
that's an implementation problem, not a language problem.

Also, any implementation of APL with true booleans ought to be able to
solve this problem with something like (for floating point arrays)
little more than 6% memory over what is required to store the array
itself.  [Though there are implementation speed problems here, as
well.]

  BAND <-  v/[0] (iota 1 take rho MAT) phi ((rho MAT)rho 0), 0 notequal MAT
  WIDTH <- +/ (v\ BAND) ^ phi v\ phi BAND

'phi' is circle-stile (reverse/rotate).
'v' is logical or
etc..

Or is there some other band width problem associated with matrices?

-- 
Raul Deluth Miller-Rockwell                   <rockwell@socrates.umd.edu>
