pub struct Skew3(pub Matrix<f64, U3, U1, <DefaultAllocator as Allocator<f64, U3>>::Buffer>);
Expand description
Contains a member of the lie algebra so(3), a representation of the tangent space of 3d rotation. This is also known as the lie algebra of the 3d rotation group SO(3).
This is only intended to be used in optimization problems where it is desirable to have unconstranied variables representing the degrees of freedom of the rotation. In all other cases, a rotation matrix should be used to store rotations, since the conversion to and from a rotation matrix is non-trivial.
Tuple Fields§
§0: Matrix<f64, U3, U1, <DefaultAllocator as Allocator<f64, U3>>::Buffer>
Implementations§
Source§impl Skew3
impl Skew3
Sourcepub fn vee(
mat: Matrix<f64, U3, U3, <DefaultAllocator as Allocator<f64, U3, U3>>::Buffer>,
) -> Skew3
pub fn vee( mat: Matrix<f64, U3, U3, <DefaultAllocator as Allocator<f64, U3, U3>>::Buffer>, ) -> Skew3
This converts a matrix in skew-symmetric form into a Skew3.
Warning: Does no check to ensure matrix is actually skew-symmetric.
Sourcepub fn hat(
self,
) -> Matrix<f64, U3, U3, <DefaultAllocator as Allocator<f64, U3, U3>>::Buffer>
pub fn hat( self, ) -> Matrix<f64, U3, U3, <DefaultAllocator as Allocator<f64, U3, U3>>::Buffer>
This converts the Skew3 into its skew-symmetric matrix form.
Sourcepub fn hat2(
self,
) -> Matrix<f64, U3, U3, <DefaultAllocator as Allocator<f64, U3, U3>>::Buffer>
pub fn hat2( self, ) -> Matrix<f64, U3, U3, <DefaultAllocator as Allocator<f64, U3, U3>>::Buffer>
This converts the Skew3 into its squared skew-symmetric matrix form efficiently.
Sourcepub fn jacobian_input(
self,
) -> Matrix<f64, U4, U4, <DefaultAllocator as Allocator<f64, U4, U4>>::Buffer>
pub fn jacobian_input( self, ) -> Matrix<f64, U4, U4, <DefaultAllocator as Allocator<f64, U4, U4>>::Buffer>
The jacobian of the output of a rotation in respect to the input of a rotation.
y = R * x
dy/dx = R
The formula is pretty simple and is just the rotation matrix created
from the exponential map of this so(3) element into SO(3). The result is converted
to homogeneous form (by adding a new dimension with a 1
in the diagonal) so
that it is compatible with homogeneous coordinates.
If you have the rotation matrix already, please use the rotation matrix itself
rather than calling this method. Calling this method will waste time converting
the Skew3
back into a Rotation3
, which is non-trivial.
Sourcepub fn jacobian_self(
y: Matrix<f64, U3, U1, <DefaultAllocator as Allocator<f64, U3>>::Buffer>,
) -> Matrix<f64, U3, U3, <DefaultAllocator as Allocator<f64, U3, U3>>::Buffer>
pub fn jacobian_self( y: Matrix<f64, U3, U1, <DefaultAllocator as Allocator<f64, U3>>::Buffer>, ) -> Matrix<f64, U3, U3, <DefaultAllocator as Allocator<f64, U3, U3>>::Buffer>
The jacobian of the output of a rotation in respect to the rotation itself.
y = R * x
dy/dR = -hat(y)
The derivative is purely based on the current output vector, and thus doesn’t take self
.
Note that when working with homogeneous projective coordinates, only the first three components
(the bearing) are relevant, hence the resulting matrix is a Matrix3
.
Methods from Deref<Target = Matrix<f64, U3, U1, <DefaultAllocator as Allocator<f64, U3>>::Buffer>>§
Sourcepub fn icamax(&self) -> usize
pub fn icamax(&self) -> usize
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, N)
pub fn argmax(&self) -> (usize, N)
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
pub fn imax(&self) -> usize
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) -> usizewhere
N: Signed,
pub fn iamax(&self) -> usizewhere
N: Signed,
Computes the index of the vector component with the largest absolute value.
§Examples:
let vec = Vector3::new(11, -15, 13);
assert_eq!(vec.iamax(), 1);
Sourcepub fn argmin(&self) -> (usize, N)
pub fn argmin(&self) -> (usize, N)
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
pub fn imin(&self) -> usize
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 iamin(&self) -> usizewhere
N: Signed,
pub fn iamin(&self) -> usizewhere
N: Signed,
Computes the index of the vector component with the smallest absolute value.
§Examples:
let vec = Vector3::new(11, -15, 13);
assert_eq!(vec.iamin(), 0);
Sourcepub fn icamax_full(&self) -> (usize, usize)
pub fn icamax_full(&self) -> (usize, usize)
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 dot<R2, C2, SB>(&self, rhs: &Matrix<N, R2, C2, SB>) -> N
pub fn dot<R2, C2, SB>(&self, rhs: &Matrix<N, R2, C2, SB>) -> N
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.
§Examples:
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<N, R2, C2, SB>) -> Nwhere
R2: Dim,
C2: Dim,
N: SimdComplexField,
SB: Storage<N, R2, C2>,
ShapeConstraint: DimEq<R, R2> + DimEq<C, C2>,
pub fn dotc<R2, C2, SB>(&self, rhs: &Matrix<N, R2, C2, SB>) -> Nwhere
R2: Dim,
C2: Dim,
N: SimdComplexField,
SB: Storage<N, R2, C2>,
ShapeConstraint: DimEq<R, R2> + 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.
§Examples:
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<N, R2, C2, SB>) -> N
pub fn tr_dot<R2, C2, SB>(&self, rhs: &Matrix<N, R2, C2, SB>) -> N
The dot product between the transpose of self
and rhs
.
§Examples:
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: N, x: &Matrix<N, D2, U1, SB>, c: N, b: N)
pub fn axcpy<D2, SB>(&mut self, a: N, x: &Matrix<N, D2, U1, SB>, c: N, b: N)
Computes self = a * x * c + b * self
.
If b
is zero, self
is never read from.
§Examples:
let mut vec1 = Vector3::new(1.0, 2.0, 3.0);
let vec2 = Vector3::new(0.1, 0.2, 0.3);
vec1.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: N, x: &Matrix<N, D2, U1, SB>, b: N)
pub fn axpy<D2, SB>(&mut self, a: N, x: &Matrix<N, D2, U1, SB>, b: N)
Computes self = a * x + b * self
.
If b
is zero, self
is never read from.
§Examples:
let mut vec1 = Vector3::new(1.0, 2.0, 3.0);
let vec2 = Vector3::new(0.1, 0.2, 0.3);
vec1.axpy(10.0, &vec2, 5.0);
assert_eq!(vec1, Vector3::new(6.0, 12.0, 18.0));
Sourcepub fn gemv<R2, C2, D3, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, R2, C2, SB>,
x: &Matrix<N, D3, U1, SC>,
beta: N,
)where
R2: Dim,
C2: Dim,
D3: Dim,
N: One,
SB: Storage<N, R2, C2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, R2> + AreMultipliable<R2, C2, D3, U1>,
pub fn gemv<R2, C2, D3, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, R2, C2, SB>,
x: &Matrix<N, D3, U1, SC>,
beta: N,
)where
R2: Dim,
C2: Dim,
D3: Dim,
N: One,
SB: Storage<N, R2, C2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, R2> + AreMultipliable<R2, C2, D3, U1>,
Computes self = alpha * a * x + beta * self
, where a
is a matrix, x
a vector, and
alpha, beta
two scalars.
If beta
is zero, self
is never read.
§Examples:
let mut vec1 = Vector2::new(1.0, 2.0);
let vec2 = Vector2::new(0.1, 0.2);
let mat = Matrix2::new(1.0, 2.0,
3.0, 4.0);
vec1.gemv(10.0, &mat, &vec2, 5.0);
assert_eq!(vec1, Vector2::new(10.0, 21.0));
Sourcepub fn gemv_symm<D2, D3, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, D2, D2, SB>,
x: &Matrix<N, D3, U1, SC>,
beta: N,
)where
D2: Dim,
D3: Dim,
N: One,
SB: Storage<N, D2, D2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, D2> + AreMultipliable<D2, D2, D3, U1>,
👎Deprecated: This is renamed sygemv
to match the original BLAS terminology.
pub fn gemv_symm<D2, D3, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, D2, D2, SB>,
x: &Matrix<N, D3, U1, SC>,
beta: N,
)where
D2: Dim,
D3: Dim,
N: One,
SB: Storage<N, D2, D2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, D2> + AreMultipliable<D2, D2, D3, U1>,
sygemv
to match the original BLAS terminology.Computes self = alpha * a * x + beta * self
, where a
is a symmetric matrix, x
a
vector, and alpha, beta
two scalars. DEPRECATED: use sygemv
instead.
Sourcepub fn sygemv<D2, D3, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, D2, D2, SB>,
x: &Matrix<N, D3, U1, SC>,
beta: N,
)where
D2: Dim,
D3: Dim,
N: One,
SB: Storage<N, D2, D2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, D2> + AreMultipliable<D2, D2, D3, U1>,
pub fn sygemv<D2, D3, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, D2, D2, SB>,
x: &Matrix<N, D3, U1, SC>,
beta: N,
)where
D2: Dim,
D3: Dim,
N: One,
SB: Storage<N, D2, D2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, D2> + AreMultipliable<D2, D2, D3, U1>,
Computes self = alpha * a * x + beta * self
, where a
is a symmetric matrix, x
a
vector, and alpha, beta
two scalars.
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: N,
a: &Matrix<N, D2, D2, SB>,
x: &Matrix<N, D3, U1, SC>,
beta: N,
)where
D2: Dim,
D3: Dim,
N: SimdComplexField,
SB: Storage<N, D2, D2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, D2> + AreMultipliable<D2, D2, D3, U1>,
pub fn hegemv<D2, D3, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, D2, D2, SB>,
x: &Matrix<N, D3, U1, SC>,
beta: N,
)where
D2: Dim,
D3: Dim,
N: SimdComplexField,
SB: Storage<N, D2, D2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, D2> + AreMultipliable<D2, D2, D3, U1>,
Computes self = alpha * a * x + beta * self
, where a
is 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: N,
a: &Matrix<N, R2, C2, SB>,
x: &Matrix<N, D3, U1, SC>,
beta: N,
)where
R2: Dim,
C2: Dim,
D3: Dim,
N: One,
SB: Storage<N, R2, C2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, C2> + AreMultipliable<C2, R2, D3, U1>,
pub fn gemv_tr<R2, C2, D3, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, R2, C2, SB>,
x: &Matrix<N, D3, U1, SC>,
beta: N,
)where
R2: Dim,
C2: Dim,
D3: Dim,
N: One,
SB: Storage<N, R2, C2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, C2> + AreMultipliable<C2, R2, D3, U1>,
Computes self = alpha * a.transpose() * x + beta * self
, where a
is a matrix, x
a vector, and
alpha, beta
two scalars.
If beta
is zero, self
is never read.
§Examples:
let mat = Matrix2::new(1.0, 3.0,
2.0, 4.0);
let mut vec1 = Vector2::new(1.0, 2.0);
let vec2 = Vector2::new(0.1, 0.2);
let expected = mat.transpose() * vec2 * 10.0 + vec1 * 5.0;
vec1.gemv_tr(10.0, &mat, &vec2, 5.0);
assert_eq!(vec1, expected);
Sourcepub fn gemv_ad<R2, C2, D3, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, R2, C2, SB>,
x: &Matrix<N, D3, U1, SC>,
beta: N,
)where
R2: Dim,
C2: Dim,
D3: Dim,
N: SimdComplexField,
SB: Storage<N, R2, C2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, C2> + AreMultipliable<C2, R2, D3, U1>,
pub fn gemv_ad<R2, C2, D3, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, R2, C2, SB>,
x: &Matrix<N, D3, U1, SC>,
beta: N,
)where
R2: Dim,
C2: Dim,
D3: Dim,
N: SimdComplexField,
SB: Storage<N, R2, C2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<D, C2> + AreMultipliable<C2, R2, D3, U1>,
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.
§Examples:
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: N,
x: &Matrix<N, D2, U1, SB>,
y: &Matrix<N, D3, U1, SC>,
beta: N,
)
pub fn ger<D2, D3, SB, SC>( &mut self, alpha: N, x: &Matrix<N, D2, U1, SB>, y: &Matrix<N, D3, U1, SC>, beta: N, )
Computes self = alpha * x * y.transpose() + beta * self
.
If beta
is zero, self
is never read.
§Examples:
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: N,
x: &Matrix<N, D2, U1, SB>,
y: &Matrix<N, D3, U1, SC>,
beta: N,
)where
D2: Dim,
D3: Dim,
N: SimdComplexField,
SB: Storage<N, D2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<R1, D2> + DimEq<C1, D3>,
pub fn gerc<D2, D3, SB, SC>(
&mut self,
alpha: N,
x: &Matrix<N, D2, U1, SB>,
y: &Matrix<N, D3, U1, SC>,
beta: N,
)where
D2: Dim,
D3: Dim,
N: SimdComplexField,
SB: Storage<N, D2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<R1, D2> + DimEq<C1, D3>,
Computes self = alpha * x * y.adjoint() + beta * self
.
If beta
is zero, self
is never read.
§Examples:
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: N,
a: &Matrix<N, R2, C2, SB>,
b: &Matrix<N, R3, C3, SC>,
beta: N,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
N: One,
SB: Storage<N, R2, C2>,
SC: Storage<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C3> + AreMultipliable<R2, C2, R3, C3>,
pub fn gemm<R2, C2, R3, C3, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, R2, C2, SB>,
b: &Matrix<N, R3, C3, SC>,
beta: N,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
N: One,
SB: Storage<N, R2, C2>,
SC: Storage<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C3> + 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.
§Examples:
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: N,
a: &Matrix<N, R2, C2, SB>,
b: &Matrix<N, R3, C3, SC>,
beta: N,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
N: One,
SB: Storage<N, R2, C2>,
SC: Storage<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, C2> + SameNumberOfColumns<C1, C3> + AreMultipliable<C2, R2, R3, C3>,
pub fn gemm_tr<R2, C2, R3, C3, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, R2, C2, SB>,
b: &Matrix<N, R3, C3, SC>,
beta: N,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
N: One,
SB: Storage<N, R2, C2>,
SC: Storage<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, C2> + SameNumberOfColumns<C1, C3> + 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.
§Examples:
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: N,
a: &Matrix<N, R2, C2, SB>,
b: &Matrix<N, R3, C3, SC>,
beta: N,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
N: SimdComplexField,
SB: Storage<N, R2, C2>,
SC: Storage<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, C2> + SameNumberOfColumns<C1, C3> + AreMultipliable<C2, R2, R3, C3>,
pub fn gemm_ad<R2, C2, R3, C3, SB, SC>(
&mut self,
alpha: N,
a: &Matrix<N, R2, C2, SB>,
b: &Matrix<N, R3, C3, SC>,
beta: N,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
N: SimdComplexField,
SB: Storage<N, R2, C2>,
SC: Storage<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, C2> + SameNumberOfColumns<C1, C3> + 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.
§Examples:
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: N,
x: &Matrix<N, D2, U1, SB>,
y: &Matrix<N, D3, U1, SC>,
beta: N,
)
👎Deprecated: This is renamed syger
to match the original BLAS terminology.
pub fn ger_symm<D2, D3, SB, SC>( &mut self, alpha: N, x: &Matrix<N, D2, U1, SB>, y: &Matrix<N, D3, U1, SC>, beta: N, )
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.
§Examples:
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: N,
x: &Matrix<N, D2, U1, SB>,
y: &Matrix<N, D3, U1, SC>,
beta: N,
)
pub fn syger<D2, D3, SB, SC>( &mut self, alpha: N, x: &Matrix<N, D2, U1, SB>, y: &Matrix<N, D3, U1, SC>, beta: N, )
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.
§Examples:
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: N,
x: &Matrix<N, D2, U1, SB>,
y: &Matrix<N, D3, U1, SC>,
beta: N,
)where
D2: Dim,
D3: Dim,
N: SimdComplexField,
SB: Storage<N, D2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<R1, D2> + DimEq<C1, D3>,
pub fn hegerc<D2, D3, SB, SC>(
&mut self,
alpha: N,
x: &Matrix<N, D2, U1, SB>,
y: &Matrix<N, D3, U1, SC>,
beta: N,
)where
D2: Dim,
D3: Dim,
N: SimdComplexField,
SB: Storage<N, D2>,
SC: Storage<N, D3>,
ShapeConstraint: DimEq<R1, D2> + 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.
§Examples:
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<N, D2, U1, S2>,
alpha: N,
lhs: &Matrix<N, R3, C3, S3>,
mid: &Matrix<N, D4, D4, S4>,
beta: N,
)
pub fn quadform_tr_with_workspace<D2, S2, R3, C3, S3, D4, S4>( &mut self, work: &mut Matrix<N, D2, U1, S2>, alpha: N, lhs: &Matrix<N, R3, C3, S3>, mid: &Matrix<N, D4, D4, S4>, beta: N, )
Computes the quadratic form self = alpha * lhs * mid * lhs.transpose() + beta * self
.
This uses the provided workspace work
to avoid allocations for intermediate results.
§Examples:
// 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: N,
lhs: &Matrix<N, R3, C3, S3>,
mid: &Matrix<N, D4, D4, S4>,
beta: N,
)
pub fn quadform_tr<R3, C3, S3, D4, S4>( &mut self, alpha: N, lhs: &Matrix<N, R3, C3, S3>, mid: &Matrix<N, D4, D4, S4>, beta: N, )
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.
§Examples:
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<N, D2, U1, S2>,
alpha: N,
mid: &Matrix<N, D3, D3, S3>,
rhs: &Matrix<N, R4, C4, S4>,
beta: N,
)where
D2: Dim,
D3: Dim,
R4: Dim,
C4: Dim,
S2: StorageMut<N, D2>,
S3: Storage<N, D3, D3>,
S4: Storage<N, R4, C4>,
ShapeConstraint: DimEq<D3, R4> + DimEq<D1, C4> + DimEq<D2, D3> + AreMultipliable<C4, R4, D2, U1>,
pub fn quadform_with_workspace<D2, S2, D3, S3, R4, C4, S4>(
&mut self,
work: &mut Matrix<N, D2, U1, S2>,
alpha: N,
mid: &Matrix<N, D3, D3, S3>,
rhs: &Matrix<N, R4, C4, S4>,
beta: N,
)where
D2: Dim,
D3: Dim,
R4: Dim,
C4: Dim,
S2: StorageMut<N, D2>,
S3: Storage<N, D3, D3>,
S4: Storage<N, R4, C4>,
ShapeConstraint: DimEq<D3, R4> + DimEq<D1, C4> + DimEq<D2, D3> + AreMultipliable<C4, R4, D2, U1>,
Computes the quadratic form self = alpha * rhs.transpose() * mid * rhs + beta * self
.
This uses the provided workspace work
to avoid allocations for intermediate results.
// 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: N,
mid: &Matrix<N, D2, D2, S2>,
rhs: &Matrix<N, R3, C3, S3>,
beta: N,
)where
D2: Dim,
R3: Dim,
C3: Dim,
S2: Storage<N, D2, D2>,
S3: Storage<N, R3, C3>,
ShapeConstraint: DimEq<D2, R3> + DimEq<D1, C3> + AreMultipliable<C3, R3, D2, U1>,
DefaultAllocator: Allocator<N, D2>,
pub fn quadform<D2, S2, R3, C3, S3>(
&mut self,
alpha: N,
mid: &Matrix<N, D2, D2, S2>,
rhs: &Matrix<N, R3, C3, S3>,
beta: N,
)where
D2: Dim,
R3: Dim,
C3: Dim,
S2: Storage<N, D2, D2>,
S3: Storage<N, R3, C3>,
ShapeConstraint: DimEq<D2, R3> + DimEq<D1, C3> + AreMultipliable<C3, R3, D2, U1>,
DefaultAllocator: Allocator<N, D2>,
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.
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<N, R2, C2, SB>,
out: &mut Matrix<N, R3, C3, SC>,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<N, R2, C2>,
SC: StorageMut<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + SameNumberOfColumns<C1, C3>,
pub fn add_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<N, R2, C2, SB>,
out: &mut Matrix<N, R3, C3, SC>,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<N, R2, C2>,
SC: StorageMut<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + 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<N, R2, C2, SB>,
out: &mut Matrix<N, R3, C3, SC>,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<N, R2, C2>,
SC: StorageMut<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + SameNumberOfColumns<C1, C3>,
pub fn sub_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<N, R2, C2, SB>,
out: &mut Matrix<N, R3, C3, SC>,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<N, R2, C2>,
SC: StorageMut<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + 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<N, R2, C2, SB>,
) -> Matrix<N, C1, C2, <DefaultAllocator as Allocator<N, C1, C2>>::Buffer>where
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
pub fn tr_mul<R2, C2, SB>(
&self,
rhs: &Matrix<N, R2, C2, SB>,
) -> Matrix<N, C1, C2, <DefaultAllocator as Allocator<N, C1, C2>>::Buffer>where
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
Equivalent to self.transpose() * rhs
.
Sourcepub fn ad_mul<R2, C2, SB>(
&self,
rhs: &Matrix<N, R2, C2, SB>,
) -> Matrix<N, C1, C2, <DefaultAllocator as Allocator<N, C1, C2>>::Buffer>where
R2: Dim,
C2: Dim,
N: SimdComplexField,
SB: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
pub fn ad_mul<R2, C2, SB>(
&self,
rhs: &Matrix<N, R2, C2, SB>,
) -> Matrix<N, C1, C2, <DefaultAllocator as Allocator<N, C1, C2>>::Buffer>where
R2: Dim,
C2: Dim,
N: SimdComplexField,
SB: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, 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<N, R2, C2, SB>,
out: &mut Matrix<N, R3, C3, SC>,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<N, R2, C2>,
SC: StorageMut<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + DimEq<C1, R3> + DimEq<C2, C3>,
pub fn tr_mul_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<N, R2, C2, SB>,
out: &mut Matrix<N, R3, C3, SC>,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<N, R2, C2>,
SC: StorageMut<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + DimEq<C1, R3> + 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<N, R2, C2, SB>,
out: &mut Matrix<N, R3, C3, SC>,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
N: SimdComplexField,
SB: Storage<N, R2, C2>,
SC: StorageMut<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + DimEq<C1, R3> + DimEq<C2, C3>,
pub fn ad_mul_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<N, R2, C2, SB>,
out: &mut Matrix<N, R3, C3, SC>,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
N: SimdComplexField,
SB: Storage<N, R2, C2>,
SC: StorageMut<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + DimEq<C1, R3> + 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<N, R2, C2, SB>,
out: &mut Matrix<N, R3, C3, SC>,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<N, R2, C2>,
SC: StorageMut<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R3, R1> + SameNumberOfColumns<C3, C2> + AreMultipliable<R1, C1, R2, C2>,
pub fn mul_to<R2, C2, SB, R3, C3, SC>(
&self,
rhs: &Matrix<N, R2, C2, SB>,
out: &mut Matrix<N, R3, C3, SC>,
)where
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<N, R2, C2>,
SC: StorageMut<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R3, R1> + SameNumberOfColumns<C3, C2> + 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<N, R2, C2, SB>,
) -> Matrix<N, <R1 as DimMul<R2>>::Output, <C1 as DimMul<C2>>::Output, <DefaultAllocator as Allocator<N, <R1 as DimMul<R2>>::Output, <C1 as DimMul<C2>>::Output>>::Buffer>
pub fn kronecker<R2, C2, SB>( &self, rhs: &Matrix<N, R2, C2, SB>, ) -> Matrix<N, <R1 as DimMul<R2>>::Output, <C1 as DimMul<C2>>::Output, <DefaultAllocator as Allocator<N, <R1 as DimMul<R2>>::Output, <C1 as DimMul<C2>>::Output>>::Buffer>
The kronecker product of two matrices (aka. tensor product of the corresponding linear maps).
Sourcepub fn add_scalar(
&self,
rhs: N,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
pub fn add_scalar(
&self,
rhs: N,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
Adds a scalar to self
.
Sourcepub fn add_scalar_mut(&mut self, rhs: N)where
S: StorageMut<N, R, C>,
pub fn add_scalar_mut(&mut self, rhs: N)where
S: StorageMut<N, R, C>,
Adds a scalar to self
in-place.
Sourcepub fn amax(&self) -> N
pub fn amax(&self) -> N
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) -> <N as SimdComplexField>::SimdRealFieldwhere
N: SimdComplexField,
pub fn camax(&self) -> <N as SimdComplexField>::SimdRealFieldwhere
N: 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) -> Nwhere
N: SimdPartialOrd + Zero,
pub fn max(&self) -> Nwhere
N: 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) -> N
pub fn amin(&self) -> N
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) -> <N as SimdComplexField>::SimdRealFieldwhere
N: SimdComplexField,
pub fn camin(&self) -> <N as SimdComplexField>::SimdRealFieldwhere
N: 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) -> Nwhere
N: SimdPartialOrd + Zero,
pub fn min(&self) -> Nwhere
N: 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 append_scaling(
&self,
scaling: N,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>
pub fn append_scaling( &self, scaling: N, ) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>
Computes the transformation equal to self
followed by an uniform scaling factor.
Sourcepub fn prepend_scaling(
&self,
scaling: N,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>
pub fn prepend_scaling( &self, scaling: N, ) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>
Computes the transformation equal to an uniform scaling factor followed by self
.
Sourcepub fn append_nonuniform_scaling<SB>(
&self,
scaling: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, SB>,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>where
D: DimNameSub<U1>,
SB: Storage<N, <D as DimNameSub<U1>>::Output>,
DefaultAllocator: Allocator<N, D, D>,
pub fn append_nonuniform_scaling<SB>(
&self,
scaling: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, SB>,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>where
D: DimNameSub<U1>,
SB: Storage<N, <D as DimNameSub<U1>>::Output>,
DefaultAllocator: Allocator<N, D, D>,
Computes the transformation equal to self
followed by a non-uniform scaling factor.
Sourcepub fn prepend_nonuniform_scaling<SB>(
&self,
scaling: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, SB>,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>where
D: DimNameSub<U1>,
SB: Storage<N, <D as DimNameSub<U1>>::Output>,
DefaultAllocator: Allocator<N, D, D>,
pub fn prepend_nonuniform_scaling<SB>(
&self,
scaling: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, SB>,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>where
D: DimNameSub<U1>,
SB: Storage<N, <D as DimNameSub<U1>>::Output>,
DefaultAllocator: Allocator<N, D, D>,
Computes the transformation equal to a non-uniform scaling factor followed by self
.
Sourcepub fn append_translation<SB>(
&self,
shift: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, SB>,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>where
D: DimNameSub<U1>,
SB: Storage<N, <D as DimNameSub<U1>>::Output>,
DefaultAllocator: Allocator<N, D, D>,
pub fn append_translation<SB>(
&self,
shift: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, SB>,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>where
D: DimNameSub<U1>,
SB: Storage<N, <D as DimNameSub<U1>>::Output>,
DefaultAllocator: Allocator<N, D, D>,
Computes the transformation equal to self
followed by a translation.
Sourcepub fn prepend_translation<SB>(
&self,
shift: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, SB>,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>where
D: DimNameSub<U1>,
SB: Storage<N, <D as DimNameSub<U1>>::Output>,
DefaultAllocator: Allocator<N, D, D> + Allocator<N, <D as DimNameSub<U1>>::Output>,
pub fn prepend_translation<SB>(
&self,
shift: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, SB>,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>where
D: DimNameSub<U1>,
SB: Storage<N, <D as DimNameSub<U1>>::Output>,
DefaultAllocator: Allocator<N, D, D> + Allocator<N, <D as DimNameSub<U1>>::Output>,
Computes the transformation equal to a translation followed by self
.
Sourcepub fn append_scaling_mut(&mut self, scaling: N)where
D: DimNameSub<U1>,
pub fn append_scaling_mut(&mut self, scaling: N)where
D: DimNameSub<U1>,
Computes in-place the transformation equal to self
followed by an uniform scaling factor.
Sourcepub fn prepend_scaling_mut(&mut self, scaling: N)where
D: DimNameSub<U1>,
pub fn prepend_scaling_mut(&mut self, scaling: N)where
D: DimNameSub<U1>,
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<N, <D as DimNameSub<U1>>::Output, U1, SB>,
)
pub fn append_nonuniform_scaling_mut<SB>( &mut self, scaling: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, SB>, )
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<N, <D as DimNameSub<U1>>::Output, U1, SB>,
)
pub fn prepend_nonuniform_scaling_mut<SB>( &mut self, scaling: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, SB>, )
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<N, <D as DimNameSub<U1>>::Output, U1, SB>,
)
pub fn append_translation_mut<SB>( &mut self, shift: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, SB>, )
Computes the transformation equal to self
followed by a translation.
Sourcepub fn prepend_translation_mut<SB>(
&mut self,
shift: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, SB>,
)where
D: DimNameSub<U1>,
SB: Storage<N, <D as DimNameSub<U1>>::Output>,
DefaultAllocator: Allocator<N, <D as DimNameSub<U1>>::Output>,
pub fn prepend_translation_mut<SB>(
&mut self,
shift: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, SB>,
)where
D: DimNameSub<U1>,
SB: Storage<N, <D as DimNameSub<U1>>::Output>,
DefaultAllocator: Allocator<N, <D as DimNameSub<U1>>::Output>,
Computes the transformation equal to a translation followed by self
.
Sourcepub fn transform_vector(
&self,
v: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, <DefaultAllocator as Allocator<N, <D as DimNameSub<U1>>::Output>>::Buffer>,
) -> Matrix<N, <D as DimNameSub<U1>>::Output, U1, <DefaultAllocator as Allocator<N, <D as DimNameSub<U1>>::Output>>::Buffer>
pub fn transform_vector( &self, v: &Matrix<N, <D as DimNameSub<U1>>::Output, U1, <DefaultAllocator as Allocator<N, <D as DimNameSub<U1>>::Output>>::Buffer>, ) -> Matrix<N, <D as DimNameSub<U1>>::Output, U1, <DefaultAllocator as Allocator<N, <D as DimNameSub<U1>>::Output>>::Buffer>
Transforms the given vector, assuming the matrix self
uses homogeneous coordinates.
Sourcepub fn transform_point(
&self,
pt: &Point<N, <D as DimNameSub<U1>>::Output>,
) -> Point<N, <D as DimNameSub<U1>>::Output>
pub fn transform_point( &self, pt: &Point<N, <D as DimNameSub<U1>>::Output>, ) -> Point<N, <D as DimNameSub<U1>>::Output>
Transforms the given point, assuming the matrix self
uses homogeneous coordinates.
Sourcepub fn abs(
&self,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>
pub fn abs( &self, ) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>
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<N, R2, C2, SB>,
) -> Matrix<N, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative, <DefaultAllocator as Allocator<N, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative>>::Buffer>where
N: ClosedMul,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
DefaultAllocator: SameShapeAllocator<N, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
pub fn component_mul<R2, C2, SB>(
&self,
rhs: &Matrix<N, R2, C2, SB>,
) -> Matrix<N, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative, <DefaultAllocator as Allocator<N, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative>>::Buffer>where
N: ClosedMul,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
DefaultAllocator: SameShapeAllocator<N, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + 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: N,
a: &Matrix<N, R2, C2, SB>,
b: &Matrix<N, R3, C3, SC>,
beta: N,
)where
N: ClosedMul<Output = N> + Zero<Output = N> + Mul + Add,
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<N, R2, C2>,
SC: Storage<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + SameNumberOfColumns<C1, C3>,
pub fn cmpy<R2, C2, SB, R3, C3, SC>(
&mut self,
alpha: N,
a: &Matrix<N, R2, C2, SB>,
b: &Matrix<N, R3, C3, SC>,
beta: N,
)where
N: ClosedMul<Output = N> + Zero<Output = N> + Mul + Add,
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<N, R2, C2>,
SC: Storage<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + 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<N, R2, C2, SB>)where
N: ClosedMul,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
pub fn component_mul_assign<R2, C2, SB>(&mut self, rhs: &Matrix<N, R2, C2, SB>)where
N: ClosedMul,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + 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<N, R2, C2, SB>)where
N: ClosedMul,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + 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<N, R2, C2, SB>)where
N: ClosedMul,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
_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<N, R2, C2, SB>,
) -> Matrix<N, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative, <DefaultAllocator as Allocator<N, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative>>::Buffer>where
N: ClosedDiv,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
DefaultAllocator: SameShapeAllocator<N, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
pub fn component_div<R2, C2, SB>(
&self,
rhs: &Matrix<N, R2, C2, SB>,
) -> Matrix<N, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative, <DefaultAllocator as Allocator<N, <ShapeConstraint as SameNumberOfRows<R1, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C1, C2>>::Representative>>::Buffer>where
N: ClosedDiv,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
DefaultAllocator: SameShapeAllocator<N, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + 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: N,
a: &Matrix<N, R2, C2, SB>,
b: &Matrix<N, R3, C3, SC>,
beta: N,
)where
N: ClosedDiv + Zero<Output = N> + Mul<Output = N> + Add,
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<N, R2, C2>,
SC: Storage<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + SameNumberOfColumns<C1, C3>,
pub fn cdpy<R2, C2, SB, R3, C3, SC>(
&mut self,
alpha: N,
a: &Matrix<N, R2, C2, SB>,
b: &Matrix<N, R3, C3, SC>,
beta: N,
)where
N: ClosedDiv + Zero<Output = N> + Mul<Output = N> + Add,
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SB: Storage<N, R2, C2>,
SC: Storage<N, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + 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<N, R2, C2, SB>)where
N: ClosedDiv,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
pub fn component_div_assign<R2, C2, SB>(&mut self, rhs: &Matrix<N, R2, C2, SB>)where
N: ClosedDiv,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + 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<N, R2, C2, SB>)where
N: ClosedDiv,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + 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<N, R2, C2, SB>)where
N: ClosedDiv,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
_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<N, R, C, S>,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>
pub fn inf( &self, other: &Matrix<N, R, C, S>, ) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>
Computes the infimum (aka. componentwise min) of two matrices/vectors.
Sourcepub fn sup(
&self,
other: &Matrix<N, R, C, S>,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>
pub fn sup( &self, other: &Matrix<N, R, C, S>, ) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>
Computes the supremum (aka. componentwise max) of two matrices/vectors.
Sourcepub fn inf_sup(
&self,
other: &Matrix<N, R, C, S>,
) -> (Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>, Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>)
pub fn inf_sup( &self, other: &Matrix<N, R, C, S>, ) -> (Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>, Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>)
Computes the (infimum, supremum) of two matrices/vectors.
Sourcepub fn upper_triangle(
&self,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
pub fn upper_triangle(
&self,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
Extracts the upper triangular part of this matrix (including the diagonal).
Sourcepub fn lower_triangle(
&self,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
pub fn lower_triangle(
&self,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
Extracts the lower triangular part of this matrix (including the diagonal).
Sourcepub fn fill_with_identity(&mut self)
pub fn fill_with_identity(&mut self)
Fills self
with the identity matrix.
Sourcepub fn fill_diagonal(&mut self, val: N)
pub fn fill_diagonal(&mut self, val: N)
Sets all the diagonal elements of this matrix to val
.
Sourcepub fn fill_column(&mut self, j: usize, val: N)
pub fn fill_column(&mut self, j: usize, val: N)
Sets all the elements of the selected column to val
.
Sourcepub fn set_diagonal<R2, S2>(&mut self, diag: &Matrix<N, R2, U1, S2>)
pub fn set_diagonal<R2, S2>(&mut self, diag: &Matrix<N, R2, U1, S2>)
Fills the diagonal of this matrix with the content of the given vector.
Sourcepub fn set_partial_diagonal(&mut self, diag: impl Iterator<Item = N>)
pub fn set_partial_diagonal(&mut self, diag: impl Iterator<Item = N>)
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<N, U1, C2, S2>)
pub fn set_row<C2, S2>(&mut self, i: usize, row: &Matrix<N, U1, C2, S2>)
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<N, R2, U1, S2>)
pub fn set_column<R2, S2>(&mut self, i: usize, column: &Matrix<N, R2, U1, S2>)
Fills the selected column of this matrix with the content of the given vector.
Sourcepub fn fill_lower_triangle(&mut self, val: N, shift: usize)
pub fn fill_lower_triangle(&mut self, val: N, shift: usize)
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: N, shift: usize)
pub fn fill_upper_triangle(&mut self, val: N, shift: usize)
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 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 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 get<'a, I>(
&'a self,
index: I,
) -> Option<<I as MatrixIndex<'a, N, R, C, S>>::Output>where
I: MatrixIndex<'a, N, R, C, S>,
pub fn get<'a, I>(
&'a self,
index: I,
) -> Option<<I as MatrixIndex<'a, N, R, C, S>>::Output>where
I: MatrixIndex<'a, N, 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, N, R, C, S>>::OutputMut>where
S: StorageMut<N, R, C>,
I: MatrixIndexMut<'a, N, R, C, S>,
pub fn get_mut<'a, I>(
&'a mut self,
index: I,
) -> Option<<I as MatrixIndexMut<'a, N, R, C, S>>::OutputMut>where
S: StorageMut<N, R, C>,
I: MatrixIndexMut<'a, N, 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, N, R, C, S>>::Outputwhere
I: MatrixIndex<'a, N, R, C, S>,
pub fn index<'a, I>(
&'a self,
index: I,
) -> <I as MatrixIndex<'a, N, R, C, S>>::Outputwhere
I: MatrixIndex<'a, N, 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, N, R, C, S>>::OutputMutwhere
S: StorageMut<N, R, C>,
I: MatrixIndexMut<'a, N, R, C, S>,
pub fn index_mut<'a, I>(
&'a mut self,
index: I,
) -> <I as MatrixIndexMut<'a, N, R, C, S>>::OutputMutwhere
S: StorageMut<N, R, C>,
I: MatrixIndexMut<'a, N, 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, N, R, C, S>>::Outputwhere
I: MatrixIndex<'a, N, R, C, S>,
pub unsafe fn get_unchecked<'a, I>(
&'a self,
index: I,
) -> <I as MatrixIndex<'a, N, R, C, S>>::Outputwhere
I: MatrixIndex<'a, N, 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, N, R, C, S>>::OutputMutwhere
S: StorageMut<N, R, C>,
I: MatrixIndexMut<'a, N, R, C, S>,
pub unsafe fn get_unchecked_mut<'a, I>(
&'a mut self,
index: I,
) -> <I as MatrixIndexMut<'a, N, R, C, S>>::OutputMutwhere
S: StorageMut<N, R, C>,
I: MatrixIndexMut<'a, N, R, C, S>,
Returns a mutable view of the data at the given index, without doing any bounds checking.
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 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).
§Examples:
let mat = Matrix3x4::<f32>::zeros();
assert_eq!(mat.shape(), (3, 4));
Sourcepub fn nrows(&self) -> usize
pub fn nrows(&self) -> usize
The number of rows of this matrix.
§Examples:
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.
§Examples:
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.
§Examples:
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 iter(&self) -> MatrixIter<'_, N, R, C, S> ⓘ
pub fn iter(&self) -> MatrixIter<'_, N, R, C, S> ⓘ
Iterates through this matrix coordinates in column-major order.
§Examples:
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<'_, N, R, C, S> ⓘ
pub fn row_iter(&self) -> RowIter<'_, N, R, C, S> ⓘ
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<'_, N, R, C, S> ⓘ
pub fn column_iter(&self) -> ColumnIter<'_, N, R, C, S> ⓘ
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 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 N
pub fn as_ptr(&self) -> *const N
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<N, R2, C2, SB>,
eps: <N as AbsDiffEq>::Epsilon,
max_relative: <N as AbsDiffEq>::Epsilon,
) -> boolwhere
N: RelativeEq,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
<N as AbsDiffEq>::Epsilon: Copy,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn relative_eq<R2, C2, SB>(
&self,
other: &Matrix<N, R2, C2, SB>,
eps: <N as AbsDiffEq>::Epsilon,
max_relative: <N as AbsDiffEq>::Epsilon,
) -> boolwhere
N: RelativeEq,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
<N as AbsDiffEq>::Epsilon: Copy,
ShapeConstraint: SameNumberOfRows<R, R2> + 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<N, R2, C2, SB>) -> boolwhere
N: PartialEq,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn eq<R2, C2, SB>(&self, other: &Matrix<N, R2, C2, SB>) -> boolwhere
N: PartialEq,
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
Tests whether self
and rhs
are exactly equal.
Sourcepub fn clone_owned(
&self,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
pub fn clone_owned(
&self,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
Clones this matrix to one that owns its data.
Sourcepub fn clone_owned_sum<R2, C2>(
&self,
) -> Matrix<N, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative, <DefaultAllocator as Allocator<N, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative>>::Buffer>where
R2: Dim,
C2: Dim,
DefaultAllocator: SameShapeAllocator<N, R, C, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn clone_owned_sum<R2, C2>(
&self,
) -> Matrix<N, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative, <DefaultAllocator as Allocator<N, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative>>::Buffer>where
R2: Dim,
C2: Dim,
DefaultAllocator: SameShapeAllocator<N, R, C, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + 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 map<N2, F>(
&self,
f: F,
) -> Matrix<N2, R, C, <DefaultAllocator as Allocator<N2, R, C>>::Buffer>
pub fn map<N2, F>( &self, f: F, ) -> Matrix<N2, R, C, <DefaultAllocator as Allocator<N2, R, C>>::Buffer>
Returns a matrix containing the result of f
applied to each of its entries.
Sourcepub fn fold_with<N2>(
&self,
init_f: impl FnOnce(Option<&N>) -> N2,
f: impl FnMut(N2, &N) -> N2,
) -> N2
pub fn fold_with<N2>( &self, init_f: impl FnOnce(Option<&N>) -> N2, f: impl FnMut(N2, &N) -> N2, ) -> N2
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<N2, F>(
&self,
f: F,
) -> Matrix<N2, R, C, <DefaultAllocator as Allocator<N2, R, C>>::Buffer>
pub fn map_with_location<N2, F>( &self, f: F, ) -> Matrix<N2, R, C, <DefaultAllocator as Allocator<N2, R, C>>::Buffer>
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<N2, N3, S2, F>(
&self,
rhs: &Matrix<N2, R, C, S2>,
f: F,
) -> Matrix<N3, R, C, <DefaultAllocator as Allocator<N3, R, C>>::Buffer>
pub fn zip_map<N2, N3, S2, F>( &self, rhs: &Matrix<N2, R, C, S2>, f: F, ) -> Matrix<N3, R, C, <DefaultAllocator as Allocator<N3, R, C>>::Buffer>
Returns a matrix containing the result of f
applied to each entries of self
and
rhs
.
Sourcepub fn zip_zip_map<N2, N3, N4, S2, S3, F>(
&self,
b: &Matrix<N2, R, C, S2>,
c: &Matrix<N3, R, C, S3>,
f: F,
) -> Matrix<N4, R, C, <DefaultAllocator as Allocator<N4, R, C>>::Buffer>
pub fn zip_zip_map<N2, N3, N4, S2, S3, F>( &self, b: &Matrix<N2, R, C, S2>, c: &Matrix<N3, R, C, S3>, f: F, ) -> Matrix<N4, R, C, <DefaultAllocator as Allocator<N4, R, C>>::Buffer>
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, N) -> Acc) -> Acc
pub fn fold<Acc>(&self, init: Acc, f: impl FnMut(Acc, N) -> Acc) -> Acc
Folds a function f
on each entry of self
.
Sourcepub fn zip_fold<N2, R2, C2, S2, Acc>(
&self,
rhs: &Matrix<N2, R2, C2, S2>,
init: Acc,
f: impl FnMut(Acc, N, N2) -> Acc,
) -> Accwhere
N2: Scalar,
R2: Dim,
C2: Dim,
S2: Storage<N2, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn zip_fold<N2, R2, C2, S2, Acc>(
&self,
rhs: &Matrix<N2, R2, C2, S2>,
init: Acc,
f: impl FnMut(Acc, N, N2) -> Acc,
) -> Accwhere
N2: Scalar,
R2: Dim,
C2: Dim,
S2: Storage<N2, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
Folds a function f
on each pairs of entries from self
and rhs
.
Sourcepub fn transpose_to<R2, C2, SB>(&self, out: &mut Matrix<N, R2, C2, SB>)where
R2: Dim,
C2: Dim,
SB: StorageMut<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>,
pub fn transpose_to<R2, C2, SB>(&self, out: &mut Matrix<N, R2, C2, SB>)where
R2: Dim,
C2: Dim,
SB: StorageMut<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>,
Transposes self
and store the result into out
.
Sourcepub fn transpose(
&self,
) -> Matrix<N, C, R, <DefaultAllocator as Allocator<N, C, R>>::Buffer>where
DefaultAllocator: Allocator<N, C, R>,
pub fn transpose(
&self,
) -> Matrix<N, C, R, <DefaultAllocator as Allocator<N, C, R>>::Buffer>where
DefaultAllocator: Allocator<N, C, R>,
Transposes self
.
Sourcepub fn iter_mut(&mut self) -> MatrixIterMut<'_, N, R, C, S> ⓘ
pub fn iter_mut(&mut self) -> MatrixIterMut<'_, N, R, C, S> ⓘ
Mutably iterates through this matrix coordinates.
Sourcepub fn as_mut_ptr(&mut self) -> *mut N
pub fn as_mut_ptr(&mut self) -> *mut N
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 fn row_iter_mut(&mut self) -> RowIterMut<'_, N, R, C, S> ⓘ
pub fn row_iter_mut(&mut self) -> RowIterMut<'_, N, R, C, S> ⓘ
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<'_, N, R, C, S> ⓘ
pub fn column_iter_mut(&mut self) -> ColumnIterMut<'_, N, R, C, S> ⓘ
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 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: &[N])
pub fn copy_from_slice(&mut self, slice: &[N])
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<N, R2, C2, SB>)where
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn copy_from<R2, C2, SB>(&mut self, other: &Matrix<N, R2, C2, SB>)where
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + 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<N, R2, C2, SB>)where
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: DimEq<R, C2> + SameNumberOfColumns<C, R2>,
pub fn tr_copy_from<R2, C2, SB>(&mut self, other: &Matrix<N, R2, C2, SB>)where
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: DimEq<R, C2> + SameNumberOfColumns<C, R2>,
Fills this matrix with the content of the transpose another one.
Sourcepub fn apply<F>(&mut self, f: F)where
F: FnMut(N) -> N,
pub fn apply<F>(&mut self, f: F)where
F: FnMut(N) -> N,
Replaces each component of self
by the result of a closure f
applied on it.
Sourcepub fn zip_apply<N2, R2, C2, S2>(
&mut self,
rhs: &Matrix<N2, R2, C2, S2>,
f: impl FnMut(N, N2) -> N,
)where
N2: Scalar,
R2: Dim,
C2: Dim,
S2: Storage<N2, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn zip_apply<N2, R2, C2, S2>(
&mut self,
rhs: &Matrix<N2, R2, C2, S2>,
f: impl FnMut(N, N2) -> N,
)where
N2: Scalar,
R2: Dim,
C2: Dim,
S2: Storage<N2, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + 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<N2, R2, C2, S2, N3, R3, C3, S3>(
&mut self,
b: &Matrix<N2, R2, C2, S2>,
c: &Matrix<N3, R3, C3, S3>,
f: impl FnMut(N, N2, N3) -> N,
)where
N2: Scalar,
R2: Dim,
C2: Dim,
S2: Storage<N2, R2, C2>,
N3: Scalar,
R3: Dim,
C3: Dim,
S3: Storage<N3, R3, C3>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn zip_zip_apply<N2, R2, C2, S2, N3, R3, C3, S3>(
&mut self,
b: &Matrix<N2, R2, C2, S2>,
c: &Matrix<N3, R3, C3, S3>,
f: impl FnMut(N, N2, N3) -> N,
)where
N2: Scalar,
R2: Dim,
C2: Dim,
S2: Storage<N2, R2, C2>,
N3: Scalar,
R3: Dim,
C3: Dim,
S3: Storage<N3, R3, C3>,
ShapeConstraint: SameNumberOfRows<R, R2> + 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 unsafe fn vget_unchecked(&self, i: usize) -> &N
pub unsafe fn vget_unchecked(&self, i: usize) -> &N
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 N
pub unsafe fn vget_unchecked_mut(&mut self, i: usize) -> &mut N
Gets a mutable reference to the i-th element of this column vector without bound checking.
Sourcepub fn as_slice(&self) -> &[N]
pub fn as_slice(&self) -> &[N]
Extracts a slice containing the entire matrix entries ordered column-by-columns.
Sourcepub fn as_mut_slice(&mut self) -> &mut [N]
pub fn as_mut_slice(&mut self) -> &mut [N]
Extracts a mutable slice containing the entire matrix entries ordered column-by-columns.
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<N, R2, C2, SB>)where
R2: Dim,
C2: Dim,
SB: StorageMut<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>,
pub fn adjoint_to<R2, C2, SB>(&self, out: &mut Matrix<N, R2, C2, SB>)where
R2: Dim,
C2: Dim,
SB: StorageMut<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>,
Takes the adjoint (aka. conjugate-transpose) of self
and store the result into out
.
Sourcepub fn adjoint(
&self,
) -> Matrix<N, C, R, <DefaultAllocator as Allocator<N, C, R>>::Buffer>where
DefaultAllocator: Allocator<N, C, R>,
pub fn adjoint(
&self,
) -> Matrix<N, C, R, <DefaultAllocator as Allocator<N, C, R>>::Buffer>where
DefaultAllocator: Allocator<N, C, R>,
The adjoint (aka. conjugate-transpose) of self
.
Sourcepub fn conjugate_transpose_to<R2, C2, SB>(
&self,
out: &mut Matrix<N, R2, C2, SB>,
)where
R2: Dim,
C2: Dim,
SB: StorageMut<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>,
👎Deprecated: Renamed self.adjoint_to(out)
.
pub fn conjugate_transpose_to<R2, C2, SB>(
&self,
out: &mut Matrix<N, R2, C2, SB>,
)where
R2: Dim,
C2: Dim,
SB: StorageMut<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>,
self.adjoint_to(out)
.Takes the conjugate and transposes self
and store the result into out
.
Sourcepub fn conjugate_transpose(
&self,
) -> Matrix<N, C, R, <DefaultAllocator as Allocator<N, C, R>>::Buffer>where
DefaultAllocator: Allocator<N, C, R>,
👎Deprecated: Renamed self.adjoint()
.
pub fn conjugate_transpose(
&self,
) -> Matrix<N, C, R, <DefaultAllocator as Allocator<N, C, R>>::Buffer>where
DefaultAllocator: Allocator<N, C, R>,
self.adjoint()
.The conjugate transposition of self
.
Sourcepub fn conjugate(
&self,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
pub fn conjugate(
&self,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
The conjugate of self
.
Sourcepub fn unscale(
&self,
real: <N as SimdComplexField>::SimdRealField,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
pub fn unscale(
&self,
real: <N as SimdComplexField>::SimdRealField,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
Divides each component of the complex matrix self
by the given real.
Sourcepub fn scale(
&self,
real: <N as SimdComplexField>::SimdRealField,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
pub fn scale(
&self,
real: <N as SimdComplexField>::SimdRealField,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, 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: <N as SimdComplexField>::SimdRealField)
pub fn unscale_mut(&mut self, real: <N as SimdComplexField>::SimdRealField)
Divides each component of the complex matrix self
by the given real.
Sourcepub fn scale_mut(&mut self, real: <N as SimdComplexField>::SimdRealField)
pub fn scale_mut(&mut self, real: <N 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)
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<N, D, U1, <DefaultAllocator as Allocator<N, D>>::Buffer>where
DefaultAllocator: Allocator<N, D>,
pub fn diagonal(
&self,
) -> Matrix<N, D, U1, <DefaultAllocator as Allocator<N, D>>::Buffer>where
DefaultAllocator: Allocator<N, D>,
The diagonal of this matrix.
Sourcepub fn map_diagonal<N2>(
&self,
f: impl FnMut(N) -> N2,
) -> Matrix<N2, D, U1, <DefaultAllocator as Allocator<N2, D>>::Buffer>
pub fn map_diagonal<N2>( &self, f: impl FnMut(N) -> N2, ) -> Matrix<N2, D, U1, <DefaultAllocator as Allocator<N2, D>>::Buffer>
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 trace(&self) -> N
pub fn trace(&self) -> N
Computes a trace of a square matrix, i.e., the sum of its diagonal elements.
Sourcepub fn symmetric_part(
&self,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>where
DefaultAllocator: Allocator<N, D, D>,
pub fn symmetric_part(
&self,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>where
DefaultAllocator: Allocator<N, D, D>,
The symmetric part of self
, i.e., 0.5 * (self + self.transpose())
.
Sourcepub fn hermitian_part(
&self,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>where
DefaultAllocator: Allocator<N, D, D>,
pub fn hermitian_part(
&self,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>where
DefaultAllocator: Allocator<N, D, D>,
The hermitian part of self
, i.e., 0.5 * (self + self.adjoint())
.
Sourcepub fn to_homogeneous(
&self,
) -> Matrix<N, <D as DimAdd<U1>>::Output, <D as DimAdd<U1>>::Output, <DefaultAllocator as Allocator<N, <D as DimAdd<U1>>::Output, <D as DimAdd<U1>>::Output>>::Buffer>
pub fn to_homogeneous( &self, ) -> Matrix<N, <D as DimAdd<U1>>::Output, <D as DimAdd<U1>>::Output, <DefaultAllocator as Allocator<N, <D as DimAdd<U1>>::Output, <D as DimAdd<U1>>::Output>>::Buffer>
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<N, <D as DimAdd<U1>>::Output, U1, <DefaultAllocator as Allocator<N, <D as DimAdd<U1>>::Output>>::Buffer>
pub fn to_homogeneous( &self, ) -> Matrix<N, <D as DimAdd<U1>>::Output, U1, <DefaultAllocator as Allocator<N, <D as DimAdd<U1>>::Output>>::Buffer>
Computes the coordinates in projective space of this vector, i.e., appends a 0
to its
coordinates.
Sourcepub fn push(
&self,
element: N,
) -> Matrix<N, <D as DimAdd<U1>>::Output, U1, <DefaultAllocator as Allocator<N, <D as DimAdd<U1>>::Output>>::Buffer>
pub fn push( &self, element: N, ) -> Matrix<N, <D as DimAdd<U1>>::Output, U1, <DefaultAllocator as Allocator<N, <D as DimAdd<U1>>::Output>>::Buffer>
Constructs a new vector of higher dimension by appending element
to the end of self
.
Sourcepub fn perp<R2, C2, SB>(&self, b: &Matrix<N, R2, C2, SB>) -> Nwhere
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, U2> + SameNumberOfColumns<C, U1> + SameNumberOfRows<R2, U2> + SameNumberOfColumns<C2, U1>,
pub fn perp<R2, C2, SB>(&self, b: &Matrix<N, R2, C2, SB>) -> Nwhere
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, U2> + SameNumberOfColumns<C, U1> + SameNumberOfRows<R2, U2> + SameNumberOfColumns<C2, U1>,
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<N, R2, C2, SB>,
) -> Matrix<N, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative, <DefaultAllocator as Allocator<N, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative>>::Buffer>where
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
DefaultAllocator: SameShapeAllocator<N, R, C, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn cross<R2, C2, SB>(
&self,
b: &Matrix<N, R2, C2, SB>,
) -> Matrix<N, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative, <DefaultAllocator as Allocator<N, <ShapeConstraint as SameNumberOfRows<R, R2>>::Representative, <ShapeConstraint as SameNumberOfColumns<C, C2>>::Representative>>::Buffer>where
R2: Dim,
C2: Dim,
SB: Storage<N, R2, C2>,
DefaultAllocator: SameShapeAllocator<N, R, C, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + 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<N, U3, U3, <DefaultAllocator as Allocator<N, U3, U3>>::Buffer>
pub fn cross_matrix( &self, ) -> Matrix<N, U3, U3, <DefaultAllocator as Allocator<N, U3, U3>>::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<N, R2, C2, SB>,
) -> <N as SimdComplexField>::SimdRealField
pub fn angle<R2, C2, SB>( &self, other: &Matrix<N, R2, C2, SB>, ) -> <N as SimdComplexField>::SimdRealField
The smallest angle between two vectors.
Sourcepub fn lerp<S2>(
&self,
rhs: &Matrix<N, D, U1, S2>,
t: N,
) -> Matrix<N, D, U1, <DefaultAllocator as Allocator<N, D>>::Buffer>
pub fn lerp<S2>( &self, rhs: &Matrix<N, D, U1, S2>, t: N, ) -> Matrix<N, D, U1, <DefaultAllocator as Allocator<N, D>>::Buffer>
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 row(
&self,
i: usize,
) -> Matrix<N, U1, C, SliceStorage<'_, N, U1, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn row( &self, i: usize, ) -> Matrix<N, U1, C, SliceStorage<'_, N, U1, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
Returns a slice containing the i-th row of this matrix.
Sourcepub fn row_part(
&self,
i: usize,
n: usize,
) -> Matrix<N, U1, Dynamic, SliceStorage<'_, N, U1, Dynamic, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn row_part( &self, i: usize, n: usize, ) -> Matrix<N, U1, Dynamic, SliceStorage<'_, N, U1, Dynamic, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, Dynamic, C, SliceStorage<'_, N, Dynamic, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn rows( &self, first_row: usize, nrows: usize, ) -> Matrix<N, Dynamic, C, SliceStorage<'_, N, Dynamic, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, Dynamic, C, SliceStorage<'_, N, Dynamic, C, Dynamic, <S as Storage<N, R, C>>::CStride>>
pub fn rows_with_step( &self, first_row: usize, nrows: usize, step: usize, ) -> Matrix<N, Dynamic, C, SliceStorage<'_, N, Dynamic, C, Dynamic, <S as Storage<N, R, C>>::CStride>>
Extracts from this matrix a set of consecutive rows regularly skipping step
rows.
Sourcepub fn fixed_rows<RSlice>(
&self,
first_row: usize,
) -> Matrix<N, RSlice, C, SliceStorage<'_, N, RSlice, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
RSlice: DimName,
pub fn fixed_rows<RSlice>(
&self,
first_row: usize,
) -> Matrix<N, RSlice, C, SliceStorage<'_, N, RSlice, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
RSlice: DimName,
Extracts a compile-time number of consecutive rows from this matrix.
Sourcepub fn fixed_rows_with_step<RSlice>(
&self,
first_row: usize,
step: usize,
) -> Matrix<N, RSlice, C, SliceStorage<'_, N, RSlice, C, Dynamic, <S as Storage<N, R, C>>::CStride>>where
RSlice: DimName,
pub fn fixed_rows_with_step<RSlice>(
&self,
first_row: usize,
step: usize,
) -> Matrix<N, RSlice, C, SliceStorage<'_, N, RSlice, C, Dynamic, <S as Storage<N, R, C>>::CStride>>where
RSlice: DimName,
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<N, RSlice, C, SliceStorage<'_, N, RSlice, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
RSlice: Dim,
pub fn rows_generic<RSlice>(
&self,
row_start: usize,
nrows: RSlice,
) -> Matrix<N, RSlice, C, SliceStorage<'_, N, RSlice, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, RSlice, C, SliceStorage<'_, N, RSlice, C, Dynamic, <S as Storage<N, R, C>>::CStride>>where
RSlice: Dim,
pub fn rows_generic_with_step<RSlice>(
&self,
row_start: usize,
nrows: RSlice,
step: usize,
) -> Matrix<N, RSlice, C, SliceStorage<'_, N, RSlice, C, Dynamic, <S as Storage<N, 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<N, R, U1, SliceStorage<'_, N, R, U1, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn column( &self, i: usize, ) -> Matrix<N, R, U1, SliceStorage<'_, N, R, U1, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
Returns a slice containing the i-th column of this matrix.
Sourcepub fn column_part(
&self,
i: usize,
n: usize,
) -> Matrix<N, Dynamic, U1, SliceStorage<'_, N, Dynamic, U1, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn column_part( &self, i: usize, n: usize, ) -> Matrix<N, Dynamic, U1, SliceStorage<'_, N, Dynamic, U1, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, R, Dynamic, SliceStorage<'_, N, R, Dynamic, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn columns( &self, first_col: usize, ncols: usize, ) -> Matrix<N, R, Dynamic, SliceStorage<'_, N, R, Dynamic, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, R, Dynamic, SliceStorage<'_, N, R, Dynamic, <S as Storage<N, R, C>>::RStride, Dynamic>>
pub fn columns_with_step( &self, first_col: usize, ncols: usize, step: usize, ) -> Matrix<N, R, Dynamic, SliceStorage<'_, N, R, Dynamic, <S as Storage<N, R, C>>::RStride, Dynamic>>
Extracts from this matrix a set of consecutive columns regularly skipping step
columns.
Sourcepub fn fixed_columns<CSlice>(
&self,
first_col: usize,
) -> Matrix<N, R, CSlice, SliceStorage<'_, N, R, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
CSlice: DimName,
pub fn fixed_columns<CSlice>(
&self,
first_col: usize,
) -> Matrix<N, R, CSlice, SliceStorage<'_, N, R, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
CSlice: DimName,
Extracts a compile-time number of consecutive columns from this matrix.
Sourcepub fn fixed_columns_with_step<CSlice>(
&self,
first_col: usize,
step: usize,
) -> Matrix<N, R, CSlice, SliceStorage<'_, N, R, CSlice, <S as Storage<N, R, C>>::RStride, Dynamic>>where
CSlice: DimName,
pub fn fixed_columns_with_step<CSlice>(
&self,
first_col: usize,
step: usize,
) -> Matrix<N, R, CSlice, SliceStorage<'_, N, R, CSlice, <S as Storage<N, R, C>>::RStride, Dynamic>>where
CSlice: DimName,
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<N, R, CSlice, SliceStorage<'_, N, R, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
CSlice: Dim,
pub fn columns_generic<CSlice>(
&self,
first_col: usize,
ncols: CSlice,
) -> Matrix<N, R, CSlice, SliceStorage<'_, N, R, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, R, CSlice, SliceStorage<'_, N, R, CSlice, <S as Storage<N, R, C>>::RStride, Dynamic>>where
CSlice: Dim,
pub fn columns_generic_with_step<CSlice>(
&self,
first_col: usize,
ncols: CSlice,
step: usize,
) -> Matrix<N, R, CSlice, SliceStorage<'_, N, R, CSlice, <S as Storage<N, 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<N, Dynamic, Dynamic, SliceStorage<'_, N, Dynamic, Dynamic, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn slice( &self, start: (usize, usize), shape: (usize, usize), ) -> Matrix<N, Dynamic, Dynamic, SliceStorage<'_, N, Dynamic, Dynamic, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, Dynamic, Dynamic, SliceStorage<'_, N, Dynamic, Dynamic, Dynamic, Dynamic>>
pub fn slice_with_steps( &self, start: (usize, usize), shape: (usize, usize), steps: (usize, usize), ) -> Matrix<N, Dynamic, Dynamic, SliceStorage<'_, N, 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<RSlice, CSlice>(
&self,
irow: usize,
icol: usize,
) -> Matrix<N, RSlice, CSlice, SliceStorage<'_, N, RSlice, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn fixed_slice<RSlice, CSlice>( &self, irow: usize, icol: usize, ) -> Matrix<N, RSlice, CSlice, SliceStorage<'_, N, RSlice, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<RSlice, CSlice>(
&self,
start: (usize, usize),
steps: (usize, usize),
) -> Matrix<N, RSlice, CSlice, SliceStorage<'_, N, RSlice, CSlice, Dynamic, Dynamic>>
pub fn fixed_slice_with_steps<RSlice, CSlice>( &self, start: (usize, usize), steps: (usize, usize), ) -> Matrix<N, RSlice, CSlice, SliceStorage<'_, N, RSlice, CSlice, Dynamic, Dynamic>>
Slices this matrix starting at its component (start.0, start.1)
and with
(R::dim(), CSlice::dim())
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<N, RSlice, CSlice, SliceStorage<'_, N, RSlice, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn generic_slice<RSlice, CSlice>( &self, start: (usize, usize), shape: (RSlice, CSlice), ) -> Matrix<N, RSlice, CSlice, SliceStorage<'_, N, RSlice, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
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<N, RSlice, CSlice, SliceStorage<'_, N, RSlice, CSlice, Dynamic, Dynamic>>
pub fn generic_slice_with_steps<RSlice, CSlice>( &self, start: (usize, usize), shape: (RSlice, CSlice), steps: (usize, usize), ) -> Matrix<N, RSlice, CSlice, SliceStorage<'_, N, RSlice, CSlice, Dynamic, Dynamic>>
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<N, <Range1 as SliceRange<R>>::Size, C, SliceStorage<'_, N, <Range1 as SliceRange<R>>::Size, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>, Matrix<N, <Range2 as SliceRange<R>>::Size, C, SliceStorage<'_, N, <Range2 as SliceRange<R>>::Size, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>)where
Range1: SliceRange<R>,
Range2: SliceRange<R>,
pub fn rows_range_pair<Range1, Range2>(
&self,
r1: Range1,
r2: Range2,
) -> (Matrix<N, <Range1 as SliceRange<R>>::Size, C, SliceStorage<'_, N, <Range1 as SliceRange<R>>::Size, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>, Matrix<N, <Range2 as SliceRange<R>>::Size, C, SliceStorage<'_, N, <Range2 as SliceRange<R>>::Size, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, R, <Range1 as SliceRange<C>>::Size, SliceStorage<'_, N, R, <Range1 as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>, Matrix<N, R, <Range2 as SliceRange<C>>::Size, SliceStorage<'_, N, R, <Range2 as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>)where
Range1: SliceRange<C>,
Range2: SliceRange<C>,
pub fn columns_range_pair<Range1, Range2>(
&self,
r1: Range1,
r2: Range2,
) -> (Matrix<N, R, <Range1 as SliceRange<C>>::Size, SliceStorage<'_, N, R, <Range1 as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>, Matrix<N, R, <Range2 as SliceRange<C>>::Size, SliceStorage<'_, N, R, <Range2 as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, U1, C, SliceStorageMut<'_, N, U1, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn row_mut( &mut self, i: usize, ) -> Matrix<N, U1, C, SliceStorageMut<'_, N, U1, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, U1, Dynamic, SliceStorageMut<'_, N, U1, Dynamic, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn row_part_mut( &mut self, i: usize, n: usize, ) -> Matrix<N, U1, Dynamic, SliceStorageMut<'_, N, U1, Dynamic, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, Dynamic, C, SliceStorageMut<'_, N, Dynamic, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn rows_mut( &mut self, first_row: usize, nrows: usize, ) -> Matrix<N, Dynamic, C, SliceStorageMut<'_, N, Dynamic, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, Dynamic, C, SliceStorageMut<'_, N, Dynamic, C, Dynamic, <S as Storage<N, R, C>>::CStride>>
pub fn rows_with_step_mut( &mut self, first_row: usize, nrows: usize, step: usize, ) -> Matrix<N, Dynamic, C, SliceStorageMut<'_, N, Dynamic, C, Dynamic, <S as Storage<N, R, C>>::CStride>>
Extracts from this matrix a set of consecutive rows regularly skipping step
rows.
Sourcepub fn fixed_rows_mut<RSlice>(
&mut self,
first_row: usize,
) -> Matrix<N, RSlice, C, SliceStorageMut<'_, N, RSlice, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
RSlice: DimName,
pub fn fixed_rows_mut<RSlice>(
&mut self,
first_row: usize,
) -> Matrix<N, RSlice, C, SliceStorageMut<'_, N, RSlice, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
RSlice: DimName,
Extracts a compile-time number of consecutive rows from this matrix.
Sourcepub fn fixed_rows_with_step_mut<RSlice>(
&mut self,
first_row: usize,
step: usize,
) -> Matrix<N, RSlice, C, SliceStorageMut<'_, N, RSlice, C, Dynamic, <S as Storage<N, R, C>>::CStride>>where
RSlice: DimName,
pub fn fixed_rows_with_step_mut<RSlice>(
&mut self,
first_row: usize,
step: usize,
) -> Matrix<N, RSlice, C, SliceStorageMut<'_, N, RSlice, C, Dynamic, <S as Storage<N, R, C>>::CStride>>where
RSlice: DimName,
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<N, RSlice, C, SliceStorageMut<'_, N, RSlice, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
RSlice: Dim,
pub fn rows_generic_mut<RSlice>(
&mut self,
row_start: usize,
nrows: RSlice,
) -> Matrix<N, RSlice, C, SliceStorageMut<'_, N, RSlice, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, RSlice, C, SliceStorageMut<'_, N, RSlice, C, Dynamic, <S as Storage<N, R, C>>::CStride>>where
RSlice: Dim,
pub fn rows_generic_with_step_mut<RSlice>(
&mut self,
row_start: usize,
nrows: RSlice,
step: usize,
) -> Matrix<N, RSlice, C, SliceStorageMut<'_, N, RSlice, C, Dynamic, <S as Storage<N, 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<N, R, U1, SliceStorageMut<'_, N, R, U1, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn column_mut( &mut self, i: usize, ) -> Matrix<N, R, U1, SliceStorageMut<'_, N, R, U1, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, Dynamic, U1, SliceStorageMut<'_, N, Dynamic, U1, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn column_part_mut( &mut self, i: usize, n: usize, ) -> Matrix<N, Dynamic, U1, SliceStorageMut<'_, N, Dynamic, U1, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, R, Dynamic, SliceStorageMut<'_, N, R, Dynamic, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn columns_mut( &mut self, first_col: usize, ncols: usize, ) -> Matrix<N, R, Dynamic, SliceStorageMut<'_, N, R, Dynamic, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, R, Dynamic, SliceStorageMut<'_, N, R, Dynamic, <S as Storage<N, R, C>>::RStride, Dynamic>>
pub fn columns_with_step_mut( &mut self, first_col: usize, ncols: usize, step: usize, ) -> Matrix<N, R, Dynamic, SliceStorageMut<'_, N, R, Dynamic, <S as Storage<N, R, C>>::RStride, Dynamic>>
Extracts from this matrix a set of consecutive columns regularly skipping step
columns.
Sourcepub fn fixed_columns_mut<CSlice>(
&mut self,
first_col: usize,
) -> Matrix<N, R, CSlice, SliceStorageMut<'_, N, R, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
CSlice: DimName,
pub fn fixed_columns_mut<CSlice>(
&mut self,
first_col: usize,
) -> Matrix<N, R, CSlice, SliceStorageMut<'_, N, R, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
CSlice: DimName,
Extracts a compile-time number of consecutive columns from this matrix.
Sourcepub fn fixed_columns_with_step_mut<CSlice>(
&mut self,
first_col: usize,
step: usize,
) -> Matrix<N, R, CSlice, SliceStorageMut<'_, N, R, CSlice, <S as Storage<N, R, C>>::RStride, Dynamic>>where
CSlice: DimName,
pub fn fixed_columns_with_step_mut<CSlice>(
&mut self,
first_col: usize,
step: usize,
) -> Matrix<N, R, CSlice, SliceStorageMut<'_, N, R, CSlice, <S as Storage<N, R, C>>::RStride, Dynamic>>where
CSlice: DimName,
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<N, R, CSlice, SliceStorageMut<'_, N, R, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
CSlice: Dim,
pub fn columns_generic_mut<CSlice>(
&mut self,
first_col: usize,
ncols: CSlice,
) -> Matrix<N, R, CSlice, SliceStorageMut<'_, N, R, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, R, CSlice, SliceStorageMut<'_, N, R, CSlice, <S as Storage<N, 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<N, R, CSlice, SliceStorageMut<'_, N, R, CSlice, <S as Storage<N, 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<N, Dynamic, Dynamic, SliceStorageMut<'_, N, Dynamic, Dynamic, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn slice_mut( &mut self, start: (usize, usize), shape: (usize, usize), ) -> Matrix<N, Dynamic, Dynamic, SliceStorageMut<'_, N, Dynamic, Dynamic, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, Dynamic, Dynamic, SliceStorageMut<'_, N, Dynamic, Dynamic, Dynamic, Dynamic>>
pub fn slice_with_steps_mut( &mut self, start: (usize, usize), shape: (usize, usize), steps: (usize, usize), ) -> Matrix<N, Dynamic, Dynamic, SliceStorageMut<'_, N, 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<RSlice, CSlice>(
&mut self,
irow: usize,
icol: usize,
) -> Matrix<N, RSlice, CSlice, SliceStorageMut<'_, N, RSlice, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn fixed_slice_mut<RSlice, CSlice>( &mut self, irow: usize, icol: usize, ) -> Matrix<N, RSlice, CSlice, SliceStorageMut<'_, N, RSlice, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<RSlice, CSlice>(
&mut self,
start: (usize, usize),
steps: (usize, usize),
) -> Matrix<N, RSlice, CSlice, SliceStorageMut<'_, N, RSlice, CSlice, Dynamic, Dynamic>>
pub fn fixed_slice_with_steps_mut<RSlice, CSlice>( &mut self, start: (usize, usize), steps: (usize, usize), ) -> Matrix<N, RSlice, CSlice, SliceStorageMut<'_, N, RSlice, CSlice, Dynamic, Dynamic>>
Slices this matrix starting at its component (start.0, start.1)
and with
(R::dim(), CSlice::dim())
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<N, RSlice, CSlice, SliceStorageMut<'_, N, RSlice, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
pub fn generic_slice_mut<RSlice, CSlice>( &mut self, start: (usize, usize), shape: (RSlice, CSlice), ) -> Matrix<N, RSlice, CSlice, SliceStorageMut<'_, N, RSlice, CSlice, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>
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<N, RSlice, CSlice, SliceStorageMut<'_, N, RSlice, CSlice, Dynamic, Dynamic>>
pub fn generic_slice_with_steps_mut<RSlice, CSlice>( &mut self, start: (usize, usize), shape: (RSlice, CSlice), steps: (usize, usize), ) -> Matrix<N, RSlice, CSlice, SliceStorageMut<'_, N, RSlice, CSlice, Dynamic, Dynamic>>
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<N, <Range1 as SliceRange<R>>::Size, C, SliceStorageMut<'_, N, <Range1 as SliceRange<R>>::Size, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>, Matrix<N, <Range2 as SliceRange<R>>::Size, C, SliceStorageMut<'_, N, <Range2 as SliceRange<R>>::Size, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, <Range1 as SliceRange<R>>::Size, C, SliceStorageMut<'_, N, <Range1 as SliceRange<R>>::Size, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>, Matrix<N, <Range2 as SliceRange<R>>::Size, C, SliceStorageMut<'_, N, <Range2 as SliceRange<R>>::Size, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, R, <Range1 as SliceRange<C>>::Size, SliceStorageMut<'_, N, R, <Range1 as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>, Matrix<N, R, <Range2 as SliceRange<C>>::Size, SliceStorageMut<'_, N, R, <Range2 as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, R, <Range1 as SliceRange<C>>::Size, SliceStorageMut<'_, N, R, <Range1 as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>, Matrix<N, R, <Range2 as SliceRange<C>>::Size, SliceStorageMut<'_, N, R, <Range2 as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, SliceStorage<'_, N, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
RowRange: SliceRange<R>,
ColRange: SliceRange<C>,
pub fn slice_range<RowRange, ColRange>(
&self,
rows: RowRange,
cols: ColRange,
) -> Matrix<N, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, SliceStorage<'_, N, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, <RowRange as SliceRange<R>>::Size, C, SliceStorage<'_, N, <RowRange as SliceRange<R>>::Size, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
RowRange: SliceRange<R>,
pub fn rows_range<RowRange>(
&self,
rows: RowRange,
) -> Matrix<N, <RowRange as SliceRange<R>>::Size, C, SliceStorage<'_, N, <RowRange as SliceRange<R>>::Size, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, R, <ColRange as SliceRange<C>>::Size, SliceStorage<'_, N, R, <ColRange as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
ColRange: SliceRange<C>,
pub fn columns_range<ColRange>(
&self,
cols: ColRange,
) -> Matrix<N, R, <ColRange as SliceRange<C>>::Size, SliceStorage<'_, N, R, <ColRange as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, SliceStorageMut<'_, N, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
RowRange: SliceRange<R>,
ColRange: SliceRange<C>,
pub fn slice_range_mut<RowRange, ColRange>(
&mut self,
rows: RowRange,
cols: ColRange,
) -> Matrix<N, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, SliceStorageMut<'_, N, <RowRange as SliceRange<R>>::Size, <ColRange as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, <RowRange as SliceRange<R>>::Size, C, SliceStorageMut<'_, N, <RowRange as SliceRange<R>>::Size, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
RowRange: SliceRange<R>,
pub fn rows_range_mut<RowRange>(
&mut self,
rows: RowRange,
) -> Matrix<N, <RowRange as SliceRange<R>>::Size, C, SliceStorageMut<'_, N, <RowRange as SliceRange<R>>::Size, C, <S as Storage<N, R, C>>::RStride, <S as Storage<N, 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<N, R, <ColRange as SliceRange<C>>::Size, SliceStorageMut<'_, N, R, <ColRange as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
ColRange: SliceRange<C>,
pub fn columns_range_mut<ColRange>(
&mut self,
cols: ColRange,
) -> Matrix<N, R, <ColRange as SliceRange<C>>::Size, SliceStorageMut<'_, N, R, <ColRange as SliceRange<C>>::Size, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>where
ColRange: SliceRange<C>,
Slice containing all the columns indexed by the range cols
.
Sourcepub fn norm_squared(&self) -> <N as SimdComplexField>::SimdRealField
pub fn norm_squared(&self) -> <N as SimdComplexField>::SimdRealField
The squared L2 norm of this vector.
Sourcepub fn norm(&self) -> <N as SimdComplexField>::SimdRealField
pub fn norm(&self) -> <N as SimdComplexField>::SimdRealField
The L2 norm of this matrix.
Use .apply_norm
to apply a custom norm.
Sourcepub fn metric_distance<R2, C2, S2>(
&self,
rhs: &Matrix<N, R2, C2, S2>,
) -> <N as SimdComplexField>::SimdRealFieldwhere
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn metric_distance<R2, C2, S2>(
&self,
rhs: &Matrix<N, R2, C2, S2>,
) -> <N as SimdComplexField>::SimdRealFieldwhere
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + 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<N>,
) -> <N as SimdComplexField>::SimdRealField
pub fn apply_norm( &self, norm: &impl Norm<N>, ) -> <N as SimdComplexField>::SimdRealField
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<N, R2, C2, S2>,
norm: &impl Norm<N>,
) -> <N as SimdComplexField>::SimdRealFieldwhere
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn apply_metric_distance<R2, C2, S2>(
&self,
rhs: &Matrix<N, R2, C2, S2>,
norm: &impl Norm<N>,
) -> <N as SimdComplexField>::SimdRealFieldwhere
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + 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) -> <N as SimdComplexField>::SimdRealField
pub fn magnitude(&self) -> <N as SimdComplexField>::SimdRealField
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) -> <N as SimdComplexField>::SimdRealField
pub fn magnitude_squared(&self) -> <N as SimdComplexField>::SimdRealField
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: <N as SimdComplexField>::SimdRealField,
)where
S: StorageMut<N, R, C>,
pub fn set_magnitude(
&mut self,
magnitude: <N as SimdComplexField>::SimdRealField,
)where
S: StorageMut<N, R, C>,
Sets the magnitude of this vector.
Sourcepub fn normalize(
&self,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
pub fn normalize(
&self,
) -> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>where
DefaultAllocator: Allocator<N, R, C>,
Returns a normalized version of this matrix.
Sourcepub fn lp_norm(&self, p: i32) -> <N as SimdComplexField>::SimdRealField
pub fn lp_norm(&self, p: i32) -> <N as SimdComplexField>::SimdRealField
The Lp norm of this matrix.
Sourcepub fn simd_try_normalize(
&self,
min_norm: <N as SimdComplexField>::SimdRealField,
) -> SimdOption<Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>>
pub fn simd_try_normalize( &self, min_norm: <N as SimdComplexField>::SimdRealField, ) -> SimdOption<Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>>
Attempts to normalize self
.
The components of this matrix can be SIMD types.
Sourcepub fn try_set_magnitude(
&mut self,
magnitude: <N as ComplexField>::RealField,
min_magnitude: <N as ComplexField>::RealField,
)where
S: StorageMut<N, R, C>,
pub fn try_set_magnitude(
&mut self,
magnitude: <N as ComplexField>::RealField,
min_magnitude: <N as ComplexField>::RealField,
)where
S: StorageMut<N, 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 try_normalize(
&self,
min_norm: <N as ComplexField>::RealField,
) -> Option<Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>>where
DefaultAllocator: Allocator<N, R, C>,
pub fn try_normalize(
&self,
min_norm: <N as ComplexField>::RealField,
) -> Option<Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>>where
DefaultAllocator: Allocator<N, 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) -> <N as SimdComplexField>::SimdRealField
pub fn normalize_mut(&mut self) -> <N as SimdComplexField>::SimdRealField
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: <N as SimdComplexField>::SimdRealField,
) -> SimdOption<<N as SimdComplexField>::SimdRealField>
pub fn simd_try_normalize_mut( &mut self, min_norm: <N as SimdComplexField>::SimdRealField, ) -> SimdOption<<N as SimdComplexField>::SimdRealField>
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: <N as ComplexField>::RealField,
) -> Option<<N as ComplexField>::RealField>
pub fn try_normalize_mut( &mut self, min_norm: <N as ComplexField>::RealField, ) -> Option<<N as ComplexField>::RealField>
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 is_identity(&self, eps: <N as AbsDiffEq>::Epsilon) -> bool
pub fn is_identity(&self, eps: <N as AbsDiffEq>::Epsilon) -> bool
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: <N as AbsDiffEq>::Epsilon) -> bool
pub fn is_orthogonal(&self, eps: <N as AbsDiffEq>::Epsilon) -> bool
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: N) -> bool
pub fn is_special_orthogonal(&self, eps: N) -> bool
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<N, R, U1, SliceStorage<'_, N, R, U1, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>) -> N,
) -> Matrix<N, U1, C, <DefaultAllocator as Allocator<N, U1, C>>::Buffer>
pub fn compress_rows( &self, f: impl Fn(Matrix<N, R, U1, SliceStorage<'_, N, R, U1, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>) -> N, ) -> Matrix<N, U1, C, <DefaultAllocator as Allocator<N, U1, C>>::Buffer>
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<N, R, U1, SliceStorage<'_, N, R, U1, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>) -> N,
) -> Matrix<N, C, U1, <DefaultAllocator as Allocator<N, C>>::Buffer>where
DefaultAllocator: Allocator<N, C>,
pub fn compress_rows_tr(
&self,
f: impl Fn(Matrix<N, R, U1, SliceStorage<'_, N, R, U1, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>) -> N,
) -> Matrix<N, C, U1, <DefaultAllocator as Allocator<N, C>>::Buffer>where
DefaultAllocator: Allocator<N, C>,
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<N, R, U1, <DefaultAllocator as Allocator<N, R>>::Buffer>,
f: impl Fn(&mut Matrix<N, R, U1, <DefaultAllocator as Allocator<N, R>>::Buffer>, Matrix<N, R, U1, SliceStorage<'_, N, R, U1, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>),
) -> Matrix<N, R, U1, <DefaultAllocator as Allocator<N, R>>::Buffer>where
DefaultAllocator: Allocator<N, R>,
pub fn compress_columns(
&self,
init: Matrix<N, R, U1, <DefaultAllocator as Allocator<N, R>>::Buffer>,
f: impl Fn(&mut Matrix<N, R, U1, <DefaultAllocator as Allocator<N, R>>::Buffer>, Matrix<N, R, U1, SliceStorage<'_, N, R, U1, <S as Storage<N, R, C>>::RStride, <S as Storage<N, R, C>>::CStride>>),
) -> Matrix<N, R, U1, <DefaultAllocator as Allocator<N, R>>::Buffer>where
DefaultAllocator: Allocator<N, R>,
Returns a column vector resulting from the folding of f
on each column of this matrix.
Sourcepub fn sum(&self) -> N
pub fn sum(&self) -> N
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<N, U1, C, <DefaultAllocator as Allocator<N, U1, C>>::Buffer>
pub fn row_sum( &self, ) -> Matrix<N, U1, C, <DefaultAllocator as Allocator<N, U1, C>>::Buffer>
The sum 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_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<N, C, U1, <DefaultAllocator as Allocator<N, C>>::Buffer>where
DefaultAllocator: Allocator<N, C>,
pub fn row_sum_tr(
&self,
) -> Matrix<N, C, U1, <DefaultAllocator as Allocator<N, C>>::Buffer>where
DefaultAllocator: Allocator<N, C>,
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<N, R, U1, <DefaultAllocator as Allocator<N, R>>::Buffer>where
DefaultAllocator: Allocator<N, R>,
pub fn column_sum(
&self,
) -> Matrix<N, R, U1, <DefaultAllocator as Allocator<N, R>>::Buffer>where
DefaultAllocator: Allocator<N, R>,
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 variance(&self) -> N
pub fn variance(&self) -> N
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<N, U1, C, <DefaultAllocator as Allocator<N, U1, C>>::Buffer>
pub fn row_variance( &self, ) -> Matrix<N, U1, C, <DefaultAllocator as Allocator<N, U1, C>>::Buffer>
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<N, C, U1, <DefaultAllocator as Allocator<N, C>>::Buffer>where
DefaultAllocator: Allocator<N, C>,
pub fn row_variance_tr(
&self,
) -> Matrix<N, C, U1, <DefaultAllocator as Allocator<N, C>>::Buffer>where
DefaultAllocator: Allocator<N, C>,
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<N, R, U1, <DefaultAllocator as Allocator<N, R>>::Buffer>where
DefaultAllocator: Allocator<N, R>,
pub fn column_variance(
&self,
) -> Matrix<N, R, U1, <DefaultAllocator as Allocator<N, R>>::Buffer>where
DefaultAllocator: Allocator<N, R>,
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) -> N
pub fn mean(&self) -> N
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<N, U1, C, <DefaultAllocator as Allocator<N, U1, C>>::Buffer>
pub fn row_mean( &self, ) -> Matrix<N, U1, C, <DefaultAllocator as Allocator<N, U1, C>>::Buffer>
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<N, C, U1, <DefaultAllocator as Allocator<N, C>>::Buffer>where
DefaultAllocator: Allocator<N, C>,
pub fn row_mean_tr(
&self,
) -> Matrix<N, C, U1, <DefaultAllocator as Allocator<N, C>>::Buffer>where
DefaultAllocator: Allocator<N, C>,
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<N, R, U1, <DefaultAllocator as Allocator<N, R>>::Buffer>where
DefaultAllocator: Allocator<N, R>,
pub fn column_mean(
&self,
) -> Matrix<N, R, U1, <DefaultAllocator as Allocator<N, R>>::Buffer>where
DefaultAllocator: Allocator<N, R>,
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<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
pub fn xx( &self, ) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn xxx(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn xxx( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn xy(
&self,
) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
pub fn xy( &self, ) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn yx(
&self,
) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
pub fn yx( &self, ) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn yy(
&self,
) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
pub fn yy( &self, ) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn xxy(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn xxy( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn xyx(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn xyx( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn xyy(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn xyy( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn yxx(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn yxx( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn yxy(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn yxy( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn yyx(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn yyx( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn yyy(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn yyy( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn xz(
&self,
) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
pub fn xz( &self, ) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn yz(
&self,
) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
pub fn yz( &self, ) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn zx(
&self,
) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
pub fn zx( &self, ) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn zy(
&self,
) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
pub fn zy( &self, ) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn zz(
&self,
) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
pub fn zz( &self, ) -> Matrix<N, U2, U1, <DefaultAllocator as Allocator<N, U2>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn xxz(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn xxz( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn xyz(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn xyz( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn xzx(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn xzx( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn xzy(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn xzy( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn xzz(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn xzz( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn yxz(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn yxz( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn yyz(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn yyz( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn yzx(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn yzx( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn yzy(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn yzy( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn yzz(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn yzz( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn zxx(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn zxx( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn zxy(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn zxy( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn zxz(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn zxz( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn zyx(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn zyx( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn zyy(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn zyy( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn zyz(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn zyz( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn zzx(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn zzx( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn zzy(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn zzy( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn zzz(
&self,
) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
pub fn zzz( &self, ) -> Matrix<N, U3, U1, <DefaultAllocator as Allocator<N, U3>>::Buffer>
Builds a new vector from components of self
.
Sourcepub fn convolve_full<D2, S2>(
&self,
kernel: Matrix<N, D2, U1, S2>,
) -> Matrix<N, <<D1 as DimAdd<D2>>::Output as DimSub<U1>>::Output, U1, <DefaultAllocator as Allocator<N, <<D1 as DimAdd<D2>>::Output as DimSub<U1>>::Output>>::Buffer>
pub fn convolve_full<D2, S2>( &self, kernel: Matrix<N, D2, U1, S2>, ) -> Matrix<N, <<D1 as DimAdd<D2>>::Output as DimSub<U1>>::Output, U1, <DefaultAllocator as Allocator<N, <<D1 as DimAdd<D2>>::Output as DimSub<U1>>::Output>>::Buffer>
Sourcepub fn convolve_valid<D2, S2>(
&self,
kernel: Matrix<N, D2, U1, S2>,
) -> Matrix<N, <<D1 as DimAdd<U1>>::Output as DimSub<D2>>::Output, U1, <DefaultAllocator as Allocator<N, <<D1 as DimAdd<U1>>::Output as DimSub<D2>>::Output>>::Buffer>
pub fn convolve_valid<D2, S2>( &self, kernel: Matrix<N, D2, U1, S2>, ) -> Matrix<N, <<D1 as DimAdd<U1>>::Output as DimSub<D2>>::Output, U1, <DefaultAllocator as Allocator<N, <<D1 as DimAdd<U1>>::Output as DimSub<D2>>::Output>>::Buffer>
Sourcepub fn convolve_same<D2, S2>(
&self,
kernel: Matrix<N, D2, U1, S2>,
) -> Matrix<N, D1, U1, <DefaultAllocator as Allocator<N, D1>>::Buffer>
pub fn convolve_same<D2, S2>( &self, kernel: Matrix<N, D2, U1, S2>, ) -> Matrix<N, D1, U1, <DefaultAllocator as Allocator<N, D1>>::Buffer>
Sourcepub fn determinant(&self) -> N
pub fn determinant(&self) -> N
Computes the matrix determinant.
If the matrix has a dimension larger than 3, an LU decomposition is used.
Sourcepub fn exp(
&self,
) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>
pub fn exp( &self, ) -> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>
Computes exponential of this matrix
Sourcepub fn try_inverse_mut(&mut self) -> boolwhere
DefaultAllocator: Allocator<N, D, D>,
pub fn try_inverse_mut(&mut self) -> boolwhere
DefaultAllocator: Allocator<N, D, D>,
Attempts to invert this matrix in-place. Returns false
and leaves self
untouched if
inversion fails.
Sourcepub fn eigenvalues(
&self,
) -> Option<Matrix<N, D, U1, <DefaultAllocator as Allocator<N, D>>::Buffer>>
pub fn eigenvalues( &self, ) -> Option<Matrix<N, D, U1, <DefaultAllocator as Allocator<N, D>>::Buffer>>
Computes the eigenvalues of this matrix.
Sourcepub fn complex_eigenvalues(
&self,
) -> Matrix<Complex<N>, D, U1, <DefaultAllocator as Allocator<Complex<N>, D>>::Buffer>
pub fn complex_eigenvalues( &self, ) -> Matrix<Complex<N>, D, U1, <DefaultAllocator as Allocator<Complex<N>, D>>::Buffer>
Computes the eigenvalues of this matrix.
Sourcepub fn solve_lower_triangular<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>,
) -> Option<Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_lower_triangular<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>,
) -> Option<Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, 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<N, R2, C2, S2>,
) -> Option<Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_upper_triangular<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>,
) -> Option<Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, 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<N, R2, C2, S2>,
) -> bool
pub fn solve_lower_triangular_mut<R2, C2, S2>( &self, b: &mut Matrix<N, R2, C2, S2>, ) -> bool
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<N, R2, C2, S2>,
diag: N,
) -> bool
pub fn solve_lower_triangular_with_diag_mut<R2, C2, S2>( &self, b: &mut Matrix<N, R2, C2, S2>, diag: N, ) -> bool
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<N, R2, C2, S2>,
) -> bool
pub fn solve_upper_triangular_mut<R2, C2, S2>( &self, b: &mut Matrix<N, R2, C2, S2>, ) -> bool
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<N, R2, C2, S2>,
) -> Option<Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_lower_triangular<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>,
) -> Option<Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, 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<N, R2, C2, S2>,
) -> Option<Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_upper_triangular<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>,
) -> Option<Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, 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<N, R2, C2, S2>,
) -> bool
pub fn tr_solve_lower_triangular_mut<R2, C2, S2>( &self, b: &mut Matrix<N, R2, C2, S2>, ) -> bool
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<N, R2, C2, S2>,
) -> bool
pub fn tr_solve_upper_triangular_mut<R2, C2, S2>( &self, b: &mut Matrix<N, R2, C2, S2>, ) -> bool
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<N, R2, C2, S2>,
) -> Option<Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_lower_triangular<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>,
) -> Option<Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, 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<N, R2, C2, S2>,
) -> Option<Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_upper_triangular<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>,
) -> Option<Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, 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<N, R2, C2, S2>,
) -> bool
pub fn ad_solve_lower_triangular_mut<R2, C2, S2>( &self, b: &mut Matrix<N, R2, C2, S2>, ) -> bool
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<N, R2, C2, S2>,
) -> bool
pub fn ad_solve_upper_triangular_mut<R2, C2, S2>( &self, b: &mut Matrix<N, R2, C2, S2>, ) -> bool
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<N, R2, C2, S2>,
) -> Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_lower_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>,
) -> Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, 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<N, R2, C2, S2>,
) -> Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_upper_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>,
) -> Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, 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<N, R2, C2, S2>,
)
pub fn solve_lower_triangular_unchecked_mut<R2, C2, S2>( &self, b: &mut Matrix<N, R2, C2, S2>, )
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<N, R2, C2, S2>,
diag: N,
)
pub fn solve_lower_triangular_with_diag_unchecked_mut<R2, C2, S2>( &self, b: &mut Matrix<N, R2, C2, S2>, diag: N, )
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<N, R2, C2, S2>,
)
pub fn solve_upper_triangular_unchecked_mut<R2, C2, S2>( &self, b: &mut Matrix<N, R2, C2, S2>, )
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<N, R2, C2, S2>,
) -> Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_lower_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>,
) -> Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, 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<N, R2, C2, S2>,
) -> Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_upper_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>,
) -> Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, 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<N, R2, C2, S2>,
)
pub fn tr_solve_lower_triangular_unchecked_mut<R2, C2, S2>( &self, b: &mut Matrix<N, R2, C2, S2>, )
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<N, R2, C2, S2>,
)
pub fn tr_solve_upper_triangular_unchecked_mut<R2, C2, S2>( &self, b: &mut Matrix<N, R2, C2, S2>, )
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<N, R2, C2, S2>,
) -> Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_lower_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>,
) -> Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, 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<N, R2, C2, S2>,
) -> Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_upper_triangular_unchecked<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>,
) -> Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>where
R2: Dim,
C2: Dim,
S2: Storage<N, R2, C2>,
DefaultAllocator: Allocator<N, 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<N, R2, C2, S2>,
)
pub fn ad_solve_lower_triangular_unchecked_mut<R2, C2, S2>( &self, b: &mut Matrix<N, R2, C2, S2>, )
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<N, R2, C2, S2>,
)
pub fn ad_solve_upper_triangular_unchecked_mut<R2, C2, S2>( &self, b: &mut Matrix<N, R2, C2, S2>, )
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(
&self,
) -> Matrix<<N as ComplexField>::RealField, <R as DimMin<C>>::Output, U1, <DefaultAllocator as Allocator<<N as ComplexField>::RealField, <R as DimMin<C>>::Output>>::Buffer>
pub fn singular_values( &self, ) -> Matrix<<N as ComplexField>::RealField, <R as DimMin<C>>::Output, U1, <DefaultAllocator as Allocator<<N as ComplexField>::RealField, <R as DimMin<C>>::Output>>::Buffer>
Computes the singular values of this matrix.
Sourcepub fn rank(&self, eps: <N as ComplexField>::RealField) -> usize
pub fn rank(&self, eps: <N as ComplexField>::RealField) -> usize
Computes the rank of this matrix.
All singular values below eps
are considered equal to 0.
Sourcepub fn symmetric_eigenvalues(
&self,
) -> Matrix<<N as ComplexField>::RealField, D, U1, <DefaultAllocator as Allocator<<N as ComplexField>::RealField, D>>::Buffer>
pub fn symmetric_eigenvalues( &self, ) -> Matrix<<N as ComplexField>::RealField, D, U1, <DefaultAllocator as Allocator<<N as ComplexField>::RealField, D>>::Buffer>
Computes the eigenvalues of this symmetric matrix.
Only the lower-triangular part of the matrix is read.
Trait Implementations§
Source§impl PartialOrd for Skew3
impl PartialOrd for Skew3
impl Copy for Skew3
impl StructuralPartialEq for Skew3
Auto Trait Implementations§
impl Freeze for Skew3
impl RefUnwindSafe for Skew3
impl Send for Skew3
impl Sync for Skew3
impl Unpin for Skew3
impl UnwindSafe for Skew3
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.