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
impl MethodVectorAlgebraReport
Sourcepub fn left_dot_right(self) -> u64
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);Sourcepub fn right_dot_left(self) -> u64
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);Sourcepub fn left_norm_squared(self) -> u64
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);Sourcepub fn right_norm_squared(self) -> u64
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
impl Clone for MethodVectorAlgebraReport
Source§fn clone(&self) -> MethodVectorAlgebraReport
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for MethodVectorAlgebraReport
Source§impl Debug for MethodVectorAlgebraReport
impl Debug for MethodVectorAlgebraReport
impl Eq for MethodVectorAlgebraReport
impl StructuralPartialEq for MethodVectorAlgebraReport
Auto Trait Implementations§
impl Freeze for MethodVectorAlgebraReport
impl RefUnwindSafe for MethodVectorAlgebraReport
impl Send for MethodVectorAlgebraReport
impl Sync for MethodVectorAlgebraReport
impl Unpin for MethodVectorAlgebraReport
impl UnsafeUnpin for MethodVectorAlgebraReport
impl UnwindSafe for MethodVectorAlgebraReport
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