NalgebraMat

Struct NalgebraMat 

Source
pub struct NalgebraMat<T: Scalar> { /* private fields */ }

Trait Implementations§

Source§

impl<T: Scalar> Add<&NalgebraMat<T>> for NalgebraMat<T>

Source§

type Output = NalgebraMat<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &NalgebraMat<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: Scalar> Add<&NalgebraMat<T>> for NalgebraMatRef<'_, T>

Source§

type Output = NalgebraMat<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &NalgebraMat<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: Scalar> Add<&NalgebraMatRef<'_, T>> for NalgebraMat<T>

Source§

type Output = NalgebraMat<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &NalgebraMatRef<'_, T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: Scalar> AddAssign<&NalgebraMat<T>> for NalgebraMat<T>

Source§

fn add_assign(&mut self, rhs: &NalgebraMat<T>)

Performs the += operation. Read more
Source§

impl<T: Scalar> AddAssign<&NalgebraMatRef<'_, T>> for NalgebraMat<T>

Source§

fn add_assign(&mut self, rhs: &NalgebraMatRef<'_, T>)

Performs the += operation. Read more
Source§

impl<T: Clone + Scalar> Clone for NalgebraMat<T>

Source§

fn clone(&self) -> NalgebraMat<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Scalar> Debug for NalgebraMat<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Scalar> DefaultSolver for NalgebraMat<T>

Source§

type LS = LU<T>

Source§

fn default_solver() -> Self::LS

Source§

impl<T: Scalar> DenseMatrix for NalgebraMat<T>

Source§

type View<'a> = NalgebraMatRef<'a, T>

A view of the dense matrix type
Source§

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)

Perform a matrix-matrix multiplication self = alpha * a * b + beta * self, where alpha and beta are scalars, and a and b are matrices
Source§

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 get_index(&self, i: IndexType, j: IndexType) -> Self::T

Get the value at a given index
Source§

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<'_>

Get a mutable vector view of the column i
Source§

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 end
Source§

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<'_>

Get a vector view of the column i
Source§

fn columns(&self, start: IndexType, end: IndexType) -> Self::View<'_>

Get a matrix view of the columns starting at start and ending at end
Source§

fn column_axpy(&mut self, alpha: Self::T, j: IndexType, i: IndexType)

Performs an axpy operation on two columns of the matrix M[:, i] = alpha * M[:, j] + M[:, i]
Source§

fn mat_mul(&self, b: &Self) -> Self

mat_mat_mul using gemm, allocating a new matrix
Source§

impl<T: Scalar> Index<(usize, usize)> for NalgebraMat<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: (IndexType, IndexType)) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<T: Scalar> IndexMut<(usize, usize)> for NalgebraMat<T>

Source§

fn index_mut(&mut self, index: (IndexType, IndexType)) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T: Scalar> LinearSolver<NalgebraMat<T>> for LU<T>

Source§

fn solve_in_place(&self, state: &mut NalgebraVec<T>) -> Result<(), DiffsolError>

Source§

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, )

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>

Solve the problem Ax = b and return the solution x. panics if Self::set_linearisation has not been called previously
Source§

impl<T: Scalar> Matrix for NalgebraMat<T>

Source§

type Sparsity = Dense<NalgebraMat<T>>

Source§

type SparsityRef<'a> = DenseRef<'a, NalgebraMat<T>>

Source§

fn sparsity(&self) -> Option<Self::SparsityRef<'_>>

Return sparsity information (None if the matrix is dense)
Source§

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, )

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 array
Source§

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 more
Source§

fn partition_indices_by_zero_diagonal( &self, ) -> (<Self::V as Vector>::Index, <Self::V as Vector>::Index)

Source§

fn add_column_to_vector(&self, j: IndexType, v: &mut Self::V)

Source§

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>

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

Create a new matrix of shape nrows x ncols filled with zeros
Source§

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)

Perform a matrix-vector multiplication y = alpha * self * x + beta * y.
Source§

fn copy_from(&mut self, other: &Self)

Copy the contents of other into self
Source§

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 updated
Source§

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

Create a new matrix from a sparsity pattern, the non-zero elements are not initialized
Source§

fn is_sparse() -> bool

Source§

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 more
Source§

fn 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>

Source§

impl<'a, T: Scalar> Mul<Scale<T>> for &NalgebraMat<T>

Source§

type Output = NalgebraMat<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scale<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, T: Scalar> Mul<Scale<T>> for NalgebraMat<T>

Source§

type Output = NalgebraMat<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scale<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: PartialEq + Scalar> PartialEq for NalgebraMat<T>

Source§

fn eq(&self, other: &NalgebraMat<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Scalar> Sub<&NalgebraMat<T>> for NalgebraMat<T>

Source§

type Output = NalgebraMat<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &NalgebraMat<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: Scalar> Sub<&NalgebraMat<T>> for NalgebraMatRef<'_, T>

Source§

type Output = NalgebraMat<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &NalgebraMat<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: Scalar> Sub<&NalgebraMatRef<'_, T>> for NalgebraMat<T>

Source§

type Output = NalgebraMat<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &NalgebraMatRef<'_, T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: Scalar> SubAssign<&NalgebraMat<T>> for NalgebraMat<T>

Source§

fn sub_assign(&mut self, rhs: &NalgebraMat<T>)

Performs the -= operation. Read more
Source§

impl<T: Scalar> SubAssign<&NalgebraMatRef<'_, T>> for NalgebraMat<T>

Source§

fn sub_assign(&mut self, rhs: &NalgebraMatRef<'_, T>)

Performs the -= operation. Read more
Source§

impl<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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

Source§

impl<T, Right> ClosedAddAssign<Right> for T
where T: ClosedAdd<Right> + AddAssign<Right>,

Source§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

Source§

impl<T, Right> ClosedSubAssign<Right> for T
where T: ClosedSub<Right> + SubAssign<Right>,

Source§

impl<M, Rhs> MatrixMutOpsByValue<Rhs> for M
where M: MatrixCommon + AddAssign<Rhs> + SubAssign<Rhs>,

Source§

impl<M, Rhs, Output> MatrixOpsByValue<Rhs, Output> for M
where M: MatrixCommon + Add<Rhs, Output = Output> + Sub<Rhs, Output = Output>,

Source§

impl<RefT, M> MatrixRef<M> for RefT
where M: MatrixCommon, RefT: Mul<Scale<<M as MatrixCommon>::T>, Output = M>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,