pub struct SparseJacobian<F: IntegrateFloat> {
pub pattern: SparsePattern,
pub values: Vec<F>,
pub index_map: HashMap<(usize, usize), usize>,
}Expand description
Sparse Jacobian representation
Fields§
§pattern: SparsePatternThe sparsity pattern
values: Vec<F>Non-zero values in row-major order
index_map: HashMap<(usize, usize), usize>Mapping from (row, col) to value index
Implementations§
Source§impl<F: IntegrateFloat> SparseJacobian<F>
impl<F: IntegrateFloat> SparseJacobian<F>
Sourcepub fn new(pattern: SparsePattern) -> Self
pub fn new(pattern: SparsePattern) -> Self
Create a new sparse Jacobian
Sourcepub fn set(&mut self, row: usize, col: usize, value: F) -> IntegrateResult<()>
pub fn set(&mut self, row: usize, col: usize, value: F) -> IntegrateResult<()>
Set a value in the sparse Jacobian
Sourcepub fn matvec(&self, x: ArrayView1<'_, F>) -> IntegrateResult<Array1<F>>
pub fn matvec(&self, x: ArrayView1<'_, F>) -> IntegrateResult<Array1<F>>
Multiply by a vector: y = J * x
Sourcepub fn matvec_transpose(
&self,
x: ArrayView1<'_, F>,
) -> IntegrateResult<Array1<F>>
pub fn matvec_transpose( &self, x: ArrayView1<'_, F>, ) -> IntegrateResult<Array1<F>>
Transpose multiply by a vector: y = J^T * x
Source§impl<F: IntegrateFloat> SparseJacobian<F>
impl<F: IntegrateFloat> SparseJacobian<F>
Sourcepub fn from_pattern(pattern: SparsePattern) -> Self
pub fn from_pattern(pattern: SparsePattern) -> Self
Create a new sparse Jacobian from pattern
Sourcepub fn set_unchecked(&mut self, row: usize, col: usize, value: F)
pub fn set_unchecked(&mut self, row: usize, col: usize, value: F)
Set a value without error checking
Sourcepub fn get_or_zero(&self, row: usize, col: usize) -> F
pub fn get_or_zero(&self, row: usize, col: usize) -> F
Get a value with default zero
Sourcepub fn to_dense_alt(&self) -> Array2<F>
pub fn to_dense_alt(&self) -> Array2<F>
Convert to dense matrix (alternative implementation)
Sourcepub fn apply(&self, x: ArrayView1<'_, F>) -> IntegrateResult<Array1<F>>
pub fn apply(&self, x: ArrayView1<'_, F>) -> IntegrateResult<Array1<F>>
Apply to vector (matrix-vector multiplication)
Sourcepub fn to_csr(&self) -> CSRJacobian<F>
pub fn to_csr(&self) -> CSRJacobian<F>
Convert to CSR format for efficient row operations
Auto Trait Implementations§
impl<F> Freeze for SparseJacobian<F>
impl<F> RefUnwindSafe for SparseJacobian<F>where
F: RefUnwindSafe,
impl<F> Send for SparseJacobian<F>where
F: Send,
impl<F> Sync for SparseJacobian<F>where
F: Sync,
impl<F> Unpin for SparseJacobian<F>where
F: Unpin,
impl<F> UnwindSafe for SparseJacobian<F>where
F: UnwindSafe,
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