Struct math_adapter::X2
source · [−]#[repr(C)]pub struct X2<Scalar: ScalarInterface>(pub Scalar, pub Scalar);
Expand description
Vector X2
Tuple Fields
0: Scalar
1: Scalar
Methods from Deref<Target = Vector2<Scalar>>
sourcepub fn dot<R2, C2, SB>(&self, rhs: &Matrix<T, R2, C2, SB>) -> T where
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<R, R2>,
ShapeConstraint: DimEq<C, C2>,
pub fn dot<R2, C2, SB>(&self, rhs: &Matrix<T, R2, C2, SB>) -> T where
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<R, R2>,
ShapeConstraint: DimEq<C, C2>,
The dot product between two vectors or matrices (seen as vectors).
This is equal to self.transpose() * rhs
. For the sesquilinear complex dot product, use
self.dotc(rhs)
.
Note that this is not the matrix multiplication as in, e.g., numpy. For matrix
multiplication, use one of: .gemm
, .mul_to
, .mul
, the *
operator.
Example
let vec1 = Vector3::new(1.0, 2.0, 3.0);
let vec2 = Vector3::new(0.1, 0.2, 0.3);
assert_eq!(vec1.dot(&vec2), 1.4);
let mat1 = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
let mat2 = Matrix2x3::new(0.1, 0.2, 0.3,
0.4, 0.5, 0.6);
assert_eq!(mat1.dot(&mat2), 9.1);
sourcepub fn dotc<R2, C2, SB>(&self, rhs: &Matrix<T, R2, C2, SB>) -> T where
R2: Dim,
C2: Dim,
T: SimdComplexField,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<R, R2>,
ShapeConstraint: DimEq<C, C2>,
pub fn dotc<R2, C2, SB>(&self, rhs: &Matrix<T, R2, C2, SB>) -> T where
R2: Dim,
C2: Dim,
T: SimdComplexField,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<R, R2>,
ShapeConstraint: DimEq<C, C2>,
The conjugate-linear dot product between two vectors or matrices (seen as vectors).
This is equal to self.adjoint() * rhs
.
For real vectors, this is identical to self.dot(&rhs)
.
Note that this is not the matrix multiplication as in, e.g., numpy. For matrix
multiplication, use one of: .gemm
, .mul_to
, .mul
, the *
operator.
Example
let vec1 = Vector2::new(Complex::new(1.0, 2.0), Complex::new(3.0, 4.0));
let vec2 = Vector2::new(Complex::new(0.4, 0.3), Complex::new(0.2, 0.1));
assert_eq!(vec1.dotc(&vec2), Complex::new(2.0, -1.0));
// Note that for complex vectors, we generally have:
// vec1.dotc(&vec2) != vec2.dot(&vec2)
assert_ne!(vec1.dotc(&vec2), vec1.dot(&vec2));
sourcepub fn tr_dot<R2, C2, SB>(&self, rhs: &Matrix<T, R2, C2, SB>) -> T where
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<C, R2>,
ShapeConstraint: DimEq<R, C2>,
pub fn tr_dot<R2, C2, SB>(&self, rhs: &Matrix<T, R2, C2, SB>) -> T where
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<C, R2>,
ShapeConstraint: DimEq<R, C2>,
The dot product between the transpose of self
and rhs
.
Example
let vec1 = Vector3::new(1.0, 2.0, 3.0);
let vec2 = RowVector3::new(0.1, 0.2, 0.3);
assert_eq!(vec1.tr_dot(&vec2), 1.4);
let mat1 = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
let mat2 = Matrix3x2::new(0.1, 0.4,
0.2, 0.5,
0.3, 0.6);
assert_eq!(mat1.tr_dot(&mat2), 9.1);
sourcepub fn axcpy<D2, SB>(
&mut self,
a: T,
x: &Matrix<T, D2, Const<1_usize>, SB>,
c: T,
b: T
) where
D2: Dim,
SB: Storage<T, D2, Const<1_usize>>,
ShapeConstraint: DimEq<D, D2>,
pub fn axcpy<D2, SB>(
&mut self,
a: T,
x: &Matrix<T, D2, Const<1_usize>, SB>,
c: T,
b: T
) where
D2: Dim,
SB: Storage<T, D2, Const<1_usize>>,
ShapeConstraint: DimEq<D, D2>,
Computes self = a * x * c + b * self
.
If b
is zero, self
is never read from.
Example
let mut vec1 = Vector3::new(1.0, 2.0, 3.0);
let vec2 = Vector3::new(0.1, 0.2, 0.3);
vec1.axcpy(5.0, &vec2, 2.0, 5.0);
assert_eq!(vec1, Vector3::new(6.0, 12.0, 18.0));
sourcepub fn axpy<D2, SB>(&mut self, a: T, x: &Matrix<T, D2, Const<1_usize>, SB>, b: T) where
D2: Dim,
T: One,
SB: Storage<T, D2, Const<1_usize>>,
ShapeConstraint: DimEq<D, D2>,
pub fn axpy<D2, SB>(&mut self, a: T, x: &Matrix<T, D2, Const<1_usize>, SB>, b: T) where
D2: Dim,
T: One,
SB: Storage<T, D2, Const<1_usize>>,
ShapeConstraint: DimEq<D, D2>,
Computes self = a * x + b * self
.
If b
is zero, self
is never read from.
Example
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));
sourcepub fn gemv<R2, C2, D3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
x: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
R2: Dim,
C2: Dim,
D3: Dim,
T: One,
SB: Storage<T, R2, C2>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<D, R2>,
ShapeConstraint: AreMultipliable<R2, C2, D3, Const<1_usize>>,
pub fn gemv<R2, C2, D3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
x: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
R2: Dim,
C2: Dim,
D3: Dim,
T: One,
SB: Storage<T, R2, C2>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<D, R2>,
ShapeConstraint: AreMultipliable<R2, C2, D3, Const<1_usize>>,
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.
Example
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));
sourcepub fn sygemv<D2, D3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, D2, D2, SB>,
x: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
D2: Dim,
D3: Dim,
T: One,
SB: Storage<T, D2, D2>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<D, D2>,
ShapeConstraint: AreMultipliable<D2, D2, D3, Const<1_usize>>,
pub fn sygemv<D2, D3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, D2, D2, SB>,
x: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
D2: Dim,
D3: Dim,
T: One,
SB: Storage<T, D2, D2>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<D, D2>,
ShapeConstraint: AreMultipliable<D2, D2, D3, Const<1_usize>>,
Computes self = alpha * a * x + beta * self
, where a
is a symmetric matrix, x
a
vector, and alpha, beta
two scalars.
For hermitian matrices, use .hegemv
instead.
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.sygemv(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.sygemv(10.0, &mat, &vec2, 5.0);
assert_eq!(vec1, Vector2::new(10.0, 20.0));
sourcepub fn hegemv<D2, D3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, D2, D2, SB>,
x: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
D2: Dim,
D3: Dim,
T: SimdComplexField,
SB: Storage<T, D2, D2>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<D, D2>,
ShapeConstraint: AreMultipliable<D2, D2, D3, Const<1_usize>>,
pub fn hegemv<D2, D3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, D2, D2, SB>,
x: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
D2: Dim,
D3: Dim,
T: SimdComplexField,
SB: Storage<T, D2, D2>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<D, D2>,
ShapeConstraint: AreMultipliable<D2, D2, D3, Const<1_usize>>,
Computes self = alpha * a * x + beta * self
, where a
is an hermitian 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(Complex::new(1.0, 0.0), Complex::new(2.0, -0.1),
Complex::new(2.0, 1.0), Complex::new(4.0, 0.0));
let mut vec1 = Vector2::new(Complex::new(1.0, 2.0), Complex::new(3.0, 4.0));
let vec2 = Vector2::new(Complex::new(0.1, 0.2), Complex::new(0.3, 0.4));
vec1.sygemv(Complex::new(10.0, 20.0), &mat, &vec2, Complex::new(5.0, 15.0));
assert_eq!(vec1, Vector2::new(Complex::new(-48.0, 44.0), Complex::new(-75.0, 110.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(Complex::new(1.0, 0.0), Complex::new(99999999.9, 999999999.9),
Complex::new(2.0, 1.0), Complex::new(4.0, 0.0));
let mut vec1 = Vector2::new(Complex::new(1.0, 2.0), Complex::new(3.0, 4.0));
let vec2 = Vector2::new(Complex::new(0.1, 0.2), Complex::new(0.3, 0.4));
vec1.sygemv(Complex::new(10.0, 20.0), &mat, &vec2, Complex::new(5.0, 15.0));
assert_eq!(vec1, Vector2::new(Complex::new(-48.0, 44.0), Complex::new(-75.0, 110.0)));
sourcepub fn gemv_tr<R2, C2, D3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
x: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
R2: Dim,
C2: Dim,
D3: Dim,
T: One,
SB: Storage<T, R2, C2>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<D, C2>,
ShapeConstraint: AreMultipliable<C2, R2, D3, Const<1_usize>>,
pub fn gemv_tr<R2, C2, D3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
x: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
R2: Dim,
C2: Dim,
D3: Dim,
T: One,
SB: Storage<T, R2, C2>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<D, C2>,
ShapeConstraint: AreMultipliable<C2, R2, D3, Const<1_usize>>,
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.
Example
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);
sourcepub fn gemv_ad<R2, C2, D3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
x: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
R2: Dim,
C2: Dim,
D3: Dim,
T: SimdComplexField,
SB: Storage<T, R2, C2>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<D, C2>,
ShapeConstraint: AreMultipliable<C2, R2, D3, Const<1_usize>>,
pub fn gemv_ad<R2, C2, D3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
x: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
R2: Dim,
C2: Dim,
D3: Dim,
T: SimdComplexField,
SB: Storage<T, R2, C2>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<D, C2>,
ShapeConstraint: AreMultipliable<C2, R2, D3, Const<1_usize>>,
Computes self = alpha * a.adjoint() * x + beta * self
, where a
is a matrix, x
a vector, and
alpha, beta
two scalars.
For real matrices, this is the same as .gemv_tr
.
If beta
is zero, self
is never read.
Example
let mat = Matrix2::new(Complex::new(1.0, 2.0), Complex::new(3.0, 4.0),
Complex::new(5.0, 6.0), Complex::new(7.0, 8.0));
let mut vec1 = Vector2::new(Complex::new(1.0, 2.0), Complex::new(3.0, 4.0));
let vec2 = Vector2::new(Complex::new(0.1, 0.2), Complex::new(0.3, 0.4));
let expected = mat.adjoint() * vec2 * Complex::new(10.0, 20.0) + vec1 * Complex::new(5.0, 15.0);
vec1.gemv_ad(Complex::new(10.0, 20.0), &mat, &vec2, Complex::new(5.0, 15.0));
assert_eq!(vec1, expected);
sourcepub fn ger<D2, D3, SB, SC>(
&mut self,
alpha: T,
x: &Matrix<T, D2, Const<1_usize>, SB>,
y: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
D2: Dim,
D3: Dim,
T: One,
SB: Storage<T, D2, Const<1_usize>>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<R1, D2>,
ShapeConstraint: DimEq<C1, D3>,
pub fn ger<D2, D3, SB, SC>(
&mut self,
alpha: T,
x: &Matrix<T, D2, Const<1_usize>, SB>,
y: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
D2: Dim,
D3: Dim,
T: One,
SB: Storage<T, D2, Const<1_usize>>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<R1, D2>,
ShapeConstraint: DimEq<C1, D3>,
Computes self = alpha * x * y.transpose() + beta * self
.
If beta
is zero, self
is never read.
Example
let mut mat = Matrix2x3::repeat(4.0);
let vec1 = Vector2::new(1.0, 2.0);
let vec2 = Vector3::new(0.1, 0.2, 0.3);
let expected = vec1 * vec2.transpose() * 10.0 + mat * 5.0;
mat.ger(10.0, &vec1, &vec2, 5.0);
assert_eq!(mat, expected);
sourcepub fn gerc<D2, D3, SB, SC>(
&mut self,
alpha: T,
x: &Matrix<T, D2, Const<1_usize>, SB>,
y: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
D2: Dim,
D3: Dim,
T: SimdComplexField,
SB: Storage<T, D2, Const<1_usize>>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<R1, D2>,
ShapeConstraint: DimEq<C1, D3>,
pub fn gerc<D2, D3, SB, SC>(
&mut self,
alpha: T,
x: &Matrix<T, D2, Const<1_usize>, SB>,
y: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
D2: Dim,
D3: Dim,
T: SimdComplexField,
SB: Storage<T, D2, Const<1_usize>>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<R1, D2>,
ShapeConstraint: DimEq<C1, D3>,
Computes self = alpha * x * y.adjoint() + beta * self
.
If beta
is zero, self
is never read.
Example
let mut mat = Matrix2x3::repeat(Complex::new(4.0, 5.0));
let vec1 = Vector2::new(Complex::new(1.0, 2.0), Complex::new(3.0, 4.0));
let vec2 = Vector3::new(Complex::new(0.6, 0.5), Complex::new(0.4, 0.5), Complex::new(0.2, 0.1));
let expected = vec1 * vec2.adjoint() * Complex::new(10.0, 20.0) + mat * Complex::new(5.0, 15.0);
mat.gerc(Complex::new(10.0, 20.0), &vec1, &vec2, Complex::new(5.0, 15.0));
assert_eq!(mat, expected);
sourcepub fn gemm<R2, C2, R3, C3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
T: One,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C3>,
ShapeConstraint: AreMultipliable<R2, C2, R3, C3>,
pub fn gemm<R2, C2, R3, C3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
T: One,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C3>,
ShapeConstraint: AreMultipliable<R2, C2, R3, C3>,
Computes self = alpha * a * b + beta * self
, where a, b, self
are matrices.
alpha
and beta
are scalar.
If beta
is zero, self
is never read.
Example
let mut mat1 = Matrix2x4::identity();
let mat2 = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
let mat3 = Matrix3x4::new(0.1, 0.2, 0.3, 0.4,
0.5, 0.6, 0.7, 0.8,
0.9, 1.0, 1.1, 1.2);
let expected = mat2 * mat3 * 10.0 + mat1 * 5.0;
mat1.gemm(10.0, &mat2, &mat3, 5.0);
assert_relative_eq!(mat1, expected);
sourcepub fn gemm_tr<R2, C2, R3, C3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
T: One,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, C2>,
ShapeConstraint: SameNumberOfColumns<C1, C3>,
ShapeConstraint: AreMultipliable<C2, R2, R3, C3>,
pub fn gemm_tr<R2, C2, R3, C3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
T: One,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, C2>,
ShapeConstraint: SameNumberOfColumns<C1, C3>,
ShapeConstraint: AreMultipliable<C2, R2, R3, C3>,
Computes self = alpha * a.transpose() * b + beta * self
, where a, b, self
are matrices.
alpha
and beta
are scalar.
If beta
is zero, self
is never read.
Example
let mut mat1 = Matrix2x4::identity();
let mat2 = Matrix3x2::new(1.0, 4.0,
2.0, 5.0,
3.0, 6.0);
let mat3 = Matrix3x4::new(0.1, 0.2, 0.3, 0.4,
0.5, 0.6, 0.7, 0.8,
0.9, 1.0, 1.1, 1.2);
let expected = mat2.transpose() * mat3 * 10.0 + mat1 * 5.0;
mat1.gemm_tr(10.0, &mat2, &mat3, 5.0);
assert_eq!(mat1, expected);
sourcepub fn gemm_ad<R2, C2, R3, C3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
T: SimdComplexField,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, C2>,
ShapeConstraint: SameNumberOfColumns<C1, C3>,
ShapeConstraint: AreMultipliable<C2, R2, R3, C3>,
pub fn gemm_ad<R2, C2, R3, C3, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
T: SimdComplexField,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, C2>,
ShapeConstraint: SameNumberOfColumns<C1, C3>,
ShapeConstraint: AreMultipliable<C2, R2, R3, C3>,
Computes self = alpha * a.adjoint() * b + beta * self
, where a, b, self
are matrices.
alpha
and beta
are scalar.
If beta
is zero, self
is never read.
Example
let mut mat1 = Matrix2x4::identity();
let mat2 = Matrix3x2::new(Complex::new(1.0, 4.0), Complex::new(7.0, 8.0),
Complex::new(2.0, 5.0), Complex::new(9.0, 10.0),
Complex::new(3.0, 6.0), Complex::new(11.0, 12.0));
let mat3 = Matrix3x4::new(Complex::new(0.1, 1.3), Complex::new(0.2, 1.4), Complex::new(0.3, 1.5), Complex::new(0.4, 1.6),
Complex::new(0.5, 1.7), Complex::new(0.6, 1.8), Complex::new(0.7, 1.9), Complex::new(0.8, 2.0),
Complex::new(0.9, 2.1), Complex::new(1.0, 2.2), Complex::new(1.1, 2.3), Complex::new(1.2, 2.4));
let expected = mat2.adjoint() * mat3 * Complex::new(10.0, 20.0) + mat1 * Complex::new(5.0, 15.0);
mat1.gemm_ad(Complex::new(10.0, 20.0), &mat2, &mat3, Complex::new(5.0, 15.0));
assert_eq!(mat1, expected);
sourcepub fn ger_symm<D2, D3, SB, SC>(
&mut self,
alpha: T,
x: &Matrix<T, D2, Const<1_usize>, SB>,
y: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
D2: Dim,
D3: Dim,
T: One,
SB: Storage<T, D2, Const<1_usize>>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<R1, D2>,
ShapeConstraint: DimEq<C1, D3>,
👎 Deprecated: This is renamed syger
to match the original BLAS terminology.
pub fn ger_symm<D2, D3, SB, SC>(
&mut self,
alpha: T,
x: &Matrix<T, D2, Const<1_usize>, SB>,
y: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
D2: Dim,
D3: Dim,
T: One,
SB: Storage<T, D2, Const<1_usize>>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<R1, D2>,
ShapeConstraint: DimEq<C1, D3>,
This is renamed syger
to match the original BLAS terminology.
Computes self = alpha * x * y.transpose() + beta * self
, where self
is a symmetric
matrix.
If beta
is zero, self
is never read. The result is symmetric. Only the lower-triangular
(including the diagonal) part of self
is read/written.
Example
let mut mat = Matrix2::identity();
let vec1 = Vector2::new(1.0, 2.0);
let vec2 = Vector2::new(0.1, 0.2);
let expected = vec1 * vec2.transpose() * 10.0 + mat * 5.0;
mat.m12 = 99999.99999; // This component is on the upper-triangular part and will not be read/written.
mat.ger_symm(10.0, &vec1, &vec2, 5.0);
assert_eq!(mat.lower_triangle(), expected.lower_triangle());
assert_eq!(mat.m12, 99999.99999); // This was untouched.
sourcepub fn syger<D2, D3, SB, SC>(
&mut self,
alpha: T,
x: &Matrix<T, D2, Const<1_usize>, SB>,
y: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
D2: Dim,
D3: Dim,
T: One,
SB: Storage<T, D2, Const<1_usize>>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<R1, D2>,
ShapeConstraint: DimEq<C1, D3>,
pub fn syger<D2, D3, SB, SC>(
&mut self,
alpha: T,
x: &Matrix<T, D2, Const<1_usize>, SB>,
y: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
D2: Dim,
D3: Dim,
T: One,
SB: Storage<T, D2, Const<1_usize>>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<R1, D2>,
ShapeConstraint: DimEq<C1, D3>,
Computes self = alpha * x * y.transpose() + beta * self
, where self
is a symmetric
matrix.
For hermitian complex matrices, use .hegerc
instead.
If beta
is zero, self
is never read. The result is symmetric. Only the lower-triangular
(including the diagonal) part of self
is read/written.
Example
let mut mat = Matrix2::identity();
let vec1 = Vector2::new(1.0, 2.0);
let vec2 = Vector2::new(0.1, 0.2);
let expected = vec1 * vec2.transpose() * 10.0 + mat * 5.0;
mat.m12 = 99999.99999; // This component is on the upper-triangular part and will not be read/written.
mat.syger(10.0, &vec1, &vec2, 5.0);
assert_eq!(mat.lower_triangle(), expected.lower_triangle());
assert_eq!(mat.m12, 99999.99999); // This was untouched.
sourcepub fn hegerc<D2, D3, SB, SC>(
&mut self,
alpha: T,
x: &Matrix<T, D2, Const<1_usize>, SB>,
y: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
D2: Dim,
D3: Dim,
T: SimdComplexField,
SB: Storage<T, D2, Const<1_usize>>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<R1, D2>,
ShapeConstraint: DimEq<C1, D3>,
pub fn hegerc<D2, D3, SB, SC>(
&mut self,
alpha: T,
x: &Matrix<T, D2, Const<1_usize>, SB>,
y: &Matrix<T, D3, Const<1_usize>, SC>,
beta: T
) where
D2: Dim,
D3: Dim,
T: SimdComplexField,
SB: Storage<T, D2, Const<1_usize>>,
SC: Storage<T, D3, Const<1_usize>>,
ShapeConstraint: DimEq<R1, D2>,
ShapeConstraint: DimEq<C1, D3>,
Computes self = alpha * x * y.adjoint() + beta * self
, where self
is an hermitian
matrix.
If beta
is zero, self
is never read. The result is symmetric. Only the lower-triangular
(including the diagonal) part of self
is read/written.
Example
let mut mat = Matrix2::identity();
let vec1 = Vector2::new(Complex::new(1.0, 3.0), Complex::new(2.0, 4.0));
let vec2 = Vector2::new(Complex::new(0.2, 0.4), Complex::new(0.1, 0.3));
let expected = vec1 * vec2.adjoint() * Complex::new(10.0, 20.0) + mat * Complex::new(5.0, 15.0);
mat.m12 = Complex::new(99999.99999, 88888.88888); // This component is on the upper-triangular part and will not be read/written.
mat.hegerc(Complex::new(10.0, 20.0), &vec1, &vec2, Complex::new(5.0, 15.0));
assert_eq!(mat.lower_triangle(), expected.lower_triangle());
assert_eq!(mat.m12, Complex::new(99999.99999, 88888.88888)); // This was untouched.
sourcepub fn quadform_tr_with_workspace<D2, S2, R3, C3, S3, D4, S4>(
&mut self,
work: &mut Matrix<T, D2, Const<1_usize>, S2>,
alpha: T,
lhs: &Matrix<T, R3, C3, S3>,
mid: &Matrix<T, D4, D4, S4>,
beta: T
) where
D2: Dim,
R3: Dim,
C3: Dim,
D4: Dim,
S2: StorageMut<T, D2, Const<1_usize>>,
S3: Storage<T, R3, C3>,
S4: Storage<T, D4, D4>,
ShapeConstraint: DimEq<D1, D2>,
ShapeConstraint: DimEq<D1, R3>,
ShapeConstraint: DimEq<D2, R3>,
ShapeConstraint: DimEq<C3, D4>,
pub fn quadform_tr_with_workspace<D2, S2, R3, C3, S3, D4, S4>(
&mut self,
work: &mut Matrix<T, D2, Const<1_usize>, S2>,
alpha: T,
lhs: &Matrix<T, R3, C3, S3>,
mid: &Matrix<T, D4, D4, S4>,
beta: T
) where
D2: Dim,
R3: Dim,
C3: Dim,
D4: Dim,
S2: StorageMut<T, D2, Const<1_usize>>,
S3: Storage<T, R3, C3>,
S4: Storage<T, D4, D4>,
ShapeConstraint: DimEq<D1, D2>,
ShapeConstraint: DimEq<D1, R3>,
ShapeConstraint: DimEq<D2, R3>,
ShapeConstraint: DimEq<C3, D4>,
Computes the quadratic form self = alpha * lhs * mid * lhs.transpose() + beta * self
.
This uses the provided workspace work
to avoid allocations for intermediate results.
Example
// Note that all those would also work with statically-sized matrices.
// We use DMatrix/DVector since that's the only case where pre-allocating the
// workspace is actually useful (assuming the same workspace is re-used for
// several computations) because it avoids repeated dynamic allocations.
let mut mat = DMatrix::identity(2, 2);
let lhs = DMatrix::from_row_slice(2, 3, &[1.0, 2.0, 3.0,
4.0, 5.0, 6.0]);
let mid = DMatrix::from_row_slice(3, 3, &[0.1, 0.2, 0.3,
0.5, 0.6, 0.7,
0.9, 1.0, 1.1]);
// The random shows that values on the workspace do not
// matter as they will be overwritten.
let mut workspace = DVector::new_random(2);
let expected = &lhs * &mid * lhs.transpose() * 10.0 + &mat * 5.0;
mat.quadform_tr_with_workspace(&mut workspace, 10.0, &lhs, &mid, 5.0);
assert_relative_eq!(mat, expected);
sourcepub fn quadform_tr<R3, C3, S3, D4, S4>(
&mut self,
alpha: T,
lhs: &Matrix<T, R3, C3, S3>,
mid: &Matrix<T, D4, D4, S4>,
beta: T
) where
R3: Dim,
C3: Dim,
D4: Dim,
S3: Storage<T, R3, C3>,
S4: Storage<T, D4, D4>,
ShapeConstraint: DimEq<D1, D1>,
ShapeConstraint: DimEq<D1, R3>,
ShapeConstraint: DimEq<C3, D4>,
DefaultAllocator: Allocator<T, D1, Const<1_usize>>,
pub fn quadform_tr<R3, C3, S3, D4, S4>(
&mut self,
alpha: T,
lhs: &Matrix<T, R3, C3, S3>,
mid: &Matrix<T, D4, D4, S4>,
beta: T
) where
R3: Dim,
C3: Dim,
D4: Dim,
S3: Storage<T, R3, C3>,
S4: Storage<T, D4, D4>,
ShapeConstraint: DimEq<D1, D1>,
ShapeConstraint: DimEq<D1, R3>,
ShapeConstraint: DimEq<C3, D4>,
DefaultAllocator: Allocator<T, D1, Const<1_usize>>,
Computes the quadratic form self = alpha * lhs * mid * lhs.transpose() + beta * self
.
This allocates a workspace vector of dimension D1 for intermediate results.
If D1
is a type-level integer, then the allocation is performed on the stack.
Use .quadform_tr_with_workspace(...)
instead to avoid allocations.
Example
let mut mat = Matrix2::identity();
let lhs = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
let mid = Matrix3::new(0.1, 0.2, 0.3,
0.5, 0.6, 0.7,
0.9, 1.0, 1.1);
let expected = lhs * mid * lhs.transpose() * 10.0 + mat * 5.0;
mat.quadform_tr(10.0, &lhs, &mid, 5.0);
assert_relative_eq!(mat, expected);
sourcepub fn quadform_with_workspace<D2, S2, D3, S3, R4, C4, S4>(
&mut self,
work: &mut Matrix<T, D2, Const<1_usize>, S2>,
alpha: T,
mid: &Matrix<T, D3, D3, S3>,
rhs: &Matrix<T, R4, C4, S4>,
beta: T
) where
D2: Dim,
D3: Dim,
R4: Dim,
C4: Dim,
S2: StorageMut<T, D2, Const<1_usize>>,
S3: Storage<T, D3, D3>,
S4: Storage<T, R4, C4>,
ShapeConstraint: DimEq<D3, R4>,
ShapeConstraint: DimEq<D1, C4>,
ShapeConstraint: DimEq<D2, D3>,
ShapeConstraint: AreMultipliable<C4, R4, D2, Const<1_usize>>,
pub fn quadform_with_workspace<D2, S2, D3, S3, R4, C4, S4>(
&mut self,
work: &mut Matrix<T, D2, Const<1_usize>, S2>,
alpha: T,
mid: &Matrix<T, D3, D3, S3>,
rhs: &Matrix<T, R4, C4, S4>,
beta: T
) where
D2: Dim,
D3: Dim,
R4: Dim,
C4: Dim,
S2: StorageMut<T, D2, Const<1_usize>>,
S3: Storage<T, D3, D3>,
S4: Storage<T, R4, C4>,
ShapeConstraint: DimEq<D3, R4>,
ShapeConstraint: DimEq<D1, C4>,
ShapeConstraint: DimEq<D2, D3>,
ShapeConstraint: AreMultipliable<C4, R4, D2, Const<1_usize>>,
Computes the quadratic form self = alpha * rhs.transpose() * mid * rhs + beta * self
.
This uses the provided workspace work
to avoid allocations for intermediate results.
Example
// Note that all those would also work with statically-sized matrices.
// We use DMatrix/DVector since that's the only case where pre-allocating the
// workspace is actually useful (assuming the same workspace is re-used for
// several computations) because it avoids repeated dynamic allocations.
let mut mat = DMatrix::identity(2, 2);
let rhs = DMatrix::from_row_slice(3, 2, &[1.0, 2.0,
3.0, 4.0,
5.0, 6.0]);
let mid = DMatrix::from_row_slice(3, 3, &[0.1, 0.2, 0.3,
0.5, 0.6, 0.7,
0.9, 1.0, 1.1]);
// The random shows that values on the workspace do not
// matter as they will be overwritten.
let mut workspace = DVector::new_random(3);
let expected = rhs.transpose() * &mid * &rhs * 10.0 + &mat * 5.0;
mat.quadform_with_workspace(&mut workspace, 10.0, &mid, &rhs, 5.0);
assert_relative_eq!(mat, expected);
sourcepub fn quadform<D2, S2, R3, C3, S3>(
&mut self,
alpha: T,
mid: &Matrix<T, D2, D2, S2>,
rhs: &Matrix<T, R3, C3, S3>,
beta: T
) where
D2: Dim,
R3: Dim,
C3: Dim,
S2: Storage<T, D2, D2>,
S3: Storage<T, R3, C3>,
ShapeConstraint: DimEq<D2, R3>,
ShapeConstraint: DimEq<D1, C3>,
ShapeConstraint: AreMultipliable<C3, R3, D2, Const<1_usize>>,
DefaultAllocator: Allocator<T, D2, Const<1_usize>>,
pub fn quadform<D2, S2, R3, C3, S3>(
&mut self,
alpha: T,
mid: &Matrix<T, D2, D2, S2>,
rhs: &Matrix<T, R3, C3, S3>,
beta: T
) where
D2: Dim,
R3: Dim,
C3: Dim,
S2: Storage<T, D2, D2>,
S3: Storage<T, R3, C3>,
ShapeConstraint: DimEq<D2, R3>,
ShapeConstraint: DimEq<D1, C3>,
ShapeConstraint: AreMultipliable<C3, R3, D2, Const<1_usize>>,
DefaultAllocator: Allocator<T, D2, Const<1_usize>>,
Computes the quadratic form self = alpha * rhs.transpose() * mid * rhs + beta * self
.
This allocates a workspace vector of dimension D2 for intermediate results.
If D2
is a type-level integer, then the allocation is performed on the stack.
Use .quadform_with_workspace(...)
instead to avoid allocations.
Example
let mut mat = Matrix2::identity();
let rhs = Matrix3x2::new(1.0, 2.0,
3.0, 4.0,
5.0, 6.0);
let mid = Matrix3::new(0.1, 0.2, 0.3,
0.5, 0.6, 0.7,
0.9, 1.0, 1.1);
let expected = rhs.transpose() * mid * rhs * 10.0 + mat * 5.0;
mat.quadform(10.0, &mid, &rhs, 5.0);
assert_relative_eq!(mat, expected);
sourcepub fn add_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R3>,
ShapeConstraint: SameNumberOfColumns<C1, C3>,
pub fn add_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R3>,
ShapeConstraint: SameNumberOfColumns<C1, C3>,
Equivalent to self + rhs
but stores the result into out
to avoid allocations.
sourcepub fn sub_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R3>,
ShapeConstraint: SameNumberOfColumns<C1, C3>,
pub fn sub_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R3>,
ShapeConstraint: SameNumberOfColumns<C1, C3>,
Equivalent to self + rhs
but stores the result into out
to avoid allocations.
sourcepub fn tr_mul<R2, C2, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> Matrix<T, C1, C2, <DefaultAllocator as Allocator<T, C1, C2>>::Buffer> where
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
pub fn tr_mul<R2, C2, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> Matrix<T, C1, C2, <DefaultAllocator as Allocator<T, C1, C2>>::Buffer> where
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
Equivalent to self.transpose() * rhs
.
sourcepub fn ad_mul<R2, C2, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> Matrix<T, C1, C2, <DefaultAllocator as Allocator<T, C1, C2>>::Buffer> where
R2: Dim,
C2: Dim,
T: SimdComplexField,
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
pub fn ad_mul<R2, C2, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> Matrix<T, C1, C2, <DefaultAllocator as Allocator<T, C1, C2>>::Buffer> where
R2: Dim,
C2: Dim,
T: SimdComplexField,
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
Equivalent to self.adjoint() * rhs
.
sourcepub fn tr_mul_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: DimEq<C1, R3>,
ShapeConstraint: DimEq<C2, C3>,
pub fn tr_mul_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: DimEq<C1, R3>,
ShapeConstraint: DimEq<C2, C3>,
Equivalent to self.transpose() * rhs
but stores the result into out
to avoid
allocations.
sourcepub fn ad_mul_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
T: SimdComplexField,
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: DimEq<C1, R3>,
ShapeConstraint: DimEq<C2, C3>,
pub fn ad_mul_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
T: SimdComplexField,
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: DimEq<C1, R3>,
ShapeConstraint: DimEq<C2, C3>,
Equivalent to self.adjoint() * rhs
but stores the result into out
to avoid
allocations.
sourcepub fn mul_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R3, R1>,
ShapeConstraint: SameNumberOfColumns<C3, C2>,
ShapeConstraint: AreMultipliable<R1, C1, R2, C2>,
pub fn mul_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R3, R1>,
ShapeConstraint: SameNumberOfColumns<C3, C2>,
ShapeConstraint: AreMultipliable<R1, C1, R2, C2>,
Equivalent to self * rhs
but stores the result into out
to avoid allocations.
sourcepub fn kronecker<R2, C2, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> Matrix<T, <R1 as DimMul<R2>>::Output, <C1 as DimMul<C2>>::Output, <DefaultAllocator as Allocator<T, <R1 as DimMul<R2>>::Output, <C1 as DimMul<C2>>::Output>>::Buffer> where
R2: Dim,
C2: Dim,
T: ClosedMul<T>,
R1: DimMul<R2>,
C1: DimMul<C2>,
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, <R1 as DimMul<R2>>::Output, <C1 as DimMul<C2>>::Output>,
pub fn kronecker<R2, C2, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> Matrix<T, <R1 as DimMul<R2>>::Output, <C1 as DimMul<C2>>::Output, <DefaultAllocator as Allocator<T, <R1 as DimMul<R2>>::Output, <C1 as DimMul<C2>>::Output>>::Buffer> where
R2: Dim,
C2: Dim,
T: ClosedMul<T>,
R1: DimMul<R2>,
C1: DimMul<C2>,
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, <R1 as DimMul<R2>>::Output, <C1 as DimMul<C2>>::Output>,
The kronecker product of two matrices (aka. tensor product of the corresponding linear maps).
sourcepub fn append_scaling(
&self,
scaling: T
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
D: DimNameSub<Const<1_usize>>,
DefaultAllocator: Allocator<T, D, D>,
pub fn append_scaling(
&self,
scaling: T
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
D: DimNameSub<Const<1_usize>>,
DefaultAllocator: Allocator<T, D, D>,
Computes the transformation equal to self
followed by an uniform scaling factor.
sourcepub fn prepend_scaling(
&self,
scaling: T
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
D: DimNameSub<Const<1_usize>>,
DefaultAllocator: Allocator<T, D, D>,
pub fn prepend_scaling(
&self,
scaling: T
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
D: DimNameSub<Const<1_usize>>,
DefaultAllocator: Allocator<T, D, D>,
Computes the transformation equal to an uniform scaling factor followed by self
.
sourcepub fn append_nonuniform_scaling<SB>(
&self,
scaling: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
D: DimNameSub<Const<1_usize>>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
DefaultAllocator: Allocator<T, D, D>,
pub fn append_nonuniform_scaling<SB>(
&self,
scaling: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
D: DimNameSub<Const<1_usize>>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
DefaultAllocator: Allocator<T, D, D>,
Computes the transformation equal to self
followed by a non-uniform scaling factor.
sourcepub fn prepend_nonuniform_scaling<SB>(
&self,
scaling: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
D: DimNameSub<Const<1_usize>>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
DefaultAllocator: Allocator<T, D, D>,
pub fn prepend_nonuniform_scaling<SB>(
&self,
scaling: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
D: DimNameSub<Const<1_usize>>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
DefaultAllocator: Allocator<T, D, D>,
Computes the transformation equal to a non-uniform scaling factor followed by self
.
sourcepub fn append_translation<SB>(
&self,
shift: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
D: DimNameSub<Const<1_usize>>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
DefaultAllocator: Allocator<T, D, D>,
pub fn append_translation<SB>(
&self,
shift: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
D: DimNameSub<Const<1_usize>>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
DefaultAllocator: Allocator<T, D, D>,
Computes the transformation equal to self
followed by a translation.
sourcepub fn prepend_translation<SB>(
&self,
shift: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
D: DimNameSub<Const<1_usize>>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
DefaultAllocator: Allocator<T, D, D>,
DefaultAllocator: Allocator<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
pub fn prepend_translation<SB>(
&self,
shift: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
D: DimNameSub<Const<1_usize>>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
DefaultAllocator: Allocator<T, D, D>,
DefaultAllocator: Allocator<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
Computes the transformation equal to a translation followed by self
.
sourcepub fn append_scaling_mut(&mut self, scaling: T) where
S: StorageMut<T, D, D>,
D: DimNameSub<Const<1_usize>>,
pub fn append_scaling_mut(&mut self, scaling: T) where
S: StorageMut<T, D, D>,
D: DimNameSub<Const<1_usize>>,
Computes in-place the transformation equal to self
followed by an uniform scaling factor.
sourcepub fn prepend_scaling_mut(&mut self, scaling: T) where
S: StorageMut<T, D, D>,
D: DimNameSub<Const<1_usize>>,
pub fn prepend_scaling_mut(&mut self, scaling: T) where
S: StorageMut<T, D, D>,
D: DimNameSub<Const<1_usize>>,
Computes in-place the transformation equal to an uniform scaling factor followed by self
.
sourcepub fn append_nonuniform_scaling_mut<SB>(
&mut self,
scaling: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) where
S: StorageMut<T, D, D>,
D: DimNameSub<Const<1_usize>>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
pub fn append_nonuniform_scaling_mut<SB>(
&mut self,
scaling: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) where
S: StorageMut<T, D, D>,
D: DimNameSub<Const<1_usize>>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
Computes in-place the transformation equal to self
followed by a non-uniform scaling factor.
sourcepub fn prepend_nonuniform_scaling_mut<SB>(
&mut self,
scaling: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) where
S: StorageMut<T, D, D>,
D: DimNameSub<Const<1_usize>>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
pub fn prepend_nonuniform_scaling_mut<SB>(
&mut self,
scaling: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) where
S: StorageMut<T, D, D>,
D: DimNameSub<Const<1_usize>>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
Computes in-place the transformation equal to a non-uniform scaling factor followed by self
.
sourcepub fn append_translation_mut<SB>(
&mut self,
shift: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) where
S: StorageMut<T, D, D>,
D: DimNameSub<Const<1_usize>>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
pub fn append_translation_mut<SB>(
&mut self,
shift: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) where
S: StorageMut<T, D, D>,
D: DimNameSub<Const<1_usize>>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
Computes the transformation equal to self
followed by a translation.
sourcepub fn prepend_translation_mut<SB>(
&mut self,
shift: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) where
D: DimNameSub<Const<1_usize>>,
S: StorageMut<T, D, D>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
DefaultAllocator: Allocator<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
pub fn prepend_translation_mut<SB>(
&mut self,
shift: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, SB>
) where
D: DimNameSub<Const<1_usize>>,
S: StorageMut<T, D, D>,
SB: Storage<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
DefaultAllocator: Allocator<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>,
Computes the transformation equal to a translation followed by self
.
sourcepub fn transform_vector(
&self,
v: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>>::Buffer>
) -> Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>>::Buffer>
pub fn transform_vector(
&self,
v: &Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>>::Buffer>
) -> Matrix<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<T, <D as DimNameSub<Const<1_usize>>>::Output, Const<1_usize>>>::Buffer>
Transforms the given vector, assuming the matrix self
uses homogeneous coordinates.
sourcepub fn abs(
&self
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
T: Signed,
DefaultAllocator: Allocator<T, R, C>,
pub fn abs(
&self
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
T: Signed,
DefaultAllocator: Allocator<T, R, C>,
Computes the component-wise absolute value.
Example
let a = Matrix2::new(0.0, 1.0,
-2.0, -3.0);
assert_eq!(a.abs(), Matrix2::new(0.0, 1.0, 2.0, 3.0))
sourcepub fn component_mul<R2, C2, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> Matrix<T, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative, <DefaultAllocator as Allocator<T, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative>>::Buffer> where
T: ClosedMul<T>,
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
pub fn component_mul<R2, C2, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> Matrix<T, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative, <DefaultAllocator as Allocator<T, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative>>::Buffer> where
T: ClosedMul<T>,
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
Componentwise matrix or vector multiplication.
Example
let a = Matrix2::new(0.0, 1.0, 2.0, 3.0);
let b = Matrix2::new(4.0, 5.0, 6.0, 7.0);
let expected = Matrix2::new(0.0, 5.0, 12.0, 21.0);
assert_eq!(a.component_mul(&b), expected);
sourcepub fn cmpy<R2, C2, SB, R3, C3, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
T: ClosedMul<T, Output = T> + Zero<Output = T> + Mul<T> + Add<T>,
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R3>,
ShapeConstraint: SameNumberOfColumns<C1, C3>,
pub fn cmpy<R2, C2, SB, R3, C3, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
T: ClosedMul<T, Output = T> + Zero<Output = T> + Mul<T> + Add<T>,
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R3>,
ShapeConstraint: SameNumberOfColumns<C1, C3>,
Computes componentwise self[i] = alpha * a[i] * b[i] + beta * self[i]
.
Example
let mut m = Matrix2::new(0.0, 1.0, 2.0, 3.0);
let a = Matrix2::new(0.0, 1.0, 2.0, 3.0);
let b = Matrix2::new(4.0, 5.0, 6.0, 7.0);
let expected = (a.component_mul(&b) * 5.0) + m * 10.0;
m.cmpy(5.0, &a, &b, 10.0);
assert_eq!(m, expected);
sourcepub fn component_mul_assign<R2, C2, SB>(&mut self, rhs: &Matrix<T, R2, C2, SB>) where
T: ClosedMul<T>,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
pub fn component_mul_assign<R2, C2, SB>(&mut self, rhs: &Matrix<T, R2, C2, SB>) where
T: ClosedMul<T>,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
Inplace componentwise matrix or vector multiplication.
Example
let mut a = Matrix2::new(0.0, 1.0, 2.0, 3.0);
let b = Matrix2::new(4.0, 5.0, 6.0, 7.0);
let expected = Matrix2::new(0.0, 5.0, 12.0, 21.0);
a.component_mul_assign(&b);
assert_eq!(a, expected);
sourcepub fn component_mul_mut<R2, C2, SB>(&mut self, rhs: &Matrix<T, R2, C2, SB>) where
T: ClosedMul<T>,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
👎 Deprecated: This is renamed using the _assign
suffix instead of the _mut
suffix.
pub fn component_mul_mut<R2, C2, SB>(&mut self, rhs: &Matrix<T, R2, C2, SB>) where
T: ClosedMul<T>,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
This is renamed using the _assign
suffix instead of the _mut
suffix.
Inplace componentwise matrix or vector multiplication.
Example
let mut a = Matrix2::new(0.0, 1.0, 2.0, 3.0);
let b = Matrix2::new(4.0, 5.0, 6.0, 7.0);
let expected = Matrix2::new(0.0, 5.0, 12.0, 21.0);
a.component_mul_assign(&b);
assert_eq!(a, expected);
sourcepub fn component_div<R2, C2, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> Matrix<T, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative, <DefaultAllocator as Allocator<T, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative>>::Buffer> where
T: ClosedDiv<T>,
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
pub fn component_div<R2, C2, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> Matrix<T, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative, <DefaultAllocator as Allocator<T, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative>>::Buffer> where
T: ClosedDiv<T>,
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
Componentwise matrix or vector division.
Example
let a = Matrix2::new(0.0, 1.0, 2.0, 3.0);
let b = Matrix2::new(4.0, 5.0, 6.0, 7.0);
let expected = Matrix2::new(0.0, 1.0 / 5.0, 2.0 / 6.0, 3.0 / 7.0);
assert_eq!(a.component_div(&b), expected);
sourcepub fn cdpy<R2, C2, SB, R3, C3, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
T: ClosedDiv<T> + Zero<Output = T> + Mul<T, Output = T> + Add<T>,
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R3>,
ShapeConstraint: SameNumberOfColumns<C1, C3>,
pub fn cdpy<R2, C2, SB, R3, C3, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
T: ClosedDiv<T> + Zero<Output = T> + Mul<T, Output = T> + Add<T>,
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R3>,
ShapeConstraint: SameNumberOfColumns<C1, C3>,
Computes componentwise self[i] = alpha * a[i] / b[i] + beta * self[i]
.
Example
let mut m = Matrix2::new(0.0, 1.0, 2.0, 3.0);
let a = Matrix2::new(4.0, 5.0, 6.0, 7.0);
let b = Matrix2::new(4.0, 5.0, 6.0, 7.0);
let expected = (a.component_div(&b) * 5.0) + m * 10.0;
m.cdpy(5.0, &a, &b, 10.0);
assert_eq!(m, expected);
sourcepub fn component_div_assign<R2, C2, SB>(&mut self, rhs: &Matrix<T, R2, C2, SB>) where
T: ClosedDiv<T>,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
pub fn component_div_assign<R2, C2, SB>(&mut self, rhs: &Matrix<T, R2, C2, SB>) where
T: ClosedDiv<T>,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
Inplace componentwise matrix or vector division.
Example
let mut a = Matrix2::new(0.0, 1.0, 2.0, 3.0);
let b = Matrix2::new(4.0, 5.0, 6.0, 7.0);
let expected = Matrix2::new(0.0, 1.0 / 5.0, 2.0 / 6.0, 3.0 / 7.0);
a.component_div_assign(&b);
assert_eq!(a, expected);
sourcepub fn component_div_mut<R2, C2, SB>(&mut self, rhs: &Matrix<T, R2, C2, SB>) where
T: ClosedDiv<T>,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
👎 Deprecated: This is renamed using the _assign
suffix instead of the _mut
suffix.
pub fn component_div_mut<R2, C2, SB>(&mut self, rhs: &Matrix<T, R2, C2, SB>) where
T: ClosedDiv<T>,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
This is renamed using the _assign
suffix instead of the _mut
suffix.
Inplace componentwise matrix or vector division.
Example
let mut a = Matrix2::new(0.0, 1.0, 2.0, 3.0);
let b = Matrix2::new(4.0, 5.0, 6.0, 7.0);
let expected = Matrix2::new(0.0, 1.0 / 5.0, 2.0 / 6.0, 3.0 / 7.0);
a.component_div_assign(&b);
assert_eq!(a, expected);
sourcepub fn inf(
&self,
other: &Matrix<T, R1, C1, SA>
) -> Matrix<T, R1, C1, <DefaultAllocator as Allocator<T, R1, C1>>::Buffer> where
T: SimdPartialOrd,
DefaultAllocator: Allocator<T, R1, C1>,
pub fn inf(
&self,
other: &Matrix<T, R1, C1, SA>
) -> Matrix<T, R1, C1, <DefaultAllocator as Allocator<T, R1, C1>>::Buffer> where
T: SimdPartialOrd,
DefaultAllocator: Allocator<T, R1, C1>,
Computes the infimum (aka. componentwise min) of two matrices/vectors.
Example
let u = Matrix2::new(4.0, 2.0, 1.0, -2.0);
let v = Matrix2::new(2.0, 4.0, -2.0, 1.0);
let expected = Matrix2::new(2.0, 2.0, -2.0, -2.0);
assert_eq!(u.inf(&v), expected)
sourcepub fn sup(
&self,
other: &Matrix<T, R1, C1, SA>
) -> Matrix<T, R1, C1, <DefaultAllocator as Allocator<T, R1, C1>>::Buffer> where
T: SimdPartialOrd,
DefaultAllocator: Allocator<T, R1, C1>,
pub fn sup(
&self,
other: &Matrix<T, R1, C1, SA>
) -> Matrix<T, R1, C1, <DefaultAllocator as Allocator<T, R1, C1>>::Buffer> where
T: SimdPartialOrd,
DefaultAllocator: Allocator<T, R1, C1>,
Computes the supremum (aka. componentwise max) of two matrices/vectors.
Example
let u = Matrix2::new(4.0, 2.0, 1.0, -2.0);
let v = Matrix2::new(2.0, 4.0, -2.0, 1.0);
let expected = Matrix2::new(4.0, 4.0, 1.0, 1.0);
assert_eq!(u.sup(&v), expected)
sourcepub fn inf_sup(
&self,
other: &Matrix<T, R1, C1, SA>
) -> (Matrix<T, R1, C1, <DefaultAllocator as Allocator<T, R1, C1>>::Buffer>, Matrix<T, R1, C1, <DefaultAllocator as Allocator<T, R1, C1>>::Buffer>) where
T: SimdPartialOrd,
DefaultAllocator: Allocator<T, R1, C1>,
pub fn inf_sup(
&self,
other: &Matrix<T, R1, C1, SA>
) -> (Matrix<T, R1, C1, <DefaultAllocator as Allocator<T, R1, C1>>::Buffer>, Matrix<T, R1, C1, <DefaultAllocator as Allocator<T, R1, C1>>::Buffer>) where
T: SimdPartialOrd,
DefaultAllocator: Allocator<T, R1, C1>,
Computes the (infimum, supremum) of two matrices/vectors.
Example
let u = Matrix2::new(4.0, 2.0, 1.0, -2.0);
let v = Matrix2::new(2.0, 4.0, -2.0, 1.0);
let expected = (Matrix2::new(2.0, 2.0, -2.0, -2.0), Matrix2::new(4.0, 4.0, 1.0, 1.0));
assert_eq!(u.inf_sup(&v), expected)
sourcepub fn add_scalar(
&self,
rhs: T
) -> Matrix<T, R1, C1, <DefaultAllocator as Allocator<T, R1, C1>>::Buffer> where
T: ClosedAdd<T>,
DefaultAllocator: Allocator<T, R1, C1>,
pub fn add_scalar(
&self,
rhs: T
) -> Matrix<T, R1, C1, <DefaultAllocator as Allocator<T, R1, C1>>::Buffer> where
T: ClosedAdd<T>,
DefaultAllocator: Allocator<T, R1, C1>,
Adds a scalar to self
.
Example
let u = Matrix2::new(1.0, 2.0, 3.0, 4.0);
let s = 10.0;
let expected = Matrix2::new(11.0, 12.0, 13.0, 14.0);
assert_eq!(u.add_scalar(s), expected)
sourcepub fn add_scalar_mut(&mut self, rhs: T) where
T: ClosedAdd<T>,
SA: StorageMut<T, R1, C1>,
pub fn add_scalar_mut(&mut self, rhs: T) where
T: ClosedAdd<T>,
SA: StorageMut<T, R1, C1>,
Adds a scalar to self
in-place.
Example
let mut u = Matrix2::new(1.0, 2.0, 3.0, 4.0);
let s = 10.0;
u.add_scalar_mut(s);
let expected = Matrix2::new(11.0, 12.0, 13.0, 14.0);
assert_eq!(u, expected)
sourcepub fn upper_triangle(
&self
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
pub fn upper_triangle(
&self
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
Extracts the upper triangular part of this matrix (including the diagonal).
sourcepub fn lower_triangle(
&self
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
pub fn lower_triangle(
&self
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
Extracts the lower triangular part of this matrix (including the diagonal).
sourcepub fn select_rows<'a, I>(
&self,
irows: I
) -> Matrix<T, Dynamic, C, <DefaultAllocator as Allocator<T, Dynamic, C>>::Buffer> where
I: IntoIterator<Item = &'a usize>,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
<I as IntoIterator>::IntoIter: Clone,
DefaultAllocator: Allocator<T, Dynamic, C>,
pub fn select_rows<'a, I>(
&self,
irows: I
) -> Matrix<T, Dynamic, C, <DefaultAllocator as Allocator<T, Dynamic, C>>::Buffer> where
I: IntoIterator<Item = &'a usize>,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
<I as IntoIterator>::IntoIter: Clone,
DefaultAllocator: Allocator<T, Dynamic, C>,
Creates a new matrix by extracting the given set of rows from self
.
sourcepub fn select_columns<'a, I>(
&self,
icols: I
) -> Matrix<T, R, Dynamic, <DefaultAllocator as Allocator<T, R, Dynamic>>::Buffer> where
I: IntoIterator<Item = &'a usize>,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
DefaultAllocator: Allocator<T, R, Dynamic>,
pub fn select_columns<'a, I>(
&self,
icols: I
) -> Matrix<T, R, Dynamic, <DefaultAllocator as Allocator<T, R, Dynamic>>::Buffer> where
I: IntoIterator<Item = &'a usize>,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
DefaultAllocator: Allocator<T, R, Dynamic>,
Creates a new matrix by extracting the given set of columns from self
.
sourcepub fn set_diagonal<R2, S2>(&mut self, diag: &Matrix<T, R2, Const<1_usize>, S2>) where
R2: Dim,
R: DimMin<C>,
S2: RawStorage<T, R2, Const<1_usize>>,
ShapeConstraint: DimEq<<R as DimMin<C>>::Output, R2>,
pub fn set_diagonal<R2, S2>(&mut self, diag: &Matrix<T, R2, Const<1_usize>, S2>) where
R2: Dim,
R: DimMin<C>,
S2: RawStorage<T, R2, Const<1_usize>>,
ShapeConstraint: DimEq<<R as DimMin<C>>::Output, R2>,
Fills the diagonal of this matrix with the content of the given vector.
sourcepub fn set_partial_diagonal(&mut self, diag: impl Iterator<Item = T>)
pub fn set_partial_diagonal(&mut self, diag: impl Iterator<Item = T>)
Fills the diagonal of this matrix with the content of the given iterator.
This will fill as many diagonal elements as the iterator yields, up to the
minimum of the number of rows and columns of self
, and starting with the
diagonal element at index (0, 0).
sourcepub fn set_row<C2, S2>(
&mut self,
i: usize,
row: &Matrix<T, Const<1_usize>, C2, S2>
) where
C2: Dim,
S2: RawStorage<T, Const<1_usize>, C2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
pub fn set_row<C2, S2>(
&mut self,
i: usize,
row: &Matrix<T, Const<1_usize>, C2, S2>
) where
C2: Dim,
S2: RawStorage<T, Const<1_usize>, C2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
Fills the selected row of this matrix with the content of the given vector.
sourcepub fn set_column<R2, S2>(
&mut self,
i: usize,
column: &Matrix<T, R2, Const<1_usize>, S2>
) where
R2: Dim,
S2: RawStorage<T, R2, Const<1_usize>>,
ShapeConstraint: SameNumberOfRows<R, R2>,
pub fn set_column<R2, S2>(
&mut self,
i: usize,
column: &Matrix<T, R2, Const<1_usize>, S2>
) where
R2: Dim,
S2: RawStorage<T, R2, Const<1_usize>>,
ShapeConstraint: SameNumberOfRows<R, R2>,
Fills the selected column of this matrix with the content of the given vector.
sourcepub fn fill_with(&mut self, val: impl Fn() -> T)
pub fn fill_with(&mut self, val: impl Fn() -> T)
Sets all the elements of this matrix to the value returned by the closure.
sourcepub fn fill_with_identity(&mut self) where
T: Scalar + Zero + One,
pub fn fill_with_identity(&mut self) where
T: Scalar + Zero + One,
Fills self
with the identity matrix.
sourcepub fn fill_diagonal(&mut self, val: T) where
T: Scalar,
pub fn fill_diagonal(&mut self, val: T) where
T: Scalar,
Sets all the diagonal elements of this matrix to val
.
sourcepub fn fill_row(&mut self, i: usize, val: T) where
T: Scalar,
pub fn fill_row(&mut self, i: usize, val: T) where
T: Scalar,
Sets all the elements of the selected row to val
.
sourcepub fn fill_column(&mut self, j: usize, val: T) where
T: Scalar,
pub fn fill_column(&mut self, j: usize, val: T) where
T: Scalar,
Sets all the elements of the selected column to val
.
sourcepub fn fill_lower_triangle(&mut self, val: T, shift: usize) where
T: Scalar,
pub fn fill_lower_triangle(&mut self, val: T, shift: usize) where
T: Scalar,
Sets all the elements of the lower-triangular part of this matrix to val
.
The parameter shift
allows some subdiagonals to be left untouched:
- If
shift = 0
then the diagonal is overwritten as well. - If
shift = 1
then the diagonal is left untouched. - If
shift > 1
, then the diagonal and the firstshift - 1
subdiagonals are left untouched.
sourcepub fn fill_upper_triangle(&mut self, val: T, shift: usize) where
T: Scalar,
pub fn fill_upper_triangle(&mut self, val: T, shift: usize) where
T: Scalar,
Sets all the elements of the lower-triangular part of this matrix to val
.
The parameter shift
allows some superdiagonals to be left untouched:
- If
shift = 0
then the diagonal is overwritten as well. - If
shift = 1
then the diagonal is left untouched. - If
shift > 1
, then the diagonal and the firstshift - 1
superdiagonals are left untouched.
sourcepub fn fill_lower_triangle_with_upper_triangle(&mut self)
pub fn fill_lower_triangle_with_upper_triangle(&mut self)
Copies the upper-triangle of this matrix to its lower-triangular part.
This makes the matrix symmetric. Panics if the matrix is not square.
sourcepub fn fill_upper_triangle_with_lower_triangle(&mut self)
pub fn fill_upper_triangle_with_lower_triangle(&mut self)
Copies the upper-triangle of this matrix to its upper-triangular part.
This makes the matrix symmetric. Panics if the matrix is not square.
sourcepub fn swap_columns(&mut self, icol1: usize, icol2: usize)
pub fn swap_columns(&mut self, icol1: usize, icol2: usize)
Swaps two columns in-place.
sourcepub fn resize_mut(&mut self, new_nrows: usize, new_ncols: usize, val: T) where
DefaultAllocator: Reallocator<T, Dynamic, Dynamic, Dynamic, Dynamic>,
pub fn resize_mut(&mut self, new_nrows: usize, new_ncols: usize, val: T) where
DefaultAllocator: Reallocator<T, Dynamic, Dynamic, Dynamic, Dynamic>,
Resizes this matrix in-place.
The values are copied such that self[(i, j)] == result[(i, j)]
. If the result has more
rows and/or columns than self
, then the extra rows or columns are filled with val
.
Defined only for owned fully-dynamic matrices, i.e., DMatrix
.
sourcepub fn resize_vertically_mut(&mut self, new_nrows: usize, val: T) where
DefaultAllocator: Reallocator<T, Dynamic, C, Dynamic, C>,
pub fn resize_vertically_mut(&mut self, new_nrows: usize, val: T) where
DefaultAllocator: Reallocator<T, Dynamic, C, Dynamic, C>,
Changes the number of rows of this matrix in-place.
The values are copied such that self[(i, j)] == result[(i, j)]
. If the result has more
rows than self
, then the extra rows are filled with val
.
Defined only for owned matrices with a dynamic number of rows (for example, DVector
).
sourcepub fn resize_horizontally_mut(&mut self, new_ncols: usize, val: T) where
DefaultAllocator: Reallocator<T, R, Dynamic, R, Dynamic>,
pub fn resize_horizontally_mut(&mut self, new_ncols: usize, val: T) where
DefaultAllocator: Reallocator<T, R, Dynamic, R, Dynamic>,
Changes the number of column of this matrix in-place.
The values are copied such that self[(i, j)] == result[(i, j)]
. If the result has more
columns than self
, then the extra columns are filled with val
.
Defined only for owned matrices with a dynamic number of columns (for example, DVector
).
sourcepub fn get<'a, I>(
&'a self,
index: I
) -> Option<<I as MatrixIndex<'a, T, R, C, S>>::Output> where
I: MatrixIndex<'a, T, R, C, S>,
pub fn get<'a, I>(
&'a self,
index: I
) -> Option<<I as MatrixIndex<'a, T, R, C, S>>::Output> where
I: MatrixIndex<'a, T, R, C, S>,
Produces a view of the data at the given index, or
None
if the index is out of bounds.
sourcepub fn get_mut<'a, I>(
&'a mut self,
index: I
) -> Option<<I as MatrixIndexMut<'a, T, R, C, S>>::OutputMut> where
S: RawStorageMut<T, R, C>,
I: MatrixIndexMut<'a, T, R, C, S>,
pub fn get_mut<'a, I>(
&'a mut self,
index: I
) -> Option<<I as MatrixIndexMut<'a, T, R, C, S>>::OutputMut> where
S: RawStorageMut<T, R, C>,
I: MatrixIndexMut<'a, T, R, C, S>,
Produces a mutable view of the data at the given index, or
None
if the index is out of bounds.
sourcepub fn index<'a, I>(
&'a self,
index: I
) -> <I as MatrixIndex<'a, T, R, C, S>>::Output where
I: MatrixIndex<'a, T, R, C, S>,
pub fn index<'a, I>(
&'a self,
index: I
) -> <I as MatrixIndex<'a, T, R, C, S>>::Output where
I: MatrixIndex<'a, T, R, C, S>,
Produces a view of the data at the given index, or panics if the index is out of bounds.
sourcepub fn index_mut<'a, I>(
&'a mut self,
index: I
) -> <I as MatrixIndexMut<'a, T, R, C, S>>::OutputMut where
S: RawStorageMut<T, R, C>,
I: MatrixIndexMut<'a, T, R, C, S>,
pub fn index_mut<'a, I>(
&'a mut self,
index: I
) -> <I as MatrixIndexMut<'a, T, R, C, S>>::OutputMut where
S: RawStorageMut<T, R, C>,
I: MatrixIndexMut<'a, T, R, C, S>,
Produces a mutable view of the data at the given index, or panics if the index is out of bounds.
sourcepub unsafe fn get_unchecked<'a, I>(
&'a self,
index: I
) -> <I as MatrixIndex<'a, T, R, C, S>>::Output where
I: MatrixIndex<'a, T, R, C, S>,
pub unsafe fn get_unchecked<'a, I>(
&'a self,
index: I
) -> <I as MatrixIndex<'a, T, R, C, S>>::Output where
I: MatrixIndex<'a, T, R, C, S>,
Produces a view of the data at the given index, without doing any bounds checking.
sourcepub unsafe fn get_unchecked_mut<'a, I>(
&'a mut self,
index: I
) -> <I as MatrixIndexMut<'a, T, R, C, S>>::OutputMut where
S: RawStorageMut<T, R, C>,
I: MatrixIndexMut<'a, T, R, C, S>,
pub unsafe fn get_unchecked_mut<'a, I>(
&'a mut self,
index: I
) -> <I as MatrixIndexMut<'a, T, R, C, S>>::OutputMut where
S: RawStorageMut<T, R, C>,
I: MatrixIndexMut<'a, T, R, C, S>,
Returns a mutable view of the data at the given index, without doing any bounds checking.
sourcepub fn shape(&self) -> (usize, usize)
pub fn shape(&self) -> (usize, usize)
The shape of this matrix returned as the tuple (number of rows, number of columns).
Example
let mat = Matrix3x4::<f32>::zeros();
assert_eq!(mat.shape(), (3, 4));
sourcepub fn shape_generic(&self) -> (R, C)
pub fn shape_generic(&self) -> (R, C)
The shape of this matrix wrapped into their representative types (Const
or Dynamic
).
sourcepub fn nrows(&self) -> usize
pub fn nrows(&self) -> usize
The number of rows of this matrix.
Example
let mat = Matrix3x4::<f32>::zeros();
assert_eq!(mat.nrows(), 3);
sourcepub fn ncols(&self) -> usize
pub fn ncols(&self) -> usize
The number of columns of this matrix.
Example
let mat = Matrix3x4::<f32>::zeros();
assert_eq!(mat.ncols(), 4);
sourcepub fn strides(&self) -> (usize, usize)
pub fn strides(&self) -> (usize, usize)
The strides (row stride, column stride) of this matrix.
Example
let mat = DMatrix::<f32>::zeros(10, 10);
let slice = mat.slice_with_steps((0, 0), (5, 3), (1, 2));
// The column strides is the number of steps (here 2) multiplied by the corresponding dimension.
assert_eq!(mat.strides(), (1, 10));
sourcepub fn vector_to_matrix_index(&self, i: usize) -> (usize, usize)
pub fn vector_to_matrix_index(&self, i: usize) -> (usize, usize)
Computes the row and column coordinates of the i-th element of this matrix seen as a vector.
Example
let m = Matrix2::new(1, 2,
3, 4);
let i = m.vector_to_matrix_index(3);
assert_eq!(i, (1, 1));
assert_eq!(m[i], m[3]);
sourcepub fn as_ptr(&self) -> *const T
pub fn as_ptr(&self) -> *const T
Returns a pointer to the start of the matrix.
If the matrix is not empty, this pointer is guaranteed to be aligned and non-null.
Example
let m = Matrix2::new(1, 2,
3, 4);
let ptr = m.as_ptr();
assert_eq!(unsafe { *ptr }, m[0]);
sourcepub fn relative_eq<R2, C2, SB>(
&self,
other: &Matrix<T, R2, C2, SB>,
eps: <T as AbsDiffEq<T>>::Epsilon,
max_relative: <T as AbsDiffEq<T>>::Epsilon
) -> bool where
T: RelativeEq<T>,
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
<T as AbsDiffEq<T>>::Epsilon: Clone,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
pub fn relative_eq<R2, C2, SB>(
&self,
other: &Matrix<T, R2, C2, SB>,
eps: <T as AbsDiffEq<T>>::Epsilon,
max_relative: <T as AbsDiffEq<T>>::Epsilon
) -> bool where
T: RelativeEq<T>,
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
<T as AbsDiffEq<T>>::Epsilon: Clone,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
Tests whether self
and rhs
are equal up to a given epsilon.
See relative_eq
from the RelativeEq
trait for more details.
sourcepub fn eq<R2, C2, SB>(&self, other: &Matrix<T, R2, C2, SB>) -> bool where
T: PartialEq<T>,
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
pub fn eq<R2, C2, SB>(&self, other: &Matrix<T, R2, C2, SB>) -> bool where
T: PartialEq<T>,
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
Tests whether self
and rhs
are exactly equal.
sourcepub fn clone_owned(
&self
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
T: Scalar,
S: Storage<T, R, C>,
DefaultAllocator: Allocator<T, R, C>,
pub fn clone_owned(
&self
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
T: Scalar,
S: Storage<T, R, C>,
DefaultAllocator: Allocator<T, R, C>,
Clones this matrix to one that owns its data.
sourcepub fn clone_owned_sum<R2, C2>(
&self
) -> Matrix<T, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative, <DefaultAllocator as Allocator<T, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative>>::Buffer> where
T: Scalar,
S: Storage<T, R, C>,
R2: Dim,
C2: Dim,
DefaultAllocator: SameShapeAllocator<T, R, C, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
pub fn clone_owned_sum<R2, C2>(
&self
) -> Matrix<T, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative, <DefaultAllocator as Allocator<T, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative>>::Buffer> where
T: Scalar,
S: Storage<T, R, C>,
R2: Dim,
C2: Dim,
DefaultAllocator: SameShapeAllocator<T, R, C, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
Clones this matrix into one that owns its data. The actual type of the result depends on matrix storage combination rules for addition.
sourcepub fn transpose_to<R2, C2, SB>(&self, out: &mut Matrix<T, R2, C2, SB>) where
T: Scalar,
R2: Dim,
C2: Dim,
SB: RawStorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2>,
ShapeConstraint: SameNumberOfColumns<C, R2>,
pub fn transpose_to<R2, C2, SB>(&self, out: &mut Matrix<T, R2, C2, SB>) where
T: Scalar,
R2: Dim,
C2: Dim,
SB: RawStorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2>,
ShapeConstraint: SameNumberOfColumns<C, R2>,
Transposes self
and store the result into out
.
sourcepub fn transpose(
&self
) -> Matrix<T, C, R, <DefaultAllocator as Allocator<T, C, R>>::Buffer> where
T: Scalar,
DefaultAllocator: Allocator<T, C, R>,
pub fn transpose(
&self
) -> Matrix<T, C, R, <DefaultAllocator as Allocator<T, C, R>>::Buffer> where
T: Scalar,
DefaultAllocator: Allocator<T, C, R>,
Transposes self
.
sourcepub fn map<T2, F>(
&self,
f: F
) -> Matrix<T2, R, C, <DefaultAllocator as Allocator<T2, R, C>>::Buffer> where
T2: Scalar,
F: FnMut(T) -> T2,
T: Scalar,
DefaultAllocator: Allocator<T2, R, C>,
pub fn map<T2, F>(
&self,
f: F
) -> Matrix<T2, R, C, <DefaultAllocator as Allocator<T2, R, C>>::Buffer> where
T2: Scalar,
F: FnMut(T) -> T2,
T: Scalar,
DefaultAllocator: Allocator<T2, R, C>,
Returns a matrix containing the result of f
applied to each of its entries.
sourcepub fn fold_with<T2>(
&self,
init_f: impl FnOnce(Option<&T>) -> T2,
f: impl FnMut(T2, &T) -> T2
) -> T2 where
T: Scalar,
pub fn fold_with<T2>(
&self,
init_f: impl FnOnce(Option<&T>) -> T2,
f: impl FnMut(T2, &T) -> T2
) -> T2 where
T: Scalar,
Similar to self.iter().fold(init, f)
except that init
is replaced by a closure.
The initialization closure is given the first component of this matrix:
- If the matrix has no component (0 rows or 0 columns) then
init_f
is called withNone
and its return value is the value returned by this method. - If the matrix has has least one component, then
init_f
is called with the first component to compute the initial value. Folding then continues on all the remaining components of the matrix.
sourcepub fn map_with_location<T2, F>(
&self,
f: F
) -> Matrix<T2, R, C, <DefaultAllocator as Allocator<T2, R, C>>::Buffer> where
T2: Scalar,
F: FnMut(usize, usize, T) -> T2,
T: Scalar,
DefaultAllocator: Allocator<T2, R, C>,
pub fn map_with_location<T2, F>(
&self,
f: F
) -> Matrix<T2, R, C, <DefaultAllocator as Allocator<T2, R, C>>::Buffer> where
T2: Scalar,
F: FnMut(usize, usize, T) -> T2,
T: Scalar,
DefaultAllocator: Allocator<T2, R, C>,
Returns a matrix containing the result of f
applied to each of its entries. Unlike map
,
f
also gets passed the row and column index, i.e. f(row, col, value)
.
sourcepub fn zip_map<T2, N3, S2, F>(
&self,
rhs: &Matrix<T2, R, C, S2>,
f: F
) -> Matrix<N3, R, C, <DefaultAllocator as Allocator<N3, R, C>>::Buffer> where
T: Scalar,
T2: Scalar,
N3: Scalar,
S2: RawStorage<T2, R, C>,
F: FnMut(T, T2) -> N3,
DefaultAllocator: Allocator<N3, R, C>,
pub fn zip_map<T2, N3, S2, F>(
&self,
rhs: &Matrix<T2, R, C, S2>,
f: F
) -> Matrix<N3, R, C, <DefaultAllocator as Allocator<N3, R, C>>::Buffer> where
T: Scalar,
T2: Scalar,
N3: Scalar,
S2: RawStorage<T2, R, C>,
F: FnMut(T, T2) -> N3,
DefaultAllocator: Allocator<N3, R, C>,
Returns a matrix containing the result of f
applied to each entries of self
and
rhs
.
sourcepub fn zip_zip_map<T2, N3, N4, S2, S3, F>(
&self,
b: &Matrix<T2, R, C, S2>,
c: &Matrix<N3, R, C, S3>,
f: F
) -> Matrix<N4, R, C, <DefaultAllocator as Allocator<N4, R, C>>::Buffer> where
T: Scalar,
T2: Scalar,
N3: Scalar,
N4: Scalar,
S2: RawStorage<T2, R, C>,
S3: RawStorage<N3, R, C>,
F: FnMut(T, T2, N3) -> N4,
DefaultAllocator: Allocator<N4, R, C>,
pub fn zip_zip_map<T2, N3, N4, S2, S3, F>(
&self,
b: &Matrix<T2, R, C, S2>,
c: &Matrix<N3, R, C, S3>,
f: F
) -> Matrix<N4, R, C, <DefaultAllocator as Allocator<N4, R, C>>::Buffer> where
T: Scalar,
T2: Scalar,
N3: Scalar,
N4: Scalar,
S2: RawStorage<T2, R, C>,
S3: RawStorage<N3, R, C>,
F: FnMut(T, T2, N3) -> N4,
DefaultAllocator: Allocator<N4, R, C>,
Returns a matrix containing the result of f
applied to each entries of self
and
b
, and c
.
sourcepub fn fold<Acc>(&self, init: Acc, f: impl FnMut(Acc, T) -> Acc) -> Acc where
T: Scalar,
pub fn fold<Acc>(&self, init: Acc, f: impl FnMut(Acc, T) -> Acc) -> Acc where
T: Scalar,
Folds a function f
on each entry of self
.
sourcepub fn zip_fold<T2, R2, C2, S2, Acc>(
&self,
rhs: &Matrix<T2, R2, C2, S2>,
init: Acc,
f: impl FnMut(Acc, T, T2) -> Acc
) -> Acc where
T: Scalar,
T2: Scalar,
R2: Dim,
C2: Dim,
S2: RawStorage<T2, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
pub fn zip_fold<T2, R2, C2, S2, Acc>(
&self,
rhs: &Matrix<T2, R2, C2, S2>,
init: Acc,
f: impl FnMut(Acc, T, T2) -> Acc
) -> Acc where
T: Scalar,
T2: Scalar,
R2: Dim,
C2: Dim,
S2: RawStorage<T2, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
Folds a function f
on each pairs of entries from self
and rhs
.
sourcepub fn apply<F>(&mut self, f: F) where
F: FnMut(&mut T),
S: RawStorageMut<T, R, C>,
pub fn apply<F>(&mut self, f: F) where
F: FnMut(&mut T),
S: RawStorageMut<T, R, C>,
Applies a closure f
to modify each component of self
.
sourcepub fn zip_apply<T2, R2, C2, S2>(
&mut self,
rhs: &Matrix<T2, R2, C2, S2>,
f: impl FnMut(&mut T, T2)
) where
S: RawStorageMut<T, R, C>,
T2: Scalar,
R2: Dim,
C2: Dim,
S2: RawStorage<T2, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
pub fn zip_apply<T2, R2, C2, S2>(
&mut self,
rhs: &Matrix<T2, R2, C2, S2>,
f: impl FnMut(&mut T, T2)
) where
S: RawStorageMut<T, R, C>,
T2: Scalar,
R2: Dim,
C2: Dim,
S2: RawStorage<T2, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
Replaces each component of self
by the result of a closure f
applied on its components
joined with the components from rhs
.
sourcepub fn zip_zip_apply<T2, R2, C2, S2, N3, R3, C3, S3>(
&mut self,
b: &Matrix<T2, R2, C2, S2>,
c: &Matrix<N3, R3, C3, S3>,
f: impl FnMut(&mut T, T2, N3)
) where
S: RawStorageMut<T, R, C>,
T2: Scalar,
R2: Dim,
C2: Dim,
S2: RawStorage<T2, R2, C2>,
N3: Scalar,
R3: Dim,
C3: Dim,
S3: RawStorage<N3, R3, C3>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
pub fn zip_zip_apply<T2, R2, C2, S2, N3, R3, C3, S3>(
&mut self,
b: &Matrix<T2, R2, C2, S2>,
c: &Matrix<N3, R3, C3, S3>,
f: impl FnMut(&mut T, T2, N3)
) where
S: RawStorageMut<T, R, C>,
T2: Scalar,
R2: Dim,
C2: Dim,
S2: RawStorage<T2, R2, C2>,
N3: Scalar,
R3: Dim,
C3: Dim,
S3: RawStorage<N3, R3, C3>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
Replaces each component of self
by the result of a closure f
applied on its components
joined with the components from b
and c
.
sourcepub fn iter(&self) -> MatrixIter<'_, T, R, C, S>ⓘNotable traits for MatrixIter<'a, T, R, C, S>impl<'a, T, R, C, S> Iterator for MatrixIter<'a, T, R, C, S> where
R: Dim,
C: Dim,
S: 'a + RawStorage<T, R, C>, type Item = &'a T;
pub fn iter(&self) -> MatrixIter<'_, T, R, C, S>ⓘNotable traits for MatrixIter<'a, T, R, C, S>impl<'a, T, R, C, S> Iterator for MatrixIter<'a, T, R, C, S> where
R: Dim,
C: Dim,
S: 'a + RawStorage<T, R, C>, type Item = &'a T;
R: Dim,
C: Dim,
S: 'a + RawStorage<T, R, C>, type Item = &'a T;
Iterates through this matrix coordinates in column-major order.
Example
let mat = Matrix2x3::new(11, 12, 13,
21, 22, 23);
let mut it = mat.iter();
assert_eq!(*it.next().unwrap(), 11);
assert_eq!(*it.next().unwrap(), 21);
assert_eq!(*it.next().unwrap(), 12);
assert_eq!(*it.next().unwrap(), 22);
assert_eq!(*it.next().unwrap(), 13);
assert_eq!(*it.next().unwrap(), 23);
assert!(it.next().is_none());
sourcepub fn row_iter(&self) -> RowIter<'_, T, R, C, S>ⓘNotable traits for RowIter<'a, T, R, C, S>impl<'a, T, R, C, S> Iterator for RowIter<'a, T, R, C, S> where
R: Dim,
C: Dim,
S: 'a + RawStorage<T, R, C>, type Item = Matrix<T, Const<1_usize>, C, SliceStorage<'a, T, Const<1_usize>, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>;
pub fn row_iter(&self) -> RowIter<'_, T, R, C, S>ⓘNotable traits for RowIter<'a, T, R, C, S>impl<'a, T, R, C, S> Iterator for RowIter<'a, T, R, C, S> where
R: Dim,
C: Dim,
S: 'a + RawStorage<T, R, C>, type Item = Matrix<T, Const<1_usize>, C, SliceStorage<'a, T, Const<1_usize>, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>;
R: Dim,
C: Dim,
S: 'a + RawStorage<T, R, C>, type Item = Matrix<T, Const<1_usize>, C, SliceStorage<'a, T, Const<1_usize>, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>;
Iterate through the rows of this matrix.
Example
let mut a = Matrix2x3::new(1, 2, 3,
4, 5, 6);
for (i, row) in a.row_iter().enumerate() {
assert_eq!(row, a.row(i))
}
sourcepub fn column_iter(&self) -> ColumnIter<'_, T, R, C, S>ⓘNotable traits for ColumnIter<'a, T, R, C, S>impl<'a, T, R, C, S> Iterator for ColumnIter<'a, T, R, C, S> where
R: Dim,
C: Dim,
S: 'a + RawStorage<T, R, C>, type Item = Matrix<T, R, Const<1_usize>, SliceStorage<'a, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>;
pub fn column_iter(&self) -> ColumnIter<'_, T, R, C, S>ⓘNotable traits for ColumnIter<'a, T, R, C, S>impl<'a, T, R, C, S> Iterator for ColumnIter<'a, T, R, C, S> where
R: Dim,
C: Dim,
S: 'a + RawStorage<T, R, C>, type Item = Matrix<T, R, Const<1_usize>, SliceStorage<'a, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>;
R: Dim,
C: Dim,
S: 'a + RawStorage<T, R, C>, type Item = Matrix<T, R, Const<1_usize>, SliceStorage<'a, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>;
Iterate through the columns of this matrix.
Example
let mut a = Matrix2x3::new(1, 2, 3,
4, 5, 6);
for (i, column) in a.column_iter().enumerate() {
assert_eq!(column, a.column(i))
}
sourcepub fn iter_mut(&mut self) -> MatrixIterMut<'_, T, R, C, S>ⓘNotable traits for MatrixIterMut<'a, T, R, C, S>impl<'a, T, R, C, S> Iterator for MatrixIterMut<'a, T, R, C, S> where
R: Dim,
C: Dim,
S: 'a + RawStorageMut<T, R, C>, type Item = &'a mut T;
where
S: RawStorageMut<T, R, C>,
pub fn iter_mut(&mut self) -> MatrixIterMut<'_, T, R, C, S>ⓘNotable traits for MatrixIterMut<'a, T, R, C, S>impl<'a, T, R, C, S> Iterator for MatrixIterMut<'a, T, R, C, S> where
R: Dim,
C: Dim,
S: 'a + RawStorageMut<T, R, C>, type Item = &'a mut T;
where
S: RawStorageMut<T, R, C>,
R: Dim,
C: Dim,
S: 'a + RawStorageMut<T, R, C>, type Item = &'a mut T;
Mutably iterates through this matrix coordinates.
sourcepub fn row_iter_mut(&mut self) -> RowIterMut<'_, T, R, C, S>ⓘNotable traits for RowIterMut<'a, T, R, C, S>impl<'a, T, R, C, S> Iterator for RowIterMut<'a, T, R, C, S> where
R: Dim,
C: Dim,
S: 'a + RawStorageMut<T, R, C>, type Item = Matrix<T, Const<1_usize>, C, SliceStorageMut<'a, T, Const<1_usize>, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>;
where
S: RawStorageMut<T, R, C>,
pub fn row_iter_mut(&mut self) -> RowIterMut<'_, T, R, C, S>ⓘNotable traits for RowIterMut<'a, T, R, C, S>impl<'a, T, R, C, S> Iterator for RowIterMut<'a, T, R, C, S> where
R: Dim,
C: Dim,
S: 'a + RawStorageMut<T, R, C>, type Item = Matrix<T, Const<1_usize>, C, SliceStorageMut<'a, T, Const<1_usize>, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>;
where
S: RawStorageMut<T, R, C>,
R: Dim,
C: Dim,
S: 'a + RawStorageMut<T, R, C>, type Item = Matrix<T, Const<1_usize>, C, SliceStorageMut<'a, T, Const<1_usize>, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>;
Mutably iterates through this matrix rows.
Example
let mut a = Matrix2x3::new(1, 2, 3,
4, 5, 6);
for (i, mut row) in a.row_iter_mut().enumerate() {
row *= (i + 1) * 10;
}
let expected = Matrix2x3::new(10, 20, 30,
80, 100, 120);
assert_eq!(a, expected);
sourcepub fn column_iter_mut(&mut self) -> ColumnIterMut<'_, T, R, C, S>ⓘNotable traits for ColumnIterMut<'a, T, R, C, S>impl<'a, T, R, C, S> Iterator for ColumnIterMut<'a, T, R, C, S> where
R: Dim,
C: Dim,
S: 'a + RawStorageMut<T, R, C>, type Item = Matrix<T, R, Const<1_usize>, SliceStorageMut<'a, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>;
where
S: RawStorageMut<T, R, C>,
pub fn column_iter_mut(&mut self) -> ColumnIterMut<'_, T, R, C, S>ⓘNotable traits for ColumnIterMut<'a, T, R, C, S>impl<'a, T, R, C, S> Iterator for ColumnIterMut<'a, T, R, C, S> where
R: Dim,
C: Dim,
S: 'a + RawStorageMut<T, R, C>, type Item = Matrix<T, R, Const<1_usize>, SliceStorageMut<'a, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>;
where
S: RawStorageMut<T, R, C>,
R: Dim,
C: Dim,
S: 'a + RawStorageMut<T, R, C>, type Item = Matrix<T, R, Const<1_usize>, SliceStorageMut<'a, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>;
Mutably iterates through this matrix columns.
Example
let mut a = Matrix2x3::new(1, 2, 3,
4, 5, 6);
for (i, mut col) in a.column_iter_mut().enumerate() {
col *= (i + 1) * 10;
}
let expected = Matrix2x3::new(10, 40, 90,
40, 100, 180);
assert_eq!(a, expected);
sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Returns a mutable pointer to the start of the matrix.
If the matrix is not empty, this pointer is guaranteed to be aligned and non-null.
sourcepub unsafe fn swap_unchecked(
&mut self,
row_cols1: (usize, usize),
row_cols2: (usize, usize)
)
pub unsafe fn swap_unchecked(
&mut self,
row_cols1: (usize, usize),
row_cols2: (usize, usize)
)
Swaps two entries without bound-checking.
sourcepub fn swap(&mut self, row_cols1: (usize, usize), row_cols2: (usize, usize))
pub fn swap(&mut self, row_cols1: (usize, usize), row_cols2: (usize, usize))
Swaps two entries.
sourcepub fn copy_from_slice(&mut self, slice: &[T]) where
T: Scalar,
pub fn copy_from_slice(&mut self, slice: &[T]) where
T: Scalar,
Fills this matrix with the content of a slice. Both must hold the same number of elements.
The components of the slice are assumed to be ordered in column-major order.
sourcepub fn copy_from<R2, C2, SB>(&mut self, other: &Matrix<T, R2, C2, SB>) where
T: Scalar,
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
pub fn copy_from<R2, C2, SB>(&mut self, other: &Matrix<T, R2, C2, SB>) where
T: Scalar,
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
Fills this matrix with the content of another one. Both must have the same shape.
sourcepub fn tr_copy_from<R2, C2, SB>(&mut self, other: &Matrix<T, R2, C2, SB>) where
T: Scalar,
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<R, C2>,
ShapeConstraint: SameNumberOfColumns<C, R2>,
pub fn tr_copy_from<R2, C2, SB>(&mut self, other: &Matrix<T, R2, C2, SB>) where
T: Scalar,
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<R, C2>,
ShapeConstraint: SameNumberOfColumns<C, R2>,
Fills this matrix with the content of the transpose another one.
sourcepub unsafe fn vget_unchecked(&self, i: usize) -> &T
pub unsafe fn vget_unchecked(&self, i: usize) -> &T
Gets a reference to the i-th element of this column vector without bound checking.
sourcepub unsafe fn vget_unchecked_mut(&mut self, i: usize) -> &mut T
pub unsafe fn vget_unchecked_mut(&mut self, i: usize) -> &mut T
Gets a mutable reference to the i-th element of this column vector without bound checking.
sourcepub fn transpose_mut(&mut self)
pub fn transpose_mut(&mut self)
Transposes the square matrix self
in-place.
sourcepub fn adjoint_to<R2, C2, SB>(&self, out: &mut Matrix<T, R2, C2, SB>) where
R2: Dim,
C2: Dim,
SB: RawStorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2>,
ShapeConstraint: SameNumberOfColumns<C, R2>,
pub fn adjoint_to<R2, C2, SB>(&self, out: &mut Matrix<T, R2, C2, SB>) where
R2: Dim,
C2: Dim,
SB: RawStorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2>,
ShapeConstraint: SameNumberOfColumns<C, R2>,
Takes the adjoint (aka. conjugate-transpose) of self
and store the result into out
.
sourcepub fn adjoint(
&self
) -> Matrix<T, C, R, <DefaultAllocator as Allocator<T, C, R>>::Buffer> where
DefaultAllocator: Allocator<T, C, R>,
pub fn adjoint(
&self
) -> Matrix<T, C, R, <DefaultAllocator as Allocator<T, C, R>>::Buffer> where
DefaultAllocator: Allocator<T, C, R>,
The adjoint (aka. conjugate-transpose) of self
.
sourcepub fn conjugate_transpose_to<R2, C2, SB>(&self, out: &mut Matrix<T, R2, C2, SB>) where
R2: Dim,
C2: Dim,
SB: RawStorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2>,
ShapeConstraint: SameNumberOfColumns<C, R2>,
👎 Deprecated: Renamed self.adjoint_to(out)
.
pub fn conjugate_transpose_to<R2, C2, SB>(&self, out: &mut Matrix<T, R2, C2, SB>) where
R2: Dim,
C2: Dim,
SB: RawStorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2>,
ShapeConstraint: SameNumberOfColumns<C, R2>,
Renamed self.adjoint_to(out)
.
Takes the conjugate and transposes self
and store the result into out
.
sourcepub fn conjugate_transpose(
&self
) -> Matrix<T, C, R, <DefaultAllocator as Allocator<T, C, R>>::Buffer> where
DefaultAllocator: Allocator<T, C, R>,
👎 Deprecated: Renamed self.adjoint()
.
pub fn conjugate_transpose(
&self
) -> Matrix<T, C, R, <DefaultAllocator as Allocator<T, C, R>>::Buffer> where
DefaultAllocator: Allocator<T, C, R>,
Renamed self.adjoint()
.
The conjugate transposition of self
.
sourcepub fn conjugate(
&self
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
pub fn conjugate(
&self
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
The conjugate of self
.
sourcepub fn unscale(
&self,
real: <T as SimdComplexField>::SimdRealField
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
pub fn unscale(
&self,
real: <T as SimdComplexField>::SimdRealField
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
Divides each component of the complex matrix self
by the given real.
sourcepub fn scale(
&self,
real: <T as SimdComplexField>::SimdRealField
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
pub fn scale(
&self,
real: <T as SimdComplexField>::SimdRealField
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
Multiplies each component of the complex matrix self
by the given real.
sourcepub fn conjugate_mut(&mut self)
pub fn conjugate_mut(&mut self)
The conjugate of the complex matrix self
computed in-place.
sourcepub fn unscale_mut(&mut self, real: <T as SimdComplexField>::SimdRealField)
pub fn unscale_mut(&mut self, real: <T as SimdComplexField>::SimdRealField)
Divides each component of the complex matrix self
by the given real.
sourcepub fn scale_mut(&mut self, real: <T as SimdComplexField>::SimdRealField)
pub fn scale_mut(&mut self, real: <T as SimdComplexField>::SimdRealField)
Multiplies each component of the complex matrix self
by the given real.
sourcepub fn conjugate_transform_mut(&mut self)
👎 Deprecated: Renamed to self.adjoint_mut()
.
pub fn conjugate_transform_mut(&mut self)
Renamed to self.adjoint_mut()
.
Sets self
to its adjoint.
sourcepub fn adjoint_mut(&mut self)
pub fn adjoint_mut(&mut self)
Sets self
to its adjoint (aka. conjugate-transpose).
sourcepub fn diagonal(
&self
) -> Matrix<T, D, Const<1_usize>, <DefaultAllocator as Allocator<T, D, Const<1_usize>>>::Buffer> where
DefaultAllocator: Allocator<T, D, Const<1_usize>>,
pub fn diagonal(
&self
) -> Matrix<T, D, Const<1_usize>, <DefaultAllocator as Allocator<T, D, Const<1_usize>>>::Buffer> where
DefaultAllocator: Allocator<T, D, Const<1_usize>>,
The diagonal of this matrix.
sourcepub fn map_diagonal<T2>(
&self,
f: impl FnMut(T) -> T2
) -> Matrix<T2, D, Const<1_usize>, <DefaultAllocator as Allocator<T2, D, Const<1_usize>>>::Buffer> where
T2: Scalar,
DefaultAllocator: Allocator<T2, D, Const<1_usize>>,
pub fn map_diagonal<T2>(
&self,
f: impl FnMut(T) -> T2
) -> Matrix<T2, D, Const<1_usize>, <DefaultAllocator as Allocator<T2, D, Const<1_usize>>>::Buffer> where
T2: Scalar,
DefaultAllocator: Allocator<T2, D, Const<1_usize>>,
Apply the given function to this matrix’s diagonal and returns it.
This is a more efficient version of self.diagonal().map(f)
since this
allocates only once.
sourcepub fn symmetric_part(
&self
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
DefaultAllocator: Allocator<T, D, D>,
pub fn symmetric_part(
&self
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
DefaultAllocator: Allocator<T, D, D>,
The symmetric part of self
, i.e., 0.5 * (self + self.transpose())
.
sourcepub fn hermitian_part(
&self
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
DefaultAllocator: Allocator<T, D, D>,
pub fn hermitian_part(
&self
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> where
DefaultAllocator: Allocator<T, D, D>,
The hermitian part of self
, i.e., 0.5 * (self + self.adjoint())
.
sourcepub fn to_homogeneous(
&self
) -> Matrix<T, <D as DimAdd<Const<1_usize>>>::Output, <D as DimAdd<Const<1_usize>>>::Output, <DefaultAllocator as Allocator<T, <D as DimAdd<Const<1_usize>>>::Output, <D as DimAdd<Const<1_usize>>>::Output>>::Buffer> where
DefaultAllocator: Allocator<T, <D as DimAdd<Const<1_usize>>>::Output, <D as DimAdd<Const<1_usize>>>::Output>,
pub fn to_homogeneous(
&self
) -> Matrix<T, <D as DimAdd<Const<1_usize>>>::Output, <D as DimAdd<Const<1_usize>>>::Output, <DefaultAllocator as Allocator<T, <D as DimAdd<Const<1_usize>>>::Output, <D as DimAdd<Const<1_usize>>>::Output>>::Buffer> where
DefaultAllocator: Allocator<T, <D as DimAdd<Const<1_usize>>>::Output, <D as DimAdd<Const<1_usize>>>::Output>,
Yields the homogeneous matrix for this matrix, i.e., appending an additional dimension and
and setting the diagonal element to 1
.
sourcepub fn to_homogeneous(
&self
) -> Matrix<T, <D as DimAdd<Const<1_usize>>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<T, <D as DimAdd<Const<1_usize>>>::Output, Const<1_usize>>>::Buffer> where
DefaultAllocator: Allocator<T, <D as DimAdd<Const<1_usize>>>::Output, Const<1_usize>>,
pub fn to_homogeneous(
&self
) -> Matrix<T, <D as DimAdd<Const<1_usize>>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<T, <D as DimAdd<Const<1_usize>>>::Output, Const<1_usize>>>::Buffer> where
DefaultAllocator: Allocator<T, <D as DimAdd<Const<1_usize>>>::Output, Const<1_usize>>,
Computes the coordinates in projective space of this vector, i.e., appends a 0
to its
coordinates.
sourcepub fn push(
&self,
element: T
) -> Matrix<T, <D as DimAdd<Const<1_usize>>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<T, <D as DimAdd<Const<1_usize>>>::Output, Const<1_usize>>>::Buffer> where
DefaultAllocator: Allocator<T, <D as DimAdd<Const<1_usize>>>::Output, Const<1_usize>>,
pub fn push(
&self,
element: T
) -> Matrix<T, <D as DimAdd<Const<1_usize>>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<T, <D as DimAdd<Const<1_usize>>>::Output, Const<1_usize>>>::Buffer> where
DefaultAllocator: Allocator<T, <D as DimAdd<Const<1_usize>>>::Output, Const<1_usize>>,
Constructs a new vector of higher dimension by appending element
to the end of self
.
sourcepub fn perp<R2, C2, SB>(&self, b: &Matrix<T, R2, C2, SB>) -> T where
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, Const<2_usize>>,
ShapeConstraint: SameNumberOfColumns<C, Const<1_usize>>,
ShapeConstraint: SameNumberOfRows<R2, Const<2_usize>>,
ShapeConstraint: SameNumberOfColumns<C2, Const<1_usize>>,
pub fn perp<R2, C2, SB>(&self, b: &Matrix<T, R2, C2, SB>) -> T where
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, Const<2_usize>>,
ShapeConstraint: SameNumberOfColumns<C, Const<1_usize>>,
ShapeConstraint: SameNumberOfRows<R2, Const<2_usize>>,
ShapeConstraint: SameNumberOfColumns<C2, Const<1_usize>>,
The perpendicular product between two 2D column vectors, i.e. a.x * b.y - a.y * b.x
.
sourcepub fn cross<R2, C2, SB>(
&self,
b: &Matrix<T, R2, C2, SB>
) -> Matrix<T, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative, <DefaultAllocator as Allocator<T, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative>>::Buffer> where
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R, C, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
pub fn cross<R2, C2, SB>(
&self,
b: &Matrix<T, R2, C2, SB>
) -> Matrix<T, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative, <DefaultAllocator as Allocator<T, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative>>::Buffer> where
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R, C, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
The 3D cross product between two vectors.
Panics if the shape is not 3D vector. In the future, this will be implemented only for dynamically-sized matrices and statically-sized 3D matrices.
sourcepub fn cross_matrix(
&self
) -> Matrix<T, Const<3_usize>, Const<3_usize>, <DefaultAllocator as Allocator<T, Const<3_usize>, Const<3_usize>>>::Buffer>
pub fn cross_matrix(
&self
) -> Matrix<T, Const<3_usize>, Const<3_usize>, <DefaultAllocator as Allocator<T, Const<3_usize>, Const<3_usize>>>::Buffer>
Computes the matrix M
such that for all vector v
we have M * v == self.cross(&v)
.
sourcepub fn angle<R2, C2, SB>(
&self,
other: &Matrix<T, R2, C2, SB>
) -> <T as SimdComplexField>::SimdRealField where
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
ShapeConstraint: DimEq<R, R2>,
ShapeConstraint: DimEq<C, C2>,
pub fn angle<R2, C2, SB>(
&self,
other: &Matrix<T, R2, C2, SB>
) -> <T as SimdComplexField>::SimdRealField where
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
ShapeConstraint: DimEq<R, R2>,
ShapeConstraint: DimEq<C, C2>,
The smallest angle between two vectors.
sourcepub fn row(
&self,
i: usize
) -> Matrix<T, Const<1_usize>, C, SliceStorage<'_, T, Const<1_usize>, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn row(
&self,
i: usize
) -> Matrix<T, Const<1_usize>, C, SliceStorage<'_, T, Const<1_usize>, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Returns a slice containing the i-th row of this matrix.
sourcepub fn row_part(
&self,
i: usize,
n: usize
) -> Matrix<T, Const<1_usize>, Dynamic, SliceStorage<'_, T, Const<1_usize>, Dynamic, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn row_part(
&self,
i: usize,
n: usize
) -> Matrix<T, Const<1_usize>, Dynamic, SliceStorage<'_, T, Const<1_usize>, Dynamic, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Returns a slice containing the n
first elements of the i-th row of this matrix.
sourcepub fn rows(
&self,
first_row: usize,
nrows: usize
) -> Matrix<T, Dynamic, C, SliceStorage<'_, T, Dynamic, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn rows(
&self,
first_row: usize,
nrows: usize
) -> Matrix<T, Dynamic, C, SliceStorage<'_, T, Dynamic, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Extracts from this matrix a set of consecutive rows.
sourcepub fn rows_with_step(
&self,
first_row: usize,
nrows: usize,
step: usize
) -> Matrix<T, Dynamic, C, SliceStorage<'_, T, Dynamic, C, Dynamic, <S as RawStorage<T, R, C>>::CStride>>
pub fn rows_with_step(
&self,
first_row: usize,
nrows: usize,
step: usize
) -> Matrix<T, Dynamic, C, SliceStorage<'_, T, Dynamic, C, Dynamic, <S as RawStorage<T, R, C>>::CStride>>
Extracts from this matrix a set of consecutive rows regularly skipping step
rows.
sourcepub fn fixed_rows<const RSLICE: usize>(
&self,
first_row: usize
) -> Matrix<T, Const<RSLICE>, C, SliceStorage<'_, T, Const<RSLICE>, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn fixed_rows<const RSLICE: usize>(
&self,
first_row: usize
) -> Matrix<T, Const<RSLICE>, C, SliceStorage<'_, T, Const<RSLICE>, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Extracts a compile-time number of consecutive rows from this matrix.
sourcepub fn fixed_rows_with_step<const RSLICE: usize>(
&self,
first_row: usize,
step: usize
) -> Matrix<T, Const<RSLICE>, C, SliceStorage<'_, T, Const<RSLICE>, C, Dynamic, <S as RawStorage<T, R, C>>::CStride>>
pub fn fixed_rows_with_step<const RSLICE: usize>(
&self,
first_row: usize,
step: usize
) -> Matrix<T, Const<RSLICE>, C, SliceStorage<'_, T, Const<RSLICE>, C, Dynamic, <S as RawStorage<T, R, C>>::CStride>>
Extracts from this matrix a compile-time number of rows regularly skipping step
rows.
sourcepub fn rows_generic<RSlice>(
&self,
row_start: usize,
nrows: RSlice
) -> Matrix<T, RSlice, C, SliceStorage<'_, T, RSlice, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RSlice: Dim,
pub fn rows_generic<RSlice>(
&self,
row_start: usize,
nrows: RSlice
) -> Matrix<T, RSlice, C, SliceStorage<'_, T, RSlice, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RSlice: Dim,
Extracts from this matrix nrows
rows regularly skipping step
rows. Both
argument may or may not be values known at compile-time.
sourcepub fn rows_generic_with_step<RSlice>(
&self,
row_start: usize,
nrows: RSlice,
step: usize
) -> Matrix<T, RSlice, C, SliceStorage<'_, T, RSlice, C, Dynamic, <S as RawStorage<T, R, C>>::CStride>> where
RSlice: Dim,
pub fn rows_generic_with_step<RSlice>(
&self,
row_start: usize,
nrows: RSlice,
step: usize
) -> Matrix<T, RSlice, C, SliceStorage<'_, T, RSlice, C, Dynamic, <S as RawStorage<T, R, C>>::CStride>> where
RSlice: Dim,
Extracts from this matrix nrows
rows regularly skipping step
rows. Both
argument may or may not be values known at compile-time.
sourcepub fn column(
&self,
i: usize
) -> Matrix<T, R, Const<1_usize>, SliceStorage<'_, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn column(
&self,
i: usize
) -> Matrix<T, R, Const<1_usize>, SliceStorage<'_, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Returns a slice containing the i-th column of this matrix.
sourcepub fn column_part(
&self,
i: usize,
n: usize
) -> Matrix<T, Dynamic, Const<1_usize>, SliceStorage<'_, T, Dynamic, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn column_part(
&self,
i: usize,
n: usize
) -> Matrix<T, Dynamic, Const<1_usize>, SliceStorage<'_, T, Dynamic, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Returns a slice containing the n
first elements of the i-th column of this matrix.
sourcepub fn columns(
&self,
first_col: usize,
ncols: usize
) -> Matrix<T, R, Dynamic, SliceStorage<'_, T, R, Dynamic, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn columns(
&self,
first_col: usize,
ncols: usize
) -> Matrix<T, R, Dynamic, SliceStorage<'_, T, R, Dynamic, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Extracts from this matrix a set of consecutive columns.
sourcepub fn columns_with_step(
&self,
first_col: usize,
ncols: usize,
step: usize
) -> Matrix<T, R, Dynamic, SliceStorage<'_, T, R, Dynamic, <S as RawStorage<T, R, C>>::RStride, Dynamic>>
pub fn columns_with_step(
&self,
first_col: usize,
ncols: usize,
step: usize
) -> Matrix<T, R, Dynamic, SliceStorage<'_, T, R, Dynamic, <S as RawStorage<T, R, C>>::RStride, Dynamic>>
Extracts from this matrix a set of consecutive columns regularly skipping step
columns.
sourcepub fn fixed_columns<const CSLICE: usize>(
&self,
first_col: usize
) -> Matrix<T, R, Const<CSLICE>, SliceStorage<'_, T, R, Const<CSLICE>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn fixed_columns<const CSLICE: usize>(
&self,
first_col: usize
) -> Matrix<T, R, Const<CSLICE>, SliceStorage<'_, T, R, Const<CSLICE>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Extracts a compile-time number of consecutive columns from this matrix.
sourcepub fn fixed_columns_with_step<const CSLICE: usize>(
&self,
first_col: usize,
step: usize
) -> Matrix<T, R, Const<CSLICE>, SliceStorage<'_, T, R, Const<CSLICE>, <S as RawStorage<T, R, C>>::RStride, Dynamic>>
pub fn fixed_columns_with_step<const CSLICE: usize>(
&self,
first_col: usize,
step: usize
) -> Matrix<T, R, Const<CSLICE>, SliceStorage<'_, T, R, Const<CSLICE>, <S as RawStorage<T, R, C>>::RStride, Dynamic>>
Extracts from this matrix a compile-time number of columns regularly skipping
step
columns.
sourcepub fn columns_generic<CSlice>(
&self,
first_col: usize,
ncols: CSlice
) -> Matrix<T, R, CSlice, SliceStorage<'_, T, R, CSlice, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
CSlice: Dim,
pub fn columns_generic<CSlice>(
&self,
first_col: usize,
ncols: CSlice
) -> Matrix<T, R, CSlice, SliceStorage<'_, T, R, CSlice, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
CSlice: Dim,
Extracts from this matrix ncols
columns. The number of columns may or may not be
known at compile-time.
sourcepub fn columns_generic_with_step<CSlice>(
&self,
first_col: usize,
ncols: CSlice,
step: usize
) -> Matrix<T, R, CSlice, SliceStorage<'_, T, R, CSlice, <S as RawStorage<T, R, C>>::RStride, Dynamic>> where
CSlice: Dim,
pub fn columns_generic_with_step<CSlice>(
&self,
first_col: usize,
ncols: CSlice,
step: usize
) -> Matrix<T, R, CSlice, SliceStorage<'_, T, R, CSlice, <S as RawStorage<T, R, C>>::RStride, Dynamic>> where
CSlice: Dim,
Extracts from this matrix ncols
columns skipping step
columns. Both argument may
or may not be values known at compile-time.
sourcepub fn slice(
&self,
start: (usize, usize),
shape: (usize, usize)
) -> Matrix<T, Dynamic, Dynamic, SliceStorage<'_, T, Dynamic, Dynamic, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn slice(
&self,
start: (usize, usize),
shape: (usize, usize)
) -> Matrix<T, Dynamic, Dynamic, SliceStorage<'_, T, Dynamic, Dynamic, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Slices this matrix starting at its component (irow, icol)
and with (nrows, ncols)
consecutive elements.
sourcepub fn slice_with_steps(
&self,
start: (usize, usize),
shape: (usize, usize),
steps: (usize, usize)
) -> Matrix<T, Dynamic, Dynamic, SliceStorage<'_, T, Dynamic, Dynamic, Dynamic, Dynamic>>
pub fn slice_with_steps(
&self,
start: (usize, usize),
shape: (usize, usize),
steps: (usize, usize)
) -> Matrix<T, Dynamic, Dynamic, SliceStorage<'_, T, Dynamic, Dynamic, Dynamic, Dynamic>>
Slices this matrix starting at its component (start.0, start.1)
and with
(shape.0, shape.1)
components. Each row (resp. column) of the sliced matrix is
separated by steps.0
(resp. steps.1
) ignored rows (resp. columns) of the
original matrix.
sourcepub fn fixed_slice<const RSLICE: usize, const CSLICE: usize>(
&self,
irow: usize,
icol: usize
) -> Matrix<T, Const<RSLICE>, Const<CSLICE>, SliceStorage<'_, T, Const<RSLICE>, Const<CSLICE>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn fixed_slice<const RSLICE: usize, const CSLICE: usize>(
&self,
irow: usize,
icol: usize
) -> Matrix<T, Const<RSLICE>, Const<CSLICE>, SliceStorage<'_, T, Const<RSLICE>, Const<CSLICE>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Slices this matrix starting at its component (irow, icol)
and with (R::dim(), CSlice::dim())
consecutive components.
sourcepub fn fixed_slice_with_steps<const RSLICE: usize, const CSLICE: usize>(
&self,
start: (usize, usize),
steps: (usize, usize)
) -> Matrix<T, Const<RSLICE>, Const<CSLICE>, SliceStorage<'_, T, Const<RSLICE>, Const<CSLICE>, Dynamic, Dynamic>>
pub fn fixed_slice_with_steps<const RSLICE: usize, const CSLICE: usize>(
&self,
start: (usize, usize),
steps: (usize, usize)
) -> Matrix<T, Const<RSLICE>, Const<CSLICE>, SliceStorage<'_, T, Const<RSLICE>, Const<CSLICE>, Dynamic, Dynamic>>
Slices this matrix starting at its component (start.0, start.1)
and with
(RSLICE, CSLICE)
components. Each row (resp. column) of the sliced
matrix is separated by steps.0
(resp. steps.1
) ignored rows (resp. columns) of
the original matrix.
sourcepub fn generic_slice<RSlice, CSlice>(
&self,
start: (usize, usize),
shape: (RSlice, CSlice)
) -> Matrix<T, RSlice, CSlice, SliceStorage<'_, T, RSlice, CSlice, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RSlice: Dim,
CSlice: Dim,
pub fn generic_slice<RSlice, CSlice>(
&self,
start: (usize, usize),
shape: (RSlice, CSlice)
) -> Matrix<T, RSlice, CSlice, SliceStorage<'_, T, RSlice, CSlice, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RSlice: Dim,
CSlice: Dim,
Creates a slice that may or may not have a fixed size and stride.
sourcepub fn generic_slice_with_steps<RSlice, CSlice>(
&self,
start: (usize, usize),
shape: (RSlice, CSlice),
steps: (usize, usize)
) -> Matrix<T, RSlice, CSlice, SliceStorage<'_, T, RSlice, CSlice, Dynamic, Dynamic>> where
RSlice: Dim,
CSlice: Dim,
pub fn generic_slice_with_steps<RSlice, CSlice>(
&self,
start: (usize, usize),
shape: (RSlice, CSlice),
steps: (usize, usize)
) -> Matrix<T, RSlice, CSlice, SliceStorage<'_, T, RSlice, CSlice, Dynamic, Dynamic>> where
RSlice: Dim,
CSlice: Dim,
Creates a slice that may or may not have a fixed size and stride.
sourcepub fn rows_range_pair<Range1, Range2>(
&self,
r1: Range1,
r2: Range2
) -> (Matrix<T, <Range1 as SliceRange<R>>::Size, C, SliceStorage<'_, T, <Range1 as SliceRange<R>>::Size, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>, Matrix<T, <Range2 as SliceRange<R>>::Size, C, SliceStorage<'_, T, <Range2 as SliceRange<R>>::Size, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>) where
Range1: SliceRange<R>,
Range2: SliceRange<R>,
pub fn rows_range_pair<Range1, Range2>(
&self,
r1: Range1,
r2: Range2
) -> (Matrix<T, <Range1 as SliceRange<R>>::Size, C, SliceStorage<'_, T, <Range1 as SliceRange<R>>::Size, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>, Matrix<T, <Range2 as SliceRange<R>>::Size, C, SliceStorage<'_, T, <Range2 as SliceRange<R>>::Size, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>) where
Range1: SliceRange<R>,
Range2: SliceRange<R>,
Splits this NxM
matrix into two parts delimited by two ranges.
Panics if the ranges overlap or if the first range is empty.
sourcepub fn columns_range_pair<Range1, Range2>(
&self,
r1: Range1,
r2: Range2
) -> (Matrix<T, R, <Range1 as SliceRange<C>>::Size, SliceStorage<'_, T, R, <Range1 as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>, Matrix<T, R, <Range2 as SliceRange<C>>::Size, SliceStorage<'_, T, R, <Range2 as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>) where
Range1: SliceRange<C>,
Range2: SliceRange<C>,
pub fn columns_range_pair<Range1, Range2>(
&self,
r1: Range1,
r2: Range2
) -> (Matrix<T, R, <Range1 as SliceRange<C>>::Size, SliceStorage<'_, T, R, <Range1 as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>, Matrix<T, R, <Range2 as SliceRange<C>>::Size, SliceStorage<'_, T, R, <Range2 as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>) where
Range1: SliceRange<C>,
Range2: SliceRange<C>,
Splits this NxM
matrix into two parts delimited by two ranges.
Panics if the ranges overlap or if the first range is empty.
sourcepub fn row_mut(
&mut self,
i: usize
) -> Matrix<T, Const<1_usize>, C, SliceStorageMut<'_, T, Const<1_usize>, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn row_mut(
&mut self,
i: usize
) -> Matrix<T, Const<1_usize>, C, SliceStorageMut<'_, T, Const<1_usize>, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Returns a slice containing the i-th row of this matrix.
sourcepub fn row_part_mut(
&mut self,
i: usize,
n: usize
) -> Matrix<T, Const<1_usize>, Dynamic, SliceStorageMut<'_, T, Const<1_usize>, Dynamic, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn row_part_mut(
&mut self,
i: usize,
n: usize
) -> Matrix<T, Const<1_usize>, Dynamic, SliceStorageMut<'_, T, Const<1_usize>, Dynamic, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Returns a slice containing the n
first elements of the i-th row of this matrix.
sourcepub fn rows_mut(
&mut self,
first_row: usize,
nrows: usize
) -> Matrix<T, Dynamic, C, SliceStorageMut<'_, T, Dynamic, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn rows_mut(
&mut self,
first_row: usize,
nrows: usize
) -> Matrix<T, Dynamic, C, SliceStorageMut<'_, T, Dynamic, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Extracts from this matrix a set of consecutive rows.
sourcepub fn rows_with_step_mut(
&mut self,
first_row: usize,
nrows: usize,
step: usize
) -> Matrix<T, Dynamic, C, SliceStorageMut<'_, T, Dynamic, C, Dynamic, <S as RawStorage<T, R, C>>::CStride>>
pub fn rows_with_step_mut(
&mut self,
first_row: usize,
nrows: usize,
step: usize
) -> Matrix<T, Dynamic, C, SliceStorageMut<'_, T, Dynamic, C, Dynamic, <S as RawStorage<T, R, C>>::CStride>>
Extracts from this matrix a set of consecutive rows regularly skipping step
rows.
sourcepub fn fixed_rows_mut<const RSLICE: usize>(
&mut self,
first_row: usize
) -> Matrix<T, Const<RSLICE>, C, SliceStorageMut<'_, T, Const<RSLICE>, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn fixed_rows_mut<const RSLICE: usize>(
&mut self,
first_row: usize
) -> Matrix<T, Const<RSLICE>, C, SliceStorageMut<'_, T, Const<RSLICE>, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Extracts a compile-time number of consecutive rows from this matrix.
sourcepub fn fixed_rows_with_step_mut<const RSLICE: usize>(
&mut self,
first_row: usize,
step: usize
) -> Matrix<T, Const<RSLICE>, C, SliceStorageMut<'_, T, Const<RSLICE>, C, Dynamic, <S as RawStorage<T, R, C>>::CStride>>
pub fn fixed_rows_with_step_mut<const RSLICE: usize>(
&mut self,
first_row: usize,
step: usize
) -> Matrix<T, Const<RSLICE>, C, SliceStorageMut<'_, T, Const<RSLICE>, C, Dynamic, <S as RawStorage<T, R, C>>::CStride>>
Extracts from this matrix a compile-time number of rows regularly skipping step
rows.
sourcepub fn rows_generic_mut<RSlice>(
&mut self,
row_start: usize,
nrows: RSlice
) -> Matrix<T, RSlice, C, SliceStorageMut<'_, T, RSlice, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RSlice: Dim,
pub fn rows_generic_mut<RSlice>(
&mut self,
row_start: usize,
nrows: RSlice
) -> Matrix<T, RSlice, C, SliceStorageMut<'_, T, RSlice, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RSlice: Dim,
Extracts from this matrix nrows
rows regularly skipping step
rows. Both
argument may or may not be values known at compile-time.
sourcepub fn rows_generic_with_step_mut<RSlice>(
&mut self,
row_start: usize,
nrows: RSlice,
step: usize
) -> Matrix<T, RSlice, C, SliceStorageMut<'_, T, RSlice, C, Dynamic, <S as RawStorage<T, R, C>>::CStride>> where
RSlice: Dim,
pub fn rows_generic_with_step_mut<RSlice>(
&mut self,
row_start: usize,
nrows: RSlice,
step: usize
) -> Matrix<T, RSlice, C, SliceStorageMut<'_, T, RSlice, C, Dynamic, <S as RawStorage<T, R, C>>::CStride>> where
RSlice: Dim,
Extracts from this matrix nrows
rows regularly skipping step
rows. Both
argument may or may not be values known at compile-time.
sourcepub fn column_mut(
&mut self,
i: usize
) -> Matrix<T, R, Const<1_usize>, SliceStorageMut<'_, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn column_mut(
&mut self,
i: usize
) -> Matrix<T, R, Const<1_usize>, SliceStorageMut<'_, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Returns a slice containing the i-th column of this matrix.
sourcepub fn column_part_mut(
&mut self,
i: usize,
n: usize
) -> Matrix<T, Dynamic, Const<1_usize>, SliceStorageMut<'_, T, Dynamic, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn column_part_mut(
&mut self,
i: usize,
n: usize
) -> Matrix<T, Dynamic, Const<1_usize>, SliceStorageMut<'_, T, Dynamic, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Returns a slice containing the n
first elements of the i-th column of this matrix.
sourcepub fn columns_mut(
&mut self,
first_col: usize,
ncols: usize
) -> Matrix<T, R, Dynamic, SliceStorageMut<'_, T, R, Dynamic, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn columns_mut(
&mut self,
first_col: usize,
ncols: usize
) -> Matrix<T, R, Dynamic, SliceStorageMut<'_, T, R, Dynamic, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Extracts from this matrix a set of consecutive columns.
sourcepub fn columns_with_step_mut(
&mut self,
first_col: usize,
ncols: usize,
step: usize
) -> Matrix<T, R, Dynamic, SliceStorageMut<'_, T, R, Dynamic, <S as RawStorage<T, R, C>>::RStride, Dynamic>>
pub fn columns_with_step_mut(
&mut self,
first_col: usize,
ncols: usize,
step: usize
) -> Matrix<T, R, Dynamic, SliceStorageMut<'_, T, R, Dynamic, <S as RawStorage<T, R, C>>::RStride, Dynamic>>
Extracts from this matrix a set of consecutive columns regularly skipping step
columns.
sourcepub fn fixed_columns_mut<const CSLICE: usize>(
&mut self,
first_col: usize
) -> Matrix<T, R, Const<CSLICE>, SliceStorageMut<'_, T, R, Const<CSLICE>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn fixed_columns_mut<const CSLICE: usize>(
&mut self,
first_col: usize
) -> Matrix<T, R, Const<CSLICE>, SliceStorageMut<'_, T, R, Const<CSLICE>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Extracts a compile-time number of consecutive columns from this matrix.
sourcepub fn fixed_columns_with_step_mut<const CSLICE: usize>(
&mut self,
first_col: usize,
step: usize
) -> Matrix<T, R, Const<CSLICE>, SliceStorageMut<'_, T, R, Const<CSLICE>, <S as RawStorage<T, R, C>>::RStride, Dynamic>>
pub fn fixed_columns_with_step_mut<const CSLICE: usize>(
&mut self,
first_col: usize,
step: usize
) -> Matrix<T, R, Const<CSLICE>, SliceStorageMut<'_, T, R, Const<CSLICE>, <S as RawStorage<T, R, C>>::RStride, Dynamic>>
Extracts from this matrix a compile-time number of columns regularly skipping
step
columns.
sourcepub fn columns_generic_mut<CSlice>(
&mut self,
first_col: usize,
ncols: CSlice
) -> Matrix<T, R, CSlice, SliceStorageMut<'_, T, R, CSlice, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
CSlice: Dim,
pub fn columns_generic_mut<CSlice>(
&mut self,
first_col: usize,
ncols: CSlice
) -> Matrix<T, R, CSlice, SliceStorageMut<'_, T, R, CSlice, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
CSlice: Dim,
Extracts from this matrix ncols
columns. The number of columns may or may not be
known at compile-time.
sourcepub fn columns_generic_with_step_mut<CSlice>(
&mut self,
first_col: usize,
ncols: CSlice,
step: usize
) -> Matrix<T, R, CSlice, SliceStorageMut<'_, T, R, CSlice, <S as RawStorage<T, R, C>>::RStride, Dynamic>> where
CSlice: Dim,
pub fn columns_generic_with_step_mut<CSlice>(
&mut self,
first_col: usize,
ncols: CSlice,
step: usize
) -> Matrix<T, R, CSlice, SliceStorageMut<'_, T, R, CSlice, <S as RawStorage<T, R, C>>::RStride, Dynamic>> where
CSlice: Dim,
Extracts from this matrix ncols
columns skipping step
columns. Both argument may
or may not be values known at compile-time.
sourcepub fn slice_mut(
&mut self,
start: (usize, usize),
shape: (usize, usize)
) -> Matrix<T, Dynamic, Dynamic, SliceStorageMut<'_, T, Dynamic, Dynamic, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn slice_mut(
&mut self,
start: (usize, usize),
shape: (usize, usize)
) -> Matrix<T, Dynamic, Dynamic, SliceStorageMut<'_, T, Dynamic, Dynamic, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Slices this matrix starting at its component (irow, icol)
and with (nrows, ncols)
consecutive elements.
sourcepub fn slice_with_steps_mut(
&mut self,
start: (usize, usize),
shape: (usize, usize),
steps: (usize, usize)
) -> Matrix<T, Dynamic, Dynamic, SliceStorageMut<'_, T, Dynamic, Dynamic, Dynamic, Dynamic>>
pub fn slice_with_steps_mut(
&mut self,
start: (usize, usize),
shape: (usize, usize),
steps: (usize, usize)
) -> Matrix<T, Dynamic, Dynamic, SliceStorageMut<'_, T, Dynamic, Dynamic, Dynamic, Dynamic>>
Slices this matrix starting at its component (start.0, start.1)
and with
(shape.0, shape.1)
components. Each row (resp. column) of the sliced matrix is
separated by steps.0
(resp. steps.1
) ignored rows (resp. columns) of the
original matrix.
sourcepub fn fixed_slice_mut<const RSLICE: usize, const CSLICE: usize>(
&mut self,
irow: usize,
icol: usize
) -> Matrix<T, Const<RSLICE>, Const<CSLICE>, SliceStorageMut<'_, T, Const<RSLICE>, Const<CSLICE>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
pub fn fixed_slice_mut<const RSLICE: usize, const CSLICE: usize>(
&mut self,
irow: usize,
icol: usize
) -> Matrix<T, Const<RSLICE>, Const<CSLICE>, SliceStorageMut<'_, T, Const<RSLICE>, Const<CSLICE>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>
Slices this matrix starting at its component (irow, icol)
and with (R::dim(), CSlice::dim())
consecutive components.
sourcepub fn fixed_slice_with_steps_mut<const RSLICE: usize, const CSLICE: usize>(
&mut self,
start: (usize, usize),
steps: (usize, usize)
) -> Matrix<T, Const<RSLICE>, Const<CSLICE>, SliceStorageMut<'_, T, Const<RSLICE>, Const<CSLICE>, Dynamic, Dynamic>>
pub fn fixed_slice_with_steps_mut<const RSLICE: usize, const CSLICE: usize>(
&mut self,
start: (usize, usize),
steps: (usize, usize)
) -> Matrix<T, Const<RSLICE>, Const<CSLICE>, SliceStorageMut<'_, T, Const<RSLICE>, Const<CSLICE>, Dynamic, Dynamic>>
Slices this matrix starting at its component (start.0, start.1)
and with
(RSLICE, CSLICE)
components. Each row (resp. column) of the sliced
matrix is separated by steps.0
(resp. steps.1
) ignored rows (resp. columns) of
the original matrix.
sourcepub fn generic_slice_mut<RSlice, CSlice>(
&mut self,
start: (usize, usize),
shape: (RSlice, CSlice)
) -> Matrix<T, RSlice, CSlice, SliceStorageMut<'_, T, RSlice, CSlice, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RSlice: Dim,
CSlice: Dim,
pub fn generic_slice_mut<RSlice, CSlice>(
&mut self,
start: (usize, usize),
shape: (RSlice, CSlice)
) -> Matrix<T, RSlice, CSlice, SliceStorageMut<'_, T, RSlice, CSlice, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RSlice: Dim,
CSlice: Dim,
Creates a slice that may or may not have a fixed size and stride.
sourcepub fn generic_slice_with_steps_mut<RSlice, CSlice>(
&mut self,
start: (usize, usize),
shape: (RSlice, CSlice),
steps: (usize, usize)
) -> Matrix<T, RSlice, CSlice, SliceStorageMut<'_, T, RSlice, CSlice, Dynamic, Dynamic>> where
RSlice: Dim,
CSlice: Dim,
pub fn generic_slice_with_steps_mut<RSlice, CSlice>(
&mut self,
start: (usize, usize),
shape: (RSlice, CSlice),
steps: (usize, usize)
) -> Matrix<T, RSlice, CSlice, SliceStorageMut<'_, T, RSlice, CSlice, Dynamic, Dynamic>> where
RSlice: Dim,
CSlice: Dim,
Creates a slice that may or may not have a fixed size and stride.
sourcepub fn rows_range_pair_mut<Range1, Range2>(
&mut self,
r1: Range1,
r2: Range2
) -> (Matrix<T, <Range1 as SliceRange<R>>::Size, C, SliceStorageMut<'_, T, <Range1 as SliceRange<R>>::Size, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>, Matrix<T, <Range2 as SliceRange<R>>::Size, C, SliceStorageMut<'_, T, <Range2 as SliceRange<R>>::Size, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>) where
Range1: SliceRange<R>,
Range2: SliceRange<R>,
pub fn rows_range_pair_mut<Range1, Range2>(
&mut self,
r1: Range1,
r2: Range2
) -> (Matrix<T, <Range1 as SliceRange<R>>::Size, C, SliceStorageMut<'_, T, <Range1 as SliceRange<R>>::Size, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>, Matrix<T, <Range2 as SliceRange<R>>::Size, C, SliceStorageMut<'_, T, <Range2 as SliceRange<R>>::Size, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>) where
Range1: SliceRange<R>,
Range2: SliceRange<R>,
Splits this NxM
matrix into two parts delimited by two ranges.
Panics if the ranges overlap or if the first range is empty.
sourcepub fn columns_range_pair_mut<Range1, Range2>(
&mut self,
r1: Range1,
r2: Range2
) -> (Matrix<T, R, <Range1 as SliceRange<C>>::Size, SliceStorageMut<'_, T, R, <Range1 as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>, Matrix<T, R, <Range2 as SliceRange<C>>::Size, SliceStorageMut<'_, T, R, <Range2 as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>) where
Range1: SliceRange<C>,
Range2: SliceRange<C>,
pub fn columns_range_pair_mut<Range1, Range2>(
&mut self,
r1: Range1,
r2: Range2
) -> (Matrix<T, R, <Range1 as SliceRange<C>>::Size, SliceStorageMut<'_, T, R, <Range1 as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>, Matrix<T, R, <Range2 as SliceRange<C>>::Size, SliceStorageMut<'_, T, R, <Range2 as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>) where
Range1: SliceRange<C>,
Range2: SliceRange<C>,
Splits this NxM
matrix into two parts delimited by two ranges.
Panics if the ranges overlap or if the first range is empty.
sourcepub fn slice_range<RowRange, ColRange>(
&self,
rows: RowRange,
cols: ColRange
) -> Matrix<T, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, SliceStorage<'_, T, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RowRange: SliceRange<R>,
ColRange: SliceRange<C>,
pub fn slice_range<RowRange, ColRange>(
&self,
rows: RowRange,
cols: ColRange
) -> Matrix<T, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, SliceStorage<'_, T, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RowRange: SliceRange<R>,
ColRange: SliceRange<C>,
Slices a sub-matrix containing the rows indexed by the range rows
and the columns indexed
by the range cols
.
sourcepub fn rows_range<RowRange>(
&self,
rows: RowRange
) -> Matrix<T, <RowRange as SliceRange<R>>::Size, C, SliceStorage<'_, T, <RowRange as SliceRange<R>>::Size, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RowRange: SliceRange<R>,
pub fn rows_range<RowRange>(
&self,
rows: RowRange
) -> Matrix<T, <RowRange as SliceRange<R>>::Size, C, SliceStorage<'_, T, <RowRange as SliceRange<R>>::Size, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RowRange: SliceRange<R>,
Slice containing all the rows indexed by the range rows
.
sourcepub fn columns_range<ColRange>(
&self,
cols: ColRange
) -> Matrix<T, R, <ColRange as SliceRange<C>>::Size, SliceStorage<'_, T, R, <ColRange as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
ColRange: SliceRange<C>,
pub fn columns_range<ColRange>(
&self,
cols: ColRange
) -> Matrix<T, R, <ColRange as SliceRange<C>>::Size, SliceStorage<'_, T, R, <ColRange as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
ColRange: SliceRange<C>,
Slice containing all the columns indexed by the range rows
.
sourcepub fn slice_range_mut<RowRange, ColRange>(
&mut self,
rows: RowRange,
cols: ColRange
) -> Matrix<T, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, SliceStorageMut<'_, T, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RowRange: SliceRange<R>,
ColRange: SliceRange<C>,
pub fn slice_range_mut<RowRange, ColRange>(
&mut self,
rows: RowRange,
cols: ColRange
) -> Matrix<T, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, SliceStorageMut<'_, T, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RowRange: SliceRange<R>,
ColRange: SliceRange<C>,
Slices a mutable sub-matrix containing the rows indexed by the range rows
and the columns
indexed by the range cols
.
sourcepub fn rows_range_mut<RowRange>(
&mut self,
rows: RowRange
) -> Matrix<T, <RowRange as SliceRange<R>>::Size, C, SliceStorageMut<'_, T, <RowRange as SliceRange<R>>::Size, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RowRange: SliceRange<R>,
pub fn rows_range_mut<RowRange>(
&mut self,
rows: RowRange
) -> Matrix<T, <RowRange as SliceRange<R>>::Size, C, SliceStorageMut<'_, T, <RowRange as SliceRange<R>>::Size, C, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
RowRange: SliceRange<R>,
Slice containing all the rows indexed by the range rows
.
sourcepub fn columns_range_mut<ColRange>(
&mut self,
cols: ColRange
) -> Matrix<T, R, <ColRange as SliceRange<C>>::Size, SliceStorageMut<'_, T, R, <ColRange as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
ColRange: SliceRange<C>,
pub fn columns_range_mut<ColRange>(
&mut self,
cols: ColRange
) -> Matrix<T, R, <ColRange as SliceRange<C>>::Size, SliceStorageMut<'_, T, R, <ColRange as SliceRange<C>>::Size, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>> where
ColRange: SliceRange<C>,
Slice containing all the columns indexed by the range cols
.
sourcepub fn norm_squared(&self) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
pub fn norm_squared(&self) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
The squared L2 norm of this vector.
sourcepub fn norm(&self) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
pub fn norm(&self) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
The L2 norm of this matrix.
Use .apply_norm
to apply a custom norm.
sourcepub fn metric_distance<R2, C2, S2>(
&self,
rhs: &Matrix<T, R2, C2, S2>
) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
pub fn metric_distance<R2, C2, S2>(
&self,
rhs: &Matrix<T, R2, C2, S2>
) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
Compute the distance between self
and rhs
using the metric induced by the euclidean norm.
Use .apply_metric_distance
to apply a custom norm.
sourcepub fn apply_norm(
&self,
norm: &impl Norm<T>
) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
pub fn apply_norm(
&self,
norm: &impl Norm<T>
) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
Uses the given norm
to compute the norm of self
.
Example
let v = Vector3::new(1.0, 2.0, 3.0);
assert_eq!(v.apply_norm(&UniformNorm), 3.0);
assert_eq!(v.apply_norm(&LpNorm(1)), 6.0);
assert_eq!(v.apply_norm(&EuclideanNorm), v.norm());
sourcepub fn apply_metric_distance<R2, C2, S2>(
&self,
rhs: &Matrix<T, R2, C2, S2>,
norm: &impl Norm<T>
) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
pub fn apply_metric_distance<R2, C2, S2>(
&self,
rhs: &Matrix<T, R2, C2, S2>,
norm: &impl Norm<T>
) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
Uses the metric induced by the given norm
to compute the metric distance between self
and rhs
.
Example
let v1 = Vector3::new(1.0, 2.0, 3.0);
let v2 = Vector3::new(10.0, 20.0, 30.0);
assert_eq!(v1.apply_metric_distance(&v2, &UniformNorm), 27.0);
assert_eq!(v1.apply_metric_distance(&v2, &LpNorm(1)), 27.0 + 18.0 + 9.0);
assert_eq!(v1.apply_metric_distance(&v2, &EuclideanNorm), (v1 - v2).norm());
sourcepub fn magnitude(&self) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
pub fn magnitude(&self) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
A synonym for the norm of this matrix.
Aka the length.
This function is simply implemented as a call to norm()
sourcepub fn magnitude_squared(&self) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
pub fn magnitude_squared(&self) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
A synonym for the squared norm of this matrix.
Aka the squared length.
This function is simply implemented as a call to norm_squared()
sourcepub fn set_magnitude(
&mut self,
magnitude: <T as SimdComplexField>::SimdRealField
) where
T: SimdComplexField,
S: StorageMut<T, R, C>,
pub fn set_magnitude(
&mut self,
magnitude: <T as SimdComplexField>::SimdRealField
) where
T: SimdComplexField,
S: StorageMut<T, R, C>,
Sets the magnitude of this vector.
sourcepub fn normalize(
&self
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
T: SimdComplexField,
DefaultAllocator: Allocator<T, R, C>,
pub fn normalize(
&self
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
T: SimdComplexField,
DefaultAllocator: Allocator<T, R, C>,
Returns a normalized version of this matrix.
sourcepub fn lp_norm(&self, p: i32) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
pub fn lp_norm(&self, p: i32) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
The Lp norm of this matrix.
sourcepub fn simd_try_normalize(
&self,
min_norm: <T as SimdComplexField>::SimdRealField
) -> SimdOption<Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer>> where
T: SimdComplexField,
<T as SimdValue>::Element: Scalar,
DefaultAllocator: Allocator<T, R, C>,
DefaultAllocator: Allocator<<T as SimdValue>::Element, R, C>,
pub fn simd_try_normalize(
&self,
min_norm: <T as SimdComplexField>::SimdRealField
) -> SimdOption<Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer>> where
T: SimdComplexField,
<T as SimdValue>::Element: Scalar,
DefaultAllocator: Allocator<T, R, C>,
DefaultAllocator: Allocator<<T as SimdValue>::Element, R, C>,
Attempts to normalize self
.
The components of this matrix can be SIMD types.
sourcepub fn try_set_magnitude(
&mut self,
magnitude: <T as ComplexField>::RealField,
min_magnitude: <T as ComplexField>::RealField
) where
T: ComplexField,
S: StorageMut<T, R, C>,
pub fn try_set_magnitude(
&mut self,
magnitude: <T as ComplexField>::RealField,
min_magnitude: <T as ComplexField>::RealField
) where
T: ComplexField,
S: StorageMut<T, R, C>,
Sets the magnitude of this vector unless it is smaller than min_magnitude
.
If self.magnitude()
is smaller than min_magnitude
, it will be left unchanged.
Otherwise this is equivalent to: `*self = self.normalize() * magnitude.
sourcepub fn cap_magnitude(
&self,
max: <T as ComplexField>::RealField
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
T: ComplexField,
DefaultAllocator: Allocator<T, R, C>,
pub fn cap_magnitude(
&self,
max: <T as ComplexField>::RealField
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
T: ComplexField,
DefaultAllocator: Allocator<T, R, C>,
Returns a new vector with the same magnitude as self
clamped between 0.0
and max
.
sourcepub fn simd_cap_magnitude(
&self,
max: <T as SimdComplexField>::SimdRealField
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
T: SimdComplexField,
<T as SimdValue>::Element: Scalar,
DefaultAllocator: Allocator<T, R, C>,
DefaultAllocator: Allocator<<T as SimdValue>::Element, R, C>,
pub fn simd_cap_magnitude(
&self,
max: <T as SimdComplexField>::SimdRealField
) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
T: SimdComplexField,
<T as SimdValue>::Element: Scalar,
DefaultAllocator: Allocator<T, R, C>,
DefaultAllocator: Allocator<<T as SimdValue>::Element, R, C>,
Returns a new vector with the same magnitude as self
clamped between 0.0
and max
.
sourcepub fn try_normalize(
&self,
min_norm: <T as ComplexField>::RealField
) -> Option<Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer>> where
T: ComplexField,
DefaultAllocator: Allocator<T, R, C>,
pub fn try_normalize(
&self,
min_norm: <T as ComplexField>::RealField
) -> Option<Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer>> where
T: ComplexField,
DefaultAllocator: Allocator<T, R, C>,
Returns a normalized version of this matrix unless its norm as smaller or equal to eps
.
The components of this matrix cannot be SIMD types (see simd_try_normalize
) instead.
sourcepub fn normalize_mut(&mut self) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
pub fn normalize_mut(&mut self) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
Normalizes this matrix in-place and returns its norm.
The components of the matrix cannot be SIMD types (see simd_try_normalize_mut
instead).
sourcepub fn simd_try_normalize_mut(
&mut self,
min_norm: <T as SimdComplexField>::SimdRealField
) -> SimdOption<<T as SimdComplexField>::SimdRealField> where
T: SimdComplexField,
<T as SimdValue>::Element: Scalar,
DefaultAllocator: Allocator<T, R, C>,
DefaultAllocator: Allocator<<T as SimdValue>::Element, R, C>,
pub fn simd_try_normalize_mut(
&mut self,
min_norm: <T as SimdComplexField>::SimdRealField
) -> SimdOption<<T as SimdComplexField>::SimdRealField> where
T: SimdComplexField,
<T as SimdValue>::Element: Scalar,
DefaultAllocator: Allocator<T, R, C>,
DefaultAllocator: Allocator<<T as SimdValue>::Element, R, C>,
Normalizes this matrix in-place and return its norm.
The components of the matrix can be SIMD types.
sourcepub fn try_normalize_mut(
&mut self,
min_norm: <T as ComplexField>::RealField
) -> Option<<T as ComplexField>::RealField> where
T: ComplexField,
pub fn try_normalize_mut(
&mut self,
min_norm: <T as ComplexField>::RealField
) -> Option<<T as ComplexField>::RealField> where
T: ComplexField,
Normalizes this matrix in-place or does nothing if its norm is smaller or equal to eps
.
If the normalization succeeded, returns the old norm of this matrix.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
The total number of elements of this matrix.
Examples:
let mat = Matrix3x4::<f32>::zeros();
assert_eq!(mat.len(), 12);
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the matrix contains no elements.
Examples:
let mat = Matrix3x4::<f32>::zeros();
assert!(!mat.is_empty());
sourcepub fn is_identity(&self, eps: <T as AbsDiffEq<T>>::Epsilon) -> bool where
T: Zero + One + RelativeEq<T>,
<T as AbsDiffEq<T>>::Epsilon: Clone,
pub fn is_identity(&self, eps: <T as AbsDiffEq<T>>::Epsilon) -> bool where
T: Zero + One + RelativeEq<T>,
<T as AbsDiffEq<T>>::Epsilon: Clone,
Indicated if this is the identity matrix within a relative error of eps
.
If the matrix is diagonal, this checks that diagonal elements (i.e. at coordinates (i, i)
for i from 0
to min(R, C)
) are equal one; and that all other elements are zero.
sourcepub fn is_orthogonal(&self, eps: <T as AbsDiffEq<T>>::Epsilon) -> bool where
T: Zero + One + ClosedAdd<T> + ClosedMul<T> + RelativeEq<T>,
S: Storage<T, R, C>,
<T as AbsDiffEq<T>>::Epsilon: Clone,
DefaultAllocator: Allocator<T, R, C>,
DefaultAllocator: Allocator<T, C, C>,
pub fn is_orthogonal(&self, eps: <T as AbsDiffEq<T>>::Epsilon) -> bool where
T: Zero + One + ClosedAdd<T> + ClosedMul<T> + RelativeEq<T>,
S: Storage<T, R, C>,
<T as AbsDiffEq<T>>::Epsilon: Clone,
DefaultAllocator: Allocator<T, R, C>,
DefaultAllocator: Allocator<T, C, C>,
Checks that Mᵀ × M = Id
.
In this definition Id
is approximately equal to the identity matrix with a relative error
equal to eps
.
sourcepub fn is_special_orthogonal(&self, eps: T) -> bool where
D: DimMin<D, Output = D>,
DefaultAllocator: Allocator<(usize, usize), D, Const<1_usize>>,
pub fn is_special_orthogonal(&self, eps: T) -> bool where
D: DimMin<D, Output = D>,
DefaultAllocator: Allocator<(usize, usize), D, Const<1_usize>>,
Checks that this matrix is orthogonal and has a determinant equal to 1.
sourcepub fn is_invertible(&self) -> bool
pub fn is_invertible(&self) -> bool
Returns true
if this matrix is invertible.
sourcepub fn compress_rows(
&self,
f: impl Fn(Matrix<T, R, Const<1_usize>, SliceStorage<'_, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>) -> T
) -> Matrix<T, Const<1_usize>, C, <DefaultAllocator as Allocator<T, Const<1_usize>, C>>::Buffer> where
DefaultAllocator: Allocator<T, Const<1_usize>, C>,
pub fn compress_rows(
&self,
f: impl Fn(Matrix<T, R, Const<1_usize>, SliceStorage<'_, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>) -> T
) -> Matrix<T, Const<1_usize>, C, <DefaultAllocator as Allocator<T, Const<1_usize>, C>>::Buffer> where
DefaultAllocator: Allocator<T, Const<1_usize>, C>,
Returns a row vector where each element is the result of the application of f
on the
corresponding column of the original matrix.
sourcepub fn compress_rows_tr(
&self,
f: impl Fn(Matrix<T, R, Const<1_usize>, SliceStorage<'_, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>) -> T
) -> Matrix<T, C, Const<1_usize>, <DefaultAllocator as Allocator<T, C, Const<1_usize>>>::Buffer> where
DefaultAllocator: Allocator<T, C, Const<1_usize>>,
pub fn compress_rows_tr(
&self,
f: impl Fn(Matrix<T, R, Const<1_usize>, SliceStorage<'_, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>) -> T
) -> Matrix<T, C, Const<1_usize>, <DefaultAllocator as Allocator<T, C, Const<1_usize>>>::Buffer> where
DefaultAllocator: Allocator<T, C, Const<1_usize>>,
Returns a column vector where each element is the result of the application of f
on the
corresponding column of the original matrix.
This is the same as self.compress_rows(f).transpose()
.
sourcepub fn compress_columns(
&self,
init: Matrix<T, R, Const<1_usize>, <DefaultAllocator as Allocator<T, R, Const<1_usize>>>::Buffer>,
f: impl Fn(&mut Matrix<T, R, Const<1_usize>, <DefaultAllocator as Allocator<T, R, Const<1_usize>>>::Buffer>, Matrix<T, R, Const<1_usize>, SliceStorage<'_, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>)
) -> Matrix<T, R, Const<1_usize>, <DefaultAllocator as Allocator<T, R, Const<1_usize>>>::Buffer> where
DefaultAllocator: Allocator<T, R, Const<1_usize>>,
pub fn compress_columns(
&self,
init: Matrix<T, R, Const<1_usize>, <DefaultAllocator as Allocator<T, R, Const<1_usize>>>::Buffer>,
f: impl Fn(&mut Matrix<T, R, Const<1_usize>, <DefaultAllocator as Allocator<T, R, Const<1_usize>>>::Buffer>, Matrix<T, R, Const<1_usize>, SliceStorage<'_, T, R, Const<1_usize>, <S as RawStorage<T, R, C>>::RStride, <S as RawStorage<T, R, C>>::CStride>>)
) -> Matrix<T, R, Const<1_usize>, <DefaultAllocator as Allocator<T, R, Const<1_usize>>>::Buffer> where
DefaultAllocator: Allocator<T, R, Const<1_usize>>,
Returns a column vector resulting from the folding of f
on each column of this matrix.
sourcepub fn sum(&self) -> T where
T: ClosedAdd<T> + Zero,
pub fn sum(&self) -> T where
T: ClosedAdd<T> + Zero,
The sum of all the elements of this matrix.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.sum(), 21.0);
sourcepub fn row_sum(
&self
) -> Matrix<T, Const<1_usize>, C, <DefaultAllocator as Allocator<T, Const<1_usize>, C>>::Buffer> where
T: ClosedAdd<T> + Zero,
DefaultAllocator: Allocator<T, Const<1_usize>, C>,
pub fn row_sum(
&self
) -> Matrix<T, Const<1_usize>, C, <DefaultAllocator as Allocator<T, Const<1_usize>, C>>::Buffer> where
T: ClosedAdd<T> + Zero,
DefaultAllocator: Allocator<T, Const<1_usize>, C>,
The sum of all the rows of this matrix.
Use .row_sum_tr
if you need the result in a column vector instead.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.row_sum(), RowVector3::new(5.0, 7.0, 9.0));
let mint = Matrix3x2::new(1, 2,
3, 4,
5, 6);
assert_eq!(mint.row_sum(), RowVector2::new(9,12));
sourcepub fn row_sum_tr(
&self
) -> Matrix<T, C, Const<1_usize>, <DefaultAllocator as Allocator<T, C, Const<1_usize>>>::Buffer> where
T: ClosedAdd<T> + Zero,
DefaultAllocator: Allocator<T, C, Const<1_usize>>,
pub fn row_sum_tr(
&self
) -> Matrix<T, C, Const<1_usize>, <DefaultAllocator as Allocator<T, C, Const<1_usize>>>::Buffer> where
T: ClosedAdd<T> + Zero,
DefaultAllocator: Allocator<T, C, Const<1_usize>>,
The sum of all the rows of this matrix. The result is transposed and returned as a column vector.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.row_sum_tr(), Vector3::new(5.0, 7.0, 9.0));
let mint = Matrix3x2::new(1, 2,
3, 4,
5, 6);
assert_eq!(mint.row_sum_tr(), Vector2::new(9, 12));
sourcepub fn column_sum(
&self
) -> Matrix<T, R, Const<1_usize>, <DefaultAllocator as Allocator<T, R, Const<1_usize>>>::Buffer> where
T: ClosedAdd<T> + Zero,
DefaultAllocator: Allocator<T, R, Const<1_usize>>,
pub fn column_sum(
&self
) -> Matrix<T, R, Const<1_usize>, <DefaultAllocator as Allocator<T, R, Const<1_usize>>>::Buffer> where
T: ClosedAdd<T> + Zero,
DefaultAllocator: Allocator<T, R, Const<1_usize>>,
The sum of all the columns of this matrix.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.column_sum(), Vector2::new(6.0, 15.0));
let mint = Matrix3x2::new(1, 2,
3, 4,
5, 6);
assert_eq!(mint.column_sum(), Vector3::new(3, 7, 11));
sourcepub fn product(&self) -> T where
T: ClosedMul<T> + One,
pub fn product(&self) -> T where
T: ClosedMul<T> + One,
The product of all the elements of this matrix.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.product(), 720.0);
sourcepub fn row_product(
&self
) -> Matrix<T, Const<1_usize>, C, <DefaultAllocator as Allocator<T, Const<1_usize>, C>>::Buffer> where
T: ClosedMul<T> + One,
DefaultAllocator: Allocator<T, Const<1_usize>, C>,
pub fn row_product(
&self
) -> Matrix<T, Const<1_usize>, C, <DefaultAllocator as Allocator<T, Const<1_usize>, C>>::Buffer> where
T: ClosedMul<T> + One,
DefaultAllocator: Allocator<T, Const<1_usize>, C>,
The product of all the rows of this matrix.
Use .row_sum_tr
if you need the result in a column vector instead.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.row_product(), RowVector3::new(4.0, 10.0, 18.0));
let mint = Matrix3x2::new(1, 2,
3, 4,
5, 6);
assert_eq!(mint.row_product(), RowVector2::new(15, 48));
sourcepub fn row_product_tr(
&self
) -> Matrix<T, C, Const<1_usize>, <DefaultAllocator as Allocator<T, C, Const<1_usize>>>::Buffer> where
T: ClosedMul<T> + One,
DefaultAllocator: Allocator<T, C, Const<1_usize>>,
pub fn row_product_tr(
&self
) -> Matrix<T, C, Const<1_usize>, <DefaultAllocator as Allocator<T, C, Const<1_usize>>>::Buffer> where
T: ClosedMul<T> + One,
DefaultAllocator: Allocator<T, C, Const<1_usize>>,
The product of all the rows of this matrix. The result is transposed and returned as a column vector.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.row_product_tr(), Vector3::new(4.0, 10.0, 18.0));
let mint = Matrix3x2::new(1, 2,
3, 4,
5, 6);
assert_eq!(mint.row_product_tr(), Vector2::new(15, 48));
sourcepub fn column_product(
&self
) -> Matrix<T, R, Const<1_usize>, <DefaultAllocator as Allocator<T, R, Const<1_usize>>>::Buffer> where
T: ClosedMul<T> + One,
DefaultAllocator: Allocator<T, R, Const<1_usize>>,
pub fn column_product(
&self
) -> Matrix<T, R, Const<1_usize>, <DefaultAllocator as Allocator<T, R, Const<1_usize>>>::Buffer> where
T: ClosedMul<T> + One,
DefaultAllocator: Allocator<T, R, Const<1_usize>>,
The product of all the columns of this matrix.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.column_product(), Vector2::new(6.0, 120.0));
let mint = Matrix3x2::new(1, 2,
3, 4,
5, 6);
assert_eq!(mint.column_product(), Vector3::new(2, 12, 30));
sourcepub fn variance(&self) -> T where
T: Field + SupersetOf<f64>,
pub fn variance(&self) -> T where
T: Field + SupersetOf<f64>,
The variance of all the elements of this matrix.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_relative_eq!(m.variance(), 35.0 / 12.0, epsilon = 1.0e-8);
sourcepub fn row_variance(
&self
) -> Matrix<T, Const<1_usize>, C, <DefaultAllocator as Allocator<T, Const<1_usize>, C>>::Buffer> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, Const<1_usize>, C>,
pub fn row_variance(
&self
) -> Matrix<T, Const<1_usize>, C, <DefaultAllocator as Allocator<T, Const<1_usize>, C>>::Buffer> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, Const<1_usize>, C>,
The variance of all the rows of this matrix.
Use .row_variance_tr
if you need the result in a column vector instead.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.row_variance(), RowVector3::new(2.25, 2.25, 2.25));
sourcepub fn row_variance_tr(
&self
) -> Matrix<T, C, Const<1_usize>, <DefaultAllocator as Allocator<T, C, Const<1_usize>>>::Buffer> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, C, Const<1_usize>>,
pub fn row_variance_tr(
&self
) -> Matrix<T, C, Const<1_usize>, <DefaultAllocator as Allocator<T, C, Const<1_usize>>>::Buffer> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, C, Const<1_usize>>,
The variance of all the rows of this matrix. The result is transposed and returned as a column vector.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.row_variance_tr(), Vector3::new(2.25, 2.25, 2.25));
sourcepub fn column_variance(
&self
) -> Matrix<T, R, Const<1_usize>, <DefaultAllocator as Allocator<T, R, Const<1_usize>>>::Buffer> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, R, Const<1_usize>>,
pub fn column_variance(
&self
) -> Matrix<T, R, Const<1_usize>, <DefaultAllocator as Allocator<T, R, Const<1_usize>>>::Buffer> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, R, Const<1_usize>>,
The variance of all the columns of this matrix.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_relative_eq!(m.column_variance(), Vector2::new(2.0 / 3.0, 2.0 / 3.0), epsilon = 1.0e-8);
sourcepub fn mean(&self) -> T where
T: Field + SupersetOf<f64>,
pub fn mean(&self) -> T where
T: Field + SupersetOf<f64>,
The mean of all the elements of this matrix.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.mean(), 3.5);
sourcepub fn row_mean(
&self
) -> Matrix<T, Const<1_usize>, C, <DefaultAllocator as Allocator<T, Const<1_usize>, C>>::Buffer> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, Const<1_usize>, C>,
pub fn row_mean(
&self
) -> Matrix<T, Const<1_usize>, C, <DefaultAllocator as Allocator<T, Const<1_usize>, C>>::Buffer> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, Const<1_usize>, C>,
The mean of all the rows of this matrix.
Use .row_mean_tr
if you need the result in a column vector instead.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.row_mean(), RowVector3::new(2.5, 3.5, 4.5));
sourcepub fn row_mean_tr(
&self
) -> Matrix<T, C, Const<1_usize>, <DefaultAllocator as Allocator<T, C, Const<1_usize>>>::Buffer> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, C, Const<1_usize>>,
pub fn row_mean_tr(
&self
) -> Matrix<T, C, Const<1_usize>, <DefaultAllocator as Allocator<T, C, Const<1_usize>>>::Buffer> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, C, Const<1_usize>>,
The mean of all the rows of this matrix. The result is transposed and returned as a column vector.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.row_mean_tr(), Vector3::new(2.5, 3.5, 4.5));
sourcepub fn column_mean(
&self
) -> Matrix<T, R, Const<1_usize>, <DefaultAllocator as Allocator<T, R, Const<1_usize>>>::Buffer> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, R, Const<1_usize>>,
pub fn column_mean(
&self
) -> Matrix<T, R, Const<1_usize>, <DefaultAllocator as Allocator<T, R, Const<1_usize>>>::Buffer> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, R, Const<1_usize>>,
The mean of all the columns of this matrix.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.column_mean(), Vector2::new(2.0, 5.0));
sourcepub fn xx(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UTerm>,
<<D as ToTypenum>::Typenum as Cmp<UTerm>>::Output == Greater,
pub fn xx(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UTerm>,
<<D as ToTypenum>::Typenum as Cmp<UTerm>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn xxx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UTerm>,
<<D as ToTypenum>::Typenum as Cmp<UTerm>>::Output == Greater,
pub fn xxx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UTerm>,
<<D as ToTypenum>::Typenum as Cmp<UTerm>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn xy(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
pub fn xy(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn yx(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
pub fn yx(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn yy(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
pub fn yy(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn xxy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
pub fn xxy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn xyx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
pub fn xyx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn xyy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
pub fn xyy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn yxx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
pub fn yxx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn yxy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
pub fn yxy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn yyx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
pub fn yyx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn yyy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
pub fn yyy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UTerm, B1>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UTerm, B1>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn xz(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn xz(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn yz(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn yz(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn zx(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn zx(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn zy(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn zy(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn zz(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn zz(
&self
) -> Matrix<T, Const<2_usize>, Const<1_usize>, ArrayStorage<T, 2_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn xxz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn xxz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn xyz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn xyz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn xzx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn xzx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn xzy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn xzy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn xzz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn xzz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn yxz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn yxz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn yyz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn yyz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn yzx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn yzx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn yzy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn yzy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn yzz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn yzz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn zxx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn zxx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn zxy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn zxy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn zxz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn zxz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn zyx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn zyx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn zyy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn zyy(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn zyz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn zyz(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn zzx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
pub fn zzx(
&self
) -> Matrix<T, Const<3_usize>, Const<1_usize>, ArrayStorage<T, 3_usize, 1_usize>> where
<D as ToTypenum>::Typenum: Cmp<UInt<UInt<UTerm, B1>, B0>>,
<<D as ToTypenum>::Typenum as Cmp<UInt<UInt<UTerm, B1>, B0>>>::Output == Greater,
Builds a new vector from components of self
.
sourcepub fn lerp<S2>(
&self,
rhs: &Matrix<T, D, Const<1_usize>, S2>,
t: T
) -> Matrix<T, D, Const<1_usize>, <DefaultAllocator as Allocator<T, D, Const<1_usize>>>::Buffer> where
S2: Storage<T, D, Const<1_usize>>,
DefaultAllocator: Allocator<T, D, Const<1_usize>>,
pub fn lerp<S2>(
&self,
rhs: &Matrix<T, D, Const<1_usize>, S2>,
t: T
) -> Matrix<T, D, Const<1_usize>, <DefaultAllocator as Allocator<T, D, Const<1_usize>>>::Buffer> where
S2: Storage<T, D, Const<1_usize>>,
DefaultAllocator: Allocator<T, D, Const<1_usize>>,
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));
sourcepub fn slerp<S2>(
&self,
rhs: &Matrix<T, D, Const<1_usize>, S2>,
t: T
) -> Matrix<T, D, Const<1_usize>, <DefaultAllocator as Allocator<T, D, Const<1_usize>>>::Buffer> where
S2: Storage<T, D, Const<1_usize>>,
T: RealField,
DefaultAllocator: Allocator<T, D, Const<1_usize>>,
pub fn slerp<S2>(
&self,
rhs: &Matrix<T, D, Const<1_usize>, S2>,
t: T
) -> Matrix<T, D, Const<1_usize>, <DefaultAllocator as Allocator<T, D, Const<1_usize>>>::Buffer> where
S2: Storage<T, D, Const<1_usize>>,
T: RealField,
DefaultAllocator: Allocator<T, D, Const<1_usize>>,
Computes the spherical linear interpolation between two non-zero vectors.
The result is a unit vector.
Examples:
let v1 =Vector2::new(1.0, 2.0);
let v2 = Vector2::new(2.0, -3.0);
let v = v1.slerp(&v2, 1.0);
assert_eq!(v, v2.normalize());
sourcepub fn amax(&self) -> T where
T: Zero + SimdSigned + SimdPartialOrd,
pub fn amax(&self) -> T where
T: Zero + SimdSigned + SimdPartialOrd,
Returns the absolute value of the component with the largest absolute value.
Example
assert_eq!(Vector3::new(-1.0, 2.0, 3.0).amax(), 3.0);
assert_eq!(Vector3::new(-1.0, -2.0, -3.0).amax(), 3.0);
sourcepub fn camax(&self) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
pub fn camax(&self) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
Returns the the 1-norm of the complex component with the largest 1-norm.
Example
assert_eq!(Vector3::new(
Complex::new(-3.0, -2.0),
Complex::new(1.0, 2.0),
Complex::new(1.0, 3.0)).camax(), 5.0);
sourcepub fn max(&self) -> T where
T: SimdPartialOrd + Zero,
pub fn max(&self) -> T where
T: SimdPartialOrd + Zero,
Returns the component with the largest value.
Example
assert_eq!(Vector3::new(-1.0, 2.0, 3.0).max(), 3.0);
assert_eq!(Vector3::new(-1.0, -2.0, -3.0).max(), -1.0);
assert_eq!(Vector3::new(5u32, 2, 3).max(), 5);
sourcepub fn amin(&self) -> T where
T: Zero + SimdPartialOrd + SimdSigned,
pub fn amin(&self) -> T where
T: Zero + SimdPartialOrd + SimdSigned,
Returns the absolute value of the component with the smallest absolute value.
Example
assert_eq!(Vector3::new(-1.0, 2.0, -3.0).amin(), 1.0);
assert_eq!(Vector3::new(10.0, 2.0, 30.0).amin(), 2.0);
sourcepub fn camin(&self) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
pub fn camin(&self) -> <T as SimdComplexField>::SimdRealField where
T: SimdComplexField,
Returns the the 1-norm of the complex component with the smallest 1-norm.
Example
assert_eq!(Vector3::new(
Complex::new(-3.0, -2.0),
Complex::new(1.0, 2.0),
Complex::new(1.0, 3.0)).camin(), 3.0);
sourcepub fn min(&self) -> T where
T: SimdPartialOrd + Zero,
pub fn min(&self) -> T where
T: SimdPartialOrd + Zero,
Returns the component with the smallest value.
Example
assert_eq!(Vector3::new(-1.0, 2.0, 3.0).min(), -1.0);
assert_eq!(Vector3::new(1.0, 2.0, 3.0).min(), 1.0);
assert_eq!(Vector3::new(5u32, 2, 3).min(), 2);
sourcepub fn icamax_full(&self) -> (usize, usize) where
T: ComplexField,
pub fn icamax_full(&self) -> (usize, usize) where
T: ComplexField,
Computes the index of the matrix component with the largest absolute value.
Examples:
let mat = Matrix2x3::new(Complex::new(11.0, 1.0), Complex::new(-12.0, 2.0), Complex::new(13.0, 3.0),
Complex::new(21.0, 43.0), Complex::new(22.0, 5.0), Complex::new(-23.0, 0.0));
assert_eq!(mat.icamax_full(), (1, 0));
sourcepub fn iamax_full(&self) -> (usize, usize)
pub fn iamax_full(&self) -> (usize, usize)
Computes the index of the matrix component with the largest absolute value.
Examples:
let mat = Matrix2x3::new(11, -12, 13,
21, 22, -23);
assert_eq!(mat.iamax_full(), (1, 2));
sourcepub fn icamax(&self) -> usize where
T: ComplexField,
pub fn icamax(&self) -> usize where
T: ComplexField,
Computes the index of the vector component with the largest complex or real absolute value.
Examples:
let vec = Vector3::new(Complex::new(11.0, 3.0), Complex::new(-15.0, 0.0), Complex::new(13.0, 5.0));
assert_eq!(vec.icamax(), 2);
sourcepub fn argmax(&self) -> (usize, T) where
T: PartialOrd<T>,
pub fn argmax(&self) -> (usize, T) where
T: PartialOrd<T>,
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));
sourcepub fn imax(&self) -> usize where
T: PartialOrd<T>,
pub fn imax(&self) -> usize where
T: PartialOrd<T>,
Computes the index of the vector component with the largest value.
Examples:
let vec = Vector3::new(11, -15, 13);
assert_eq!(vec.imax(), 2);
sourcepub fn iamax(&self) -> usize where
T: PartialOrd<T> + Signed,
pub fn iamax(&self) -> usize where
T: PartialOrd<T> + 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);
sourcepub fn argmin(&self) -> (usize, T) where
T: PartialOrd<T>,
pub fn argmin(&self) -> (usize, T) where
T: PartialOrd<T>,
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));
sourcepub fn imin(&self) -> usize where
T: PartialOrd<T>,
pub fn imin(&self) -> usize where
T: PartialOrd<T>,
Computes the index of the vector component with the smallest value.
Examples:
let vec = Vector3::new(11, -15, 13);
assert_eq!(vec.imin(), 1);
sourcepub fn convolve_full<D2, S2>(
&self,
kernel: Matrix<T, D2, Const<1_usize>, S2>
) -> Matrix<T, <<D1 as DimAdd<D2>>::Output as DimSub<Const<1_usize>>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<T, <<D1 as DimAdd<D2>>::Output as DimSub<Const<1_usize>>>::Output, Const<1_usize>>>::Buffer> where
D1: DimAdd<D2>,
D2: DimAdd<D1, Output = <D1 as DimAdd<D2>>::Output>,
S2: Storage<T, D2, Const<1_usize>>,
<D1 as DimAdd<D2>>::Output: DimSub<Const<1_usize>>,
DefaultAllocator: Allocator<T, <<D1 as DimAdd<D2>>::Output as DimSub<Const<1_usize>>>::Output, Const<1_usize>>,
pub fn convolve_full<D2, S2>(
&self,
kernel: Matrix<T, D2, Const<1_usize>, S2>
) -> Matrix<T, <<D1 as DimAdd<D2>>::Output as DimSub<Const<1_usize>>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<T, <<D1 as DimAdd<D2>>::Output as DimSub<Const<1_usize>>>::Output, Const<1_usize>>>::Buffer> where
D1: DimAdd<D2>,
D2: DimAdd<D1, Output = <D1 as DimAdd<D2>>::Output>,
S2: Storage<T, D2, Const<1_usize>>,
<D1 as DimAdd<D2>>::Output: DimSub<Const<1_usize>>,
DefaultAllocator: Allocator<T, <<D1 as DimAdd<D2>>::Output as DimSub<Const<1_usize>>>::Output, Const<1_usize>>,
sourcepub fn convolve_valid<D2, S2>(
&self,
kernel: Matrix<T, D2, Const<1_usize>, S2>
) -> Matrix<T, <<D1 as DimAdd<Const<1_usize>>>::Output as DimSub<D2>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<T, <<D1 as DimAdd<Const<1_usize>>>::Output as DimSub<D2>>::Output, Const<1_usize>>>::Buffer> where
D1: DimAdd<Const<1_usize>>,
D2: Dim,
S2: Storage<T, D2, Const<1_usize>>,
<D1 as DimAdd<Const<1_usize>>>::Output: DimSub<D2>,
DefaultAllocator: Allocator<T, <<D1 as DimAdd<Const<1_usize>>>::Output as DimSub<D2>>::Output, Const<1_usize>>,
pub fn convolve_valid<D2, S2>(
&self,
kernel: Matrix<T, D2, Const<1_usize>, S2>
) -> Matrix<T, <<D1 as DimAdd<Const<1_usize>>>::Output as DimSub<D2>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<T, <<D1 as DimAdd<Const<1_usize>>>::Output as DimSub<D2>>::Output, Const<1_usize>>>::Buffer> where
D1: DimAdd<Const<1_usize>>,
D2: Dim,
S2: Storage<T, D2, Const<1_usize>>,
<D1 as DimAdd<Const<1_usize>>>::Output: DimSub<D2>,
DefaultAllocator: Allocator<T, <<D1 as DimAdd<Const<1_usize>>>::Output as DimSub<D2>>::Output, Const<1_usize>>,
sourcepub fn determinant(&self) -> T where
DefaultAllocator: Allocator<T, D, D>,
DefaultAllocator: Allocator<(usize, usize), D, Const<1_usize>>,
pub fn determinant(&self) -> T where
DefaultAllocator: Allocator<T, D, D>,
DefaultAllocator: Allocator<(usize, usize), D, Const<1_usize>>,
Computes the matrix determinant.
If the matrix has a dimension larger than 3, an LU decomposition is used.
sourcepub fn try_inverse_mut(&mut self) -> bool where
DefaultAllocator: Allocator<T, D, D>,
pub fn try_inverse_mut(&mut self) -> bool where
DefaultAllocator: Allocator<T, D, D>,
Attempts to invert this matrix in-place. Returns false
and leaves self
untouched if
inversion fails.
sourcepub fn eigenvalues(
&self
) -> Option<Matrix<T, D, Const<1_usize>, <DefaultAllocator as Allocator<T, D, Const<1_usize>>>::Buffer>>
pub fn eigenvalues(
&self
) -> Option<Matrix<T, D, Const<1_usize>, <DefaultAllocator as Allocator<T, D, Const<1_usize>>>::Buffer>>
Computes the eigenvalues of this matrix.
sourcepub fn complex_eigenvalues(
&self
) -> Matrix<Complex<T>, D, Const<1_usize>, <DefaultAllocator as Allocator<Complex<T>, D, Const<1_usize>>>::Buffer> where
T: RealField,
DefaultAllocator: Allocator<Complex<T>, D, Const<1_usize>>,
pub fn complex_eigenvalues(
&self
) -> Matrix<Complex<T>, D, Const<1_usize>, <DefaultAllocator as Allocator<Complex<T>, D, Const<1_usize>>>::Buffer> where
T: RealField,
DefaultAllocator: Allocator<Complex<T>, D, Const<1_usize>>,
Computes the eigenvalues of this matrix.
sourcepub fn solve_lower_triangular<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_lower_triangular<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self . x = b
where x
is the unknown and only
the lower-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn solve_upper_triangular<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_upper_triangular<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self . x = b
where x
is the unknown and only
the upper-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn solve_lower_triangular_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_lower_triangular_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self . x = b
where x
is the unknown and only the
lower-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn solve_lower_triangular_with_diag_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>,
diag: T
) -> bool where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_lower_triangular_with_diag_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>,
diag: T
) -> bool where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self . x = b
where x
is the unknown and only the
lower-triangular part of self
is considered not-zero. The diagonal is never read as it is
assumed to be equal to diag
. Returns false
and does not modify its inputs if diag
is zero.
sourcepub fn solve_upper_triangular_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_upper_triangular_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self . x = b
where x
is the unknown and only the
upper-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn tr_solve_lower_triangular<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_lower_triangular<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.transpose() . x = b
where x
is the unknown and only
the lower-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn tr_solve_upper_triangular<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_upper_triangular<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.transpose() . x = b
where x
is the unknown and only
the upper-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn tr_solve_lower_triangular_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_lower_triangular_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.transpose() . x = b
where x
is the unknown and only the
lower-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn tr_solve_upper_triangular_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_upper_triangular_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.transpose() . x = b
where x
is the unknown and only the
upper-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn ad_solve_lower_triangular<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_lower_triangular<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.adjoint() . x = b
where x
is the unknown and only
the lower-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn ad_solve_upper_triangular<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_upper_triangular<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.adjoint() . x = b
where x
is the unknown and only
the upper-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn ad_solve_lower_triangular_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_lower_triangular_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.adjoint() . x = b
where x
is the unknown and only the
lower-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn ad_solve_upper_triangular_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_upper_triangular_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.adjoint() . x = b
where x
is the unknown and only the
upper-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn solve_lower_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_lower_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self . x = b
where x
is the unknown and only
the lower-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn solve_upper_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_upper_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self . x = b
where x
is the unknown and only
the upper-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn solve_lower_triangular_unchecked_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_lower_triangular_unchecked_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self . x = b
where x
is the unknown and only the
lower-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn solve_lower_triangular_with_diag_unchecked_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>,
diag: T
) where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_lower_triangular_with_diag_unchecked_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>,
diag: T
) where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self . x = b
where x
is the unknown and only the
lower-triangular part of self
is considered not-zero. The diagonal is never read as it is
assumed to be equal to diag
. Returns false
and does not modify its inputs if diag
is zero.
sourcepub fn solve_upper_triangular_unchecked_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_upper_triangular_unchecked_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self . x = b
where x
is the unknown and only the
upper-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn tr_solve_lower_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_lower_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.transpose() . x = b
where x
is the unknown and only
the lower-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn tr_solve_upper_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_upper_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.transpose() . x = b
where x
is the unknown and only
the upper-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn tr_solve_lower_triangular_unchecked_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_lower_triangular_unchecked_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.transpose() . x = b
where x
is the unknown and only the
lower-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn tr_solve_upper_triangular_unchecked_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_upper_triangular_unchecked_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.transpose() . x = b
where x
is the unknown and only the
upper-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn ad_solve_lower_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_lower_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.adjoint() . x = b
where x
is the unknown and only
the lower-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn ad_solve_upper_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_upper_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer> where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.adjoint() . x = b
where x
is the unknown and only
the upper-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn ad_solve_lower_triangular_unchecked_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_lower_triangular_unchecked_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.adjoint() . x = b
where x
is the unknown and only the
lower-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn ad_solve_upper_triangular_unchecked_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_upper_triangular_unchecked_mut<R2, C2, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.adjoint() . x = b
where x
is the unknown and only the
upper-triangular part of self
(including the diagonal) is considered not-zero.
sourcepub fn singular_values_unordered(
&self
) -> Matrix<<T as ComplexField>::RealField, <R as DimMin<C>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<<T as ComplexField>::RealField, <R as DimMin<C>>::Output, Const<1_usize>>>::Buffer>
pub fn singular_values_unordered(
&self
) -> Matrix<<T as ComplexField>::RealField, <R as DimMin<C>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<<T as ComplexField>::RealField, <R as DimMin<C>>::Output, Const<1_usize>>>::Buffer>
Computes the singular values of this matrix.
The singular values are not guaranteed to be sorted in any particular order.
If a descending order is required, consider using singular_values
instead.
sourcepub fn rank(&self, eps: <T as ComplexField>::RealField) -> usize
pub fn rank(&self, eps: <T as ComplexField>::RealField) -> usize
Computes the rank of this matrix.
All singular values below eps
are considered equal to 0.
sourcepub fn singular_values(
&self
) -> Matrix<<T as ComplexField>::RealField, <R as DimMin<C>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<<T as ComplexField>::RealField, <R as DimMin<C>>::Output, Const<1_usize>>>::Buffer>
pub fn singular_values(
&self
) -> Matrix<<T as ComplexField>::RealField, <R as DimMin<C>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<<T as ComplexField>::RealField, <R as DimMin<C>>::Output, Const<1_usize>>>::Buffer>
Computes the singular values of this matrix.
The singular values are guaranteed to be sorted in descending order.
If this order is not required consider using singular_values_unordered
.
sourcepub fn symmetric_eigenvalues(
&self
) -> Matrix<<T as ComplexField>::RealField, D, Const<1_usize>, <DefaultAllocator as Allocator<<T as ComplexField>::RealField, D, Const<1_usize>>>::Buffer>
pub fn symmetric_eigenvalues(
&self
) -> Matrix<<T as ComplexField>::RealField, D, Const<1_usize>, <DefaultAllocator as Allocator<<T as ComplexField>::RealField, D, Const<1_usize>>>::Buffer>
Computes the eigenvalues of this symmetric matrix.
Only the lower-triangular part of the matrix is read.
Trait Implementations
sourceimpl<Right, Scalar> Add<&Right> for &X2<Scalar> where
Scalar: ScalarInterface + Add<Output = Scalar>,
Right: X2Interface<Scalar = Scalar> + Copy,
impl<Right, Scalar> Add<&Right> for &X2<Scalar> where
Scalar: ScalarInterface + Add<Output = Scalar>,
Right: X2Interface<Scalar = Scalar> + Copy,
sourceimpl<Right, Scalar> Add<Right> for X2<Scalar> where
Scalar: ScalarInterface + Add<Output = Scalar>,
Right: X2Interface<Scalar = Scalar> + Copy,
impl<Right, Scalar> Add<Right> for X2<Scalar> where
Scalar: ScalarInterface + Add<Output = Scalar>,
Right: X2Interface<Scalar = Scalar> + Copy,
sourceimpl<Scalar: Clone + ScalarInterface> Clone for X2<Scalar>
impl<Scalar: Clone + ScalarInterface> Clone for X2<Scalar>
sourceimpl<Scalar> Debug for X2<Scalar> where
Scalar: ScalarInterface,
impl<Scalar> Debug for X2<Scalar> where
Scalar: ScalarInterface,
sourceimpl<Scalar: Default + ScalarInterface> Default for X2<Scalar>
impl<Scalar: Default + ScalarInterface> Default for X2<Scalar>
sourceimpl<Scalar> Deref for X2<Scalar> where
Scalar: ScalarInterface,
impl<Scalar> Deref for X2<Scalar> where
Scalar: ScalarInterface,
sourceimpl<Scalar> DerefMut for X2<Scalar> where
Scalar: ScalarInterface,
impl<Scalar> DerefMut for X2<Scalar> where
Scalar: ScalarInterface,
sourceimpl<Scalar> Display for X2<Scalar> where
Scalar: ScalarInterface,
impl<Scalar> Display for X2<Scalar> where
Scalar: ScalarInterface,
sourceimpl<Scalar: Hash + ScalarInterface> Hash for X2<Scalar>
impl<Scalar: Hash + ScalarInterface> Hash for X2<Scalar>
sourceimpl<Scalar> Neg for &X2<Scalar> where
Scalar: ScalarInterface + Neg<Output = Scalar>,
impl<Scalar> Neg for &X2<Scalar> where
Scalar: ScalarInterface + Neg<Output = Scalar>,
sourceimpl<Scalar> Neg for X2<Scalar> where
Scalar: ScalarInterface + Neg<Output = Scalar>,
impl<Scalar> Neg for X2<Scalar> where
Scalar: ScalarInterface + Neg<Output = Scalar>,
sourceimpl<Right, Scalar> Sub<&Right> for &X2<Scalar> where
Scalar: ScalarInterface + Sub<Output = Scalar>,
Right: X2Interface<Scalar = Scalar> + Copy,
impl<Right, Scalar> Sub<&Right> for &X2<Scalar> where
Scalar: ScalarInterface + Sub<Output = Scalar>,
Right: X2Interface<Scalar = Scalar> + Copy,
sourceimpl<Right, Scalar> Sub<Right> for X2<Scalar> where
Scalar: ScalarInterface + Sub<Output = Scalar>,
Right: X2Interface<Scalar = Scalar> + Copy,
impl<Right, Scalar> Sub<Right> for X2<Scalar> where
Scalar: ScalarInterface + Sub<Output = Scalar>,
Right: X2Interface<Scalar = Scalar> + Copy,
sourceimpl<Scalar> X2BasicInterface for X2<Scalar> where
Scalar: ScalarInterface,
impl<Scalar> X2BasicInterface for X2<Scalar> where
Scalar: ScalarInterface,
sourceimpl<Scalar> X2CanonicalInterface for X2<Scalar> where
Scalar: ScalarInterface,
impl<Scalar> X2CanonicalInterface for X2<Scalar> where
Scalar: ScalarInterface,
sourcefn as_canonical(&self) -> &X2<Self::Scalar>
fn as_canonical(&self) -> &X2<Self::Scalar>
Canonical representation of the vector.
sourcefn as_canonical_mut(&mut self) -> &mut X2<Self::Scalar>
fn as_canonical_mut(&mut self) -> &mut X2<Self::Scalar>
Mutable canonical representation of the vector.
sourcefn assign<Src: X2BasicInterface<Scalar = Self::Scalar>>(&mut self, src: Src)
fn assign<Src: X2BasicInterface<Scalar = Self::Scalar>>(&mut self, src: Src)
Assign value.
sourcefn as_tuple_mut(&mut self) -> &mut (Self::Scalar, Self::Scalar)
fn as_tuple_mut(&mut self) -> &mut (Self::Scalar, Self::Scalar)
Interpret as mutable tuple.
sourcefn as_array_mut(&mut self) -> &mut [Self::Scalar; 2]
fn as_array_mut(&mut self) -> &mut [Self::Scalar; 2]
Interpret as mutable array.
sourcefn as_slice_mut(&mut self) -> &mut [Self::Scalar]
fn as_slice_mut(&mut self) -> &mut [Self::Scalar]
Interpret as mutable slice.
sourceimpl<Scalar> X2NominalInterface for X2<Scalar> where
Scalar: ScalarInterface,
impl<Scalar> X2NominalInterface for X2<Scalar> where
Scalar: ScalarInterface,
type Scalar = Scalar
type Scalar = Scalar
Type of element.
sourcefn clone_as_tuple(&self) -> (Self::Scalar, Self::Scalar)
fn clone_as_tuple(&self) -> (Self::Scalar, Self::Scalar)
Clone as tuple.
sourcefn clone_as_array(&self) -> [Self::Scalar; 2]
fn clone_as_array(&self) -> [Self::Scalar; 2]
Clone as array.
sourcefn clone_as_canonical(&self) -> X2<Self::Scalar>
fn clone_as_canonical(&self) -> X2<Self::Scalar>
Clone as canonical.
impl<Scalar: Copy + ScalarInterface> Copy for X2<Scalar>
impl<Scalar: ScalarInterface> StructuralPartialEq for X2<Scalar>
Auto Trait Implementations
impl<Scalar> RefUnwindSafe for X2<Scalar> where
Scalar: RefUnwindSafe,
impl<Scalar> Send for X2<Scalar> where
Scalar: Send,
impl<Scalar> Sync for X2<Scalar> where
Scalar: Sync,
impl<Scalar> Unpin for X2<Scalar> where
Scalar: Unpin,
impl<Scalar> UnwindSafe for X2<Scalar> where
Scalar: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.