wavelib

package module
v0.0.0-...-36642dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2021 License: CC0-1.0 Imports: 4 Imported by: 0

README

GoDoc

Example

	rand.Seed(0)
	obj := WaveInit("bior3.5")
	defer obj.Free()

	input := make([]float64, 256)
	for idx := range input {
		input[idx] = rand.Float64()
	}

	wt := WTInit(obj, "swt", 256, 1)
	defer wt.Free()

	SetWTConv(wt, "direct")
	SWT(wt, input)
	for _, value := range wt.Output() {
		fmt.Printf("%g\n", value)
	}

	output := make([]float64, 256)
	ISWT(wt, output)

	diff := make([]float64, 256)
	for i := 0; i < wt.SigLength(); i++ {
		diff[i] = output[i] - input[i]
	}

	fmt.Printf("\n MAX %g \n", absMax(diff))
	WTSummary(wt)

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ISWT

func ISWT(wt WTObject, swtop []float64)

func SWT

func SWT(wt WTObject, inp []float64)
Example

analog of https://github.com/rafat/wavelib/wiki/SWT-Example-Code

rand.Seed(0)
obj := WaveInit("bior3.5")
defer obj.Free()

input := make([]float64, 256)
for idx := range input {
	input[idx] = rand.Float64()
}

wt := WTInit(obj, "swt", 256, 1)
defer wt.Free()

SetWTConv(wt, "direct")
SWT(wt, input)
for _, value := range wt.Output() {
	fmt.Printf("%g\n", value)
}

output := make([]float64, 256)
ISWT(wt, output)

diff := make([]float64, 256)
for i := 0; i < wt.SigLength(); i++ {
	diff[i] = output[i] - input[i]
}

fmt.Printf("\n MAX %g \n", absMax(diff))
WTSummary(wt)
Output:

func SetWTConv

func SetWTConv(wt WTObject, cmethod string)

func WTFree

func WTFree(wt WTObject)

func WTSummary

func WTSummary(wt WTObject)

func WaveFree

func WaveFree(obj WaveObject)

Types

type WTObject

type WTObject struct {
	C_WTObject C.wt_object
}

func WTInit

func WTInit(wave WaveObject, method string, sigLength int, j int) WTObject

func (WTObject) Free

func (wt WTObject) Free()

func (WTObject) OutLength

func (wt WTObject) OutLength() int

func (WTObject) Output

func (wt WTObject) Output() []float64

func (WTObject) SigLength

func (wt WTObject) SigLength() int

type WaveObject

type WaveObject struct {
	C_WaveObject C.wave_object
}

func WaveInit

func WaveInit(name string) WaveObject

func (WaveObject) Free

func (obj WaveObject) Free()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL