[−][src]Type Definition nalgebra::base::Vector
type Vector<N, D, S> = Matrix<N, D, U1, S>;
A matrix with one column and D
rows.
Methods
impl<N: Scalar + PartialOrd, D: Dim, S: Storage<N, D>> Vector<N, D, S>
[src]
pub fn argmax(&self) -> (usize, N)
[src]
Computes the index and value of the vector component with the largest value.
Examples:
let vec = Vector3::new(11, -15, 13); assert_eq!(vec.argmax(), (2, 13));
pub fn imax(&self) -> usize
[src]
Computes the index of the vector component with the largest value.
Examples:
let vec = Vector3::new(11, -15, 13); assert_eq!(vec.imax(), 2);
pub fn iamax(&self) -> usize where
N: Signed,
[src]
N: Signed,
Computes the index of the vector component with the largest absolute value.
Examples:
let vec = Vector3::new(11, -15, 13); assert_eq!(vec.iamax(), 1);
pub fn argmin(&self) -> (usize, N)
[src]
Computes the index and value of the vector component with the smallest value.
Examples:
let vec = Vector3::new(11, -15, 13); assert_eq!(vec.argmin(), (1, -15));
pub fn imin(&self) -> usize
[src]
Computes the index of the vector component with the smallest value.
Examples:
let vec = Vector3::new(11, -15, 13); assert_eq!(vec.imin(), 1);
pub fn iamin(&self) -> usize where
N: Signed,
[src]
N: Signed,
Computes the index of the vector component with the smallest absolute value.
Examples:
let vec = Vector3::new(11, -15, 13); assert_eq!(vec.iamin(), 0);
impl<N, D: Dim, S> Vector<N, D, S> where
N: Scalar + Zero + ClosedAdd + ClosedMul,
S: StorageMut<N, D>,
[src]
N: Scalar + Zero + ClosedAdd + ClosedMul,
S: StorageMut<N, D>,
pub fn axpy<D2: Dim, SB>(&mut self, a: N, x: &Vector<N, D2, SB>, b: N) where
SB: Storage<N, D2>,
ShapeConstraint: DimEq<D, D2>,
[src]
SB: Storage<N, D2>,
ShapeConstraint: DimEq<D, D2>,
Computes self = a * x + b * self
.
If be is zero, self
is never read from.
Examples:
let mut vec1 = Vector3::new(1.0, 2.0, 3.0); let vec2 = Vector3::new(0.1, 0.2, 0.3); vec1.axpy(10.0, &vec2, 5.0); assert_eq!(vec1, Vector3::new(6.0, 12.0, 18.0));
pub fn gemv<R2: Dim, C2: Dim, D3: Dim, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, R2, C2, SB>,
x: &Vector<N, D3, SC>,
beta: N
) where
N: One,
SB: Storage<N, R2, C2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, R2> + AreMultipliable<R2, C2, D3, U1>,
[src]
&mut self,
alpha: N,
a: &Matrix<N, R2, C2, SB>,
x: &Vector<N, D3, SC>,
beta: N
) where
N: One,
SB: Storage<N, R2, C2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, R2> + AreMultipliable<R2, C2, D3, U1>,
Computes self = alpha * a * x + beta * self
, where a
is a matrix, x
a vector, and
alpha, beta
two scalars.
If beta
is zero, self
is never read.
Examples:
let mut vec1 = Vector2::new(1.0, 2.0); let vec2 = Vector2::new(0.1, 0.2); let mat = Matrix2::new(1.0, 2.0, 3.0, 4.0); vec1.gemv(10.0, &mat, &vec2, 5.0); assert_eq!(vec1, Vector2::new(10.0, 21.0));
pub fn gemv_symm<D2: Dim, D3: Dim, SB, SC>(
&mut self,
alpha: N,
a: &SquareMatrix<N, D2, SB>,
x: &Vector<N, D3, SC>,
beta: N
) where
N: One,
SB: Storage<N, D2, D2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, D2> + AreMultipliable<D2, D2, D3, U1>,
[src]
&mut self,
alpha: N,
a: &SquareMatrix<N, D2, SB>,
x: &Vector<N, D3, SC>,
beta: N
) where
N: One,
SB: Storage<N, D2, D2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, D2> + AreMultipliable<D2, D2, D3, U1>,
Computes self = alpha * a * x + beta * self
, where a
is a symmetric matrix, x
a
vector, and alpha, beta
two scalars.
If beta
is zero, self
is never read. If self
is read, only its lower-triangular part
(including the diagonal) is actually read.
Examples:
let mat = Matrix2::new(1.0, 2.0, 2.0, 4.0); let mut vec1 = Vector2::new(1.0, 2.0); let vec2 = Vector2::new(0.1, 0.2); vec1.gemv_symm(10.0, &mat, &vec2, 5.0); assert_eq!(vec1, Vector2::new(10.0, 20.0)); // The matrix upper-triangular elements can be garbage because it is never // read by this method. Therefore, it is not necessary for the caller to // fill the matrix struct upper-triangle. let mat = Matrix2::new(1.0, 9999999.9999999, 2.0, 4.0); let mut vec1 = Vector2::new(1.0, 2.0); vec1.gemv_symm(10.0, &mat, &vec2, 5.0); assert_eq!(vec1, Vector2::new(10.0, 20.0));
pub fn gemv_tr<R2: Dim, C2: Dim, D3: Dim, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, R2, C2, SB>,
x: &Vector<N, D3, SC>,
beta: N
) where
N: One,
SB: Storage<N, R2, C2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, C2> + AreMultipliable<C2, R2, D3, U1>,
[src]
&mut self,
alpha: N,
a: &Matrix<N, R2, C2, SB>,
x: &Vector<N, D3, SC>,
beta: N
) where
N: One,
SB: Storage<N, R2, C2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, C2> + AreMultipliable<C2, R2, D3, U1>,
Computes self = alpha * a.transpose() * x + beta * self
, where a
is a matrix, x
a vector, and
alpha, beta
two scalars.
If beta
is zero, self
is never read.
Examples:
let mat = Matrix2::new(1.0, 3.0, 2.0, 4.0); let mut vec1 = Vector2::new(1.0, 2.0); let vec2 = Vector2::new(0.1, 0.2); let expected = mat.transpose() * vec2 * 10.0 + vec1 * 5.0; vec1.gemv_tr(10.0, &mat, &vec2, 5.0); assert_eq!(vec1, expected);
impl<N: Scalar, D: Dim, S: Storage<N, D>> Vector<N, D, S>
[src]
pub unsafe fn vget_unchecked(&self, i: usize) -> &N
[src]
Gets a reference to the i-th element of this column vector without bound checking.
impl<N: Scalar, D: Dim, S: StorageMut<N, D>> Vector<N, D, S>
[src]
pub unsafe fn vget_unchecked_mut(&mut self, i: usize) -> &mut N
[src]
Gets a mutable reference to the i-th element of this column vector without bound checking.
impl<N: Scalar + Zero, D: DimAdd<U1>, S: Storage<N, D>> Vector<N, D, S>
[src]
pub fn to_homogeneous(&self) -> VectorN<N, DimSum<D, U1>> where
DefaultAllocator: Allocator<N, DimSum<D, U1>>,
[src]
DefaultAllocator: Allocator<N, DimSum<D, U1>>,
Computes the coordinates in projective space of this vector, i.e., appends a 0
to its
coordinates.
pub fn from_homogeneous<SB>(
v: Vector<N, DimSum<D, U1>, SB>
) -> Option<VectorN<N, D>> where
SB: Storage<N, DimSum<D, U1>>,
DefaultAllocator: Allocator<N, D>,
[src]
v: Vector<N, DimSum<D, U1>, SB>
) -> Option<VectorN<N, D>> where
SB: Storage<N, DimSum<D, U1>>,
DefaultAllocator: Allocator<N, D>,
Constructs a vector from coordinates in projective space, i.e., removes a 0
at the end of
self
. Returns None
if this last component is not zero.
impl<N: Scalar + Zero, D: DimAdd<U1>, S: Storage<N, D>> Vector<N, D, S>
[src]
pub fn push(&self, element: N) -> VectorN<N, DimSum<D, U1>> where
DefaultAllocator: Allocator<N, DimSum<D, U1>>,
[src]
DefaultAllocator: Allocator<N, DimSum<D, U1>>,
Constructs a new vector of higher dimension by appending element
to the end of self
.
impl<N: Real, S: Storage<N, U3>> Vector<N, U3, S> where
DefaultAllocator: Allocator<N, U3>,
[src]
DefaultAllocator: Allocator<N, U3>,
pub fn cross_matrix(&self) -> MatrixN<N, U3>
[src]
Computes the matrix M
such that for all vector v
we have M * v == self.cross(&v)
.
impl<N: Scalar + Zero + One + ClosedAdd + ClosedSub + ClosedMul, D: Dim, S: Storage<N, D>> Vector<N, D, S>
[src]
pub fn lerp<S2: Storage<N, D>>(
&self,
rhs: &Vector<N, D, S2>,
t: N
) -> VectorN<N, D> where
DefaultAllocator: Allocator<N, D>,
[src]
&self,
rhs: &Vector<N, D, S2>,
t: N
) -> VectorN<N, D> where
DefaultAllocator: Allocator<N, D>,
Returns self * (1.0 - t) + rhs * t
, i.e., the linear blend of the vectors x and y using the scalar value a.
The value for a is not restricted to the range [0, 1]
.
Examples:
let x = Vector3::new(1.0, 2.0, 3.0); let y = Vector3::new(10.0, 20.0, 30.0); assert_eq!(x.lerp(&y, 0.1), Vector3::new(1.9, 3.8, 5.7));
impl<N: Scalar, D: DimName, S: Storage<N, D>> Vector<N, D, S> where
D::Value: Cmp<U0, Output = Greater>,
[src]
D::Value: Cmp<U0, Output = Greater>,
pub fn xx(&self) -> Vector2<N>
[src]
Builds a new vector from components of self
.
pub fn xxx(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
impl<N: Scalar, D: DimName, S: Storage<N, D>> Vector<N, D, S> where
D::Value: Cmp<U1, Output = Greater>,
[src]
D::Value: Cmp<U1, Output = Greater>,
pub fn xy(&self) -> Vector2<N>
[src]
Builds a new vector from components of self
.
pub fn yx(&self) -> Vector2<N>
[src]
Builds a new vector from components of self
.
pub fn yy(&self) -> Vector2<N>
[src]
Builds a new vector from components of self
.
pub fn xxy(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn xyx(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn xyy(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn yxx(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn yxy(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn yyx(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn yyy(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
impl<N: Scalar, D: DimName, S: Storage<N, D>> Vector<N, D, S> where
D::Value: Cmp<U2, Output = Greater>,
[src]
D::Value: Cmp<U2, Output = Greater>,
pub fn xz(&self) -> Vector2<N>
[src]
Builds a new vector from components of self
.
pub fn yz(&self) -> Vector2<N>
[src]
Builds a new vector from components of self
.
pub fn zx(&self) -> Vector2<N>
[src]
Builds a new vector from components of self
.
pub fn zy(&self) -> Vector2<N>
[src]
Builds a new vector from components of self
.
pub fn zz(&self) -> Vector2<N>
[src]
Builds a new vector from components of self
.
pub fn xxz(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn xyz(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn xzx(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn xzy(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn xzz(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn yxz(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn yyz(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn yzx(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn yzy(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn yzz(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn zxx(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn zxy(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn zxz(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn zyx(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn zyy(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn zyz(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn zzx(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn zzy(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.
pub fn zzz(&self) -> Vector3<N>
[src]
Builds a new vector from components of self
.