The parenthesis do not bug me all that much, compared to not knowing
what reasonable values for things like dwt and yy would be.

I can see a variety of possibilities for cleaning up the code, but
without a working example, organizing is (and should be) a secondary
priority.

Thanks,

-- 
Raul



On Mon, Oct 27, 2014 at 3:35 PM, Scott Locklin <[email protected]> wrote:
> So, I'm trying to cook up a wavelet package for you guys. I want to use it
> to illustrate "notation as a tool of thought," and also so everyone has
> wavelets with which to wavelet things.
>
> Wavelets have multiple levels, and calculating them is a recursive process
> on filtered values of the original time series. So, when you calculate level
> 1 wavelets, you get the level 1 wavelet, plus the filtered y at level 1. To
> calculate level 2, you operate on the decimated y, etc.
>
> At each level, this is done with a dyad called dwt, which has x as the type
> of wavelet called, and y as the timeseries; dwt returns the next level y,
> and the next level wavelet. So I do it with this verb:
>
> dwtL=: 4 : 0
>  'lev k'=.x
>  'yn wn'=. k&dwt y
>  wn; (((<:lev);k)&dwtL^:(lev>1) yn)
> )
>
> called something like:
>
> 'w4 w3 w2 w1 y4'=.(4;'db6') dwtL yy
>
> The boxing is pretty necessary for simple inversion, which can be
> accomplished with the / adverb.
>
> I think this is pretty clear code, but all the parenthesis and machinery of
> temporary variables kind of bug me. Is there some better way to accomplish
> the same thing without the temp variables, while retaining some clarity of
> intention? Perhaps by using something which isn't the power conjunction?
> Power is my "go to" loop when I can't do it with / or \, but maybe it isn't
> the best thing to use (performance is good FWIIW).
>
> -SL
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to