pub struct SymMat {
pub rows: usize,
pub cols: usize,
pub data: Vec<E>,
}Expand description
Symbolic matrix of expressions.
Stored in row-major order. Supports transpose, matrix multiplication, matrix-vector product, element-wise differentiation, and code generation.
Fields§
§rows: usizeNumber of rows.
cols: usizeNumber of columns.
data: Vec<E>Row-major element data.
Implementations§
Source§impl SymMat
impl SymMat
Sourcepub fn new<I>(rows: usize, cols: usize, data: I) -> Self
pub fn new<I>(rows: usize, cols: usize, data: I) -> Self
Create a matrix from dimensions and row-major data. Accepts
any iterable of Into<E> so you can pass bare numeric literals:
SymMat::new(2, 2, [1.0, 2.0, 3.0, 4.0]).
Sourcepub fn diff(&self, var: impl AsVarName) -> SymMat
pub fn diff(&self, var: impl AsVarName) -> SymMat
Differentiate every element with respect to a variable.
Sourcepub fn eval(&self, vars: &HashMap<&str, f64>) -> Result<Vec<Vec<f64>>, String>
pub fn eval(&self, vars: &HashMap<&str, f64>) -> Result<Vec<Vec<f64>>, String>
Evaluate every element numerically, returning a nested Vec<Vec<f64>>.
Trait Implementations§
impl StructuralPartialEq for SymMat
Auto Trait Implementations§
impl Freeze for SymMat
impl RefUnwindSafe for SymMat
impl !Send for SymMat
impl !Sync for SymMat
impl Unpin for SymMat
impl UnsafeUnpin for SymMat
impl UnwindSafe for SymMat
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