Struct ohsl::vector::Vector [−][src]
Fields
vec: Vec<T>
Implementations
impl<T> Vector<T>
[src]
pub const fn empty() -> Self
[src]
Create a new vector of unspecified size
pub fn create(vec: Vec<T>) -> Self
[src]
Create a vector from an std::vec::Vec
pub fn size(&self) -> usize
[src]
Return the size of the vector
pub fn clear(&mut self)
[src]
Remove all of the element from the vector
pub fn swap(&mut self, i: usize, j: usize)
[src]
Swap elements two elements in the vector
pub fn push(&mut self, elem: T)
[src]
Push a new element onto the end of the vector
pub fn insert(&mut self, pos: usize, new_elem: T)
[src]
Insert a new element into the Vector at a specified position
pub fn pop(&mut self) -> T
[src]
Remove the last element from the vector and return it
impl<T: PartialEq> Vector<T>
[src]
pub fn find(&self, value: T) -> usize
[src]
Return the index of the first element in the Vector equal to a given value
impl<T: Clone> Vector<T>
[src]
pub fn new(size: usize, elem: T) -> Self
[src]
Create a new vector of specified size
pub fn assign(&mut self, elem: T)
[src]
Assign a value to every element in the vector
impl<T: Clone + Number> Vector<T>
[src]
pub fn zeros(size: usize) -> Self
[src]
Create a vector of zeros
pub fn ones(size: usize) -> Self
[src]
Create a vector of ones
impl<T: Default> Vector<T>
[src]
impl<T: Clone + Number> Vector<T>
[src]
pub fn dot(&self, w: Vector<T>) -> T
[src]
Return the dot product of two vectors v.dot(w)
pub fn sum(&self) -> T
[src]
Return the sum of all the elements in the vector
pub fn sum_slice(&self, start: usize, end: usize) -> T
[src]
Return the sum of the elements in the vector from index start to end
pub fn product(&self) -> T
[src]
Return the product of all the elements in the vector
pub fn product_slice(&self, start: usize, end: usize) -> T
[src]
Return the product of the elements in the vector from index start to end
impl<T: Display> Vector<T>
[src]
impl<T: Clone + Signed> Vector<T>
[src]
pub fn abs(&self) -> Self
[src]
Return a vector containing the absolute values of the elements
pub fn norm_1(&self) -> T
[src]
Return the L1 norm: sum of absolute values
impl<T: Clone + Signed> Vector<Complex<T>>
[src]
impl<T: Clone + Number> Vector<Complex<T>>
[src]
pub fn real(&self) -> Vector<T>
[src]
Return a vector containing the real parts of a vector of complex numbers
impl Vector<f64>
[src]
pub fn linspace(a: f64, b: f64, size: usize) -> Self
[src]
Create a linearly spaced vector of f64 with n elements with lower limit a and upper limit b
pub fn powspace(a: f64, b: f64, size: usize, p: f64) -> Self
[src]
Create a nonuniform vector of f64 with n elements with lower limit a, upper limit b and exponent p (p=1 -> linear)
pub fn norm_2(&self) -> f64
[src]
Return the L2 norm: square root of the sum of the squares
pub fn norm_p(&self, p: f64) -> f64
[src]
Return the Lp norm: p-th root of the sum of the absolute values raised to the power p
pub fn norm_inf(&self) -> f64
[src]
Return the Inf norm: largest absolute value element (p -> infinity)
pub fn random(size: usize) -> Self
[src]
pub fn dotf64(&self, w: &Vector<f64>) -> f64
[src]
Return the dot product of two vectors v.dot(w)
impl<T: Ord + PartialEq + PartialOrd> Vector<T>
[src]
impl<T: PartialEq + PartialOrd> Vector<T>
[src]
pub fn sort_by<F>(&mut self, compare: F) where
F: FnMut(&T, &T) -> Ordering,
[src]
F: FnMut(&T, &T) -> Ordering,
Sort the Vector of elements using a comparison function
Trait Implementations
impl<T: Clone + Number> Add<Vector<T>> for Vector<T>
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, plus: Self) -> Self::Output
[src]
Add the elements of two vectors together ( binary + )
impl<T: Clone + Number> AddAssign<T> for Vector<T>
[src]
fn add_assign(&mut self, rhs: T)
[src]
Add the same value to every element in a mutable vector
impl<T: Clone + Number> AddAssign<Vector<T>> for Vector<T>
[src]
fn add_assign(&mut self, rhs: Self)
[src]
Add a vector to a mutable vector and assign the result ( += )
impl<T: Clone> Clone for Vector<T>
[src]
impl<T> Debug for Vector<T> where
T: Debug,
[src]
T: Debug,
impl<T> Display for Vector<T> where
T: Debug,
[src]
T: Debug,
impl<T: Clone + Number> Div<T> for Vector<T>
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, scalar: T) -> Self::Output
[src]
Divide a vector by a scalar (vector / scalar)
impl<T: Clone + Number> DivAssign<T> for Vector<T>
[src]
fn div_assign(&mut self, rhs: T)
[src]
Divide every element in a mutable vector by a scalar
impl<T> Index<usize> for Vector<T>
[src]
type Output = T
The returned type after indexing.
fn index<'a>(&'a self, index: usize) -> &'a T
[src]
Indexing operator [] (read only)
impl<T> IndexMut<usize> for Vector<T>
[src]
impl<T: Clone + Number> Mul<T> for Vector<T>
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, scalar: T) -> Self::Output
[src]
Multiply a vector by a scalar (vector * scalar)
impl<T: Clone + Number> Mul<Vector<T>> for Matrix<T>
[src]
type Output = Vector<T>
The resulting type after applying the *
operator.
fn mul(self, vec: Vector<T>) -> Vector<T>
[src]
Multiply a matrix with a (column) vector ( matrix * vector )
impl<T: Clone + Number> MulAssign<T> for Vector<T>
[src]
fn mul_assign(&mut self, rhs: T)
[src]
Multiply every element in a mutable vector by a scalar
impl<T: Clone + Neg<Output = T>> Neg for Vector<T>
[src]
type Output = Self
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
Return the unary negation ( unary - ) of each element
impl<T: Clone + Number> Sub<Vector<T>> for Vector<T>
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, minus: Self) -> Self::Output
[src]
Subtract the elements of one vector from another ( binary - )
impl<T: Clone + Number> SubAssign<T> for Vector<T>
[src]
fn sub_assign(&mut self, rhs: T)
[src]
Subtract the same value from every element in a mutable vector
impl<T: Clone + Number> SubAssign<Vector<T>> for Vector<T>
[src]
fn sub_assign(&mut self, rhs: Self)
[src]
Substract a vector from a mutable vector and assign the result ( -= )
Auto Trait Implementations
impl<T> RefUnwindSafe for Vector<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Vector<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Vector<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Vector<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Vector<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, Rhs> AssignOperations<Rhs> for T where
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs>,
[src]
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs>,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,