The cl-wavelets Reference Manual

This is the cl-wavelets Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 15:51:46 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 cl-wavelets

Wavelet transform library

Author

Vasily Postnicov <>

License

2-clause BSD

Version

0.1

Dependencies
  • alexandria (system).
  • serapeum (system).
Source

cl-wavelets.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 cl-wavelets/cl-wavelets.asd

Source

cl-wavelets.asd.

Parent Component

cl-wavelets (system).

ASDF Systems

cl-wavelets.


3.1.2 cl-wavelets/package.lisp

Source

cl-wavelets.asd.

Parent Component

cl-wavelets (system).

Packages

cl-wavelets.


3.1.3 cl-wavelets/types.lisp

Dependency

package.lisp (file).

Source

cl-wavelets.asd.

Parent Component

cl-wavelets (system).

Internals

3.1.4 cl-wavelets/aref.lisp

Dependency

types.lisp (file).

Source

cl-wavelets.asd.

Parent Component

cl-wavelets (system).

Internals

3.1.5 cl-wavelets/lifting.lisp

Dependency

aref.lisp (file).

Source

cl-wavelets.asd.

Parent Component

cl-wavelets (system).

Public Interface

get-wavelets (function).

Internals

3.1.6 cl-wavelets/phases.lisp

Dependency

lifting.lisp (file).

Source

cl-wavelets.asd.

Parent Component

cl-wavelets (system).

Internals

3.1.7 cl-wavelets/dwt.lisp

Dependency

phases.lisp (file).

Source

cl-wavelets.asd.

Parent Component

cl-wavelets (system).

Public Interface
Internals

clamp-steps (function).


3.1.8 cl-wavelets/freqdomain.lisp

Dependency

dwt.lisp (file).

Source

cl-wavelets.asd.

Parent Component

cl-wavelets (system).

Public Interface
Internals

pwt-freq (function).


3.1.9 cl-wavelets/pwt.lisp

Dependency

freqdomain.lisp (file).

Source

cl-wavelets.asd.

Parent Component

cl-wavelets (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 cl-wavelets

Source

package.lisp.

Nickname

wavelets

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *threshold*

Default value for an argument to @c(make-threshold-cost).

Package

cl-wavelets.

Source

pwt.lisp.


5.1.2 Ordinary functions

Function: basis-key=>bit-vector (basis-key)

Transform a basis key returned from @c(pwt) or @c(pwt!) to a bit vector form.

Package

cl-wavelets.

Source

pwt.lisp.

Function: bit-vector=>basis-key (vector)

Transform a bit vector to a basis key.

Package

cl-wavelets.

Source

pwt.lisp.

Function: dwt (array &key wavelet boundary-style steps)

This function is a non-destructive equivalent of @c(dwt!) function

Package

cl-wavelets.

Source

dwt.lisp.

Function: dwt! (array &key wavelet boundary-style steps)

Perform in-place DWT transform on array of integer samples. Meaning of key arguments:
@begin(enum)
@item(@c(wavelet) Wavelet to use. Consult @ref[id=wavelets](wavelets) section of this manual to know possible values of this argument.) @item(@c(boundary-style) Determines how the signal is extended beyond array boundaries. Can be @c(:zero) or
@c(:mirror). Usually @c(:mirror) gives better results, but is a little slower.)
@item(@c(steps) Specify the number of filtering and downsampling steps taken to perform the transform. This value can be negative or zero. Zero means the full DWT transform and a negative value means @i(maximal dwt steps) - @c((abs steps)).) @end(enum)

Package

cl-wavelets.

Source

dwt.lisp.

Function: dwt-inverse (array &key wavelet boundary-style steps)

This function is a non-destructive equivalent of @c(dwt-inverse!) function

Package

cl-wavelets.

Source

dwt.lisp.

Function: dwt-inverse! (array &key wavelet boundary-style steps)

Perform in-place inversion of DWT transform. The @c(wavelet), @c(boundary-style) and @c(steps) arguments must be the same as for the corresponding call to DWT! function

Package

cl-wavelets.

Source

dwt.lisp.

Function: frequency-domain (array &key wavelet boundary-style)

Translate a signal in frequency domain using PWT. This is a non-destructive version of @c(frequency-domain!).

Package

cl-wavelets.

Source

freqdomain.lisp.

Function: frequency-domain! (array &key wavelet boundary-style)

Translate a signal into frequency domain using PWT. @c(wavelet) and @c(boundary-style) have the same meaning as in @c(dwt!). This function modifies the @c(array).

@b(NB): CDF-4-2 gives very poor results for the reasons yet unknown. Do not use it. CDF-2-2 seems to be the best.

Package

cl-wavelets.

Source

freqdomain.lisp.

Function: get-wavelets ()

Get a list of available wavelets

Package

cl-wavelets.

Source

lifting.lisp.

Function: make-threshold-cost (&optional threshold)

Make a cost function which depends on the number of items whose magnitude is greater than @c(threshold).

Package

cl-wavelets.

Source

pwt.lisp.

Function: pwt (array &key wavelet boundary-style cost)

This function is a non-destructive version of @c(pwt!).

Package

cl-wavelets.

Source

pwt.lisp.

Function: pwt! (array &key wavelet boundary-style cost)

Perform a best-basis PWT transform of an @c(array). Unlike DWT which has a fixed basis of scaled and translated mother wavelet functions and a scaling function, this transform picks the best basis, minimizing the @c(cost) function over possible results. The meaning of @c(wavelet) and @c(boundary-style) arguments is the same as for DWT. See the documentation for @c(dwt!) for information.

Two values are returned: the first is a transformed array and the second is a basis key object which must be passed to @c(pwt-inverse!) or @c(pwt-inverse) to invert the transform.

This function modifies its first argument.

Package

cl-wavelets.

Source

pwt.lisp.

Function: pwt-inverse (array basis-key &key wavelet boundary-style)

This is a non-destructive version of @c(pwt-inverse!).

Package

cl-wavelets.

Source

pwt.lisp.

Function: pwt-inverse! (array basis-key &key wavelet boundary-style)

Inverse the PWT. The @c(array) and @c(basis-key) must match the values returned by @c(pwt!) or @c(pwt). @c(wavelet) and @c(boundary-style) must also match their counterparts used for the forward transform.

Package

cl-wavelets.

Source

pwt.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *aref-func*

Current aref style

Package

cl-wavelets.

Source

aref.lisp.

Special Variable: *cost-func*
Package

cl-wavelets.

Source

pwt.lisp.

Special Variable: *forward-table*

Table of wavelets used for forward transform

Package

cl-wavelets.

Source

lifting.lisp.

Special Variable: *inverse-table*

Table of wavelets used for inverse transform

Package

cl-wavelets.

Source

lifting.lisp.

Special Variable: *lifting-func*

Current wavelet transform function

Package

cl-wavelets.

Source

lifting.lisp.


5.2.2 Macros

Macro: def-lifting-scheme ((name alias direction) &body body)

Define a function with the name ‘NAME‘ which performs one step of discrete wavelet transform (DWT, PWT) using lifting scheme. ‘ALIAS‘ is a keyword associated with this function which can be later used with ‘dwt‘ or ‘dwt-inverse‘ functions. Direction must be either ‘:FORWARD‘ or ‘INVERSE‘.

The body of the lifting scheme consists of several expressions, each such expression represents a lifting step (called prediction and update in literature). In each expression you can manipulate with ‘ODD‘, ‘EVEN‘, ‘ODD-1‘, ‘EVEN-1‘, ‘ODD+1‘ and ‘EVEN+1‘ variables, representing the odd sample, the even sample, the previous and the next odd/even samples respectively.

TODO: Allow access to n-th odd or even sample.

Package

cl-wavelets.

Source

lifting.lisp.

Macro: with-lifting-scheme ((lifting aref-style &key inverse) &body body)

Set @c(*lifting-func*) and @c(*aref-func*) parameters to desired value.

Package

cl-wavelets.

Source

lifting.lisp.


5.2.3 Ordinary functions

Function: aref-extended (array idx &key start end)

This function works just like aref, but allows for idx to be any integer number, not just one for which start <= idx < end holds. The way how this function extends array out of its bounds depends on value of *AREF-FUNC*.

Package

cl-wavelets.

Source

aref.lisp.

Function: aref-mirror-1 (array idx &key start end)

’Mirror’ content of an array from its borders mapping even indices to even indices and odd indices to odd indices, so array[-1] == array[1] and array[len] == array[len-2].

This function can be used to create a continous infinite signal from a signal with compact support in time domain for using in lifting scheme or in two-filters algorithm with symmetric filters with odd number of coefficients

Package

cl-wavelets.

Source

aref.lisp.

Function: aref-mirror-2 (array idx &key start end)

’Mirror’ content of an array from its borders, ’doubling’ the elements at the borders, so array[-1] == array[0] and array[len] == array[len-1].

This function can be used to create a continous infinite signal for the wavelet transform using symmetric wavelets with even number of coefficients and two-filters algorithm.

Package

cl-wavelets.

Source

aref.lisp.

Function: aref-periodic (array idx &key start end)

Create an infinite sequence from an array by making the content of an array periodic. Can be used with two-filters algorithm and all wavelets.

Package

cl-wavelets.

Source

aref.lisp.

Function: aref-zero (array idx &key start end)

Return zero for out-of-bounds array reads. Can be used for every wavelet and every DWT/PWT algorithm

Package

cl-wavelets.

Source

aref.lisp.

Function: build-tree (array)
Package

cl-wavelets.

Source

pwt.lisp.

Function: cdf-2-2 (array &key start end)
Package

cl-wavelets.

Source

lifting.lisp.

Function: cdf-3-1 (array &key start end)
Package

cl-wavelets.

Source

lifting.lisp.

Function: cdf-4-2 (array &key start end)
Package

cl-wavelets.

Source

lifting.lisp.

Function: check-power-of-2 (x)

Check if the argument is a power of two.

Package

cl-wavelets.

Source

phases.lisp.

Function: clamp-steps (steps max-steps)
Package

cl-wavelets.

Source

dwt.lisp.

Function: collect-preferred (node &optional acc)
Package

cl-wavelets.

Source

pwt.lisp.

Function: concatenate-into (array array-list)
Package

cl-wavelets.

Source

pwt.lisp.

Function: copy-pwt-node (instance)
Package

cl-wavelets.

Source

pwt.lisp.

Function: get-basis-key (node)
Package

cl-wavelets.

Source

pwt.lisp.

Function: get-boundary-style-lifting (symbol)
Package

cl-wavelets.

Source

aref.lisp.

Function: get-forward-transform (symbol)
Package

cl-wavelets.

Source

lifting.lisp.

Function: get-inverse-transform (symbol)
Package

cl-wavelets.

Source

lifting.lisp.

Function: haar (array &key start end)
Package

cl-wavelets.

Source

lifting.lisp.

Function: inv-cdf-2-2 (array &key start end)
Package

cl-wavelets.

Source

lifting.lisp.

Function: inv-cdf-3-1 (array &key start end)
Package

cl-wavelets.

Source

lifting.lisp.

Function: inv-cdf-4-2 (array &key start end)
Package

cl-wavelets.

Source

lifting.lisp.

Function: inv-haar (array &key start end)
Package

cl-wavelets.

Source

lifting.lisp.

Function: make-pwt-node (&key data low-pass high-pass cost preferred)
Package

cl-wavelets.

Source

pwt.lisp.

Function: make-tmp-array (length)

Make temporary array for PHASE-SPLIT and PHASE-MIX functions

Package

cl-wavelets.

Source

phases.lisp.

Function: phase-mix (array &key start end tmp)

Interleave even and odd samples in the array

Package

cl-wavelets.

Source

phases.lisp.

Function: phase-split (array &key start end inverse tmp)

Split even and odd samples in the array. If INVERSE is T, higher frequencies subband will be stored before lower frequencies subband.

Package

cl-wavelets.

Source

phases.lisp.

Function: pwt-freq (array &key start end tmp inverse)
Package

cl-wavelets.

Source

freqdomain.lisp.

Reader: pwt-node-cost (instance)
Writer: (setf pwt-node-cost) (instance)
Package

cl-wavelets.

Source

pwt.lisp.

Target Slot

cost.

Reader: pwt-node-data (instance)
Writer: (setf pwt-node-data) (instance)
Package

cl-wavelets.

Source

pwt.lisp.

Target Slot

data.

Reader: pwt-node-high-pass (instance)
Writer: (setf pwt-node-high-pass) (instance)
Package

cl-wavelets.

Source

pwt.lisp.

Target Slot

high-pass.

Reader: pwt-node-low-pass (instance)
Writer: (setf pwt-node-low-pass) (instance)
Package

cl-wavelets.

Source

pwt.lisp.

Target Slot

low-pass.

Function: pwt-node-p (object)
Package

cl-wavelets.

Source

pwt.lisp.

Reader: pwt-node-preferred (instance)
Writer: (setf pwt-node-preferred) (instance)
Package

cl-wavelets.

Source

pwt.lisp.

Target Slot

preferred.


5.2.4 Structures

Structure: pwt-node
Package

cl-wavelets.

Source

pwt.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: data
Readers

pwt-node-data.

Writers

(setf pwt-node-data).

Slot: low-pass
Readers

pwt-node-low-pass.

Writers

(setf pwt-node-low-pass).

Slot: high-pass
Readers

pwt-node-high-pass.

Writers

(setf pwt-node-high-pass).

Slot: cost
Type

fixnum

Initform

0

Readers

pwt-node-cost.

Writers

(setf pwt-node-cost).

Slot: preferred
Type

boolean

Readers

pwt-node-preferred.

Writers

(setf pwt-node-preferred).


5.2.5 Types

Type: aref-function ()
Package

cl-wavelets.

Source

types.lisp.

Type: lifting-function ()
Package

cl-wavelets.

Source

types.lisp.

Type: sa-sb (bits)
Package

cl-wavelets.

Source

types.lisp.

Type: sb (bits)
Package

cl-wavelets.

Source

types.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   B   C   D   F   G   H   I   M   P   W  
Index Entry  Section

(
(setf pwt-node-cost): Private ordinary functions
(setf pwt-node-data): Private ordinary functions
(setf pwt-node-high-pass): Private ordinary functions
(setf pwt-node-low-pass): Private ordinary functions
(setf pwt-node-preferred): Private ordinary functions

A
aref-extended: Private ordinary functions
aref-mirror-1: Private ordinary functions
aref-mirror-2: Private ordinary functions
aref-periodic: Private ordinary functions
aref-zero: Private ordinary functions

B
basis-key=>bit-vector: Public ordinary functions
bit-vector=>basis-key: Public ordinary functions
build-tree: Private ordinary functions

C
cdf-2-2: Private ordinary functions
cdf-3-1: Private ordinary functions
cdf-4-2: Private ordinary functions
check-power-of-2: Private ordinary functions
clamp-steps: Private ordinary functions
collect-preferred: Private ordinary functions
concatenate-into: Private ordinary functions
copy-pwt-node: Private ordinary functions

D
def-lifting-scheme: Private macros
dwt: Public ordinary functions
dwt!: Public ordinary functions
dwt-inverse: Public ordinary functions
dwt-inverse!: Public ordinary functions

F
frequency-domain: Public ordinary functions
frequency-domain!: Public ordinary functions
Function, (setf pwt-node-cost): Private ordinary functions
Function, (setf pwt-node-data): Private ordinary functions
Function, (setf pwt-node-high-pass): Private ordinary functions
Function, (setf pwt-node-low-pass): Private ordinary functions
Function, (setf pwt-node-preferred): Private ordinary functions
Function, aref-extended: Private ordinary functions
Function, aref-mirror-1: Private ordinary functions
Function, aref-mirror-2: Private ordinary functions
Function, aref-periodic: Private ordinary functions
Function, aref-zero: Private ordinary functions
Function, basis-key=>bit-vector: Public ordinary functions
Function, bit-vector=>basis-key: Public ordinary functions
Function, build-tree: Private ordinary functions
Function, cdf-2-2: Private ordinary functions
Function, cdf-3-1: Private ordinary functions
Function, cdf-4-2: Private ordinary functions
Function, check-power-of-2: Private ordinary functions
Function, clamp-steps: Private ordinary functions
Function, collect-preferred: Private ordinary functions
Function, concatenate-into: Private ordinary functions
Function, copy-pwt-node: Private ordinary functions
Function, dwt: Public ordinary functions
Function, dwt!: Public ordinary functions
Function, dwt-inverse: Public ordinary functions
Function, dwt-inverse!: Public ordinary functions
Function, frequency-domain: Public ordinary functions
Function, frequency-domain!: Public ordinary functions
Function, get-basis-key: Private ordinary functions
Function, get-boundary-style-lifting: Private ordinary functions
Function, get-forward-transform: Private ordinary functions
Function, get-inverse-transform: Private ordinary functions
Function, get-wavelets: Public ordinary functions
Function, haar: Private ordinary functions
Function, inv-cdf-2-2: Private ordinary functions
Function, inv-cdf-3-1: Private ordinary functions
Function, inv-cdf-4-2: Private ordinary functions
Function, inv-haar: Private ordinary functions
Function, make-pwt-node: Private ordinary functions
Function, make-threshold-cost: Public ordinary functions
Function, make-tmp-array: Private ordinary functions
Function, phase-mix: Private ordinary functions
Function, phase-split: Private ordinary functions
Function, pwt: Public ordinary functions
Function, pwt!: Public ordinary functions
Function, pwt-freq: Private ordinary functions
Function, pwt-inverse: Public ordinary functions
Function, pwt-inverse!: Public ordinary functions
Function, pwt-node-cost: Private ordinary functions
Function, pwt-node-data: Private ordinary functions
Function, pwt-node-high-pass: Private ordinary functions
Function, pwt-node-low-pass: Private ordinary functions
Function, pwt-node-p: Private ordinary functions
Function, pwt-node-preferred: Private ordinary functions

G
get-basis-key: Private ordinary functions
get-boundary-style-lifting: Private ordinary functions
get-forward-transform: Private ordinary functions
get-inverse-transform: Private ordinary functions
get-wavelets: Public ordinary functions

H
haar: Private ordinary functions

I
inv-cdf-2-2: Private ordinary functions
inv-cdf-3-1: Private ordinary functions
inv-cdf-4-2: Private ordinary functions
inv-haar: Private ordinary functions

M
Macro, def-lifting-scheme: Private macros
Macro, with-lifting-scheme: Private macros
make-pwt-node: Private ordinary functions
make-threshold-cost: Public ordinary functions
make-tmp-array: Private ordinary functions

P
phase-mix: Private ordinary functions
phase-split: Private ordinary functions
pwt: Public ordinary functions
pwt!: Public ordinary functions
pwt-freq: Private ordinary functions
pwt-inverse: Public ordinary functions
pwt-inverse!: Public ordinary functions
pwt-node-cost: Private ordinary functions
pwt-node-data: Private ordinary functions
pwt-node-high-pass: Private ordinary functions
pwt-node-low-pass: Private ordinary functions
pwt-node-p: Private ordinary functions
pwt-node-preferred: Private ordinary functions

W
with-lifting-scheme: Private macros


A.4 Data types

Jump to:   A   C   D   F   L   P   S   T  
Index Entry  Section

A
aref-function: Private types
aref.lisp: The cl-wavelets/aref․lisp file

C
cl-wavelets: The cl-wavelets system
cl-wavelets: The cl-wavelets package
cl-wavelets.asd: The cl-wavelets/cl-wavelets․asd file

D
dwt.lisp: The cl-wavelets/dwt․lisp file

F
File, aref.lisp: The cl-wavelets/aref․lisp file
File, cl-wavelets.asd: The cl-wavelets/cl-wavelets․asd file
File, dwt.lisp: The cl-wavelets/dwt․lisp file
File, freqdomain.lisp: The cl-wavelets/freqdomain․lisp file
File, lifting.lisp: The cl-wavelets/lifting․lisp file
File, package.lisp: The cl-wavelets/package․lisp file
File, phases.lisp: The cl-wavelets/phases․lisp file
File, pwt.lisp: The cl-wavelets/pwt․lisp file
File, types.lisp: The cl-wavelets/types․lisp file
freqdomain.lisp: The cl-wavelets/freqdomain․lisp file

L
lifting-function: Private types
lifting.lisp: The cl-wavelets/lifting․lisp file

P
Package, cl-wavelets: The cl-wavelets package
package.lisp: The cl-wavelets/package․lisp file
phases.lisp: The cl-wavelets/phases․lisp file
pwt-node: Private structures
pwt.lisp: The cl-wavelets/pwt․lisp file

S
sa-sb: Private types
sb: Private types
Structure, pwt-node: Private structures
System, cl-wavelets: The cl-wavelets system

T
Type, aref-function: Private types
Type, lifting-function: Private types
Type, sa-sb: Private types
Type, sb: Private types
types.lisp: The cl-wavelets/types․lisp file