FerroWave · guides
Getting started
Add ferro-wave to a Cargo workspace and decompose your first signal.
This guide walks through wiring ferro-wave into a Cargo workspace and
running a multi-resolution decomposition on a price series end-to-end.
Add the dependency
Add ferro-wave to your crate's Cargo.toml from the approved MorphIQ package
source for your workspace:
[dependencies]
ferro-wave = { version = "0.14" }
ferro-wave-finance = { version = "0.14" }Decompose a signal
A discrete wavelet transform decomposes a signal of length into one approximation band and detail bands :
Each detail band captures variation at scale . In code:
use ferro_wave::dwt::{Wavelet, decompose};
let signal: Vec<f64> = load_log_returns();
let levels = 5;
let mra = decompose(&signal, Wavelet::Db4, levels)?;
for (j, detail) in mra.details().iter().enumerate() {
println!("level {}: energy = {:.4}", j + 1, detail.energy());
}The transform is allocation-free past initial buffer setup and pure — the same inputs always produce the same output, which makes it safe to use on the hot path of a backtest or live regime detector.
Choosing a wavelet
- Daubechies (
Db2–Db20) — orthogonal, compact support, the default for return-series work.Db4is a reasonable starting point. - Symlets (
Sym4–Sym8) — near-symmetric Daubechies variants, useful when phase distortion matters. - Coiflets (
Coif1–Coif5) — higher vanishing moments per filter length, good for smooth signal approximation.
Match the vanishing moments of the wavelet to the polynomial order of the trend you want the approximation band to absorb.
Next steps
Read the MRA reference for the full multi-resolution API, or the regime primitives reference for the change-point and scale-energy estimators downstream products consume.