pub struct GraphCostModel {
pub node_costs: HashMap<usize, OperationCost>,
pub total_cost: OperationCost,
pub metadata: HashMap<String, String>,
}Expand description
Cost model for an entire graph.
Fields§
§node_costs: HashMap<usize, OperationCost>Cost annotations per node (indexed by node index)
total_cost: OperationCostTotal estimated cost
metadata: HashMap<String, String>Cost model metadata
Implementations§
Source§impl GraphCostModel
impl GraphCostModel
Sourcepub fn set_node_cost(&mut self, node_idx: usize, cost: OperationCost)
pub fn set_node_cost(&mut self, node_idx: usize, cost: OperationCost)
Add a cost annotation for a node.
Sourcepub fn get_node_cost(&self, node_idx: usize) -> Option<&OperationCost>
pub fn get_node_cost(&self, node_idx: usize) -> Option<&OperationCost>
Get the cost annotation for a node.
Sourcepub fn compute_total_cost(&mut self, graph: &EinsumGraph)
pub fn compute_total_cost(&mut self, graph: &EinsumGraph)
Compute the total cost based on node costs and graph structure.
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add metadata to the cost model.
Sourcepub fn summary(&self) -> CostSummary
pub fn summary(&self) -> CostSummary
Get a summary of the cost model.
Trait Implementations§
Source§impl Clone for GraphCostModel
impl Clone for GraphCostModel
Source§fn clone(&self) -> GraphCostModel
fn clone(&self) -> GraphCostModel
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 GraphCostModel
impl Debug for GraphCostModel
Source§impl Default for GraphCostModel
impl Default for GraphCostModel
Source§impl<'de> Deserialize<'de> for GraphCostModel
impl<'de> Deserialize<'de> for GraphCostModel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 PartialEq for GraphCostModel
impl PartialEq for GraphCostModel
Source§impl Serialize for GraphCostModel
impl Serialize for GraphCostModel
impl StructuralPartialEq for GraphCostModel
Auto Trait Implementations§
impl Freeze for GraphCostModel
impl RefUnwindSafe for GraphCostModel
impl Send for GraphCostModel
impl Sync for GraphCostModel
impl Unpin for GraphCostModel
impl UnwindSafe for GraphCostModel
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