Yes,  the Wiki article does distinguish between unnormalised and normalised

Haar matrices.  The ordering is presumably a matter of taste. I don't advocate

any particular one!

The Wiki article has (unnormalised)

H2Wiki = 1 1,: 1 _1,

H2nWiki = (HnWiki kp [1 1]), In kp [1 _1]

whereas Raul Miller's (original) approach

effectively had, again unnormalised

H2miller = 1 _1,: 1 1 ,

H2nMiller = (In kp [1 _1]), HnMiller kp [1 1]

(It's not clear whether H1 is defined.)

Working with matrices renders normalisation quite straightforward:

eg

(% %:@(+/@:|)"1) @:H2n 4   NB. with Miller's ordering:

0.707107 _0.707107        0         0

       0         0 0.707107 _0.707107

     0.5       0.5     _0.5      _0.5

     0.5       0.5      0.5       0.5


... similar result to Raul's HaarM, except that his argumment is

the log of n to base 2.


There's quite a famous poem,  this side of the pond (no pun!), by Stevie Smith,

called "Not waving but Drowning"

... and it's bed-time.  So agreed,  perhaps that's enough of wavelets!


Cheers,


Mike



On 08/01/2018 19:08, Raul Miller wrote:
Venturing further afield, it looks like normalizing means instead of using

    kp =:  *&$ ($,) 0 2 1 3 |: */

use

    Kp =: (%%:2) * *&$ ($,) 0 2 1 3 |: */

Or, put differently, multiply the unnormalized result r by
2^(1-2^.#r)%2 or (same numbers) by -@-:@<:&.(2&^.) #r or (again, same
numbers) 0.5 _0.5&p.&.(2&^.) #r

Or, in other words, values from the sequence %:1 2 4 8 16 32 ... with
1 being used for 2 by 2 arrays. This suggests that the order 0 Harr
matrix should be ,.%:0.5

People mostly ignore this, it seems, because it slightly obscures the
rest of the structure, and because matrix inverse works just fine with
or without it.

Ordering... I'm going to guess that Mike Day's H2N represents the
canonical order for the Haar wavelet. Mostly, because I can't think of
any reason to pick any other order and because the formulation "feels
right".

In other words:

    HaarM=: (Kp&(,:1 1), Kp&(,:1 _1)@(=@i.@#))@]^:[&(,.%:0.5)
    uHaarM=: (kp&(,:1 1), kp&(,:1 _1)@(=@i.@#))@]^:[&(,.1)

    HaarM 2
0.353553  0.353553 0.353553  0.353553
      0.5       0.5     _0.5      _0.5
0.707107 _0.707107        0         0
        0         0 0.707107 _0.707107
    uHaarM 2
1  1  1  1
1  1 _1 _1
1 _1  0  0
0  0  1 _1

Wrapped up as transforms:

    uhaar=: +/ .*~ uHaarM@(2 ^. #)
    iuhaar=: +/ .*~ %.@uHaarM@(2 ^. #)

And the normalized versions follow the same pattern (except no 'u' in
the names nor definitions)

Revisiting my (not normalized) original definitions, to get things in
the proper order, they should have been:

    Haar=: _2&(Haar^:(1<#)@(+/\), -/\)

and

    iHaar -:@(+/,@,.-/)@(,:~iHaar^:(1<#))/@($~ 2,-:@#)

I need to think a bit more about whether these versions should be
normalized - normalizing makes them significantly more complex:

    (haar % uhaar) p: i.2
0.5 0.707107
    (haar % uhaar) p: i.4
0.353553 0.5 0.707107 0.707107
    (haar % uhaar) p: i.8
0.25 0.353553 0.5 0.5 0.707107 0.707107 0.707107 0.707107

Anyways, I've probably gone way past the saturation point on this
particular wavelet, and I should probably be looking at other
wavelets, instead.

Thanks,




---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to