Skip to main content

DVector

Struct DVector 

Source
pub struct DVector<T = f64> { /* private fields */ }
Expand description

Dense matrix / vector types re-exported from the tpt-math substrate so callers can consume assembled operators without a separate dependency. A dynamically-sized column vector of T, stored as a contiguous Vec.

Implementations§

Source§

impl<T> DVector<T>

Source

pub fn zeros(n: usize) -> DVector<T>
where T: Scalar,

A zero vector of length n.

Source

pub fn from_vec(data: Vec<T>) -> DVector<T>

Build from a Vec (elements in order).

Source

pub fn from_row_slice(data: &[T]) -> DVector<T>
where T: Clone,

Build from a slice (elements in order).

Source

pub fn from_fn(n: usize, f: impl FnMut(usize) -> T) -> DVector<T>

Build element-by-element with f(i).

Source§

impl<T> DVector<T>

Source

pub fn len(&self) -> usize

Number of components.

Source

pub fn is_empty(&self) -> bool

True if the vector has no components.

Source

pub fn iter(&self) -> impl Iterator<Item = &T>

Iterate over the elements (in order).

Source§

impl<T> DVector<T>
where T: Scalar,

Source

pub fn norm(&self) -> T

The Euclidean (L2) norm.

Source

pub fn dot(&self, other: &DVector<T>) -> T

Dot product with another vector of the same length.

Source§

impl<T> DVector<T>
where T: Scalar + Clone,

Source

pub fn transpose(&self) -> DMatrix<T>

Transpose to a 1 x n row matrix.

Trait Implementations§

Source§

impl<T> Add for DVector<T>
where T: Scalar,

Available on crate feature alloc only.
Source§

type Output = DVector<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: DVector<T>) -> DVector<T>

Performs the + operation. Read more
Source§

impl<T> Add<T> for DVector<T>
where T: Scalar,

Available on crate feature alloc only.
Source§

type Output = DVector<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> DVector<T>

Performs the + operation. Read more
Source§

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

Source§

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

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for DVector<T>
where T: Debug,

Source§

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

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

impl<T> Div<T> for DVector<T>
where T: Scalar,

Available on crate feature alloc only.
Source§

type Output = DVector<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> DVector<T>

Performs the / operation. Read more
Source§

impl<T> Index<usize> for DVector<T>

Source§

fn index(&self, i: usize) -> &T

§Panics

Panics if i is out of bounds.

Source§

type Output = T

The returned type after indexing.
Source§

impl<T> Mul<DVector<T>> for DMatrix<T>
where T: Scalar,

Available on crate feature alloc only.
Source§

fn mul(self, rhs: DVector<T>) -> DVector<T>

§Panics

Panics if the matrix column count does not match the vector length.

Source§

type Output = DVector<T>

The resulting type after applying the * operator.
Source§

impl<T> Mul<T> for DVector<T>
where T: Scalar,

Available on crate feature alloc only.
Source§

type Output = DVector<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> DVector<T>

Performs the * operation. Read more
Source§

impl<T> Neg for DVector<T>
where T: Scalar,

Available on crate feature alloc only.
Source§

type Output = DVector<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> DVector<T>

Performs the unary - operation. Read more
Source§

impl<T> PartialEq for DVector<T>
where T: PartialEq,

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<T> Sub for DVector<T>
where T: Scalar,

Available on crate feature alloc only.
Source§

type Output = DVector<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: DVector<T>) -> DVector<T>

Performs the - operation. Read more
Source§

impl<T> Sub<T> for DVector<T>
where T: Scalar,

Available on crate feature alloc only.
Source§

type Output = DVector<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> DVector<T>

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<T> Freeze for DVector<T>
where Vec<T>: Freeze,

§

impl<T> RefUnwindSafe for DVector<T>
where Vec<T>: RefUnwindSafe,

§

impl<T> Send for DVector<T>
where Vec<T>: Send,

§

impl<T> Sync for DVector<T>
where Vec<T>: Sync,

§

impl<T> Unpin for DVector<T>
where Vec<T>: Unpin,

§

impl<T> UnsafeUnpin for DVector<T>
where Vec<T>: UnsafeUnpin,

§

impl<T> UnwindSafe for DVector<T>
where Vec<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> 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> 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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.