pub struct NalgebraMat<T: Scalar> { /* private fields */ }Trait Implementations§
Source§impl<T: Scalar> Add<&NalgebraMat<T>> for NalgebraMat<T>
impl<T: Scalar> Add<&NalgebraMat<T>> for NalgebraMat<T>
Source§type Output = NalgebraMat<T>
type Output = NalgebraMat<T>
The resulting type after applying the
+ operator.Source§impl<T: Scalar> Add<&NalgebraMat<T>> for NalgebraMatRef<'_, T>
impl<T: Scalar> Add<&NalgebraMat<T>> for NalgebraMatRef<'_, T>
Source§type Output = NalgebraMat<T>
type Output = NalgebraMat<T>
The resulting type after applying the
+ operator.Source§impl<T: Scalar> Add<&NalgebraMatRef<'_, T>> for NalgebraMat<T>
impl<T: Scalar> Add<&NalgebraMatRef<'_, T>> for NalgebraMat<T>
Source§type Output = NalgebraMat<T>
type Output = NalgebraMat<T>
The resulting type after applying the
+ operator.Source§impl<T: Scalar> AddAssign<&NalgebraMat<T>> for NalgebraMat<T>
impl<T: Scalar> AddAssign<&NalgebraMat<T>> for NalgebraMat<T>
Source§fn add_assign(&mut self, rhs: &NalgebraMat<T>)
fn add_assign(&mut self, rhs: &NalgebraMat<T>)
Performs the
+= operation. Read moreSource§impl<T: Scalar> AddAssign<&NalgebraMatRef<'_, T>> for NalgebraMat<T>
impl<T: Scalar> AddAssign<&NalgebraMatRef<'_, T>> for NalgebraMat<T>
Source§fn add_assign(&mut self, rhs: &NalgebraMatRef<'_, T>)
fn add_assign(&mut self, rhs: &NalgebraMatRef<'_, T>)
Performs the
+= operation. Read moreSource§impl<T: Clone + Scalar> Clone for NalgebraMat<T>
impl<T: Clone + Scalar> Clone for NalgebraMat<T>
Source§fn clone(&self) -> NalgebraMat<T>
fn clone(&self) -> NalgebraMat<T>
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<T: Scalar> DefaultSolver for NalgebraMat<T>
impl<T: Scalar> DefaultSolver for NalgebraMat<T>
Source§impl<T: Scalar> DenseMatrix for NalgebraMat<T>
impl<T: Scalar> DenseMatrix for NalgebraMat<T>
Source§type View<'a> = NalgebraMatRef<'a, T>
type View<'a> = NalgebraMatRef<'a, T>
A view of the dense matrix type
Source§type ViewMut<'a> = NalgebraMatMut<'a, T>
type ViewMut<'a> = NalgebraMatMut<'a, T>
A mutable view of the dense matrix type
Source§fn gemm(&mut self, alpha: Self::T, a: &Self, b: &Self, beta: Self::T)
fn gemm(&mut self, alpha: Self::T, a: &Self, b: &Self, beta: Self::T)
Perform a matrix-matrix multiplication
self = alpha * a * b + beta * self, where alpha and beta are scalars, and a and b are matricesSource§fn resize_cols(&mut self, ncols: IndexType)
fn resize_cols(&mut self, ncols: IndexType)
Resize the number of columns in the matrix. Existing data is preserved, new elements are uninitialized
Source§fn from_vec(
nrows: IndexType,
ncols: IndexType,
data: Vec<Self::T>,
ctx: Self::C,
) -> Self
fn from_vec( nrows: IndexType, ncols: IndexType, data: Vec<Self::T>, ctx: Self::C, ) -> Self
creates a new matrix from a vector of values, which are assumed
to be in column-major order
Source§fn column_mut(&mut self, i: IndexType) -> <Self::V as Vector>::ViewMut<'_>
fn column_mut(&mut self, i: IndexType) -> <Self::V as Vector>::ViewMut<'_>
Get a mutable vector view of the column
iSource§fn columns_mut(&mut self, start: IndexType, end: IndexType) -> Self::ViewMut<'_>
fn columns_mut(&mut self, start: IndexType, end: IndexType) -> Self::ViewMut<'_>
Get a mutable matrix view of the columns starting at
start and ending at endSource§fn set_index(&mut self, i: IndexType, j: IndexType, value: Self::T)
fn set_index(&mut self, i: IndexType, j: IndexType, value: Self::T)
Set the value at a given index
Source§fn column(&self, i: IndexType) -> <Self::V as Vector>::View<'_>
fn column(&self, i: IndexType) -> <Self::V as Vector>::View<'_>
Get a vector view of the column
iSource§fn columns(&self, start: IndexType, end: IndexType) -> Self::View<'_>
fn columns(&self, start: IndexType, end: IndexType) -> Self::View<'_>
Get a matrix view of the columns starting at
start and ending at endSource§impl<T: Scalar> LinearSolver<NalgebraMat<T>> for LU<T>
impl<T: Scalar> LinearSolver<NalgebraMat<T>> for LU<T>
fn solve_in_place(&self, state: &mut NalgebraVec<T>) -> Result<(), DiffsolError>
fn set_linearisation<C: NonLinearOpJacobian<T = T, V = NalgebraVec<T>, M = NalgebraMat<T>>>( &mut self, op: &C, x: &NalgebraVec<T>, t: T, )
Source§fn set_problem<C: NonLinearOpJacobian<T = T, V = NalgebraVec<T>, M = NalgebraMat<T>, C = NalgebraContext>>(
&mut self,
op: &C,
)
fn set_problem<C: NonLinearOpJacobian<T = T, V = NalgebraVec<T>, M = NalgebraMat<T>, C = NalgebraContext>>( &mut self, op: &C, )
Set the problem to be solved, any previous problem is discarded.
Any internal state of the solver is reset.
This function will normally set the sparsity pattern of the matrix to be solved.
Source§fn solve(&self, b: &M::V) -> Result<M::V, DiffsolError>
fn solve(&self, b: &M::V) -> Result<M::V, DiffsolError>
Solve the problem
Ax = b and return the solution x.
panics if Self::set_linearisation has not been called previouslySource§impl<T: Scalar> Matrix for NalgebraMat<T>
impl<T: Scalar> Matrix for NalgebraMat<T>
type Sparsity = Dense<NalgebraMat<T>>
type SparsityRef<'a> = DenseRef<'a, NalgebraMat<T>>
Source§fn sparsity(&self) -> Option<Self::SparsityRef<'_>>
fn sparsity(&self) -> Option<Self::SparsityRef<'_>>
Return sparsity information (None if the matrix is dense)
fn context(&self) -> &Self::C
Source§fn set_data_with_indices(
&mut self,
dst_indices: &<Self::V as Vector>::Index,
src_indices: &<Self::V as Vector>::Index,
data: &Self::V,
)
fn set_data_with_indices( &mut self, dst_indices: &<Self::V as Vector>::Index, src_indices: &<Self::V as Vector>::Index, data: &Self::V, )
assign the values in the
data vector to the matrix at the indices in dst_indices from the indices in src_indices
dst_index can be obtained using the get_index method on the Sparsity type
- for dense matrices, the dst_index is the data index in column-major order
- for sparse matrices, the dst_index is the index into the data arraySource§fn gather(&mut self, other: &Self, indices: &<Self::V as Vector>::Index)
fn gather(&mut self, other: &Self, indices: &<Self::V as Vector>::Index)
gather the values in the matrix
other at the indices in indices to the matrix self
for sparse matrices: the index idx_i in indices is an index into the data array for other, and is copied to the index idx_i in the data array for self
for dense matrices: the index idx_i in indices is the data index in column-major order for other, and is copied to the index idx_i in the data array for self (again in column-major order) Read morefn partition_indices_by_zero_diagonal( &self, ) -> (<Self::V as Vector>::Index, <Self::V as Vector>::Index)
fn add_column_to_vector(&self, j: IndexType, v: &mut Self::V)
fn triplet_iter(&self) -> impl Iterator<Item = (IndexType, IndexType, Self::T)>
Source§fn try_from_triplets(
nrows: IndexType,
ncols: IndexType,
triplets: Vec<(IndexType, IndexType, T)>,
ctx: Self::C,
) -> Result<Self, DiffsolError>
fn try_from_triplets( nrows: IndexType, ncols: IndexType, triplets: Vec<(IndexType, IndexType, T)>, ctx: Self::C, ) -> Result<Self, DiffsolError>
Create a new matrix from a vector of triplets (i, j, value) where i and j are the row and column indices of the value
Source§fn zeros(nrows: IndexType, ncols: IndexType, ctx: Self::C) -> Self
fn zeros(nrows: IndexType, ncols: IndexType, ctx: Self::C) -> Self
Create a new matrix of shape
nrows x ncols filled with zerosSource§fn from_diagonal(v: &Self::V) -> Self
fn from_diagonal(v: &Self::V) -> Self
Create a new diagonal matrix from a Vector holding the diagonal elements
Source§fn gemv(&self, alpha: Self::T, x: &Self::V, beta: Self::T, y: &mut Self::V)
fn gemv(&self, alpha: Self::T, x: &Self::V, beta: Self::T, y: &mut Self::V)
Perform a matrix-vector multiplication
y = alpha * self * x + beta * y.Source§fn set_column(&mut self, j: IndexType, v: &Self::V)
fn set_column(&mut self, j: IndexType, v: &Self::V)
sets the values of column
j to be equal to the values in v
For sparse matrices, only the existing non-zero elements are updatedSource§fn scale_add_and_assign(&mut self, x: &Self, beta: Self::T, y: &Self)
fn scale_add_and_assign(&mut self, x: &Self, beta: Self::T, y: &Self)
Perform the assignment self = x + beta * y where x and y are matrices and beta is a scalar
Panics if the sparsity of self, x, and y do not match (i.e. sparsity of self must be the union of the sparsity of x and y)
Source§fn new_from_sparsity(
nrows: IndexType,
ncols: IndexType,
_sparsity: Option<Self::Sparsity>,
ctx: Self::C,
) -> Self
fn new_from_sparsity( nrows: IndexType, ncols: IndexType, _sparsity: Option<Self::Sparsity>, ctx: Self::C, ) -> Self
Create a new matrix from a sparsity pattern, the non-zero elements are not initialized
fn is_sparse() -> bool
Source§fn split(
&self,
algebraic_indices: &<Self::V as Vector>::Index,
) -> [(Self, <Self::V as Vector>::Index); 4]
fn split( &self, algebraic_indices: &<Self::V as Vector>::Index, ) -> [(Self, <Self::V as Vector>::Index); 4]
Split the matrix into four submatrices, based on the indices in
algebraic_indices Read morefn combine( ul: &Self, ur: &Self, ll: &Self, lr: &Self, algebraic_indices: &<Self::V as Vector>::Index, ) -> Self
Source§impl<T: Scalar> MatrixCommon for NalgebraMat<T>
impl<T: Scalar> MatrixCommon for NalgebraMat<T>
Source§impl<T: Scalar> Sub<&NalgebraMat<T>> for NalgebraMat<T>
impl<T: Scalar> Sub<&NalgebraMat<T>> for NalgebraMat<T>
Source§type Output = NalgebraMat<T>
type Output = NalgebraMat<T>
The resulting type after applying the
- operator.Source§impl<T: Scalar> Sub<&NalgebraMat<T>> for NalgebraMatRef<'_, T>
impl<T: Scalar> Sub<&NalgebraMat<T>> for NalgebraMatRef<'_, T>
Source§type Output = NalgebraMat<T>
type Output = NalgebraMat<T>
The resulting type after applying the
- operator.Source§impl<T: Scalar> Sub<&NalgebraMatRef<'_, T>> for NalgebraMat<T>
impl<T: Scalar> Sub<&NalgebraMatRef<'_, T>> for NalgebraMat<T>
Source§type Output = NalgebraMat<T>
type Output = NalgebraMat<T>
The resulting type after applying the
- operator.Source§impl<T: Scalar> SubAssign<&NalgebraMat<T>> for NalgebraMat<T>
impl<T: Scalar> SubAssign<&NalgebraMat<T>> for NalgebraMat<T>
Source§fn sub_assign(&mut self, rhs: &NalgebraMat<T>)
fn sub_assign(&mut self, rhs: &NalgebraMat<T>)
Performs the
-= operation. Read moreSource§impl<T: Scalar> SubAssign<&NalgebraMatRef<'_, T>> for NalgebraMat<T>
impl<T: Scalar> SubAssign<&NalgebraMatRef<'_, T>> for NalgebraMat<T>
Source§fn sub_assign(&mut self, rhs: &NalgebraMatRef<'_, T>)
fn sub_assign(&mut self, rhs: &NalgebraMatRef<'_, T>)
Performs the
-= operation. Read moreimpl<T: Scalar> StructuralPartialEq for NalgebraMat<T>
Auto Trait Implementations§
impl<T> Freeze for NalgebraMat<T>
impl<T> RefUnwindSafe for NalgebraMat<T>where
T: RefUnwindSafe,
impl<T> Send for NalgebraMat<T>
impl<T> Sync for NalgebraMat<T>
impl<T> Unpin for NalgebraMat<T>where
T: Unpin,
impl<T> UnwindSafe for NalgebraMat<T>where
T: 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.