pub struct Graph<A> { /* private fields */ }
Expand description
Calculation graph based on petgraph::graph::Graph
Implementations
sourceimpl<A: Scalar> Graph<A>
impl<A: Scalar> Graph<A>
pub fn add(&mut self, lhs: NodeIndex, rhs: NodeIndex) -> NodeIndex
pub fn mul(&mut self, lhs: NodeIndex, rhs: NodeIndex) -> NodeIndex
pub fn div(&mut self, lhs: NodeIndex, rhs: NodeIndex) -> NodeIndex
pub fn pow(&mut self, lhs: NodeIndex, rhs: NodeIndex) -> NodeIndex
pub fn neg(&mut self, arg: NodeIndex) -> NodeIndex
pub fn square(&mut self, arg: NodeIndex) -> NodeIndex
pub fn exp(&mut self, arg: NodeIndex) -> NodeIndex
pub fn ln(&mut self, arg: NodeIndex) -> NodeIndex
pub fn sin(&mut self, arg: NodeIndex) -> NodeIndex
pub fn cos(&mut self, arg: NodeIndex) -> NodeIndex
pub fn tan(&mut self, arg: NodeIndex) -> NodeIndex
pub fn sinh(&mut self, arg: NodeIndex) -> NodeIndex
pub fn cosh(&mut self, arg: NodeIndex) -> NodeIndex
pub fn tanh(&mut self, arg: NodeIndex) -> NodeIndex
pub fn sub(&mut self, lhs: NodeIndex, rhs: NodeIndex) -> NodeIndex
pub fn constant(&mut self, value: A) -> NodeIndex
sourcepub fn empty_variable(&mut self, name: &str) -> Result<NodeIndex>
pub fn empty_variable(&mut self, name: &str) -> Result<NodeIndex>
Create new empty variable
sourcepub fn variable(&mut self, name: &str, value: A) -> Result<NodeIndex>
pub fn variable(&mut self, name: &str, value: A) -> Result<NodeIndex>
Create new variable with value
pub fn set_name(&mut self, node: NodeIndex, name: &str) -> Option<NodeIndex>
sourcepub fn set_value(&mut self, node: NodeIndex, value: A) -> Result<()>
pub fn set_value(&mut self, node: NodeIndex, value: A) -> Result<()>
Set a value to a variable node, and returns NodeTypeError
if the node is an operator.
sourcepub fn eval_value(&mut self, node: NodeIndex) -> Result<A>
pub fn eval_value(&mut self, node: NodeIndex) -> Result<A>
Evaluate the value of the node recusively.
pub fn get_value(&self, node: NodeIndex) -> Result<A>
pub fn get_deriv(&self, node: NodeIndex) -> Result<A>
sourcepub fn eval_deriv(&mut self, node: NodeIndex) -> Result<()>
pub fn eval_deriv(&mut self, node: NodeIndex) -> Result<()>
Evaluate derivative recursively.
pub fn to_json(&self, writer: impl Write) -> Result<()>
pub fn to_json_str(&self) -> Result<String>
pub fn to_dot(&self, sink: &mut impl Write) -> Result<()>where
A: Debug,
Trait Implementations
sourceimpl<'de, A> Deserialize<'de> for Graph<A>where
A: Deserialize<'de>,
impl<'de, A> Deserialize<'de> for Graph<A>where
A: Deserialize<'de>,
sourcefn 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
Auto Trait Implementations
impl<A> RefUnwindSafe for Graph<A>where
A: RefUnwindSafe,
impl<A> Send for Graph<A>where
A: Send,
impl<A> Sync for Graph<A>where
A: Sync,
impl<A> Unpin for Graph<A>where
A: Unpin,
impl<A> UnwindSafe for Graph<A>where
A: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more