Skip to main content

T3

Struct T3 

Source
pub struct T3 { /* private fields */ }
Expand description

A 3-dimensional trust tensor with fractal sub-dimension support

Implementations§

Source§

impl T3

Source

pub fn new() -> Self

Create a new T3 with neutral trust (0.5) and zero confidence

Source

pub fn with_scores(scores: [f64; 3]) -> Result<Self>

Create a T3 with specific initial root scores

Source

pub fn from_parts(scores: [f64; 3], observation_counts: [u64; 3]) -> Self

Reconstruct a T3 from persisted parts: root scores + per-dimension observation counts. Weights are recomputed from the counts using the same logarithmic formula as T3::apply_delta/T3::observe, so a tensor that is saved and re-loaded keeps its confidence without having to replay its observation history. Scores are clamped to [0, 1].

This is the persistence-round-trip constructor used by at-rest stores (e.g. sealed EntityTrust files): the serialized form carries the three root scores plus their observation counts, and this rebuilds the exact tensor state. Sub-dimensions are not part of the persisted parts and are initialized empty.

Source

pub fn score(&self, dimension: TrustDimension) -> f64

Get the score for a root dimension

Source

pub fn weight(&self, dimension: TrustDimension) -> f64

Get the weight (confidence) for a root dimension

Source

pub fn observation_counts(&self) -> &[u64; 3]

Get all per-dimension observation counts.

Exposes the raw evidence counts so persistence layers can serialize and later restore confidence via T3::from_parts. Weights are a pure function of these counts, so this is sufficient to round-trip state.

Source

pub fn scores(&self) -> &[f64; 3]

Get all root dimension scores

Source

pub fn weights(&self) -> &[f64; 3]

Get all weights

Source

pub fn sub_dimensions(&self) -> &HashMap<String, SubDimensionScore>

Get sub-dimensions map

Source

pub fn apply_delta(&mut self, dimension: TrustDimension, delta: f64) -> f64

Record an observation for a root dimension

Uses exponential moving average with decay factor based on observation count Apply a signed reputation delta directly to a dimension, clamped to [0, 1], counting it as one observation. This is how a ReputationDelta from an R7 action outcome — e.g. a missed deadline debiting Temperament — folds into the tensor. Returns the realized change after clamping.

Source

pub fn observe( &mut self, dimension: TrustDimension, observed_score: f64, ) -> Result<()>

Source

pub fn observe_sub_dimension( &mut self, name: &str, parent: TrustDimension, observed_score: f64, ) -> Result<()>

Record an observation for a sub-dimension

Sub-dimensions are keyed by name and linked to a root dimension. Uses the same EMA math as root dimensions.

Source

pub fn aggregate(&self) -> f64

Compute the aggregate trust score (weighted geometric mean)

Geometric mean ensures that a zero in any dimension zeros the total, reflecting that trust requires all dimensions to be positive.

Source

pub fn distance(&self, other: &T3) -> f64

Compute Euclidean distance to another T3

Source

pub fn merge(&self, other: &T3) -> Self

Merge with another T3 using weighted average

The merge is weighted by the observation counts in each tensor

Source

pub fn decay(&mut self, decay_factor: f64)

Apply time decay to the tensor

Trust that isn’t reinforced decays toward neutral (0.5) over time. The decay_factor should be in (0, 1), where smaller = faster decay.

Source

pub fn meets_thresholds(&self, min_scores: &[f64; 3]) -> bool

Check if trust meets minimum thresholds

Trait Implementations§

Source§

impl Clone for T3

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for T3

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for T3

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for T3

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for T3

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for T3

§

impl RefUnwindSafe for T3

§

impl Send for T3

§

impl Sync for T3

§

impl Unpin for T3

§

impl UnsafeUnpin for T3

§

impl UnwindSafe for T3

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V