pub struct JacobianOperations;Expand description
Jacobian matrix operations
Implementations§
Source§impl JacobianOperations
impl JacobianOperations
Sourcepub fn compute(
functions: &[Expression],
variables: &[Symbol],
) -> Vec<Vec<Expression>>
pub fn compute( functions: &[Expression], variables: &[Symbol], ) -> Vec<Vec<Expression>>
Compute Jacobian matrix for vector-valued function F: ℝⁿ → ℝᵐ
§Examples
use mathhook_core::simplify::Simplify;
use mathhook_core::calculus::derivatives::Derivative;
use mathhook_core::calculus::derivatives::PartialUtils;
use mathhook_core::calculus::derivatives::MatrixUtils;
use mathhook_core::{Expression};
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::JacobianOperations;
let x = symbol!(x);
let y = symbol!(y);
let functions = vec![
Expression::mul(vec![Expression::symbol(x.clone()), Expression::symbol(y.clone())]),
Expression::add(vec![Expression::symbol(x.clone()), Expression::symbol(y.clone())])
];
let variables = vec![x, y];
let jacobian = JacobianOperations::compute(&functions, &variables);Sourcepub fn compute_cached(
functions: &[Expression],
variables: &[Symbol],
cache: &mut HashMap<String, Expression>,
) -> Vec<Vec<Expression>>
pub fn compute_cached( functions: &[Expression], variables: &[Symbol], cache: &mut HashMap<String, Expression>, ) -> Vec<Vec<Expression>>
Compute Jacobian matrix with caching for repeated variable sets
§Examples
use mathhook_core::{Expression};
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::JacobianOperations;
use std::collections::HashMap;
let x = symbol!(x);
let y = symbol!(y);
let functions = vec![
Expression::symbol(x.clone()),
Expression::symbol(y.clone())
];
let variables = vec![x, y];
let mut cache = HashMap::new();
let jacobian = JacobianOperations::compute_cached(&functions, &variables, &mut cache);Sourcepub fn transpose(
functions: &[Expression],
variables: &[Symbol],
) -> Vec<Vec<Expression>>
pub fn transpose( functions: &[Expression], variables: &[Symbol], ) -> Vec<Vec<Expression>>
Compute transpose of Jacobian matrix
§Examples
use mathhook_core::{Expression};
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::JacobianOperations;
let x = symbol!(x);
let y = symbol!(y);
let functions = vec![
Expression::symbol(x.clone()),
Expression::symbol(y.clone())
];
let variables = vec![x, y];
let jacobian_t = JacobianOperations::transpose(&functions, &variables);Auto Trait Implementations§
impl Freeze for JacobianOperations
impl RefUnwindSafe for JacobianOperations
impl Send for JacobianOperations
impl Sync for JacobianOperations
impl Unpin for JacobianOperations
impl UnsafeUnpin for JacobianOperations
impl UnwindSafe for JacobianOperations
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more