Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!torn!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!gumby!wupost!spool.mu.edu!umn.edu!csus.edu!sfsuvax1.sfsu.edu!emclean
From: emclean@sfsuvax1.sfsu.edu (Emmett McLean)
Subject: Re: rank of nD fft (Re: what about func(a,a,a)
Message-ID: <1992Dec5.063410.18290@csus.edu>
Sender: news@csus.edu
Organization: San Francisco State University
References: <1992Dec4.111043.20054@bernina.ethz.ch> <1992Dec4.145530.3124@mr.med.ge.com>
Date: Sat, 5 Dec 1992 06:34:10 GMT
Lines: 71

In article <1992Dec4.145530.3124@mr.med.ge.com> gurr@sakari (David Gurr 4-6989 MR Sys) writes:
>I was thinking about using rank to specify what 
>dimension fft to apply to an array.  I have a nD
>fft hacked into J as an external function (129!:0
>--fft, monadic is 1D dyadic is nD, and 129!:1
>--inverse fft, monadic is 1D, dyadic is nD).  
>
>But now I want to clean things up.  How can I
>get a function, say fft, such that the obverse
>of fft is the inverse fft and the rank n varient
>of fft is the nD fft?  Can I do this in J or do
>I need to hack the source?
>

   Is the difficulty you ran into related to a problem
   with getting a domain error on the dyadic case of
   the obverse?

   For example :
 
   f1 =. ' *: y.':11
   fn =. ' x.&^y.':11
   f =.  f1 : fn
   
   g1 =. '%: y.':11
   gn =. ' y.&^.x.':11
   g  =. g1 : gn

   h  =. f :. g

   f 2    NB. verb monad
4
   g 4    NB. obverse monad
2
   2 f 4  NB. verb dyad
16
   2 g 16 NB. obverse dyad
4
   h 2    NB. same as f 2
4
   2 h 4  NB. same as 2 f 4
16
   2 (h^: _1) 16  NB. sb same as 2 g 16 but crashes.
domain error

A simpler example which also crashes :
   j =. 0: : 1:
   k =. 1: : 0:
   l =. j :. k
   l 4
0
   2 l 3
1
   l^:_1 (4)
1
   2 (l^:_1) 4
domain error

   What about something like:

   f1 =. ' 129!:0 y.':11
   fn =. ' x. (129!:0)"(#@$ y.) y.':11
   f =. f1 : fn
   
   g1 =. ' 129!:1 y.':11
   gn =. ' y. (129!:1)"(#@$ x.) .x.':11
   g  =. g1 : gn

   h  =. f :. g

   Emmett emclean@sfsuvax1.sfsu.edu
