gammalooprs/uv/
renormalization.rs1use std::{fmt, ops::Deref};
2
3use symbolica::atom::Atom;
4
5#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
6pub struct RenormalizationStats {
7 pub forest_node_count: usize,
8}
9
10#[derive(Clone, Debug)]
11pub struct RenormalizationPart {
12 pub expression: Atom,
13 pub stats: RenormalizationStats,
14}
15
16impl RenormalizationPart {
17 pub(crate) fn legacy(expression: Atom) -> Self {
18 Self {
19 expression,
20 stats: RenormalizationStats::default(),
21 }
22 }
23
24 pub(crate) fn new(expression: Atom, forest_node_count: usize) -> Self {
25 Self {
26 expression,
27 stats: RenormalizationStats { forest_node_count },
28 }
29 }
30}
31
32impl Deref for RenormalizationPart {
33 type Target = Atom;
34
35 fn deref(&self) -> &Self::Target {
36 &self.expression
37 }
38}
39
40impl fmt::Display for RenormalizationPart {
41 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
42 self.expression.fmt(f)
43 }
44}
45
46impl PartialEq for RenormalizationPart {
47 fn eq(&self, other: &Self) -> bool {
48 self.expression == other.expression
49 }
50}
51
52impl Eq for RenormalizationPart {}