Skip to main content

quant_codec_core/
eval.rs

1#[cfg(feature = "serde")]
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, PartialEq)]
5#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
6pub struct EvalReport {
7    pub mse: Option<f64>,
8    pub cosine_similarity: Option<f64>,
9    pub max_abs_error: Option<f64>,
10    pub bytes_exact: u64,
11    pub bytes_encoded: u64,
12    pub passed: bool,
13    pub notes: Vec<String>,
14}
15
16impl EvalReport {
17    pub fn exact(bytes_exact: u64) -> Self {
18        Self {
19            mse: Some(0.0),
20            cosine_similarity: Some(1.0),
21            max_abs_error: Some(0.0),
22            bytes_exact,
23            bytes_encoded: bytes_exact,
24            passed: true,
25            notes: vec!["exact representation".to_string()],
26        }
27    }
28}