[−][src]Struct mathru::algebra::linear::vector::vector::Vector
Implementations
impl<T> Vector<T>
[src]
pub fn iter(&self) -> VectorIterator<'_, T>ⓘNotable traits for VectorIterator<'a, T>
impl<'a, T> Iterator for VectorIterator<'a, T> where
T: Field + Scalar, type Item = &'a T;
[src]
Notable traits for VectorIterator<'a, T>
impl<'a, T> Iterator for VectorIterator<'a, T> where
T: Field + Scalar, type Item = &'a T;
pub fn iter_mut(&mut self) -> VectorIteratorMut<'_, T>ⓘNotable traits for VectorIteratorMut<'a, T>
impl<'a, T> Iterator for VectorIteratorMut<'a, T> where
T: Field + Scalar, type Item = &'a mut T;
[src]
Notable traits for VectorIteratorMut<'a, T>
impl<'a, T> Iterator for VectorIteratorMut<'a, T> where
T: Field + Scalar, type Item = &'a mut T;
impl<T> Vector<T> where
T: Field + Scalar + Power,
[src]
T: Field + Scalar + Power,
impl<T> Vector<T>
[src]
pub fn convert_to_vec(self) -> Vec<T>
[src]
impl<T> Vector<T> where
T: Field + Scalar + Power + Exponential,
[src]
T: Field + Scalar + Power + Exponential,
pub fn eucl_norm(&self) -> T
[src]
Computes the euclidean norm
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 0.0, 3.0, -2.0]); let norm_ref: f64 = 3.7416573867739413; let norm: f64 = a.eucl_norm(); assert_eq!(norm_ref, norm);
impl<T> Vector<T> where
T: Clone + Copy,
[src]
T: Clone + Copy,
pub fn new_row(n: usize, data: Vec<T>) -> Self
[src]
Returns a row vector
Panics
n != data.len()
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_row(4, vec![1.0, 0.0, 3.0, -2.0]);
pub fn new_column(m: usize, data: Vec<T>) -> Self
[src]
Returns a column vector
Panics
m != data.len()
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 0.0, 3.0, -2.0]);
pub fn apply(self: Vector<T>, f: &dyn Fn(&T) -> T) -> Self
[src]
impl<T> Vector<T> where
T: Scalar,
[src]
T: Scalar,
pub fn new_row_random(n: usize) -> Self
[src]
Returns a row vector initialized with random numbers
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_row_random(4);
pub fn new_column_random(m: usize) -> Self
[src]
Returns a column vector initialized with random numbers
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column_random(4);
impl<T> Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
pub fn transpose(self) -> Self
[src]
Returns the transposed vector
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 0.0, 3.0, -2.0]); let b: Vector<f64> = a.transpose();
impl<T> Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
pub fn dotp<'a, 'b>(&'a self, rhs: &'b Self) -> T
[src]
Computes the dot product of two vectors
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 0.0, 3.0, -2.0]); let b: Vector<f64> = Vector::new_column(4, vec![-1.0, 2.0, 3.0, 5.0]); let dotp_ref: f64 = -2.0; let dotp: f64 = a.dotp(&b); assert_eq!(dotp_ref, dotp);
pub fn argmax(&self) -> usize
[src]
Find the argmax of the vector.
Returns the index of the largest value in the vector.
Examples
use mathru::algebra::linear::Vector; let a = Vector::new_column(4, vec![1.0, 2.0, -3.0, 5.0]); let idx = a.argmax(); assert_eq!(idx, 3);
pub fn argmin(&self) -> usize
[src]
Find the argmin of the vector.
Returns the index of the smallest value in the vector.
Examples
use mathru::algebra::linear::Vector; let a = Vector::new_column(4, vec![1.0, -2.0, -6.0, 75.0]); let b = a.argmin(); assert_eq!(b, 2);
impl<T> Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
pub fn dyadp(&self, rhs: &Self) -> Matrix<T>
[src]
Computes the dyadic product of two vectors
Example
use mathru::algebra::linear::{Matrix, Vector}; let a: Vector<f64> = Vector::new_row(4, vec![1.0, 0.0, 3.0, -2.0]); let b: Vector<f64> = Vector::new_column(4, vec![-1.0, 2.0, 3.0, 5.0]); let m: Matrix<f64> = a.dyadp(&b);
impl<T> Vector<T>
[src]
impl<T> Vector<T>
[src]
impl<T> Vector<T> where
T: Field + Scalar + Power,
[src]
T: Field + Scalar + Power,
impl<T> Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
pub fn zero(m: usize) -> Self
[src]
Returns the zero vector
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![0.0, 0.0, 0.0, 0.0]); let b: Vector<f64> = Vector::zero(4); assert_eq!(a, b)
impl<T> Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
pub fn one(m: usize) -> Self
[src]
Returns the one vector
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 1.0, 1.0, 1.0]); let b: Vector<f64> = Vector::one(4); assert_eq!(a, b)
impl<T> Vector<T>
[src]
pub fn dim(&self) -> (usize, usize)
[src]
Returns the vector dimension
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 2.0, 3.0, 4.0]); let (m, n): (usize, usize) = a.dim(); assert_eq!(4, m); assert_eq!(1, n);
impl<T> Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
pub fn get_slice(&self, s: usize, e: usize) -> Vector<T>
[src]
Returns a slice of the vector
Arugments
0 <= s < m
0 <= e < m
s: start
e: end
Panics
iff s and e are out of bounds
Example
use mathru::algebra::linear::Vector; let mut a: Vector<f64> = Vector::new_column(4, vec![1.0, -2.0, 3.0, -7.0]); a = a.get_slice(1, 2); let a_ref: Vector<f64> = Vector::new_column(2, vec![-2.0, 3.0]); assert_eq!(a_ref, a);
pub fn set_slice<'a>(&mut self, rhs: &Self, s: usize)
[src]
Overwrite a slice of the vector with the given values
Arugments
0 <= s < m
s: start
Example
use mathru::algebra::linear::Vector; let mut a: Vector<f64> = Vector::new_column(4, vec![1.0, -2.0, 3.0, -7.0]); let b: Vector<f64> = Vector::new_column(2, vec![-5.0, 4.0]); a.set_slice(&b, 1); let a_ref: Vector<f64> = Vector::new_column(4, vec![1.0, -5.0, 4.0, -7.0]); assert_eq!(a_ref, a);
impl<T> Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
pub fn compare_neighbourhood(&self, b: &Self, epsilon: T) -> bool
[src]
Trait Implementations
impl AbsDiffEq<Vector<f32>> for Vector<f32>
[src]
type Epsilon = f32
Used for specifying relative comparisons.
pub fn default_epsilon() -> f32
[src]
pub fn abs_diff_eq(&self, other: &Vector<f32>, epsilon: f32) -> bool
[src]
pub fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
[src]
impl AbsDiffEq<Vector<f64>> for Vector<f64>
[src]
type Epsilon = f64
Used for specifying relative comparisons.
pub fn default_epsilon() -> f64
[src]
pub fn abs_diff_eq(&self, other: &Vector<f64>, epsilon: f64) -> bool
[src]
pub fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
[src]
impl<'a, T, '_> Add<&'_ T> for &'a Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the +
operator.
pub fn add(self, rhs: &T) -> Self::Output
[src]
Adds a scalar to the vector
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 2.0, 3.0, 4.0]); let res_ref: Vector<f64> = Vector::new_column(4, vec![-4.0, -3.0, -2.0, -1.0]); assert_eq!(res_ref, &a + &-5.0)
impl<'a, 'b, T> Add<&'b Vector<T>> for &'a Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the +
operator.
pub fn add(self, rhs: &'b Vector<T>) -> Self::Output
[src]
Adds two vectors
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 2.0, 3.0, 4.0]); let b: Vector<f64> = Vector::new_column(4, vec![3.0, -4.0, 5.0, 4.0]); let res_ref: Vector<f64> = Vector::new_column(4, vec![4.0, -2.0, 8.0, 8.0]); assert_eq!(res_ref, &a + &b)
impl<T> Add<T> for Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the +
operator.
pub fn add(self, rhs: T) -> Self::Output
[src]
Adds a scalar to the vector
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 2.0, 3.0, 4.0]); let res_ref: Vector<f64> = Vector::new_column(4, vec![-4.0, -3.0, -2.0, -1.0]); assert_eq!(res_ref, a + -5.0)
impl<T> Add<Vector<T>> for Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the +
operator.
pub fn add(self, rhs: Self) -> Self::Output
[src]
Adds two vectors
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 2.0, 3.0, 4.0]); let b: Vector<f64> = Vector::new_column(4, vec![3.0, -4.0, 5.0, 4.0]); let res_ref: Vector<f64> = Vector::new_column(4, vec![4.0, -2.0, 8.0, 8.0]); assert_eq!(res_ref, a + b)
impl<T: Clone> Clone for Vector<T>
[src]
impl<T: Debug> Debug for Vector<T>
[src]
impl<'de, T> Deserialize<'de> for Vector<T> where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<T> Display for Vector<T> where
T: Display,
[src]
T: Display,
impl<'a, T, '_> Div<&'_ T> for &'a Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the /
operator.
pub fn div(self, rhs: &T) -> Self::Output
[src]
Divides the elements of a vector with the scalar value
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![5.0, 10.0, 15.0, 20.0]); let res_ref: Vector<f64> = Vector::new_column(4, vec![1.0, 2.0, 3.0, 4.0]); assert_eq!(res_ref, a / 5.0)
impl<T> Div<T> for Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the /
operator.
pub fn div(self, rhs: T) -> Self::Output
[src]
Divides the vector elements with scalar values
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![-5.0, -10.0, -15.0, -20.0]); let res_ref: Vector<f64> = Vector::new_column(4, vec![1.0, 2.0, 3.0, 4.0]); assert_eq!(res_ref, a / -5.0)
impl<T> From<Vector<T>> for Matrix<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
impl<T> IntoIterator for Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Item = T
The type of the elements being iterated over.
type IntoIter = VectorIntoIterator<T>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, T, '_> Mul<&'_ T> for &'a Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: &T) -> Self::Output
[src]
Multiplies the vector elements with the scalar value
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 2.0, 3.0, 4.0]); let res_ref: Vector<f64> = Vector::new_column(4, vec![5.0, 10.0, 15.0, 20.0]); assert_eq!(res_ref, a * 5.0)
impl<'a, 'b, T> Mul<&'b Matrix<T>> for &'a Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: &'b Matrix<T>) -> Self::Output
[src]
impl<'a, 'b, T> Mul<&'b Vector<T>> for &'a Matrix<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
Multiplies matrix by vector.
type Output = Vector<T>
The resulting type after applying the *
operator.
pub fn mul(self, v: &'b Vector<T>) -> Vector<T>
[src]
impl<T> Mul<Matrix<T>> for Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Matrix<T>) -> Self::Output
[src]
impl<T> Mul<T> for Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: T) -> Self::Output
[src]
Multiplies the vector elements with a scalar value
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 2.0, 3.0, 4.0]); let res_ref: Vector<f64> = Vector::new_column(4, vec![-5.0, -10.0, -15.0, -20.0]); assert_eq!(res_ref, a * -5.0)
impl<T> Mul<Vector<T>> for Matrix<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the *
operator.
pub fn mul(self, m: Vector<T>) -> Vector<T>
[src]
impl<T> Neg for Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the -
operator.
pub fn neg(self) -> Self::Output
[src]
impl<T> PartialEq<Vector<T>> for Vector<T> where
T: Scalar,
[src]
T: Scalar,
pub fn eq(&self, other: &Self) -> bool
[src]
Compares if two vectors are equal
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![0.0, 0.0, 0.0, 0.0]); let b: Vector<f64> = Vector::zero(4); assert_eq!(true, a.eq(&b))
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl RelativeEq<Vector<f32>> for Vector<f32>
[src]
pub fn default_max_relative() -> f32
[src]
pub fn relative_eq(
&self,
other: &Vector<f32>,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Vector<f32>,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
A test for equality that uses a relative comparison if the values are far apart.
pub fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
impl RelativeEq<Vector<f64>> for Vector<f64>
[src]
pub fn default_max_relative() -> f64
[src]
pub fn relative_eq(
&self,
other: &Vector<f64>,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Vector<f64>,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
A test for equality that uses a relative comparison if the values are far apart.
pub fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
impl<T> Serialize for Vector<T> where
T: Serialize,
[src]
T: Serialize,
pub fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<T> Sign for Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
pub fn sign(&self) -> Self
[src]
pub fn abs(&self) -> Self
[src]
pub fn is_positive(&self) -> bool
[src]
pub fn is_negative(&self) -> bool
[src]
impl<T> Solve<Vector<T>> for LUDec<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
pub fn solve(&self, rhs: &Vector<T>) -> Result<Vector<T>, ()>
[src]
Solves Ax = y where A \in R^{m * n}, x \in R^n, y \in R^m
impl<T> Solve<Vector<T>> for Matrix<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
pub fn solve(&self, rhs: &Vector<T>) -> Result<Vector<T>, ()>
[src]
Solves Ax = y where A \in R^{m * n}, x \in R^n, y \in R^m
impl<'a, T, '_> Sub<&'_ T> for &'a Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the -
operator.
pub fn sub(self, rhs: &T) -> Self::Output
[src]
Subtract a scalar from vector elements
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 2.0, 3.0, 4.0]); let res_ref: Vector<f64> = Vector::new_column(4, vec![-4.0, -3.0, -2.0, -1.0]); assert_eq!(res_ref, a - 5.0)
impl<'a, 'b, T> Sub<&'b Vector<T>> for &'a Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the -
operator.
pub fn sub(self, rhs: &'b Vector<T>) -> Self::Output
[src]
Subtracts two vectors
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 2.0, 3.0, 4.0]); let b: Vector<f64> = Vector::new_column(4, vec![3.0, -4.0, 5.0, 4.0]); let res_ref: Vector<f64> = Vector::new_column(4, vec![-2.0, 6.0, -2.0, 0.0]); assert_eq!(res_ref, &a - &b)
impl<T> Sub<T> for Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the -
operator.
pub fn sub(self, rhs: T) -> Self::Output
[src]
Subtracts a scalar value from all vector elements
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 2.0, 3.0, 4.0]); let res_ref: Vector<f64> = Vector::new_column(4, vec![6.0, 7.0, 8.0, 9.0]); assert_eq!(res_ref, a - -5.0)
impl<T> Sub<Vector<T>> for Vector<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
type Output = Vector<T>
The resulting type after applying the -
operator.
pub fn sub(self, rhs: Vector<T>) -> Self::Output
[src]
Subtracts two vectors
Example
use mathru::algebra::linear::Vector; let a: Vector<f64> = Vector::new_column(4, vec![1.0, 2.0, 3.0, 4.0]); let b: Vector<f64> = Vector::new_column(4, vec![3.0, -4.0, 5.0, 4.0]); let res_ref: Vector<f64> = Vector::new_column(4, vec![-2.0, 6.0, -2.0, 0.0]); assert_eq!(res_ref, a - b)
impl<T> Substitute<Vector<T>> for Matrix<T> where
T: Field + Scalar,
[src]
T: Field + Scalar,
pub fn substitute_forward(&self, a: Vector<T>) -> Vector<T>
[src]
pub fn substitute_backward(&self, c: Vector<T>) -> Vector<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Vector<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Vector<T> where
T: Send,
T: Send,
impl<T> Sync for Vector<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Vector<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Vector<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
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>,