Bring the whole workspace into compliance with the repo's rustfmt config (edition 2024, max_width 100, use_small_heuristics = "Max"), which had drifted across many crates. Pure formatting — no logic changes; `cargo fmt --check` is now clean and `cargo build --workspace` is green.
15 lines
611 B
Rust
15 lines
611 B
Rust
use lawsynth_regime::{SegmentationConfig, TransitionMatrix, pelt};
|
|
fn main() {
|
|
let signal = [0.0, 0.1, -0.1, 4.9, 5.0, 5.1];
|
|
let segmentation = pelt(&signal, SegmentationConfig { penalty: 0.5, min_segment_len: 2 })
|
|
.expect("valid signal");
|
|
let states: Vec<usize> = (0..signal.len()).map(|i| segmentation.label_at(i).unwrap()).collect();
|
|
let transitions =
|
|
TransitionMatrix::from_states(&states, segmentation.segments.len()).expect("labels");
|
|
println!(
|
|
"change points: {:?}; transitions: {:?}",
|
|
segmentation.change_points(),
|
|
transitions.counts
|
|
);
|
|
}
|