Skip to main content

MethodVectorAlgebraReport

Struct MethodVectorAlgebraReport 

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

Observable runtime vector-algebra results for two methods.

§Examples

use whitaker_common::test_support::decomposition::{MethodInput, method_vector_algebra, profile};

let left = profile(MethodInput {
    name: "parse_tokens",
    fields: &["grammar"],
    signature_types: &[],
    local_types: &[],
    domains: &[],
});
let right = profile(MethodInput {
    name: "parse_nodes",
    fields: &["grammar"],
    signature_types: &[],
    local_types: &[],
    domains: &[],
});

let report = method_vector_algebra(&left, &right);
assert_eq!(report.left_dot_right(), report.right_dot_left());
assert!(report.left_norm_squared() > 0);

Implementations§

Source§

impl MethodVectorAlgebraReport

Source

pub fn left_dot_right(self) -> u64

Returns the result of MethodVectorAlgebraReport::left_dot_right.

This is the dot product of the left and right method vectors.

use whitaker_common::test_support::decomposition::{MethodInput, method_vector_algebra, profile};

let left = profile(MethodInput {
    name: "parse_tokens",
    fields: &["grammar"],
    signature_types: &[],
    local_types: &[],
    domains: &[],
});
let right = profile(MethodInput {
    name: "parse_nodes",
    fields: &["grammar"],
    signature_types: &[],
    local_types: &[],
    domains: &[],
});

let report = method_vector_algebra(&left, &right);
assert_eq!(report.left_dot_right(), 40);
Source

pub fn right_dot_left(self) -> u64

Returns the result of MethodVectorAlgebraReport::right_dot_left.

This is the dot product of the right and left method vectors.

use whitaker_common::test_support::decomposition::{MethodInput, method_vector_algebra, profile};

let left = profile(MethodInput {
    name: "parse_tokens",
    fields: &["grammar"],
    signature_types: &[],
    local_types: &[],
    domains: &[],
});
let right = profile(MethodInput {
    name: "parse_nodes",
    fields: &["grammar"],
    signature_types: &[],
    local_types: &[],
    domains: &[],
});

let report = method_vector_algebra(&left, &right);
assert_eq!(report.right_dot_left(), 40);
Source

pub fn left_norm_squared(self) -> u64

Returns the result of MethodVectorAlgebraReport::left_norm_squared.

This is the squared L2 norm of the left method vector.

use whitaker_common::test_support::decomposition::{MethodInput, method_vector_algebra, profile};

let left = profile(MethodInput {
    name: "parse_tokens",
    fields: &["grammar"],
    signature_types: &[],
    local_types: &[],
    domains: &[],
});
let right = profile(MethodInput {
    name: "parse_nodes",
    fields: &["grammar"],
    signature_types: &[],
    local_types: &[],
    domains: &[],
});

let report = method_vector_algebra(&left, &right);
assert_eq!(report.left_norm_squared(), 44);
Source

pub fn right_norm_squared(self) -> u64

Returns the result of MethodVectorAlgebraReport::right_norm_squared.

This is the squared L2 norm of the right method vector.

use whitaker_common::test_support::decomposition::{MethodInput, method_vector_algebra, profile};

let left = profile(MethodInput {
    name: "parse_tokens",
    fields: &["grammar"],
    signature_types: &[],
    local_types: &[],
    domains: &[],
});
let right = profile(MethodInput {
    name: "parse_nodes",
    fields: &["grammar"],
    signature_types: &[],
    local_types: &[],
    domains: &[],
});

let report = method_vector_algebra(&left, &right);
assert_eq!(report.right_norm_squared(), 44);

Trait Implementations§

Source§

impl Clone for MethodVectorAlgebraReport

Source§

fn clone(&self) -> MethodVectorAlgebraReport

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 Copy for MethodVectorAlgebraReport

Source§

impl Debug for MethodVectorAlgebraReport

Source§

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

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

impl Eq for MethodVectorAlgebraReport

Source§

impl PartialEq for MethodVectorAlgebraReport

Source§

fn eq(&self, other: &MethodVectorAlgebraReport) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MethodVectorAlgebraReport

Auto Trait Implementations§

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> AnyEq for T
where T: Any + PartialEq,

Source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn as_any(&self) -> &(dyn Any + 'static)

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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.