pub struct AtlasLabel {
pub e1: i8,
pub e2: i8,
pub e3: i8,
pub d45: i8,
pub e6: i8,
pub e7: i8,
}Expand description
An Atlas label: 6-tuple identifying a resonance class.
§Coordinate System
e1, e2, e3: Binary coordinates (0 or 1)d45: Ternary coordinate (-1, 0, or +1) representing e₄ - e₅e6, e7: Binary coordinates (0 or 1)
§Examples
use atlas_embeddings::foundations::resonance::AtlasLabel;
// Create label (0,0,0,0,0,0) - the "origin" vertex
let origin = AtlasLabel::new(0, 0, 0, 0, 0, 0);
assert!(origin.is_valid());
// Create label with ternary coordinate
let label = AtlasLabel::new(1, 0, 1, 1, 0, 1);
assert!(label.is_valid());
assert_eq!(label.d45(), 1);
// Invalid ternary value
let invalid = AtlasLabel::new(0, 0, 0, 2, 0, 0);
assert!(!invalid.is_valid());Fields§
§e1: i8First coordinate (binary: 0 or 1)
e2: i8Second coordinate (binary: 0 or 1)
e3: i8Third coordinate (binary: 0 or 1)
d45: i8Difference d₄₅ = e₄ - e₅ (ternary: -1, 0, or +1)
e6: i8Sixth coordinate (binary: 0 or 1)
e7: i8Seventh coordinate (binary: 0 or 1)
Implementations§
Source§impl AtlasLabel
impl AtlasLabel
Sourcepub const fn is_valid(&self) -> bool
pub const fn is_valid(&self) -> bool
Check if this label is valid.
Validity conditions:
- Binary coordinates in {0, 1}
- Ternary coordinate in {-1, 0, +1}
Sourcepub const fn binary_weight(&self) -> usize
pub const fn binary_weight(&self) -> usize
Count the number of 1’s in the binary coordinates.
This is used in determining adjacency and other properties.
Trait Implementations§
Source§impl Clone for AtlasLabel
impl Clone for AtlasLabel
Source§fn clone(&self) -> AtlasLabel
fn clone(&self) -> AtlasLabel
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AtlasLabel
impl Debug for AtlasLabel
Source§impl Hash for AtlasLabel
impl Hash for AtlasLabel
Source§impl PartialEq for AtlasLabel
impl PartialEq for AtlasLabel
impl Copy for AtlasLabel
impl Eq for AtlasLabel
impl StructuralPartialEq for AtlasLabel
Auto Trait Implementations§
impl Freeze for AtlasLabel
impl RefUnwindSafe for AtlasLabel
impl Send for AtlasLabel
impl Sync for AtlasLabel
impl Unpin for AtlasLabel
impl UnwindSafe for AtlasLabel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more