Struct nalgebra::base::Matrix [−][src]
#[repr(C)]pub struct Matrix<T, R, C, S> {
pub data: S,
// some fields omitted
}
Expand description
The most generic column-major matrix (and vector) type.
Methods summary
Because Matrix
is the most generic types used as a common representation of all matrices and
vectors of nalgebra this documentation page contains every single matrix/vector-related
method. In order to make browsing this page simpler, the next subsections contain direct links
to groups of methods related to a specific topic.
Vector and matrix construction
- Constructors of statically-sized vectors or statically-sized matrices
(
Vector3
,Matrix3x6
…) - Constructors of fully dynamic matrices (
DMatrix
) - Constructors of dynamic vectors and matrices with a dynamic number of rows
(
DVector
,MatrixXx3
…) - Constructors of matrices with a dynamic number of columns
(
Matrix2xX
…) - Generic constructors (For code generic wrt. the vectors or matrices dimensions.)
Computer graphics utilities for transformations
- 2D transformations as a Matrix3
new_rotation
… - 3D transformations as a Matrix4
new_rotation
,new_perspective
,look_at_rh
… - Translation and scaling in any dimension
new_scaling
,new_translation
… - Append/prepend translation and scaling
append_scaling
,prepend_translation_mut
… - Transformation of vectors and points
transform_vector
,transform_point
…
Common math operations
- Componentwise operations
component_mul
,component_div
,inf
… - Special multiplications
tr_mul
,ad_mul
,kronecker
… - Dot/scalar product
dot
,dotc
,tr_dot
… - Cross product
cross
,perp
… - Magnitude and norms
norm
,normalize
,metric_distance
… - In-place normalization
normalize_mut
,try_normalize_mut
… - Interpolation
lerp
,slerp
… - BLAS functions
gemv
,gemm
,syger
… - Swizzling
xx
,yxz
…
Statistics
- Common operations
row_sum
,column_mean
,variance
… - Find the min and max components
min
,max
,amin
,amax
,camin
,cmax
… - Find the min and max components (vector-specific methods)
argmin
,argmax
,icamin
,icamax
…
Iteration, map, and fold
- Iteration on components, rows, and columns
iter
,column_iter
… - Elementwise mapping and folding
map
,fold
,zip_map
… - Folding or columns and rows
compress_rows
,compress_columns
…
Vector and matrix slicing
- Creating matrix slices from
&[T]
from_slice
,from_slice_with_strides
… - Creating mutable matrix slices from
&mut [T]
from_slice_mut
,from_slice_with_strides_mut
… - Slicing based on index and length
row
,columns
,slice
… - Mutable slicing based on index and length
row_mut
,columns_mut
,slice_mut
… - Slicing based on ranges
rows_range
,columns_range
… - Mutable slicing based on ranges
rows_range_mut
,columns_range_mut
…
In-place modification of a single matrix or vector
- In-place filling
fill
,fill_diagonal
,fill_with_identity
… - In-place swapping
swap
,swap_columns
… - Set rows, columns, and diagonal
set_column
,set_diagonal
…
Vector and matrix size modification
- Rows and columns insertion
insert_row
,insert_column
… - Rows and columns removal
remove_row
,remove column
… - Rows and columns extraction
select_rows
,select_columns
… - Resizing and reshaping
resize
,reshape_generic
… - In-place resizing
resize_mut
,resize_vertically_mut
…
Matrix decomposition
- Rectangular matrix decomposition
qr
,lu
,svd
… - Square matrix decomposition
cholesky
,symmetric_eigen
…
Vector basis computation
Type parameters
The generic Matrix
type has four type parameters:
T
: for the matrix components scalar type.R
: for the matrix number of rows.C
: for the matrix number of columns.S
: for the matrix data storage, i.e., the buffer that actually contains the matrix components.
The matrix dimensions parameters R
and C
can either be:
- type-level unsigned integer constants (e.g.
U1
,U124
) from thenalgebra::
root module. All numbers from 0 to 127 are defined that way. - type-level unsigned integer constants (e.g.
U1024
,U10000
) from thetypenum::
crate. Using those, you will not get error messages as nice as for numbers smaller than 128 defined on thenalgebra::
module. - the special value
Dynamic
from thenalgebra::
root module. This indicates that the specified dimension is not known at compile-time. Note that this will generally imply that the matrix data storageS
performs a dynamic allocation and contains extra metadata for the matrix shape.
Note that mixing Dynamic
with type-level unsigned integers is allowed. Actually, a
dynamically-sized column vector should be represented as a Matrix<T, Dynamic, U1, S>
(given
some concrete types for T
and a compatible data storage type S
).
Fields
data: S
The data storage that contains all the matrix components. Disappointed?
Well, if you came here to see how you can access the matrix components,
you may be in luck: you can access the individual components of all vectors with compile-time
dimensions <= 6 using field notation like this:
vec.x
, vec.y
, vec.z
, vec.w
, vec.a
, vec.b
. Reference and assignation work too:
let mut vec = Vector3::new(1.0, 2.0, 3.0);
vec.x = 10.0;
vec.y += 30.0;
assert_eq!(vec.x, 10.0);
assert_eq!(vec.y + 100.0, 132.0);
Similarly, for matrices with compile-time dimensions <= 6, you can use field notation
like this: mat.m11
, mat.m42
, etc. The first digit identifies the row to address
and the second digit identifies the column to address. So mat.m13
identifies the component
at the first row and third column (note that the count of rows and columns start at 1 instead
of 0 here. This is so we match the mathematical notation).
For all matrices and vectors, independently from their size, individual components can
be accessed and modified using indexing: vec[20]
, mat[(20, 19)]
. Here the indexing
starts at 0 as you would expect.
Implementations
pub fn dot<R2: Dim, C2: Dim, SB>(&self, rhs: &Matrix<T, R2, C2, SB>) -> T where
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<R, R2> + DimEq<C, C2>,
pub fn dot<R2: Dim, C2: Dim, SB>(&self, rhs: &Matrix<T, R2, C2, SB>) -> T where
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<R, R2> + DimEq<C, C2>,
The dot product between two vectors or matrices (seen as vectors).
This is equal to self.transpose() * rhs
. For the sesquilinear complex dot product, use
self.dotc(rhs)
.
Note that this is not the matrix multiplication as in, e.g., numpy. For matrix
multiplication, use one of: .gemm
, .mul_to
, .mul
, the *
operator.
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);
pub fn dotc<R2: Dim, C2: Dim, SB>(&self, rhs: &Matrix<T, R2, C2, SB>) -> T where
T: SimdComplexField,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<R, R2> + DimEq<C, C2>,
pub fn dotc<R2: Dim, C2: Dim, SB>(&self, rhs: &Matrix<T, R2, C2, SB>) -> T where
T: SimdComplexField,
SB: RawStorage<T, 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));
pub fn tr_dot<R2: Dim, C2: Dim, SB>(&self, rhs: &Matrix<T, R2, C2, SB>) -> T where
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<C, R2> + DimEq<R, C2>,
pub fn tr_dot<R2: Dim, C2: Dim, SB>(&self, rhs: &Matrix<T, R2, C2, SB>) -> T where
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<C, R2> + DimEq<R, C2>,
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);
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));
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));
Computes self = alpha * a * x + beta * self
, where a
is a matrix, x
a vector, and
alpha, beta
two scalars.
If beta
is zero, self
is never read.
Examples:
let mut vec1 = Vector2::new(1.0, 2.0);
let vec2 = Vector2::new(0.1, 0.2);
let mat = Matrix2::new(1.0, 2.0,
3.0, 4.0);
vec1.gemv(10.0, &mat, &vec2, 5.0);
assert_eq!(vec1, Vector2::new(10.0, 21.0));
pub fn sygemv<D2: Dim, D3: Dim, SB, SC>(
&mut self,
alpha: T,
a: &SquareMatrix<T, D2, SB>,
x: &Vector<T, D3, SC>,
beta: T
) where
T: One,
SB: Storage<T, D2, D2>,
SC: Storage<T, D3>,
ShapeConstraint: DimEq<D, D2> + AreMultipliable<D2, D2, D3, U1>,
pub fn sygemv<D2: Dim, D3: Dim, SB, SC>(
&mut self,
alpha: T,
a: &SquareMatrix<T, D2, SB>,
x: &Vector<T, D3, SC>,
beta: T
) where
T: One,
SB: Storage<T, D2, D2>,
SC: Storage<T, 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));
pub fn hegemv<D2: Dim, D3: Dim, SB, SC>(
&mut self,
alpha: T,
a: &SquareMatrix<T, D2, SB>,
x: &Vector<T, D3, SC>,
beta: T
) where
T: SimdComplexField,
SB: Storage<T, D2, D2>,
SC: Storage<T, D3>,
ShapeConstraint: DimEq<D, D2> + AreMultipliable<D2, D2, D3, U1>,
pub fn hegemv<D2: Dim, D3: Dim, SB, SC>(
&mut self,
alpha: T,
a: &SquareMatrix<T, D2, SB>,
x: &Vector<T, D3, SC>,
beta: T
) where
T: SimdComplexField,
SB: Storage<T, D2, D2>,
SC: Storage<T, 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)));
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);
pub fn gemv_ad<R2: Dim, C2: Dim, D3: Dim, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
x: &Vector<T, D3, SC>,
beta: T
) where
T: SimdComplexField,
SB: Storage<T, R2, C2>,
SC: Storage<T, D3>,
ShapeConstraint: DimEq<D, C2> + AreMultipliable<C2, R2, D3, U1>,
pub fn gemv_ad<R2: Dim, C2: Dim, D3: Dim, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
x: &Vector<T, D3, SC>,
beta: T
) where
T: SimdComplexField,
SB: Storage<T, R2, C2>,
SC: Storage<T, 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);
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);
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);
pub fn gemm<R2: Dim, C2: Dim, R3: Dim, C3: Dim, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
T: One,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C3> + AreMultipliable<R2, C2, R3, C3>,
pub fn gemm<R2: Dim, C2: Dim, R3: Dim, C3: Dim, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
T: One,
SB: Storage<T, R2, C2>,
SC: Storage<T, 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);
pub fn gemm_tr<R2: Dim, C2: Dim, R3: Dim, C3: Dim, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
T: One,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, C2> + SameNumberOfColumns<C1, C3> + AreMultipliable<C2, R2, R3, C3>,
pub fn gemm_tr<R2: Dim, C2: Dim, R3: Dim, C3: Dim, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
T: One,
SB: Storage<T, R2, C2>,
SC: Storage<T, 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);
pub fn gemm_ad<R2: Dim, C2: Dim, R3: Dim, C3: Dim, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
T: SimdComplexField,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, C2> + SameNumberOfColumns<C1, C3> + AreMultipliable<C2, R2, R3, C3>,
pub fn gemm_ad<R2: Dim, C2: Dim, R3: Dim, C3: Dim, SB, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
T: SimdComplexField,
SB: Storage<T, R2, C2>,
SC: Storage<T, 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);
pub fn ger_symm<D2: Dim, D3: Dim, SB, SC>(
&mut self,
alpha: T,
x: &Vector<T, D2, SB>,
y: &Vector<T, D3, SC>,
beta: T
) where
T: One,
SB: Storage<T, D2>,
SC: Storage<T, D3>,
ShapeConstraint: DimEq<R1, D2> + DimEq<C1, D3>,
👎 Deprecated: This is renamed syger
to match the original BLAS terminology.
pub fn ger_symm<D2: Dim, D3: Dim, SB, SC>(
&mut self,
alpha: T,
x: &Vector<T, D2, SB>,
y: &Vector<T, D3, SC>,
beta: T
) where
T: One,
SB: Storage<T, D2>,
SC: Storage<T, D3>,
ShapeConstraint: DimEq<R1, D2> + DimEq<C1, D3>,
This is renamed syger
to match the original BLAS terminology.
Computes self = alpha * x * y.transpose() + beta * self
, where self
is a symmetric
matrix.
If beta
is zero, self
is never read. The result is symmetric. Only the lower-triangular
(including the diagonal) part of self
is read/written.
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.
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.
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.
pub fn quadform_tr_with_workspace<D2, S2, R3, C3, S3, D4, S4>(
&mut self,
work: &mut Vector<T, D2, S2>,
alpha: T,
lhs: &Matrix<T, R3, C3, S3>,
mid: &SquareMatrix<T, D4, S4>,
beta: T
) where
D2: Dim,
R3: Dim,
C3: Dim,
D4: Dim,
S2: StorageMut<T, D2>,
S3: Storage<T, R3, C3>,
S4: Storage<T, D4, D4>,
ShapeConstraint: DimEq<D1, D2> + DimEq<D1, R3> + DimEq<D2, R3> + DimEq<C3, D4>,
pub fn quadform_tr_with_workspace<D2, S2, R3, C3, S3, D4, S4>(
&mut self,
work: &mut Vector<T, D2, S2>,
alpha: T,
lhs: &Matrix<T, R3, C3, S3>,
mid: &SquareMatrix<T, D4, S4>,
beta: T
) where
D2: Dim,
R3: Dim,
C3: Dim,
D4: Dim,
S2: StorageMut<T, D2>,
S3: Storage<T, R3, C3>,
S4: Storage<T, D4, D4>,
ShapeConstraint: DimEq<D1, D2> + DimEq<D1, R3> + DimEq<D2, R3> + DimEq<C3, D4>,
Computes the quadratic form self = alpha * lhs * mid * lhs.transpose() + beta * self
.
This uses the provided workspace work
to avoid allocations for intermediate results.
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);
pub fn quadform_tr<R3, C3, S3, D4, S4>(
&mut self,
alpha: T,
lhs: &Matrix<T, R3, C3, S3>,
mid: &SquareMatrix<T, D4, S4>,
beta: T
) where
R3: Dim,
C3: Dim,
D4: Dim,
S3: Storage<T, R3, C3>,
S4: Storage<T, D4, D4>,
ShapeConstraint: DimEq<D1, D1> + DimEq<D1, R3> + DimEq<C3, D4>,
DefaultAllocator: Allocator<T, D1>,
pub fn quadform_tr<R3, C3, S3, D4, S4>(
&mut self,
alpha: T,
lhs: &Matrix<T, R3, C3, S3>,
mid: &SquareMatrix<T, D4, S4>,
beta: T
) where
R3: Dim,
C3: Dim,
D4: Dim,
S3: Storage<T, R3, C3>,
S4: Storage<T, D4, D4>,
ShapeConstraint: DimEq<D1, D1> + DimEq<D1, R3> + DimEq<C3, D4>,
DefaultAllocator: Allocator<T, D1>,
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);
pub fn quadform_with_workspace<D2, S2, D3, S3, R4, C4, S4>(
&mut self,
work: &mut Vector<T, D2, S2>,
alpha: T,
mid: &SquareMatrix<T, D3, S3>,
rhs: &Matrix<T, R4, C4, S4>,
beta: T
) where
D2: Dim,
D3: Dim,
R4: Dim,
C4: Dim,
S2: StorageMut<T, D2>,
S3: Storage<T, D3, D3>,
S4: Storage<T, 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 Vector<T, D2, S2>,
alpha: T,
mid: &SquareMatrix<T, D3, S3>,
rhs: &Matrix<T, R4, C4, S4>,
beta: T
) where
D2: Dim,
D3: Dim,
R4: Dim,
C4: Dim,
S2: StorageMut<T, D2>,
S3: Storage<T, D3, D3>,
S4: Storage<T, 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);
pub fn quadform<D2, S2, R3, C3, S3>(
&mut self,
alpha: T,
mid: &SquareMatrix<T, D2, S2>,
rhs: &Matrix<T, R3, C3, S3>,
beta: T
) where
D2: Dim,
R3: Dim,
C3: Dim,
S2: Storage<T, D2, D2>,
S3: Storage<T, R3, C3>,
ShapeConstraint: DimEq<D2, R3> + DimEq<D1, C3> + AreMultipliable<C3, R3, D2, U1>,
DefaultAllocator: Allocator<T, D2>,
pub fn quadform<D2, S2, R3, C3, S3>(
&mut self,
alpha: T,
mid: &SquareMatrix<T, D2, S2>,
rhs: &Matrix<T, R3, C3, S3>,
beta: T
) where
D2: Dim,
R3: Dim,
C3: Dim,
S2: Storage<T, D2, D2>,
S3: Storage<T, R3, C3>,
ShapeConstraint: DimEq<D2, R3> + DimEq<D1, C3> + AreMultipliable<C3, R3, D2, U1>,
DefaultAllocator: Allocator<T, 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);
pub fn add_to<R2: Dim, C2: Dim, SB, R3: Dim, C3: Dim, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + SameNumberOfColumns<C1, C3>,
pub fn add_to<R2: Dim, C2: Dim, SB, R3: Dim, C3: Dim, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
SB: Storage<T, R2, C2>,
SC: StorageMut<T, 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.
pub fn sub_to<R2: Dim, C2: Dim, SB, R3: Dim, C3: Dim, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + SameNumberOfColumns<C1, C3>,
pub fn sub_to<R2: Dim, C2: Dim, SB, R3: Dim, C3: Dim, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
SB: Storage<T, R2, C2>,
SC: StorageMut<T, 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.
pub fn tr_mul<R2: Dim, C2: Dim, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> OMatrix<T, C1, C2> where
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
pub fn tr_mul<R2: Dim, C2: Dim, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> OMatrix<T, C1, C2> where
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
Equivalent to self.transpose() * rhs
.
pub fn ad_mul<R2: Dim, C2: Dim, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> OMatrix<T, C1, C2> where
T: SimdComplexField,
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
pub fn ad_mul<R2: Dim, C2: Dim, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> OMatrix<T, C1, C2> where
T: SimdComplexField,
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>,
Equivalent to self.adjoint() * rhs
.
pub fn tr_mul_to<R2: Dim, C2: Dim, SB, R3: Dim, C3: Dim, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + DimEq<C1, R3> + DimEq<C2, C3>,
pub fn tr_mul_to<R2: Dim, C2: Dim, SB, R3: Dim, C3: Dim, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
SB: Storage<T, R2, C2>,
SC: StorageMut<T, 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.
pub fn ad_mul_to<R2: Dim, C2: Dim, SB, R3: Dim, C3: Dim, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
T: SimdComplexField,
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + DimEq<C1, R3> + DimEq<C2, C3>,
pub fn ad_mul_to<R2: Dim, C2: Dim, SB, R3: Dim, C3: Dim, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
T: SimdComplexField,
SB: Storage<T, R2, C2>,
SC: StorageMut<T, 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.
pub fn mul_to<R2: Dim, C2: Dim, SB, R3: Dim, C3: Dim, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
SB: Storage<T, R2, C2>,
SC: StorageMut<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R3, R1> + SameNumberOfColumns<C3, C2> + AreMultipliable<R1, C1, R2, C2>,
pub fn mul_to<R2: Dim, C2: Dim, SB, R3: Dim, C3: Dim, SC>(
&self,
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<T, R3, C3, SC>
) where
SB: Storage<T, R2, C2>,
SC: StorageMut<T, 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.
The kronecker product of two matrices (aka. tensor product of the corresponding linear maps).
Creates a new homogeneous matrix that applies the same scaling factor on each dimension.
pub fn new_nonuniform_scaling<SB>(
scaling: &Vector<T, DimNameDiff<D, U1>, SB>
) -> Self where
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
pub fn new_nonuniform_scaling<SB>(
scaling: &Vector<T, DimNameDiff<D, U1>, SB>
) -> Self where
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
Creates a new homogeneous matrix that applies a distinct scaling factor for each dimension.
pub fn new_translation<SB>(
translation: &Vector<T, DimNameDiff<D, U1>, SB>
) -> Self where
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
pub fn new_translation<SB>(
translation: &Vector<T, DimNameDiff<D, U1>, SB>
) -> Self where
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
Creates a new homogeneous matrix that applies a pure translation.
Builds a 2 dimensional homogeneous rotation matrix from an angle in radian.
Creates a new homogeneous matrix that applies a scaling factor for each dimension with respect to point.
Can be used to implement zoom_to
functionality.
Builds a 3D homogeneous rotation matrix from an axis and an angle (multiplied together).
Returns the identity matrix if the given argument is zero.
Builds a 3D homogeneous rotation matrix from an axis and an angle (multiplied together).
Returns the identity matrix if the given argument is zero.
Creates a new homogeneous matrix that applies a scaling factor for each dimension with respect to point.
Can be used to implement zoom_to
functionality.
Builds a 3D homogeneous rotation matrix from an axis and an angle (multiplied together).
Returns the identity matrix if the given argument is zero.
This is identical to Self::new_rotation
.
Creates a new rotation from Euler angles.
The primitive rotations are applied in order: 1 roll − 2 pitch − 3 yaw.
Builds a 3D homogeneous rotation matrix from an axis and a rotation angle.
Creates a new homogeneous matrix for an orthographic projection.
Creates a new homogeneous matrix for a perspective projection.
Creates an isometry that corresponds to the local frame of an observer standing at the
point eye
and looking toward target
.
It maps the view direction target - eye
to the positive z
axis and the origin to the
eye
.
👎 Deprecated: renamed to face_towards
renamed to face_towards
Deprecated: Use Matrix4::face_towards
instead.
Builds a right-handed look-at view matrix.
Builds a left-handed look-at view matrix.
pub fn append_scaling(&self, scaling: T) -> OMatrix<T, D, D> where
D: DimNameSub<U1>,
DefaultAllocator: Allocator<T, D, D>,
pub fn append_scaling(&self, scaling: T) -> OMatrix<T, D, D> where
D: DimNameSub<U1>,
DefaultAllocator: Allocator<T, D, D>,
Computes the transformation equal to self
followed by an uniform scaling factor.
pub fn prepend_scaling(&self, scaling: T) -> OMatrix<T, D, D> where
D: DimNameSub<U1>,
DefaultAllocator: Allocator<T, D, D>,
pub fn prepend_scaling(&self, scaling: T) -> OMatrix<T, D, D> where
D: DimNameSub<U1>,
DefaultAllocator: Allocator<T, D, D>,
Computes the transformation equal to an uniform scaling factor followed by self
.
pub fn append_nonuniform_scaling<SB>(
&self,
scaling: &Vector<T, DimNameDiff<D, U1>, SB>
) -> OMatrix<T, D, D> where
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
DefaultAllocator: Allocator<T, D, D>,
pub fn append_nonuniform_scaling<SB>(
&self,
scaling: &Vector<T, DimNameDiff<D, U1>, SB>
) -> OMatrix<T, D, D> where
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
DefaultAllocator: Allocator<T, D, D>,
Computes the transformation equal to self
followed by a non-uniform scaling factor.
pub fn prepend_nonuniform_scaling<SB>(
&self,
scaling: &Vector<T, DimNameDiff<D, U1>, SB>
) -> OMatrix<T, D, D> where
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
DefaultAllocator: Allocator<T, D, D>,
pub fn prepend_nonuniform_scaling<SB>(
&self,
scaling: &Vector<T, DimNameDiff<D, U1>, SB>
) -> OMatrix<T, D, D> where
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
DefaultAllocator: Allocator<T, D, D>,
Computes the transformation equal to a non-uniform scaling factor followed by self
.
pub fn append_translation<SB>(
&self,
shift: &Vector<T, DimNameDiff<D, U1>, SB>
) -> OMatrix<T, D, D> where
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
DefaultAllocator: Allocator<T, D, D>,
pub fn append_translation<SB>(
&self,
shift: &Vector<T, DimNameDiff<D, U1>, SB>
) -> OMatrix<T, D, D> where
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
DefaultAllocator: Allocator<T, D, D>,
Computes the transformation equal to self
followed by a translation.
pub fn prepend_translation<SB>(
&self,
shift: &Vector<T, DimNameDiff<D, U1>, SB>
) -> OMatrix<T, D, D> where
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
DefaultAllocator: Allocator<T, D, D> + Allocator<T, DimNameDiff<D, U1>>,
pub fn prepend_translation<SB>(
&self,
shift: &Vector<T, DimNameDiff<D, U1>, SB>
) -> OMatrix<T, D, D> where
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
DefaultAllocator: Allocator<T, D, D> + Allocator<T, DimNameDiff<D, U1>>,
Computes the transformation equal to a translation followed by self
.
pub fn append_scaling_mut(&mut self, scaling: T) where
S: StorageMut<T, D, D>,
D: DimNameSub<U1>,
pub fn append_scaling_mut(&mut self, scaling: T) where
S: StorageMut<T, D, D>,
D: DimNameSub<U1>,
Computes in-place the transformation equal to self
followed by an uniform scaling factor.
pub fn prepend_scaling_mut(&mut self, scaling: T) where
S: StorageMut<T, D, D>,
D: DimNameSub<U1>,
pub fn prepend_scaling_mut(&mut self, scaling: T) where
S: StorageMut<T, D, D>,
D: DimNameSub<U1>,
Computes in-place the transformation equal to an uniform scaling factor followed by self
.
pub fn append_nonuniform_scaling_mut<SB>(
&mut self,
scaling: &Vector<T, DimNameDiff<D, U1>, SB>
) where
S: StorageMut<T, D, D>,
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
pub fn append_nonuniform_scaling_mut<SB>(
&mut self,
scaling: &Vector<T, DimNameDiff<D, U1>, SB>
) where
S: StorageMut<T, D, D>,
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
Computes in-place the transformation equal to self
followed by a non-uniform scaling factor.
pub fn prepend_nonuniform_scaling_mut<SB>(
&mut self,
scaling: &Vector<T, DimNameDiff<D, U1>, SB>
) where
S: StorageMut<T, D, D>,
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
pub fn prepend_nonuniform_scaling_mut<SB>(
&mut self,
scaling: &Vector<T, DimNameDiff<D, U1>, SB>
) where
S: StorageMut<T, D, D>,
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
Computes in-place the transformation equal to a non-uniform scaling factor followed by self
.
pub fn append_translation_mut<SB>(
&mut self,
shift: &Vector<T, DimNameDiff<D, U1>, SB>
) where
S: StorageMut<T, D, D>,
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
pub fn append_translation_mut<SB>(
&mut self,
shift: &Vector<T, DimNameDiff<D, U1>, SB>
) where
S: StorageMut<T, D, D>,
D: DimNameSub<U1>,
SB: Storage<T, DimNameDiff<D, U1>>,
Computes the transformation equal to self
followed by a translation.
pub fn prepend_translation_mut<SB>(
&mut self,
shift: &Vector<T, DimNameDiff<D, U1>, SB>
) where
D: DimNameSub<U1>,
S: StorageMut<T, D, D>,
SB: Storage<T, DimNameDiff<D, U1>>,
DefaultAllocator: Allocator<T, DimNameDiff<D, U1>>,
pub fn prepend_translation_mut<SB>(
&mut self,
shift: &Vector<T, DimNameDiff<D, U1>, SB>
) where
D: DimNameSub<U1>,
S: StorageMut<T, D, D>,
SB: Storage<T, DimNameDiff<D, U1>>,
DefaultAllocator: Allocator<T, DimNameDiff<D, U1>>,
Computes the transformation equal to a translation followed by self
.
impl<T: RealField, D: DimNameSub<U1>, S: Storage<T, D, D>> Matrix<T, D, D, S> where
DefaultAllocator: Allocator<T, D, D> + Allocator<T, DimNameDiff<D, U1>> + Allocator<T, DimNameDiff<D, U1>, DimNameDiff<D, U1>>,
impl<T: RealField, D: DimNameSub<U1>, S: Storage<T, D, D>> Matrix<T, D, D, S> where
DefaultAllocator: Allocator<T, D, D> + Allocator<T, DimNameDiff<D, U1>> + Allocator<T, DimNameDiff<D, U1>, DimNameDiff<D, U1>>,
pub fn transform_vector(
&self,
v: &OVector<T, DimNameDiff<D, U1>>
) -> OVector<T, DimNameDiff<D, U1>>
pub fn transform_vector(
&self,
v: &OVector<T, DimNameDiff<D, U1>>
) -> OVector<T, DimNameDiff<D, U1>>
Transforms the given vector, assuming the matrix self
uses homogeneous coordinates.
Transforms the given point, assuming the matrix self
uses homogeneous coordinates.
Transforms the given point, assuming the matrix self
uses homogeneous coordinates.
pub fn component_mul<R2, C2, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> MatrixSum<T, R1, C1, R2, C2> where
T: ClosedMul,
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
pub fn component_mul<R2, C2, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> MatrixSum<T, R1, C1, R2, C2> where
T: ClosedMul,
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, 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);
pub fn cmpy<R2, C2, SB, R3, C3, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
T: ClosedMul + Zero + Mul<T, Output = T> + Add<T, Output = T>,
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + SameNumberOfColumns<C1, C3>,
pub fn cmpy<R2, C2, SB, R3, C3, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
T: ClosedMul + Zero + Mul<T, Output = T> + Add<T, Output = T>,
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + 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);
pub fn component_mul_assign<R2, C2, SB>(&mut self, rhs: &Matrix<T, R2, C2, SB>) where
T: ClosedMul,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
pub fn component_mul_assign<R2, C2, SB>(&mut self, rhs: &Matrix<T, R2, C2, SB>) where
T: ClosedMul,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, 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);
pub fn component_mul_mut<R2, C2, SB>(&mut self, rhs: &Matrix<T, R2, C2, SB>) where
T: ClosedMul,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, 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<T, R2, C2, SB>) where
T: ClosedMul,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
This is renamed using the _assign
suffix instead of the _mut
suffix.
Inplace componentwise matrix or vector multiplication.
Example
let mut a = Matrix2::new(0.0, 1.0, 2.0, 3.0);
let b = Matrix2::new(4.0, 5.0, 6.0, 7.0);
let expected = Matrix2::new(0.0, 5.0, 12.0, 21.0);
a.component_mul_assign(&b);
assert_eq!(a, expected);
pub fn component_div<R2, C2, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> MatrixSum<T, R1, C1, R2, C2> where
T: ClosedDiv,
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
pub fn component_div<R2, C2, SB>(
&self,
rhs: &Matrix<T, R2, C2, SB>
) -> MatrixSum<T, R1, C1, R2, C2> where
T: ClosedDiv,
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, 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);
pub fn cdpy<R2, C2, SB, R3, C3, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
T: ClosedDiv + Zero + Mul<T, Output = T> + Add<T, Output = T>,
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + SameNumberOfColumns<C1, C3>,
pub fn cdpy<R2, C2, SB, R3, C3, SC>(
&mut self,
alpha: T,
a: &Matrix<T, R2, C2, SB>,
b: &Matrix<T, R3, C3, SC>,
beta: T
) where
T: ClosedDiv + Zero + Mul<T, Output = T> + Add<T, Output = T>,
R2: Dim,
C2: Dim,
R3: Dim,
C3: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
SC: Storage<T, R3, C3>,
ShapeConstraint: SameNumberOfRows<R1, R2> + 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);
pub fn component_div_assign<R2, C2, SB>(&mut self, rhs: &Matrix<T, R2, C2, SB>) where
T: ClosedDiv,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
pub fn component_div_assign<R2, C2, SB>(&mut self, rhs: &Matrix<T, R2, C2, SB>) where
T: ClosedDiv,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, 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);
pub fn component_div_mut<R2, C2, SB>(&mut self, rhs: &Matrix<T, R2, C2, SB>) where
T: ClosedDiv,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, 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<T, R2, C2, SB>) where
T: ClosedDiv,
R2: Dim,
C2: Dim,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
This is renamed using the _assign
suffix instead of the _mut
suffix.
Inplace componentwise matrix or vector division.
Example
let mut a = Matrix2::new(0.0, 1.0, 2.0, 3.0);
let b = Matrix2::new(4.0, 5.0, 6.0, 7.0);
let expected = Matrix2::new(0.0, 1.0 / 5.0, 2.0 / 6.0, 3.0 / 7.0);
a.component_div_assign(&b);
assert_eq!(a, expected);
pub fn inf(&self, other: &Self) -> OMatrix<T, R1, C1> where
T: SimdPartialOrd,
DefaultAllocator: Allocator<T, R1, C1>,
pub fn inf(&self, other: &Self) -> OMatrix<T, R1, C1> where
T: SimdPartialOrd,
DefaultAllocator: Allocator<T, R1, C1>,
Computes the infimum (aka. componentwise min) of two matrices/vectors.
Example
let u = Matrix2::new(4.0, 2.0, 1.0, -2.0);
let v = Matrix2::new(2.0, 4.0, -2.0, 1.0);
let expected = Matrix2::new(2.0, 2.0, -2.0, -2.0);
assert_eq!(u.inf(&v), expected)
pub fn sup(&self, other: &Self) -> OMatrix<T, R1, C1> where
T: SimdPartialOrd,
DefaultAllocator: Allocator<T, R1, C1>,
pub fn sup(&self, other: &Self) -> OMatrix<T, R1, C1> where
T: SimdPartialOrd,
DefaultAllocator: Allocator<T, R1, C1>,
Computes the supremum (aka. componentwise max) of two matrices/vectors.
Example
let u = Matrix2::new(4.0, 2.0, 1.0, -2.0);
let v = Matrix2::new(2.0, 4.0, -2.0, 1.0);
let expected = Matrix2::new(4.0, 4.0, 1.0, 1.0);
assert_eq!(u.sup(&v), expected)
pub fn inf_sup(&self, other: &Self) -> (OMatrix<T, R1, C1>, OMatrix<T, R1, C1>) where
T: SimdPartialOrd,
DefaultAllocator: Allocator<T, R1, C1>,
pub fn inf_sup(&self, other: &Self) -> (OMatrix<T, R1, C1>, OMatrix<T, R1, C1>) where
T: SimdPartialOrd,
DefaultAllocator: Allocator<T, R1, C1>,
Computes the (infimum, supremum) of two matrices/vectors.
Example
let u = Matrix2::new(4.0, 2.0, 1.0, -2.0);
let v = Matrix2::new(2.0, 4.0, -2.0, 1.0);
let expected = (Matrix2::new(2.0, 2.0, -2.0, -2.0), Matrix2::new(4.0, 4.0, 1.0, 1.0));
assert_eq!(u.inf_sup(&v), expected)
pub fn add_scalar(&self, rhs: T) -> OMatrix<T, R1, C1> where
T: ClosedAdd,
DefaultAllocator: Allocator<T, R1, C1>,
pub fn add_scalar(&self, rhs: T) -> OMatrix<T, R1, C1> where
T: ClosedAdd,
DefaultAllocator: Allocator<T, R1, C1>,
Adds a scalar to self
.
Example
let u = Matrix2::new(1.0, 2.0, 3.0, 4.0);
let s = 10.0;
let expected = Matrix2::new(11.0, 12.0, 13.0, 14.0);
assert_eq!(u.add_scalar(s), expected)
Adds a scalar to self
in-place.
Example
let mut u = Matrix2::new(1.0, 2.0, 3.0, 4.0);
let s = 10.0;
u.add_scalar_mut(s);
let expected = Matrix2::new(11.0, 12.0, 13.0, 14.0);
assert_eq!(u, expected)
impl<T: Scalar, R: Dim, C: Dim> Matrix<MaybeUninit<T>, R, C, <DefaultAllocator as Allocator<T, R, C>>::BufferUninit> where
DefaultAllocator: Allocator<T, R, C>,
impl<T: Scalar, R: Dim, C: Dim> Matrix<MaybeUninit<T>, R, C, <DefaultAllocator as Allocator<T, R, C>>::BufferUninit> where
DefaultAllocator: Allocator<T, R, C>,
impl<T: Scalar, R: Dim, C: Dim> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
impl<T: Scalar, R: Dim, C: Dim> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
Generic constructors
This set of matrix and vector construction functions are all generic with-regard to the matrix dimensions. They all expect to be given the dimension as inputs.
These functions should only be used when working on dimension-generic code.
Creates a matrix with all its elements set to elem
.
Creates a matrix with all its elements set to elem
.
Same as from_element_generic
.
Creates a matrix with all its elements set to 0.
pub fn from_iterator_generic<I>(nrows: R, ncols: C, iter: I) -> Self where
I: IntoIterator<Item = T>,
pub fn from_iterator_generic<I>(nrows: R, ncols: C, iter: I) -> Self where
I: IntoIterator<Item = T>,
Creates a matrix with all its elements filled by an iterator.
Creates a matrix with its elements filled with the components provided by a slice in row-major order.
The order of elements in the slice must follow the usual mathematic writing, i.e., row-by-row.
Creates a matrix with its elements filled with the components provided by a slice. The components must have the same layout as the matrix data storage (i.e. column-major).
Creates a matrix filled with the results of a function applied to each of its component coordinates.
Creates a new identity matrix.
If the matrix is not square, the largest square submatrix starting at index (0, 0)
is set
to the identity matrix. All other entries are set to zero.
Creates a new matrix with its diagonal filled with copies of elt
.
If the matrix is not square, the largest square submatrix starting at index (0, 0)
is set
to the identity matrix. All other entries are set to zero.
Creates a new matrix that may be rectangular. The first elts.len()
diagonal elements are
filled with the content of elts
. Others are set to 0.
Panics if elts.len()
is larger than the minimum among nrows
and ncols
.
Builds a new matrix from its rows.
Panics if not enough rows are provided (for statically-sized matrices), or if all rows do not have the same dimensions.
Example
let m = Matrix3::from_rows(&[ RowVector3::new(1.0, 2.0, 3.0), RowVector3::new(4.0, 5.0, 6.0), RowVector3::new(7.0, 8.0, 9.0) ]);
assert!(m.m11 == 1.0 && m.m12 == 2.0 && m.m13 == 3.0 &&
m.m21 == 4.0 && m.m22 == 5.0 && m.m23 == 6.0 &&
m.m31 == 7.0 && m.m32 == 8.0 && m.m33 == 9.0);
Builds a new matrix from its columns.
Panics if not enough columns are provided (for statically-sized matrices), or if all columns do not have the same dimensions.
Example
let m = Matrix3::from_columns(&[ Vector3::new(1.0, 2.0, 3.0), Vector3::new(4.0, 5.0, 6.0), Vector3::new(7.0, 8.0, 9.0) ]);
assert!(m.m11 == 1.0 && m.m12 == 4.0 && m.m13 == 7.0 &&
m.m21 == 2.0 && m.m22 == 5.0 && m.m23 == 8.0 &&
m.m31 == 3.0 && m.m32 == 6.0 && m.m33 == 9.0);
Creates a matrix backed by a given Vec
.
The output matrix is filled column-by-column.
Example
let vec = vec![0, 1, 2, 3, 4, 5];
let vec_ptr = vec.as_ptr();
let matrix = Matrix::from_vec_generic(Dynamic::new(vec.len()), Const::<1>, vec);
let matrix_storage_ptr = matrix.data.as_vec().as_ptr();
// `matrix` is backed by exactly the same `Vec` as it was constructed from.
assert_eq!(matrix_storage_ptr, vec_ptr);
impl<T, D: Dim> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
T: Scalar,
DefaultAllocator: Allocator<T, D, D>,
impl<T, D: Dim> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
T: Scalar,
DefaultAllocator: Allocator<T, D, D>,
Creates a square matrix with its diagonal set to diag
and all other entries set to 0.
Example
let m = Matrix3::from_diagonal(&Vector3::new(1.0, 2.0, 3.0));
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_diagonal(&DVector::from_row_slice(&[1.0, 2.0, 3.0]));
assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 2.0 && m.m23 == 0.0 &&
m.m31 == 0.0 && m.m32 == 0.0 && m.m33 == 3.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 0.0 &&
dm[(2, 0)] == 0.0 && dm[(2, 1)] == 0.0 && dm[(2, 2)] == 3.0);
impl<T: Scalar, R: DimName, C: DimName> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
impl<T: Scalar, R: DimName, C: DimName> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
Creates a matrix or vector with all its elements set to elem
.
Example
let v = Vector3::from_element(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::from_element(3, 2.0);
let m = Matrix2x3::from_element(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_element(2, 3, 2.0);
assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);
Creates a matrix or vector with all its elements set to elem
.
Same as .from_element
.
Example
let v = Vector3::repeat(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::repeat(3, 2.0);
let m = Matrix2x3::repeat(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::repeat(2, 3, 2.0);
assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);
Creates a matrix or vector with all its elements set to 0
.
Example
let v = Vector3::<f32>::zeros();
// The argument represents the vector dimension.
let dv = DVector::<f32>::zeros(3);
let m = Matrix2x3::<f32>::zeros();
// The two arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::zeros(2, 3);
assert!(v.x == 0.0 && v.y == 0.0 && v.z == 0.0);
assert!(dv[0] == 0.0 && dv[1] == 0.0 && dv[2] == 0.0);
assert!(m.m11 == 0.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 0.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 0.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 0.0 && dm[(1, 2)] == 0.0);
Creates a matrix or vector with all its elements filled by an iterator.
The output matrix is filled column-by-column.
Example
let v = Vector3::from_iterator((0..3).into_iter());
// The additional argument represents the vector dimension.
let dv = DVector::from_iterator(3, (0..3).into_iter());
let m = Matrix2x3::from_iterator((0..6).into_iter());
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_iterator(2, 3, (0..6).into_iter());
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);
Creates a matrix or vector filled with the results of a function applied to each of its component coordinates.
Example
let v = Vector3::from_fn(|i, _| i);
// The additional argument represents the vector dimension.
let dv = DVector::from_fn(3, |i, _| i);
let m = Matrix2x3::from_fn(|i, j| i * 3 + j);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_fn(2, 3, |i, j| i * 3 + j);
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);
Creates an identity matrix. If the matrix is not square, the largest square submatrix (starting at the first row and column) is set to the identity while all other entries are set to zero.
Example
let m = Matrix2x3::<f32>::identity();
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::identity(2, 3);
assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 1.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 1.0 && dm[(1, 2)] == 0.0);
Creates a matrix filled with its diagonal filled with elt
and all other
components set to zero.
Example
let m = Matrix2x3::from_diagonal_element(5.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_diagonal_element(2, 3, 5.0);
assert!(m.m11 == 5.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 5.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 5.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 5.0 && dm[(1, 2)] == 0.0);
Creates a new matrix that may be rectangular. The first elts.len()
diagonal
elements are filled with the content of elts
. Others are set to 0.
Panics if elts.len()
is larger than the minimum among nrows
and ncols
.
Example
let m = Matrix3::from_partial_diagonal(&[1.0, 2.0]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_partial_diagonal(3, 3, &[1.0, 2.0]);
assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 2.0 && m.m23 == 0.0 &&
m.m31 == 0.0 && m.m32 == 0.0 && m.m33 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 0.0 &&
dm[(2, 0)] == 0.0 && dm[(2, 1)] == 0.0 && dm[(2, 2)] == 0.0);
impl<T: Scalar, R: DimName> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, Dynamic>,
impl<T: Scalar, R: DimName> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, Dynamic>,
Creates a matrix or vector with all its elements set to elem
.
Example
let v = Vector3::from_element(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::from_element(3, 2.0);
let m = Matrix2x3::from_element(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_element(2, 3, 2.0);
assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);
Creates a matrix or vector with all its elements set to elem
.
Same as .from_element
.
Example
let v = Vector3::repeat(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::repeat(3, 2.0);
let m = Matrix2x3::repeat(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::repeat(2, 3, 2.0);
assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);
Creates a matrix or vector with all its elements set to 0
.
Example
let v = Vector3::<f32>::zeros();
// The argument represents the vector dimension.
let dv = DVector::<f32>::zeros(3);
let m = Matrix2x3::<f32>::zeros();
// The two arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::zeros(2, 3);
assert!(v.x == 0.0 && v.y == 0.0 && v.z == 0.0);
assert!(dv[0] == 0.0 && dv[1] == 0.0 && dv[2] == 0.0);
assert!(m.m11 == 0.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 0.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 0.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 0.0 && dm[(1, 2)] == 0.0);
Creates a matrix or vector with all its elements filled by an iterator.
The output matrix is filled column-by-column.
Example
let v = Vector3::from_iterator((0..3).into_iter());
// The additional argument represents the vector dimension.
let dv = DVector::from_iterator(3, (0..3).into_iter());
let m = Matrix2x3::from_iterator((0..6).into_iter());
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_iterator(2, 3, (0..6).into_iter());
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);
Creates a matrix or vector filled with the results of a function applied to each of its component coordinates.
Example
let v = Vector3::from_fn(|i, _| i);
// The additional argument represents the vector dimension.
let dv = DVector::from_fn(3, |i, _| i);
let m = Matrix2x3::from_fn(|i, j| i * 3 + j);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_fn(2, 3, |i, j| i * 3 + j);
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);
Creates an identity matrix. If the matrix is not square, the largest square submatrix (starting at the first row and column) is set to the identity while all other entries are set to zero.
Example
let m = Matrix2x3::<f32>::identity();
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::identity(2, 3);
assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 1.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 1.0 && dm[(1, 2)] == 0.0);
Creates a matrix filled with its diagonal filled with elt
and all other
components set to zero.
Example
let m = Matrix2x3::from_diagonal_element(5.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_diagonal_element(2, 3, 5.0);
assert!(m.m11 == 5.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 5.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 5.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 5.0 && dm[(1, 2)] == 0.0);
Creates a new matrix that may be rectangular. The first elts.len()
diagonal
elements are filled with the content of elts
. Others are set to 0.
Panics if elts.len()
is larger than the minimum among nrows
and ncols
.
Example
let m = Matrix3::from_partial_diagonal(&[1.0, 2.0]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_partial_diagonal(3, 3, &[1.0, 2.0]);
assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 2.0 && m.m23 == 0.0 &&
m.m31 == 0.0 && m.m32 == 0.0 && m.m33 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 0.0 &&
dm[(2, 0)] == 0.0 && dm[(2, 1)] == 0.0 && dm[(2, 2)] == 0.0);
impl<T: Scalar, C: DimName> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, Dynamic, C>,
impl<T: Scalar, C: DimName> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, Dynamic, C>,
Creates a matrix or vector with all its elements set to elem
.
Example
let v = Vector3::from_element(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::from_element(3, 2.0);
let m = Matrix2x3::from_element(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_element(2, 3, 2.0);
assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);
Creates a matrix or vector with all its elements set to elem
.
Same as .from_element
.
Example
let v = Vector3::repeat(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::repeat(3, 2.0);
let m = Matrix2x3::repeat(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::repeat(2, 3, 2.0);
assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);
Creates a matrix or vector with all its elements set to 0
.
Example
let v = Vector3::<f32>::zeros();
// The argument represents the vector dimension.
let dv = DVector::<f32>::zeros(3);
let m = Matrix2x3::<f32>::zeros();
// The two arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::zeros(2, 3);
assert!(v.x == 0.0 && v.y == 0.0 && v.z == 0.0);
assert!(dv[0] == 0.0 && dv[1] == 0.0 && dv[2] == 0.0);
assert!(m.m11 == 0.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 0.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 0.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 0.0 && dm[(1, 2)] == 0.0);
Creates a matrix or vector with all its elements filled by an iterator.
The output matrix is filled column-by-column.
Example
let v = Vector3::from_iterator((0..3).into_iter());
// The additional argument represents the vector dimension.
let dv = DVector::from_iterator(3, (0..3).into_iter());
let m = Matrix2x3::from_iterator((0..6).into_iter());
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_iterator(2, 3, (0..6).into_iter());
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);
Creates a matrix or vector filled with the results of a function applied to each of its component coordinates.
Example
let v = Vector3::from_fn(|i, _| i);
// The additional argument represents the vector dimension.
let dv = DVector::from_fn(3, |i, _| i);
let m = Matrix2x3::from_fn(|i, j| i * 3 + j);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_fn(2, 3, |i, j| i * 3 + j);
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);
Creates an identity matrix. If the matrix is not square, the largest square submatrix (starting at the first row and column) is set to the identity while all other entries are set to zero.
Example
let m = Matrix2x3::<f32>::identity();
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::identity(2, 3);
assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 1.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 1.0 && dm[(1, 2)] == 0.0);
Creates a matrix filled with its diagonal filled with elt
and all other
components set to zero.
Example
let m = Matrix2x3::from_diagonal_element(5.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_diagonal_element(2, 3, 5.0);
assert!(m.m11 == 5.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 5.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 5.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 5.0 && dm[(1, 2)] == 0.0);
Creates a new matrix that may be rectangular. The first elts.len()
diagonal
elements are filled with the content of elts
. Others are set to 0.
Panics if elts.len()
is larger than the minimum among nrows
and ncols
.
Example
let m = Matrix3::from_partial_diagonal(&[1.0, 2.0]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_partial_diagonal(3, 3, &[1.0, 2.0]);
assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 2.0 && m.m23 == 0.0 &&
m.m31 == 0.0 && m.m32 == 0.0 && m.m33 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 0.0 &&
dm[(2, 0)] == 0.0 && dm[(2, 1)] == 0.0 && dm[(2, 2)] == 0.0);
impl<T: Scalar> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, Dynamic, Dynamic>,
impl<T: Scalar> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, Dynamic, Dynamic>,
Creates a matrix or vector with all its elements set to elem
.
Example
let v = Vector3::from_element(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::from_element(3, 2.0);
let m = Matrix2x3::from_element(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_element(2, 3, 2.0);
assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);
Creates a matrix or vector with all its elements set to elem
.
Same as .from_element
.
Example
let v = Vector3::repeat(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::repeat(3, 2.0);
let m = Matrix2x3::repeat(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::repeat(2, 3, 2.0);
assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);
Creates a matrix or vector with all its elements set to 0
.
Example
let v = Vector3::<f32>::zeros();
// The argument represents the vector dimension.
let dv = DVector::<f32>::zeros(3);
let m = Matrix2x3::<f32>::zeros();
// The two arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::zeros(2, 3);
assert!(v.x == 0.0 && v.y == 0.0 && v.z == 0.0);
assert!(dv[0] == 0.0 && dv[1] == 0.0 && dv[2] == 0.0);
assert!(m.m11 == 0.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 0.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 0.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 0.0 && dm[(1, 2)] == 0.0);
pub fn from_iterator<I>(nrows: usize, ncols: usize, iter: I) -> Self where
I: IntoIterator<Item = T>,
pub fn from_iterator<I>(nrows: usize, ncols: usize, iter: I) -> Self where
I: IntoIterator<Item = T>,
Creates a matrix or vector with all its elements filled by an iterator.
The output matrix is filled column-by-column.
Example
let v = Vector3::from_iterator((0..3).into_iter());
// The additional argument represents the vector dimension.
let dv = DVector::from_iterator(3, (0..3).into_iter());
let m = Matrix2x3::from_iterator((0..6).into_iter());
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_iterator(2, 3, (0..6).into_iter());
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);
Creates a matrix or vector filled with the results of a function applied to each of its component coordinates.
Example
let v = Vector3::from_fn(|i, _| i);
// The additional argument represents the vector dimension.
let dv = DVector::from_fn(3, |i, _| i);
let m = Matrix2x3::from_fn(|i, j| i * 3 + j);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_fn(2, 3, |i, j| i * 3 + j);
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);
Creates an identity matrix. If the matrix is not square, the largest square submatrix (starting at the first row and column) is set to the identity while all other entries are set to zero.
Example
let m = Matrix2x3::<f32>::identity();
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::identity(2, 3);
assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 1.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 1.0 && dm[(1, 2)] == 0.0);
Creates a matrix filled with its diagonal filled with elt
and all other
components set to zero.
Example
let m = Matrix2x3::from_diagonal_element(5.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_diagonal_element(2, 3, 5.0);
assert!(m.m11 == 5.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 5.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 5.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 5.0 && dm[(1, 2)] == 0.0);
Creates a new matrix that may be rectangular. The first elts.len()
diagonal
elements are filled with the content of elts
. Others are set to 0.
Panics if elts.len()
is larger than the minimum among nrows
and ncols
.
Example
let m = Matrix3::from_partial_diagonal(&[1.0, 2.0]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_partial_diagonal(3, 3, &[1.0, 2.0]);
assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 2.0 && m.m23 == 0.0 &&
m.m31 == 0.0 && m.m32 == 0.0 && m.m33 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 0.0 &&
dm[(2, 0)] == 0.0 && dm[(2, 1)] == 0.0 && dm[(2, 2)] == 0.0);
impl<T: Scalar, R: DimName, C: DimName> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
impl<T: Scalar, R: DimName, C: DimName> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, C>,
Creates a matrix with its elements filled with the components provided by a slice in row-major order.
The order of elements in the slice must follow the usual mathematic writing, i.e., row-by-row.
Example
let v = Vector3::from_row_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_row_slice(&[0, 1, 2]);
let m = Matrix2x3::from_row_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_row_slice(2, 3, &[0, 1, 2, 3, 4, 5]);
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);
Creates a matrix with its elements filled with the components provided by a slice in column-major order.
Example
let v = Vector3::from_column_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_column_slice(&[0, 1, 2]);
let m = Matrix2x3::from_column_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_column_slice(2, 3, &[0, 1, 2, 3, 4, 5]);
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);
Creates a matrix backed by a given Vec
.
The output matrix is filled column-by-column.
Example
let m = Matrix2x3::from_vec(vec![0, 1, 2, 3, 4, 5]);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_vec(2, 3, vec![0, 1, 2, 3, 4, 5]);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);
impl<T: Scalar, R: DimName> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, Dynamic>,
impl<T: Scalar, R: DimName> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, Dynamic>,
Creates a matrix with its elements filled with the components provided by a slice in row-major order.
The order of elements in the slice must follow the usual mathematic writing, i.e., row-by-row.
Example
let v = Vector3::from_row_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_row_slice(&[0, 1, 2]);
let m = Matrix2x3::from_row_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_row_slice(2, 3, &[0, 1, 2, 3, 4, 5]);
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);
Creates a matrix with its elements filled with the components provided by a slice in column-major order.
Example
let v = Vector3::from_column_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_column_slice(&[0, 1, 2]);
let m = Matrix2x3::from_column_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_column_slice(2, 3, &[0, 1, 2, 3, 4, 5]);
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);
Creates a matrix backed by a given Vec
.
The output matrix is filled column-by-column.
Example
let m = Matrix2x3::from_vec(vec![0, 1, 2, 3, 4, 5]);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_vec(2, 3, vec![0, 1, 2, 3, 4, 5]);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);
impl<T: Scalar, C: DimName> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, Dynamic, C>,
impl<T: Scalar, C: DimName> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, Dynamic, C>,
Creates a matrix with its elements filled with the components provided by a slice in row-major order.
The order of elements in the slice must follow the usual mathematic writing, i.e., row-by-row.
Example
let v = Vector3::from_row_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_row_slice(&[0, 1, 2]);
let m = Matrix2x3::from_row_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_row_slice(2, 3, &[0, 1, 2, 3, 4, 5]);
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);
Creates a matrix with its elements filled with the components provided by a slice in column-major order.
Example
let v = Vector3::from_column_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_column_slice(&[0, 1, 2]);
let m = Matrix2x3::from_column_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_column_slice(2, 3, &[0, 1, 2, 3, 4, 5]);
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);
Creates a matrix backed by a given Vec
.
The output matrix is filled column-by-column.
Example
let m = Matrix2x3::from_vec(vec![0, 1, 2, 3, 4, 5]);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_vec(2, 3, vec![0, 1, 2, 3, 4, 5]);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);
impl<T: Scalar> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, Dynamic, Dynamic>,
impl<T: Scalar> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, Dynamic, Dynamic>,
Creates a matrix with its elements filled with the components provided by a slice in row-major order.
The order of elements in the slice must follow the usual mathematic writing, i.e., row-by-row.
Example
let v = Vector3::from_row_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_row_slice(&[0, 1, 2]);
let m = Matrix2x3::from_row_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_row_slice(2, 3, &[0, 1, 2, 3, 4, 5]);
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);
Creates a matrix with its elements filled with the components provided by a slice in column-major order.
Example
let v = Vector3::from_column_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_column_slice(&[0, 1, 2]);
let m = Matrix2x3::from_column_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_column_slice(2, 3, &[0, 1, 2, 3, 4, 5]);
assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);
Creates a matrix backed by a given Vec
.
The output matrix is filled column-by-column.
Example
let m = Matrix2x3::from_vec(vec![0, 1, 2, 3, 4, 5]);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_vec(2, 3, vec![0, 1, 2, 3, 4, 5]);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);
pub const fn new(
m11: T,
m12: T,
m13: T,
m14: T,
m15: T,
m16: T,
m21: T,
m22: T,
m23: T,
m24: T,
m25: T,
m26: T,
m31: T,
m32: T,
m33: T,
m34: T,
m35: T,
m36: T,
m41: T,
m42: T,
m43: T,
m44: T,
m45: T,
m46: T,
m51: T,
m52: T,
m53: T,
m54: T,
m55: T,
m56: T,
m61: T,
m62: T,
m63: T,
m64: T,
m65: T,
m66: T
) -> Self
pub const fn new(
m11: T,
m12: T,
m13: T,
m14: T,
m15: T,
m16: T,
m21: T,
m22: T,
m23: T,
m24: T,
m25: T,
m26: T,
m31: T,
m32: T,
m33: T,
m34: T,
m35: T,
m36: T,
m41: T,
m42: T,
m43: T,
m44: T,
m45: T,
m46: T,
m51: T,
m52: T,
m53: T,
m54: T,
m55: T,
m56: T,
m61: T,
m62: T,
m63: T,
m64: T,
m65: T,
m66: T
) -> Self
Initializes this matrix from its components.
Initializes this matrix from its components.
Initializes this matrix from its components.
The column unit vector with T::one()
as its i-th component.
The column vector with a 1 as its first component, and zero elsewhere.
The column vector with a 1 as its second component, and zero elsewhere.
The column vector with a 1 as its third component, and zero elsewhere.
The column vector with a 1 as its fourth component, and zero elsewhere.
The column vector with a 1 as its fifth component, and zero elsewhere.
The column vector with a 1 as its sixth component, and zero elsewhere.
The unit column vector with a 1 as its first component, and zero elsewhere.
The unit column vector with a 1 as its second component, and zero elsewhere.
The unit column vector with a 1 as its third component, and zero elsewhere.
The unit column vector with a 1 as its fourth component, and zero elsewhere.
The unit column vector with a 1 as its fifth component, and zero elsewhere.
pub unsafe fn from_slice_with_strides_generic_unchecked(
data: &'a [T],
start: usize,
nrows: R,
ncols: C,
rstride: RStride,
cstride: CStride
) -> Self
pub unsafe fn from_slice_with_strides_generic_unchecked(
data: &'a [T],
start: usize,
nrows: R,
ncols: C,
rstride: RStride,
cstride: CStride
) -> Self
Creates, without bound-checking, a matrix slice from an array and with dimensions and strides specified by generic types instances.
Safety
This method is unsafe because the input data array is not checked to contain enough elements.
The generic types R
, C
, RStride
, CStride
can either be type-level integers or integers wrapped with Dynamic::new()
.
pub fn from_slice_with_strides_generic(
data: &'a [T],
nrows: R,
ncols: C,
rstride: RStride,
cstride: CStride
) -> Self
pub fn from_slice_with_strides_generic(
data: &'a [T],
nrows: R,
ncols: C,
rstride: RStride,
cstride: CStride
) -> Self
Creates a matrix slice from an array and with dimensions and strides specified by generic types instances.
Panics if the input data array dose not contain enough elements.
The generic types R
, C
, RStride
, CStride
can either be type-level integers or integers wrapped with Dynamic::new()
.
pub unsafe fn from_slice_generic_unchecked(
data: &'a [T],
start: usize,
nrows: R,
ncols: C
) -> Self
pub unsafe fn from_slice_generic_unchecked(
data: &'a [T],
start: usize,
nrows: R,
ncols: C
) -> Self
Creates, without bound-checking, a matrix slice from an array and with dimensions specified by generic types instances.
Safety
This method is unsafe because the input data array is not checked to contain enough elements.
The generic types R
and C
can either be type-level integers or integers wrapped with Dynamic::new()
.
Creates a matrix slice from an array and with dimensions and strides specified by generic types instances.
Panics if the input data array dose not contain enough elements.
The generic types R
and C
can either be type-level integers or integers wrapped with Dynamic::new()
.
Creates a new matrix slice from the given data array.
Panics if data
does not contain enough elements.
Creates, without bound checking, a new matrix slice from the given data array.
Creates a new matrix slice with the specified strides from the given data array.
Panics if data
does not contain enough elements.
Creates a new matrix slice from the given data array.
Panics if data
does not contain enough elements.
Creates, without bound checking, a new matrix slice from the given data array.
Creates a new matrix slice with the specified strides from the given data array.
Panics if data
does not contain enough elements.
Creates a new matrix slice from the given data array.
Panics if data
does not contain enough elements.
Creates, without bound checking, a new matrix slice from the given data array.
Creates a new matrix slice with the specified strides from the given data array.
Panics if data
does not contain enough elements.
Creates a new matrix slice from the given data array.
Panics if data
does not contain enough elements.
Creates a new matrix slice with the specified strides from the given data array.
Panics if data
does not contain enough elements.
pub unsafe fn from_slice_with_strides_generic_unchecked(
data: &'a mut [T],
start: usize,
nrows: R,
ncols: C,
rstride: RStride,
cstride: CStride
) -> Self
pub unsafe fn from_slice_with_strides_generic_unchecked(
data: &'a mut [T],
start: usize,
nrows: R,
ncols: C,
rstride: RStride,
cstride: CStride
) -> Self
Creates, without bound-checking, a mutable matrix slice from an array and with dimensions and strides specified by generic types instances.
Safety
This method is unsafe because the input data array is not checked to contain enough elements.
The generic types R
, C
, RStride
, CStride
can either be type-level integers or integers wrapped with Dynamic::new()
.
pub fn from_slice_with_strides_generic(
data: &'a mut [T],
nrows: R,
ncols: C,
rstride: RStride,
cstride: CStride
) -> Self
pub fn from_slice_with_strides_generic(
data: &'a mut [T],
nrows: R,
ncols: C,
rstride: RStride,
cstride: CStride
) -> Self
Creates a mutable matrix slice from an array and with dimensions and strides specified by generic types instances.
Panics if the input data array dose not contain enough elements.
The generic types R
, C
, RStride
, CStride
can either be type-level integers or integers wrapped with Dynamic::new()
.
pub unsafe fn from_slice_generic_unchecked(
data: &'a mut [T],
start: usize,
nrows: R,
ncols: C
) -> Self
pub unsafe fn from_slice_generic_unchecked(
data: &'a mut [T],
start: usize,
nrows: R,
ncols: C
) -> Self
Creates, without bound-checking, a mutable matrix slice from an array and with dimensions specified by generic types instances.
Safety
This method is unsafe because the input data array is not checked to contain enough elements.
The generic types R
and C
can either be type-level integers or integers wrapped with Dynamic::new()
.
Creates a mutable matrix slice from an array and with dimensions and strides specified by generic types instances.
Panics if the input data array dose not contain enough elements.
The generic types R
and C
can either be type-level integers or integers wrapped with Dynamic::new()
.
Creates a new mutable matrix slice from the given data array.
Panics if data
does not contain enough elements.
Creates, without bound checking, a new mutable matrix slice from the given data array.
Creates a new mutable matrix slice with the specified strides from the given data array.
Panics if data
does not contain enough elements.
pub unsafe fn from_slice_with_strides_unchecked(
data: &'a mut [T],
start: usize,
rstride: usize,
cstride: usize
) -> Self
pub unsafe fn from_slice_with_strides_unchecked(
data: &'a mut [T],
start: usize,
rstride: usize,
cstride: usize
) -> Self
Creates, without bound checking, a new mutable matrix slice with the specified strides from the given data array.
impl<'a, T: Scalar, R: DimName> Matrix<T, R, C, SliceStorageMut<'a, T, R, C, RStride, CStride>>
impl<'a, T: Scalar, R: DimName> Matrix<T, R, C, SliceStorageMut<'a, T, R, C, RStride, CStride>>
Creates a new mutable matrix slice from the given data array.
Panics if data
does not contain enough elements.
Creates, without bound checking, a new mutable matrix slice from the given data array.
impl<'a, T: Scalar, R: DimName> Matrix<T, R, C, SliceStorageMut<'a, T, R, C, RStride, CStride>>
impl<'a, T: Scalar, R: DimName> Matrix<T, R, C, SliceStorageMut<'a, T, R, C, RStride, CStride>>
pub fn from_slice_with_strides_mut(
data: &'a mut [T],
ncols: usize,
rstride: usize,
cstride: usize
) -> Self
pub fn from_slice_with_strides_mut(
data: &'a mut [T],
ncols: usize,
rstride: usize,
cstride: usize
) -> Self
Creates a new mutable matrix slice with the specified strides from the given data array.
Panics if data
does not contain enough elements.
pub unsafe fn from_slice_with_strides_unchecked(
data: &'a mut [T],
start: usize,
ncols: usize,
rstride: usize,
cstride: usize
) -> Self
pub unsafe fn from_slice_with_strides_unchecked(
data: &'a mut [T],
start: usize,
ncols: usize,
rstride: usize,
cstride: usize
) -> Self
Creates, without bound checking, a new mutable matrix slice with the specified strides from the given data array.
impl<'a, T: Scalar, C: DimName> Matrix<T, R, C, SliceStorageMut<'a, T, R, C, RStride, CStride>>
impl<'a, T: Scalar, C: DimName> Matrix<T, R, C, SliceStorageMut<'a, T, R, C, RStride, CStride>>
Creates a new mutable matrix slice from the given data array.
Panics if data
does not contain enough elements.
Creates, without bound checking, a new mutable matrix slice from the given data array.
impl<'a, T: Scalar, C: DimName> Matrix<T, R, C, SliceStorageMut<'a, T, R, C, RStride, CStride>>
impl<'a, T: Scalar, C: DimName> Matrix<T, R, C, SliceStorageMut<'a, T, R, C, RStride, CStride>>
pub fn from_slice_with_strides_mut(
data: &'a mut [T],
nrows: usize,
rstride: usize,
cstride: usize
) -> Self
pub fn from_slice_with_strides_mut(
data: &'a mut [T],
nrows: usize,
rstride: usize,
cstride: usize
) -> Self
Creates a new mutable matrix slice with the specified strides from the given data array.
Panics if data
does not contain enough elements.
pub unsafe fn from_slice_with_strides_unchecked(
data: &'a mut [T],
start: usize,
nrows: usize,
rstride: usize,
cstride: usize
) -> Self
pub unsafe fn from_slice_with_strides_unchecked(
data: &'a mut [T],
start: usize,
nrows: usize,
rstride: usize,
cstride: usize
) -> Self
Creates, without bound checking, a new mutable matrix slice with the specified strides from the given data array.
Creates a new mutable matrix slice from the given data array.
Panics if data
does not contain enough elements.
pub unsafe fn from_slice_unchecked(
data: &'a mut [T],
start: usize,
nrows: usize,
ncols: usize
) -> Self
pub unsafe fn from_slice_unchecked(
data: &'a mut [T],
start: usize,
nrows: usize,
ncols: usize
) -> Self
Creates, without bound checking, a new mutable matrix slice from the given data array.
pub fn from_slice_with_strides_mut(
data: &'a mut [T],
nrows: usize,
ncols: usize,
rstride: usize,
cstride: usize
) -> Self
pub fn from_slice_with_strides_mut(
data: &'a mut [T],
nrows: usize,
ncols: usize,
rstride: usize,
cstride: usize
) -> Self
Creates a new mutable matrix slice with the specified strides from the given data array.
Panics if data
does not contain enough elements.
pub unsafe fn from_slice_with_strides_unchecked(
data: &'a mut [T],
start: usize,
nrows: usize,
ncols: usize,
rstride: usize,
cstride: usize
) -> Self
pub unsafe fn from_slice_with_strides_unchecked(
data: &'a mut [T],
start: usize,
nrows: usize,
ncols: usize,
rstride: usize,
cstride: usize
) -> Self
Creates, without bound checking, a new mutable matrix slice with the specified strides from the given data array.
Extracts the upper triangular part of this matrix (including the diagonal).
Extracts the lower triangular part of this matrix (including the diagonal).
pub fn select_rows<'a, I>(&self, irows: I) -> OMatrix<T, Dynamic, C> where
I: IntoIterator<Item = &'a usize>,
I::IntoIter: ExactSizeIterator + Clone,
DefaultAllocator: Allocator<T, Dynamic, C>,
pub fn select_rows<'a, I>(&self, irows: I) -> OMatrix<T, Dynamic, C> where
I: IntoIterator<Item = &'a usize>,
I::IntoIter: ExactSizeIterator + Clone,
DefaultAllocator: Allocator<T, Dynamic, C>,
Creates a new matrix by extracting the given set of rows from self
.
pub fn select_columns<'a, I>(&self, icols: I) -> OMatrix<T, R, Dynamic> where
I: IntoIterator<Item = &'a usize>,
I::IntoIter: ExactSizeIterator,
DefaultAllocator: Allocator<T, R, Dynamic>,
pub fn select_columns<'a, I>(&self, icols: I) -> OMatrix<T, R, Dynamic> where
I: IntoIterator<Item = &'a usize>,
I::IntoIter: ExactSizeIterator,
DefaultAllocator: Allocator<T, R, Dynamic>,
Creates a new matrix by extracting the given set of columns from self
.
pub fn set_diagonal<R2: Dim, S2>(&mut self, diag: &Vector<T, R2, S2>) where
R: DimMin<C>,
S2: RawStorage<T, R2>,
ShapeConstraint: DimEq<DimMinimum<R, C>, R2>,
pub fn set_diagonal<R2: Dim, S2>(&mut self, diag: &Vector<T, R2, S2>) where
R: DimMin<C>,
S2: RawStorage<T, R2>,
ShapeConstraint: DimEq<DimMinimum<R, C>, R2>,
Fills the diagonal of this matrix with the content of the given vector.
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).
pub fn set_row<C2: Dim, S2>(&mut self, i: usize, row: &RowVector<T, C2, S2>) where
S2: RawStorage<T, U1, C2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
pub fn set_row<C2: Dim, S2>(&mut self, i: usize, row: &RowVector<T, C2, S2>) where
S2: RawStorage<T, U1, C2>,
ShapeConstraint: SameNumberOfColumns<C, C2>,
Fills the selected row of this matrix with the content of the given vector.
pub fn set_column<R2: Dim, S2>(&mut self, i: usize, column: &Vector<T, R2, S2>) where
S2: RawStorage<T, R2, U1>,
ShapeConstraint: SameNumberOfRows<R, R2>,
pub fn set_column<R2: Dim, S2>(&mut self, i: usize, column: &Vector<T, R2, S2>) where
S2: RawStorage<T, R2, U1>,
ShapeConstraint: SameNumberOfRows<R, R2>,
Fills the selected column of this matrix with the content of the given vector.
Sets all the elements of this matrix to the value returned by the closure.
Fills self
with the identity matrix.
Sets all the diagonal elements of this matrix to val
.
Sets all the elements of the selected row to val
.
Sets all the elements of the selected column to val
.
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.
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.
Copies the upper-triangle of this matrix to its lower-triangular part.
This makes the matrix symmetric. Panics if the matrix is not square.
Copies the upper-triangle of this matrix to its upper-triangular part.
This makes the matrix symmetric. Panics if the matrix is not square.
pub fn remove_column(self, i: usize) -> OMatrix<T, R, DimDiff<C, U1>> where
C: DimSub<U1>,
DefaultAllocator: Reallocator<T, R, C, R, DimDiff<C, U1>>,
pub fn remove_column(self, i: usize) -> OMatrix<T, R, DimDiff<C, U1>> where
C: DimSub<U1>,
DefaultAllocator: Reallocator<T, R, C, R, DimDiff<C, U1>>,
Removes the i
-th column from this matrix.
pub fn remove_columns_at(self, indices: &[usize]) -> OMatrix<T, R, Dynamic> where
C: DimSub<Dynamic, Output = Dynamic>,
DefaultAllocator: Reallocator<T, R, C, R, Dynamic>,
pub fn remove_columns_at(self, indices: &[usize]) -> OMatrix<T, R, Dynamic> where
C: DimSub<Dynamic, Output = Dynamic>,
DefaultAllocator: Reallocator<T, R, C, R, Dynamic>,
Removes all columns in indices
pub fn remove_rows_at(self, indices: &[usize]) -> OMatrix<T, Dynamic, C> where
R: DimSub<Dynamic, Output = Dynamic>,
DefaultAllocator: Reallocator<T, R, C, Dynamic, C>,
pub fn remove_rows_at(self, indices: &[usize]) -> OMatrix<T, Dynamic, C> where
R: DimSub<Dynamic, Output = Dynamic>,
DefaultAllocator: Reallocator<T, R, C, Dynamic, C>,
Removes all rows in indices
pub fn remove_fixed_columns<const D: usize>(
self,
i: usize
) -> OMatrix<T, R, DimDiff<C, Const<D>>> where
C: DimSub<Const<D>>,
DefaultAllocator: Reallocator<T, R, C, R, DimDiff<C, Const<D>>>,
pub fn remove_fixed_columns<const D: usize>(
self,
i: usize
) -> OMatrix<T, R, DimDiff<C, Const<D>>> where
C: DimSub<Const<D>>,
DefaultAllocator: Reallocator<T, R, C, R, DimDiff<C, Const<D>>>,
Removes D::dim()
consecutive columns from this matrix, starting with the i
-th
(included).
pub fn remove_columns(self, i: usize, n: usize) -> OMatrix<T, R, Dynamic> where
C: DimSub<Dynamic, Output = Dynamic>,
DefaultAllocator: Reallocator<T, R, C, R, Dynamic>,
pub fn remove_columns(self, i: usize, n: usize) -> OMatrix<T, R, Dynamic> where
C: DimSub<Dynamic, Output = Dynamic>,
DefaultAllocator: Reallocator<T, R, C, R, Dynamic>,
Removes n
consecutive columns from this matrix, starting with the i
-th (included).
pub fn remove_columns_generic<D>(
self,
i: usize,
nremove: D
) -> OMatrix<T, R, DimDiff<C, D>> where
D: Dim,
C: DimSub<D>,
DefaultAllocator: Reallocator<T, R, C, R, DimDiff<C, D>>,
pub fn remove_columns_generic<D>(
self,
i: usize,
nremove: D
) -> OMatrix<T, R, DimDiff<C, D>> where
D: Dim,
C: DimSub<D>,
DefaultAllocator: Reallocator<T, R, C, R, DimDiff<C, D>>,
Removes nremove.value()
columns from this matrix, starting with the i
-th (included).
This is the generic implementation of .remove_columns(...)
and
.remove_fixed_columns(...)
which have nicer API interfaces.
pub fn remove_row(self, i: usize) -> OMatrix<T, DimDiff<R, U1>, C> where
R: DimSub<U1>,
DefaultAllocator: Reallocator<T, R, C, DimDiff<R, U1>, C>,
pub fn remove_row(self, i: usize) -> OMatrix<T, DimDiff<R, U1>, C> where
R: DimSub<U1>,
DefaultAllocator: Reallocator<T, R, C, DimDiff<R, U1>, C>,
Removes the i
-th row from this matrix.
pub fn remove_fixed_rows<const D: usize>(
self,
i: usize
) -> OMatrix<T, DimDiff<R, Const<D>>, C> where
R: DimSub<Const<D>>,
DefaultAllocator: Reallocator<T, R, C, DimDiff<R, Const<D>>, C>,
pub fn remove_fixed_rows<const D: usize>(
self,
i: usize
) -> OMatrix<T, DimDiff<R, Const<D>>, C> where
R: DimSub<Const<D>>,
DefaultAllocator: Reallocator<T, R, C, DimDiff<R, Const<D>>, C>,
Removes D::dim()
consecutive rows from this matrix, starting with the i
-th (included).
pub fn remove_rows(self, i: usize, n: usize) -> OMatrix<T, Dynamic, C> where
R: DimSub<Dynamic, Output = Dynamic>,
DefaultAllocator: Reallocator<T, R, C, Dynamic, C>,
pub fn remove_rows(self, i: usize, n: usize) -> OMatrix<T, Dynamic, C> where
R: DimSub<Dynamic, Output = Dynamic>,
DefaultAllocator: Reallocator<T, R, C, Dynamic, C>,
Removes n
consecutive rows from this matrix, starting with the i
-th (included).
pub fn remove_rows_generic<D>(
self,
i: usize,
nremove: D
) -> OMatrix<T, DimDiff<R, D>, C> where
D: Dim,
R: DimSub<D>,
DefaultAllocator: Reallocator<T, R, C, DimDiff<R, D>, C>,
pub fn remove_rows_generic<D>(
self,
i: usize,
nremove: D
) -> OMatrix<T, DimDiff<R, D>, C> where
D: Dim,
R: DimSub<D>,
DefaultAllocator: Reallocator<T, R, C, DimDiff<R, D>, C>,
Removes nremove.value()
rows from this matrix, starting with the i
-th (included).
This is the generic implementation of .remove_rows(...)
and .remove_fixed_rows(...)
which have nicer API interfaces.
pub fn insert_column(self, i: usize, val: T) -> OMatrix<T, R, DimSum<C, U1>> where
C: DimAdd<U1>,
DefaultAllocator: Reallocator<T, R, C, R, DimSum<C, U1>>,
pub fn insert_column(self, i: usize, val: T) -> OMatrix<T, R, DimSum<C, U1>> where
C: DimAdd<U1>,
DefaultAllocator: Reallocator<T, R, C, R, DimSum<C, U1>>,
Inserts a column filled with val
at the i-th
position.
pub fn insert_fixed_columns<const D: usize>(
self,
i: usize,
val: T
) -> OMatrix<T, R, DimSum<C, Const<D>>> where
C: DimAdd<Const<D>>,
DefaultAllocator: Reallocator<T, R, C, R, DimSum<C, Const<D>>>,
pub fn insert_fixed_columns<const D: usize>(
self,
i: usize,
val: T
) -> OMatrix<T, R, DimSum<C, Const<D>>> where
C: DimAdd<Const<D>>,
DefaultAllocator: Reallocator<T, R, C, R, DimSum<C, Const<D>>>,
Inserts D
columns filled with val
starting at the i-th
position.
pub fn insert_columns(
self,
i: usize,
n: usize,
val: T
) -> OMatrix<T, R, Dynamic> where
C: DimAdd<Dynamic, Output = Dynamic>,
DefaultAllocator: Reallocator<T, R, C, R, Dynamic>,
pub fn insert_columns(
self,
i: usize,
n: usize,
val: T
) -> OMatrix<T, R, Dynamic> where
C: DimAdd<Dynamic, Output = Dynamic>,
DefaultAllocator: Reallocator<T, R, C, R, Dynamic>,
Inserts n
columns filled with val
starting at the i-th
position.
pub unsafe fn insert_columns_generic_uninitialized<D>(
self,
i: usize,
ninsert: D
) -> UninitMatrix<T, R, DimSum<C, D>> where
D: Dim,
C: DimAdd<D>,
DefaultAllocator: Reallocator<T, R, C, R, DimSum<C, D>>,
pub unsafe fn insert_columns_generic_uninitialized<D>(
self,
i: usize,
ninsert: D
) -> UninitMatrix<T, R, DimSum<C, D>> where
D: Dim,
C: DimAdd<D>,
DefaultAllocator: Reallocator<T, R, C, R, DimSum<C, D>>,
Inserts ninsert.value()
columns starting at the i-th
place of this matrix.
Safety
The output matrix has all its elements initialized except for the the components of the added columns.
pub fn insert_row(self, i: usize, val: T) -> OMatrix<T, DimSum<R, U1>, C> where
R: DimAdd<U1>,
DefaultAllocator: Reallocator<T, R, C, DimSum<R, U1>, C>,
pub fn insert_row(self, i: usize, val: T) -> OMatrix<T, DimSum<R, U1>, C> where
R: DimAdd<U1>,
DefaultAllocator: Reallocator<T, R, C, DimSum<R, U1>, C>,
Inserts a row filled with val
at the i-th
position.
pub fn insert_fixed_rows<const D: usize>(
self,
i: usize,
val: T
) -> OMatrix<T, DimSum<R, Const<D>>, C> where
R: DimAdd<Const<D>>,
DefaultAllocator: Reallocator<T, R, C, DimSum<R, Const<D>>, C>,
pub fn insert_fixed_rows<const D: usize>(
self,
i: usize,
val: T
) -> OMatrix<T, DimSum<R, Const<D>>, C> where
R: DimAdd<Const<D>>,
DefaultAllocator: Reallocator<T, R, C, DimSum<R, Const<D>>, C>,
Inserts D::dim()
rows filled with val
starting at the i-th
position.
pub fn insert_rows(self, i: usize, n: usize, val: T) -> OMatrix<T, Dynamic, C> where
R: DimAdd<Dynamic, Output = Dynamic>,
DefaultAllocator: Reallocator<T, R, C, Dynamic, C>,
pub fn insert_rows(self, i: usize, n: usize, val: T) -> OMatrix<T, Dynamic, C> where
R: DimAdd<Dynamic, Output = Dynamic>,
DefaultAllocator: Reallocator<T, R, C, Dynamic, C>,
Inserts n
rows filled with val
starting at the i-th
position.
pub unsafe fn insert_rows_generic_uninitialized<D>(
self,
i: usize,
ninsert: D
) -> UninitMatrix<T, DimSum<R, D>, C> where
D: Dim,
R: DimAdd<D>,
DefaultAllocator: Reallocator<T, R, C, DimSum<R, D>, C>,
pub unsafe fn insert_rows_generic_uninitialized<D>(
self,
i: usize,
ninsert: D
) -> UninitMatrix<T, DimSum<R, D>, C> where
D: Dim,
R: DimAdd<D>,
DefaultAllocator: Reallocator<T, R, C, DimSum<R, D>, C>,
Inserts ninsert.value()
rows at the i-th
place of this matrix.
Safety
The added rows values are not initialized.
This is the generic implementation of .insert_rows(...)
and
.insert_fixed_rows(...)
which have nicer API interfaces.
Resizes this matrix so that it contains new_nrows
rows and new_ncols
columns.
The values are copied such that self[(i, j)] == result[(i, j)]
. If the result has more
rows and/or columns than self
, then the extra rows or columns are filled with val
.
pub fn resize_vertically(
self,
new_nrows: usize,
val: T
) -> OMatrix<T, Dynamic, C> where
DefaultAllocator: Reallocator<T, R, C, Dynamic, C>,
pub fn resize_vertically(
self,
new_nrows: usize,
val: T
) -> OMatrix<T, Dynamic, C> where
DefaultAllocator: Reallocator<T, R, C, Dynamic, C>,
Resizes this matrix vertically, i.e., so that it contains new_nrows
rows while keeping the same number of columns.
The values are copied such that self[(i, j)] == result[(i, j)]
. If the result has more
rows than self
, then the extra rows are filled with val
.
pub fn resize_horizontally(
self,
new_ncols: usize,
val: T
) -> OMatrix<T, R, Dynamic> where
DefaultAllocator: Reallocator<T, R, C, R, Dynamic>,
pub fn resize_horizontally(
self,
new_ncols: usize,
val: T
) -> OMatrix<T, R, Dynamic> where
DefaultAllocator: Reallocator<T, R, C, R, Dynamic>,
Resizes this matrix horizontally, i.e., so that it contains new_ncolumns
columns while keeping the same number of columns.
The values are copied such that self[(i, j)] == result[(i, j)]
. If the result has more
columns than self
, then the extra columns are filled with val
.
pub fn fixed_resize<const R2: usize, const C2: usize>(
self,
val: T
) -> OMatrix<T, Const<R2>, Const<C2>> where
DefaultAllocator: Reallocator<T, R, C, Const<R2>, Const<C2>>,
pub fn fixed_resize<const R2: usize, const C2: usize>(
self,
val: T
) -> OMatrix<T, Const<R2>, Const<C2>> where
DefaultAllocator: Reallocator<T, R, C, Const<R2>, Const<C2>>,
Resizes this matrix so that it contains R2::value()
rows and C2::value()
columns.
The values are copied such that self[(i, j)] == result[(i, j)]
. If the result has more
rows and/or columns than self
, then the extra rows or columns are filled with val
.
pub fn resize_generic<R2: Dim, C2: Dim>(
self,
new_nrows: R2,
new_ncols: C2,
val: T
) -> OMatrix<T, R2, C2> where
DefaultAllocator: Reallocator<T, R, C, R2, C2>,
pub fn resize_generic<R2: Dim, C2: Dim>(
self,
new_nrows: R2,
new_ncols: C2,
val: T
) -> OMatrix<T, R2, C2> where
DefaultAllocator: Reallocator<T, R, C, R2, C2>,
Resizes self
such that it has dimensions new_nrows × new_ncols
.
The values are copied such that self[(i, j)] == result[(i, j)]
. If the result has more
rows and/or columns than self
, then the extra rows or columns are filled with val
.
pub fn reshape_generic<R2, C2>(
self,
new_nrows: R2,
new_ncols: C2
) -> Matrix<T, R2, C2, S::Output> where
R2: Dim,
C2: Dim,
S: ReshapableStorage<T, R, C, R2, C2>,
pub fn reshape_generic<R2, C2>(
self,
new_nrows: R2,
new_ncols: C2
) -> Matrix<T, R2, C2, S::Output> where
R2: Dim,
C2: Dim,
S: ReshapableStorage<T, R, C, R2, C2>,
Reshapes self
such that it has dimensions new_nrows × new_ncols
.
This will reinterpret self
as if it is a matrix with new_nrows
rows and new_ncols
columns. The arrangements of the component in the output matrix are the same as what
would be obtained by Matrix::from_slice_generic(self.as_slice(), new_nrows, new_ncols)
.
If self
is a dynamically-sized matrix, then its components are neither copied nor moved.
If self
is staticyll-sized, then a copy may happen in some situations.
This function will panic if the given dimensions are such that the number of elements of
the input matrix are not equal to the number of elements of the output matrix.
Examples
let m1 = Matrix2x3::new(
1.1, 1.2, 1.3,
2.1, 2.2, 2.3
);
let m2 = Matrix3x2::new(
1.1, 2.2,
2.1, 1.3,
1.2, 2.3
);
let reshaped = m1.reshape_generic(Const::<3>, Const::<2>);
assert_eq!(reshaped, m2);
let dm1 = DMatrix::from_row_slice(
4,
3,
&[
1.0, 0.0, 0.0,
0.0, 0.0, 1.0,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0
],
);
let dm2 = DMatrix::from_row_slice(
6,
2,
&[
1.0, 0.0,
0.0, 1.0,
0.0, 0.0,
0.0, 1.0,
0.0, 0.0,
0.0, 0.0,
],
);
let reshaped = dm1.reshape_generic(Dynamic::new(6), Dynamic::new(2));
assert_eq!(reshaped, dm2);
pub fn resize_mut(&mut self, new_nrows: usize, new_ncols: usize, val: T) where
DefaultAllocator: Reallocator<T, Dynamic, Dynamic, Dynamic, Dynamic>,
pub fn resize_mut(&mut self, new_nrows: usize, new_ncols: usize, val: T) where
DefaultAllocator: Reallocator<T, Dynamic, Dynamic, Dynamic, Dynamic>,
Resizes this matrix in-place.
The values are copied such that self[(i, j)] == result[(i, j)]
. If the result has more
rows and/or columns than self
, then the extra rows or columns are filled with val
.
Defined only for owned fully-dynamic matrices, i.e., DMatrix
.
impl<T: Scalar, C: Dim> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, Dynamic, C>,
impl<T: Scalar, C: Dim> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, Dynamic, C>,
pub fn resize_vertically_mut(&mut self, new_nrows: usize, val: T) where
DefaultAllocator: Reallocator<T, Dynamic, C, Dynamic, C>,
pub fn resize_vertically_mut(&mut self, new_nrows: usize, val: T) where
DefaultAllocator: Reallocator<T, Dynamic, C, Dynamic, C>,
Changes the number of rows of this matrix in-place.
The values are copied such that self[(i, j)] == result[(i, j)]
. If the result has more
rows than self
, then the extra rows are filled with val
.
Defined only for owned matrices with a dynamic number of rows (for example, DVector
).
impl<T: Scalar, R: Dim> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, Dynamic>,
impl<T: Scalar, R: Dim> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
DefaultAllocator: Allocator<T, R, Dynamic>,
pub fn resize_horizontally_mut(&mut self, new_ncols: usize, val: T) where
DefaultAllocator: Reallocator<T, R, Dynamic, R, Dynamic>,
pub fn resize_horizontally_mut(&mut self, new_ncols: usize, val: T) where
DefaultAllocator: Reallocator<T, R, Dynamic, R, Dynamic>,
Changes the number of column of this matrix in-place.
The values are copied such that self[(i, j)] == result[(i, j)]
. If the result has more
columns than self
, then the extra columns are filled with val
.
Defined only for owned matrices with a dynamic number of columns (for example, DVector
).
Slicing based on ranges
Indices to Individual Elements
Two-Dimensional Indices
let matrix = Matrix2::new(0, 2,
1, 3);
assert_eq!(matrix.index((0, 0)), &0);
assert_eq!(matrix.index((1, 0)), &1);
assert_eq!(matrix.index((0, 1)), &2);
assert_eq!(matrix.index((1, 1)), &3);
Linear Address Indexing
let matrix = Matrix2::new(0, 2,
1, 3);
assert_eq!(matrix.get(0), Some(&0));
assert_eq!(matrix.get(1), Some(&1));
assert_eq!(matrix.get(2), Some(&2));
assert_eq!(matrix.get(3), Some(&3));
Indices to Individual Rows and Columns
Index to a Row
let matrix = Matrix2::new(0, 2,
1, 3);
assert!(matrix.index((0, ..))
.eq(&Matrix1x2::new(0, 2)));
Index to a Column
let matrix = Matrix2::new(0, 2,
1, 3);
assert!(matrix.index((.., 0))
.eq(&Matrix2x1::new(0,
1)));
Indices to Parts of Individual Rows and Columns
Index to a Partial Row
let matrix = Matrix3::new(0, 3, 6,
1, 4, 7,
2, 5, 8);
assert!(matrix.index((0, ..2))
.eq(&Matrix1x2::new(0, 3)));
Index to a Partial Column
let matrix = Matrix3::new(0, 3, 6,
1, 4, 7,
2, 5, 8);
assert!(matrix.index((..2, 0))
.eq(&Matrix2x1::new(0,
1)));
assert!(matrix.index((Const::<1>.., 0))
.eq(&Matrix2x1::new(1,
2)));
Indices to Ranges of Rows and Columns
Index to a Range of Rows
let matrix = Matrix3::new(0, 3, 6,
1, 4, 7,
2, 5, 8);
assert!(matrix.index((1..3, ..))
.eq(&Matrix2x3::new(1, 4, 7,
2, 5, 8)));
Index to a Range of Columns
let matrix = Matrix3::new(0, 3, 6,
1, 4, 7,
2, 5, 8);
assert!(matrix.index((.., 1..3))
.eq(&Matrix3x2::new(3, 6,
4, 7,
5, 8)));
pub fn get<'a, I>(&'a self, index: I) -> Option<I::Output> where
I: MatrixIndex<'a, T, R, C, S>,
pub fn get<'a, I>(&'a self, index: I) -> Option<I::Output> where
I: MatrixIndex<'a, T, R, C, S>,
Produces a view of the data at the given index, or
None
if the index is out of bounds.
pub fn get_mut<'a, I>(&'a mut self, index: I) -> Option<I::OutputMut> where
S: RawStorageMut<T, R, C>,
I: MatrixIndexMut<'a, T, R, C, S>,
pub fn get_mut<'a, I>(&'a mut self, index: I) -> Option<I::OutputMut> where
S: RawStorageMut<T, R, C>,
I: MatrixIndexMut<'a, T, R, C, S>,
Produces a mutable view of the data at the given index, or
None
if the index is out of bounds.
Produces a view of the data at the given index, or panics if the index is out of bounds.
pub fn index_mut<'a, I>(&'a mut self, index: I) -> I::OutputMut where
S: RawStorageMut<T, R, C>,
I: MatrixIndexMut<'a, T, R, C, S>,
pub fn index_mut<'a, I>(&'a mut self, index: I) -> I::OutputMut where
S: RawStorageMut<T, R, C>,
I: MatrixIndexMut<'a, T, R, C, S>,
Produces a mutable view of the data at the given index, or panics if the index is out of bounds.
pub unsafe fn get_unchecked<'a, I>(&'a self, index: I) -> I::Output where
I: MatrixIndex<'a, T, R, C, S>,
pub unsafe fn get_unchecked<'a, I>(&'a self, index: I) -> I::Output where
I: MatrixIndex<'a, T, R, C, S>,
Produces a view of the data at the given index, without doing any bounds checking.
pub unsafe fn get_unchecked_mut<'a, I>(&'a mut self, index: I) -> I::OutputMut where
S: RawStorageMut<T, R, C>,
I: MatrixIndexMut<'a, T, R, C, S>,
pub unsafe fn get_unchecked_mut<'a, I>(&'a mut self, index: I) -> I::OutputMut where
S: RawStorageMut<T, R, C>,
I: MatrixIndexMut<'a, T, R, C, S>,
Returns a mutable view of the data at the given index, without doing any bounds checking.
Creates a new matrix with the given data without statically checking that the matrix dimension matches the storage dimension.
Creates a new statically-allocated matrix from the given ArrayStorage
.
This method exists primarily as a workaround for the fact that from_data
can not
work in const fn
contexts.
Creates a new heap-allocated matrix from the given VecStorage
.
This method exists primarily as a workaround for the fact that from_data
can not
work in const fn
contexts.
Creates a new heap-allocated matrix from the given VecStorage
.
This method exists primarily as a workaround for the fact that from_data
can not
work in const fn
contexts.
impl<T, R: Dim, C: Dim> Matrix<MaybeUninit<T>, R, C, <DefaultAllocator as Allocator<T, R, C>>::BufferUninit> where
DefaultAllocator: Allocator<T, R, C>,
impl<T, R: Dim, C: Dim> Matrix<MaybeUninit<T>, R, C, <DefaultAllocator as Allocator<T, R, C>>::BufferUninit> where
DefaultAllocator: Allocator<T, R, C>,
Assumes a matrix’s entries to be initialized. This operation should be near zero-cost.
For the similar method that operates on matrix slices, see [slice_assume_init
].
Safety
The user must make sure that every single entry of the buffer has been initialized, or Undefined Behavior will immediately occur.
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));
The shape of this matrix wrapped into their representative types (Const
or Dynamic
).
The number of rows of this matrix.
Examples:
let mat = Matrix3x4::<f32>::zeros();
assert_eq!(mat.nrows(), 3);
The number of columns of this matrix.
Examples:
let mat = Matrix3x4::<f32>::zeros();
assert_eq!(mat.ncols(), 4);
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));
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]);
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]);
pub fn relative_eq<R2, C2, SB>(
&self,
other: &Matrix<T, R2, C2, SB>,
eps: T::Epsilon,
max_relative: T::Epsilon
) -> bool where
T: RelativeEq,
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
T::Epsilon: Clone,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn relative_eq<R2, C2, SB>(
&self,
other: &Matrix<T, R2, C2, SB>,
eps: T::Epsilon,
max_relative: T::Epsilon
) -> bool where
T: RelativeEq,
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
T::Epsilon: Clone,
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.
pub fn eq<R2, C2, SB>(&self, other: &Matrix<T, R2, C2, SB>) -> bool where
T: PartialEq,
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn eq<R2, C2, SB>(&self, other: &Matrix<T, R2, C2, SB>) -> bool where
T: PartialEq,
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
Tests whether self
and rhs
are exactly equal.
pub fn into_owned(self) -> OMatrix<T, R, C> where
T: Scalar,
S: Storage<T, R, C>,
DefaultAllocator: Allocator<T, R, C>,
pub fn into_owned(self) -> OMatrix<T, R, C> where
T: Scalar,
S: Storage<T, R, C>,
DefaultAllocator: Allocator<T, R, C>,
Moves this matrix into one that owns its data.
pub fn into_owned_sum<R2, C2>(self) -> MatrixSum<T, R, C, R2, C2> where
T: Scalar,
S: Storage<T, R, C>,
R2: Dim,
C2: Dim,
DefaultAllocator: SameShapeAllocator<T, R, C, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn into_owned_sum<R2, C2>(self) -> MatrixSum<T, R, C, R2, C2> where
T: Scalar,
S: Storage<T, R, C>,
R2: Dim,
C2: Dim,
DefaultAllocator: SameShapeAllocator<T, R, C, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
Moves this matrix into one that owns its data. The actual type of the result depends on matrix storage combination rules for addition.
pub fn clone_owned(&self) -> OMatrix<T, R, C> where
T: Scalar,
S: Storage<T, R, C>,
DefaultAllocator: Allocator<T, R, C>,
pub fn clone_owned(&self) -> OMatrix<T, R, C> where
T: Scalar,
S: Storage<T, R, C>,
DefaultAllocator: Allocator<T, R, C>,
Clones this matrix to one that owns its data.
pub fn clone_owned_sum<R2, C2>(&self) -> MatrixSum<T, R, C, R2, C2> where
T: Scalar,
S: Storage<T, R, C>,
R2: Dim,
C2: Dim,
DefaultAllocator: SameShapeAllocator<T, R, C, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn clone_owned_sum<R2, C2>(&self) -> MatrixSum<T, R, C, R2, C2> where
T: Scalar,
S: Storage<T, R, C>,
R2: Dim,
C2: Dim,
DefaultAllocator: SameShapeAllocator<T, 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.
pub fn transpose_to<R2, C2, SB>(&self, out: &mut Matrix<T, R2, C2, SB>) where
T: Scalar,
R2: Dim,
C2: Dim,
SB: RawStorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>,
pub fn transpose_to<R2, C2, SB>(&self, out: &mut Matrix<T, R2, C2, SB>) where
T: Scalar,
R2: Dim,
C2: Dim,
SB: RawStorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>,
Transposes self
and store the result into out
.
Returns a matrix containing the result of f
applied to each of its entries.
pub fn cast<T2: Scalar>(self) -> OMatrix<T2, R, C> where
T: Scalar,
OMatrix<T2, R, C>: SupersetOf<Self>,
DefaultAllocator: Allocator<T2, R, C>,
pub fn cast<T2: Scalar>(self) -> OMatrix<T2, R, C> where
T: Scalar,
OMatrix<T2, R, C>: SupersetOf<Self>,
DefaultAllocator: Allocator<T2, R, C>,
Cast the components of self
to another type.
Example
let q = Vector3::new(1.0f64, 2.0, 3.0);
let q2 = q.cast::<f32>();
assert_eq!(q2, Vector3::new(1.0f32, 2.0, 3.0));
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.
pub fn map_with_location<T2: Scalar, F: FnMut(usize, usize, T) -> T2>(
&self,
f: F
) -> OMatrix<T2, R, C> where
T: Scalar,
DefaultAllocator: Allocator<T2, R, C>,
pub fn map_with_location<T2: Scalar, F: FnMut(usize, usize, T) -> T2>(
&self,
f: F
) -> OMatrix<T2, R, C> where
T: Scalar,
DefaultAllocator: Allocator<T2, R, C>,
Returns a matrix containing the result of f
applied to each of its entries. Unlike map
,
f
also gets passed the row and column index, i.e. f(row, col, value)
.
Returns a matrix containing the result of f
applied to each entries of self
and
rhs
.
pub fn zip_zip_map<T2, N3, N4, S2, S3, F>(
&self,
b: &Matrix<T2, R, C, S2>,
c: &Matrix<N3, R, C, S3>,
f: F
) -> OMatrix<N4, R, C> where
T: Scalar,
T2: Scalar,
N3: Scalar,
N4: Scalar,
S2: RawStorage<T2, R, C>,
S3: RawStorage<N3, R, C>,
F: FnMut(T, T2, N3) -> N4,
DefaultAllocator: Allocator<N4, R, C>,
pub fn zip_zip_map<T2, N3, N4, S2, S3, F>(
&self,
b: &Matrix<T2, R, C, S2>,
c: &Matrix<N3, R, C, S3>,
f: F
) -> OMatrix<N4, R, C> where
T: Scalar,
T2: Scalar,
N3: Scalar,
N4: Scalar,
S2: RawStorage<T2, R, C>,
S3: RawStorage<N3, R, C>,
F: FnMut(T, T2, N3) -> N4,
DefaultAllocator: Allocator<N4, R, C>,
Returns a matrix containing the result of f
applied to each entries of self
and
b
, and c
.
Folds a function f
on each entry of self
.
pub fn zip_fold<T2, R2, C2, S2, Acc>(
&self,
rhs: &Matrix<T2, R2, C2, S2>,
init: Acc,
f: impl FnMut(Acc, T, T2) -> Acc
) -> Acc where
T: Scalar,
T2: Scalar,
R2: Dim,
C2: Dim,
S2: RawStorage<T2, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn zip_fold<T2, R2, C2, S2, Acc>(
&self,
rhs: &Matrix<T2, R2, C2, S2>,
init: Acc,
f: impl FnMut(Acc, T, T2) -> Acc
) -> Acc where
T: Scalar,
T2: Scalar,
R2: Dim,
C2: Dim,
S2: RawStorage<T2, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
Folds a function f
on each pairs of entries from self
and rhs
.
Applies a closure f
to modify each component of self
.
pub fn zip_apply<T2, R2, C2, S2>(
&mut self,
rhs: &Matrix<T2, R2, C2, S2>,
f: impl FnMut(&mut T, T2)
) where
S: RawStorageMut<T, R, C>,
T2: Scalar,
R2: Dim,
C2: Dim,
S2: RawStorage<T2, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn zip_apply<T2, R2, C2, S2>(
&mut self,
rhs: &Matrix<T2, R2, C2, S2>,
f: impl FnMut(&mut T, T2)
) where
S: RawStorageMut<T, R, C>,
T2: Scalar,
R2: Dim,
C2: Dim,
S2: RawStorage<T2, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + 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
.
pub fn zip_zip_apply<T2, R2, C2, S2, N3, R3, C3, S3>(
&mut self,
b: &Matrix<T2, R2, C2, S2>,
c: &Matrix<N3, R3, C3, S3>,
f: impl FnMut(&mut T, T2, N3)
) where
S: RawStorageMut<T, R, C>,
T2: Scalar,
R2: Dim,
C2: Dim,
S2: RawStorage<T2, R2, C2>,
N3: Scalar,
R3: Dim,
C3: Dim,
S3: RawStorage<N3, R3, C3>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn zip_zip_apply<T2, R2, C2, S2, N3, R3, C3, S3>(
&mut self,
b: &Matrix<T2, R2, C2, S2>,
c: &Matrix<N3, R3, C3, S3>,
f: impl FnMut(&mut T, T2, N3)
) where
S: RawStorageMut<T, R, C>,
T2: Scalar,
R2: Dim,
C2: Dim,
S2: RawStorage<T2, R2, C2>,
N3: Scalar,
R3: Dim,
C3: Dim,
S3: RawStorage<N3, R3, C3>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, 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 b
and c
.
pub fn iter(&self) -> MatrixIter<'_, T, R, C, S>ⓘNotable traits for MatrixIter<'a, T, R, C, S>impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorage<T, R, C>> Iterator for MatrixIter<'a, T, R, C, S> type Item = &'a T;
pub fn iter(&self) -> MatrixIter<'_, T, R, C, S>ⓘNotable traits for MatrixIter<'a, T, R, C, S>impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorage<T, R, C>> Iterator for MatrixIter<'a, T, R, C, S> type Item = &'a T;
impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorage<T, R, C>> Iterator for MatrixIter<'a, T, R, C, S> type Item = &'a T;
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());
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))
}
pub fn column_iter(&self) -> ColumnIter<'_, T, R, C, S>ⓘNotable traits for ColumnIter<'a, T, R, C, S>impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorage<T, R, C>> Iterator for ColumnIter<'a, T, R, C, S> type Item = MatrixSlice<'a, T, R, U1, S::RStride, S::CStride>;
pub fn column_iter(&self) -> ColumnIter<'_, T, R, C, S>ⓘNotable traits for ColumnIter<'a, T, R, C, S>impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorage<T, R, C>> Iterator for ColumnIter<'a, T, R, C, S> type Item = MatrixSlice<'a, T, R, U1, S::RStride, S::CStride>;
impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorage<T, R, C>> Iterator for ColumnIter<'a, T, R, C, S> type Item = MatrixSlice<'a, T, R, U1, S::RStride, S::CStride>;
Iterate through the columns of this matrix.
Example
let mut a = Matrix2x3::new(1, 2, 3,
4, 5, 6);
for (i, column) in a.column_iter().enumerate() {
assert_eq!(column, a.column(i))
}
pub fn iter_mut(&mut self) -> MatrixIterMut<'_, T, R, C, S>ⓘNotable traits for MatrixIterMut<'a, T, R, C, S>impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorageMut<T, R, C>> Iterator for MatrixIterMut<'a, T, R, C, S> type Item = &'a mut T;
where
S: RawStorageMut<T, R, C>,
pub fn iter_mut(&mut self) -> MatrixIterMut<'_, T, R, C, S>ⓘNotable traits for MatrixIterMut<'a, T, R, C, S>impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorageMut<T, R, C>> Iterator for MatrixIterMut<'a, T, R, C, S> type Item = &'a mut T;
where
S: RawStorageMut<T, R, C>,
impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorageMut<T, R, C>> Iterator for MatrixIterMut<'a, T, R, C, S> type Item = &'a mut T;
Mutably iterates through this matrix coordinates.
pub fn row_iter_mut(&mut self) -> RowIterMut<'_, T, R, C, S>ⓘNotable traits for RowIterMut<'a, T, R, C, S>impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorageMut<T, R, C>> Iterator for RowIterMut<'a, T, R, C, S> type Item = MatrixSliceMut<'a, T, U1, C, S::RStride, S::CStride>;
where
S: RawStorageMut<T, R, C>,
pub fn row_iter_mut(&mut self) -> RowIterMut<'_, T, R, C, S>ⓘNotable traits for RowIterMut<'a, T, R, C, S>impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorageMut<T, R, C>> Iterator for RowIterMut<'a, T, R, C, S> type Item = MatrixSliceMut<'a, T, U1, C, S::RStride, S::CStride>;
where
S: RawStorageMut<T, R, C>,
impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorageMut<T, R, C>> Iterator for RowIterMut<'a, T, R, C, S> type Item = MatrixSliceMut<'a, T, U1, C, S::RStride, S::CStride>;
Mutably iterates through this matrix rows.
Example
let mut a = Matrix2x3::new(1, 2, 3,
4, 5, 6);
for (i, mut row) in a.row_iter_mut().enumerate() {
row *= (i + 1) * 10;
}
let expected = Matrix2x3::new(10, 20, 30,
80, 100, 120);
assert_eq!(a, expected);
pub fn column_iter_mut(&mut self) -> ColumnIterMut<'_, T, R, C, S>ⓘNotable traits for ColumnIterMut<'a, T, R, C, S>impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorageMut<T, R, C>> Iterator for ColumnIterMut<'a, T, R, C, S> type Item = MatrixSliceMut<'a, T, R, U1, S::RStride, S::CStride>;
where
S: RawStorageMut<T, R, C>,
pub fn column_iter_mut(&mut self) -> ColumnIterMut<'_, T, R, C, S>ⓘNotable traits for ColumnIterMut<'a, T, R, C, S>impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorageMut<T, R, C>> Iterator for ColumnIterMut<'a, T, R, C, S> type Item = MatrixSliceMut<'a, T, R, U1, S::RStride, S::CStride>;
where
S: RawStorageMut<T, R, C>,
impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorageMut<T, R, C>> Iterator for ColumnIterMut<'a, T, R, C, S> type Item = MatrixSliceMut<'a, T, R, U1, S::RStride, S::CStride>;
Mutably iterates through this matrix columns.
Example
let mut a = Matrix2x3::new(1, 2, 3,
4, 5, 6);
for (i, mut col) in a.column_iter_mut().enumerate() {
col *= (i + 1) * 10;
}
let expected = Matrix2x3::new(10, 40, 90,
40, 100, 180);
assert_eq!(a, expected);
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.
Swaps two entries without bound-checking.
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.
pub fn copy_from<R2, C2, SB>(&mut self, other: &Matrix<T, R2, C2, SB>) where
T: Scalar,
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn copy_from<R2, C2, SB>(&mut self, other: &Matrix<T, R2, C2, SB>) where
T: Scalar,
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
Fills this matrix with the content of another one. Both must have the same shape.
pub fn tr_copy_from<R2, C2, SB>(&mut self, other: &Matrix<T, R2, C2, SB>) where
T: Scalar,
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<R, C2> + SameNumberOfColumns<C, R2>,
pub fn tr_copy_from<R2, C2, SB>(&mut self, other: &Matrix<T, R2, C2, SB>) where
T: Scalar,
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: DimEq<R, C2> + SameNumberOfColumns<C, R2>,
Fills this matrix with the content of the transpose another one.
Returns self
with each of its components replaced by the result of a closure f
applied on it.
Gets a reference to the i-th element of this column vector without bound checking.
Gets a mutable reference to the i-th element of this column vector without bound checking.
Transposes the square matrix self
in-place.
pub fn adjoint_to<R2, C2, SB>(&self, out: &mut Matrix<T, R2, C2, SB>) where
R2: Dim,
C2: Dim,
SB: RawStorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>,
pub fn adjoint_to<R2, C2, SB>(&self, out: &mut Matrix<T, R2, C2, SB>) where
R2: Dim,
C2: Dim,
SB: RawStorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>,
Takes the adjoint (aka. conjugate-transpose) of self
and store the result into out
.
The adjoint (aka. conjugate-transpose) of self
.
pub fn conjugate_transpose_to<R2, C2, SB>(
&self,
out: &mut Matrix<T, R2, C2, SB>
) where
R2: Dim,
C2: Dim,
SB: RawStorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>,
👎 Deprecated: Renamed self.adjoint_to(out)
.
pub fn conjugate_transpose_to<R2, C2, SB>(
&self,
out: &mut Matrix<T, R2, C2, SB>
) where
R2: Dim,
C2: Dim,
SB: RawStorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>,
Renamed self.adjoint_to(out)
.
Takes the conjugate and transposes self
and store the result into out
.
pub fn conjugate_transpose(&self) -> OMatrix<T, C, R> where
DefaultAllocator: Allocator<T, C, R>,
👎 Deprecated: Renamed self.adjoint()
.
pub fn conjugate_transpose(&self) -> OMatrix<T, C, R> where
DefaultAllocator: Allocator<T, C, R>,
Renamed self.adjoint()
.
The conjugate transposition of self
.
The conjugate of self
.
pub fn unscale(&self, real: T::SimdRealField) -> OMatrix<T, R, C> where
DefaultAllocator: Allocator<T, R, C>,
pub fn unscale(&self, real: T::SimdRealField) -> OMatrix<T, R, C> where
DefaultAllocator: Allocator<T, R, C>,
Divides each component of the complex matrix self
by the given real.
pub fn scale(&self, real: T::SimdRealField) -> OMatrix<T, R, C> where
DefaultAllocator: Allocator<T, R, C>,
pub fn scale(&self, real: T::SimdRealField) -> OMatrix<T, R, C> where
DefaultAllocator: Allocator<T, R, C>,
Multiplies each component of the complex matrix self
by the given real.
The conjugate of the complex matrix self
computed in-place.
Divides each component of the complex matrix self
by the given real.
Multiplies each component of the complex matrix self
by the given real.
👎 Deprecated: Renamed to self.adjoint_mut()
.
Renamed to self.adjoint_mut()
.
Sets self
to its adjoint.
Sets self
to its adjoint (aka. conjugate-transpose).
The diagonal of this matrix.
pub fn map_diagonal<T2: Scalar>(&self, f: impl FnMut(T) -> T2) -> OVector<T2, D> where
DefaultAllocator: Allocator<T2, D>,
pub fn map_diagonal<T2: Scalar>(&self, f: impl FnMut(T) -> T2) -> OVector<T2, D> where
DefaultAllocator: Allocator<T2, D>,
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.
The symmetric part of self
, i.e., 0.5 * (self + self.transpose())
.
The hermitian part of self
, i.e., 0.5 * (self + self.adjoint())
.
impl<T: Scalar + Zero + One, D: DimAdd<U1> + IsNotStaticOne, S: RawStorage<T, D, D>> Matrix<T, D, D, S>
impl<T: Scalar + Zero + One, D: DimAdd<U1> + IsNotStaticOne, S: RawStorage<T, D, D>> Matrix<T, D, D, S>
pub fn to_homogeneous(&self) -> OVector<T, DimSum<D, U1>> where
DefaultAllocator: Allocator<T, DimSum<D, U1>>,
pub fn to_homogeneous(&self) -> OVector<T, DimSum<D, U1>> where
DefaultAllocator: Allocator<T, DimSum<D, U1>>,
Computes the coordinates in projective space of this vector, i.e., appends a 0
to its
coordinates.
pub fn from_homogeneous<SB>(
v: Vector<T, DimSum<D, U1>, SB>
) -> Option<OVector<T, D>> where
SB: RawStorage<T, DimSum<D, U1>>,
DefaultAllocator: Allocator<T, D>,
pub fn from_homogeneous<SB>(
v: Vector<T, DimSum<D, U1>, SB>
) -> Option<OVector<T, D>> where
SB: RawStorage<T, DimSum<D, U1>>,
DefaultAllocator: Allocator<T, D>,
Constructs a vector from coordinates in projective space, i.e., removes a 0
at the end of
self
. Returns None
if this last component is not zero.
pub fn perp<R2, C2, SB>(&self, b: &Matrix<T, R2, C2, SB>) -> T where
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, U2> + SameNumberOfColumns<C, U1> + SameNumberOfRows<R2, U2> + SameNumberOfColumns<C2, U1>,
pub fn perp<R2, C2, SB>(&self, b: &Matrix<T, R2, C2, SB>) -> T where
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, 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
.
pub fn cross<R2, C2, SB>(
&self,
b: &Matrix<T, R2, C2, SB>
) -> MatrixCross<T, R, C, R2, C2> where
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R, C, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn cross<R2, C2, SB>(
&self,
b: &Matrix<T, R2, C2, SB>
) -> MatrixCross<T, R, C, R2, C2> where
R2: Dim,
C2: Dim,
SB: RawStorage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, 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.
Computes the matrix M
such that for all vector v
we have M * v == self.cross(&v)
.
pub fn angle<R2: Dim, C2: Dim, SB>(
&self,
other: &Matrix<T, R2, C2, SB>
) -> T::SimdRealField where
SB: Storage<T, R2, C2>,
ShapeConstraint: DimEq<R, R2> + DimEq<C, C2>,
pub fn angle<R2: Dim, C2: Dim, SB>(
&self,
other: &Matrix<T, R2, C2, SB>
) -> T::SimdRealField where
SB: Storage<T, R2, C2>,
ShapeConstraint: DimEq<R, R2> + DimEq<C, C2>,
The smallest angle between two vectors.
Returns a slice containing the i-th row of this matrix.
Returns a slice containing the n
first elements of the i-th row of this matrix.
Extracts from this matrix a set of consecutive rows.
pub fn rows_with_step(
&self,
first_row: usize,
nrows: usize,
step: usize
) -> MatrixSlice<'_, T, Dynamic, C, Dynamic, S::CStride>
pub fn rows_with_step(
&self,
first_row: usize,
nrows: usize,
step: usize
) -> MatrixSlice<'_, T, Dynamic, C, Dynamic, S::CStride>
Extracts from this matrix a set of consecutive rows regularly skipping step
rows.
pub fn fixed_rows<const RSLICE: usize>(
&self,
first_row: usize
) -> MatrixSlice<'_, T, Const<RSLICE>, C, S::RStride, S::CStride>
pub fn fixed_rows<const RSLICE: usize>(
&self,
first_row: usize
) -> MatrixSlice<'_, T, Const<RSLICE>, C, S::RStride, S::CStride>
Extracts a compile-time number of consecutive rows from this matrix.
pub fn fixed_rows_with_step<const RSLICE: usize>(
&self,
first_row: usize,
step: usize
) -> MatrixSlice<'_, T, Const<RSLICE>, C, Dynamic, S::CStride>
pub fn fixed_rows_with_step<const RSLICE: usize>(
&self,
first_row: usize,
step: usize
) -> MatrixSlice<'_, T, Const<RSLICE>, C, Dynamic, S::CStride>
Extracts from this matrix a compile-time number of rows regularly skipping step
rows.
pub fn rows_generic<RSlice: Dim>(
&self,
row_start: usize,
nrows: RSlice
) -> MatrixSlice<'_, T, RSlice, C, S::RStride, S::CStride>
pub fn rows_generic<RSlice: Dim>(
&self,
row_start: usize,
nrows: RSlice
) -> MatrixSlice<'_, T, RSlice, C, S::RStride, S::CStride>
Extracts from this matrix nrows
rows regularly skipping step
rows. Both
argument may or may not be values known at compile-time.
pub fn rows_generic_with_step<RSlice>(
&self,
row_start: usize,
nrows: RSlice,
step: usize
) -> MatrixSlice<'_, T, RSlice, C, Dynamic, S::CStride> where
RSlice: Dim,
pub fn rows_generic_with_step<RSlice>(
&self,
row_start: usize,
nrows: RSlice,
step: usize
) -> MatrixSlice<'_, T, RSlice, C, Dynamic, S::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.
Returns a slice containing the i-th column of this matrix.
pub fn column_part(
&self,
i: usize,
n: usize
) -> MatrixSlice<'_, T, Dynamic, U1, S::RStride, S::CStride>
pub fn column_part(
&self,
i: usize,
n: usize
) -> MatrixSlice<'_, T, Dynamic, U1, S::RStride, S::CStride>
Returns a slice containing the n
first elements of the i-th column of this matrix.
Extracts from this matrix a set of consecutive columns.
pub fn columns_with_step(
&self,
first_col: usize,
ncols: usize,
step: usize
) -> MatrixSlice<'_, T, R, Dynamic, S::RStride, Dynamic>
pub fn columns_with_step(
&self,
first_col: usize,
ncols: usize,
step: usize
) -> MatrixSlice<'_, T, R, Dynamic, S::RStride, Dynamic>
Extracts from this matrix a set of consecutive columns regularly skipping step
columns.
pub fn fixed_columns<const CSLICE: usize>(
&self,
first_col: usize
) -> MatrixSlice<'_, T, R, Const<CSLICE>, S::RStride, S::CStride>
pub fn fixed_columns<const CSLICE: usize>(
&self,
first_col: usize
) -> MatrixSlice<'_, T, R, Const<CSLICE>, S::RStride, S::CStride>
Extracts a compile-time number of consecutive columns from this matrix.
pub fn fixed_columns_with_step<const CSLICE: usize>(
&self,
first_col: usize,
step: usize
) -> MatrixSlice<'_, T, R, Const<CSLICE>, S::RStride, Dynamic>
pub fn fixed_columns_with_step<const CSLICE: usize>(
&self,
first_col: usize,
step: usize
) -> MatrixSlice<'_, T, R, Const<CSLICE>, S::RStride, Dynamic>
Extracts from this matrix a compile-time number of columns regularly skipping
step
columns.
pub fn columns_generic<CSlice: Dim>(
&self,
first_col: usize,
ncols: CSlice
) -> MatrixSlice<'_, T, R, CSlice, S::RStride, S::CStride>
pub fn columns_generic<CSlice: Dim>(
&self,
first_col: usize,
ncols: CSlice
) -> MatrixSlice<'_, T, R, CSlice, S::RStride, S::CStride>
Extracts from this matrix ncols
columns. The number of columns may or may not be
known at compile-time.
pub fn columns_generic_with_step<CSlice: Dim>(
&self,
first_col: usize,
ncols: CSlice,
step: usize
) -> MatrixSlice<'_, T, R, CSlice, S::RStride, Dynamic>
pub fn columns_generic_with_step<CSlice: Dim>(
&self,
first_col: usize,
ncols: CSlice,
step: usize
) -> MatrixSlice<'_, T, R, CSlice, S::RStride, Dynamic>
Extracts from this matrix ncols
columns skipping step
columns. Both argument may
or may not be values known at compile-time.
Slices this matrix starting at its component (irow, icol)
and with (nrows, ncols)
consecutive elements.
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.
Slices this matrix starting at its component (irow, icol)
and with (R::dim(), CSlice::dim())
consecutive components.
Slices this matrix starting at its component (start.0, start.1)
and with
(RSLICE, CSLICE)
components. Each row (resp. column) of the sliced
matrix is separated by steps.0
(resp. steps.1
) ignored rows (resp. columns) of
the original matrix.
Creates a slice that may or may not have a fixed size and stride.
Creates a slice that may or may not have a fixed size and stride.
pub fn rows_range_pair<Range1: SliceRange<R>, Range2: SliceRange<R>>(
&self,
r1: Range1,
r2: Range2
) -> (MatrixSlice<'_, T, Range1::Size, C, S::RStride, S::CStride>, MatrixSlice<'_, T, Range2::Size, C, S::RStride, S::CStride>)
pub fn rows_range_pair<Range1: SliceRange<R>, Range2: SliceRange<R>>(
&self,
r1: Range1,
r2: Range2
) -> (MatrixSlice<'_, T, Range1::Size, C, S::RStride, S::CStride>, MatrixSlice<'_, T, Range2::Size, C, S::RStride, S::CStride>)
Splits this NxM
matrix into two parts delimited by two ranges.
Panics if the ranges overlap or if the first range is empty.
pub fn columns_range_pair<Range1: SliceRange<C>, Range2: SliceRange<C>>(
&self,
r1: Range1,
r2: Range2
) -> (MatrixSlice<'_, T, R, Range1::Size, S::RStride, S::CStride>, MatrixSlice<'_, T, R, Range2::Size, S::RStride, S::CStride>)
pub fn columns_range_pair<Range1: SliceRange<C>, Range2: SliceRange<C>>(
&self,
r1: Range1,
r2: Range2
) -> (MatrixSlice<'_, T, R, Range1::Size, S::RStride, S::CStride>, MatrixSlice<'_, T, R, Range2::Size, S::RStride, S::CStride>)
Splits this NxM
matrix into two parts delimited by two ranges.
Panics if the ranges overlap or if the first range is empty.
Returns a slice containing the i-th row of this matrix.
pub fn row_part_mut(
&mut self,
i: usize,
n: usize
) -> MatrixSliceMut<'_, T, U1, Dynamic, S::RStride, S::CStride>
pub fn row_part_mut(
&mut self,
i: usize,
n: usize
) -> MatrixSliceMut<'_, T, U1, Dynamic, S::RStride, S::CStride>
Returns a slice containing the n
first elements of the i-th row of this matrix.
Extracts from this matrix a set of consecutive rows.
pub fn rows_with_step_mut(
&mut self,
first_row: usize,
nrows: usize,
step: usize
) -> MatrixSliceMut<'_, T, Dynamic, C, Dynamic, S::CStride>
pub fn rows_with_step_mut(
&mut self,
first_row: usize,
nrows: usize,
step: usize
) -> MatrixSliceMut<'_, T, Dynamic, C, Dynamic, S::CStride>
Extracts from this matrix a set of consecutive rows regularly skipping step
rows.
pub fn fixed_rows_mut<const RSLICE: usize>(
&mut self,
first_row: usize
) -> MatrixSliceMut<'_, T, Const<RSLICE>, C, S::RStride, S::CStride>
pub fn fixed_rows_mut<const RSLICE: usize>(
&mut self,
first_row: usize
) -> MatrixSliceMut<'_, T, Const<RSLICE>, C, S::RStride, S::CStride>
Extracts a compile-time number of consecutive rows from this matrix.
pub fn fixed_rows_with_step_mut<const RSLICE: usize>(
&mut self,
first_row: usize,
step: usize
) -> MatrixSliceMut<'_, T, Const<RSLICE>, C, Dynamic, S::CStride>
pub fn fixed_rows_with_step_mut<const RSLICE: usize>(
&mut self,
first_row: usize,
step: usize
) -> MatrixSliceMut<'_, T, Const<RSLICE>, C, Dynamic, S::CStride>
Extracts from this matrix a compile-time number of rows regularly skipping step
rows.
pub fn rows_generic_mut<RSlice: Dim>(
&mut self,
row_start: usize,
nrows: RSlice
) -> MatrixSliceMut<'_, T, RSlice, C, S::RStride, S::CStride>
pub fn rows_generic_mut<RSlice: Dim>(
&mut self,
row_start: usize,
nrows: RSlice
) -> MatrixSliceMut<'_, T, RSlice, C, S::RStride, S::CStride>
Extracts from this matrix nrows
rows regularly skipping step
rows. Both
argument may or may not be values known at compile-time.
pub fn rows_generic_with_step_mut<RSlice>(
&mut self,
row_start: usize,
nrows: RSlice,
step: usize
) -> MatrixSliceMut<'_, T, RSlice, C, Dynamic, S::CStride> where
RSlice: Dim,
pub fn rows_generic_with_step_mut<RSlice>(
&mut self,
row_start: usize,
nrows: RSlice,
step: usize
) -> MatrixSliceMut<'_, T, RSlice, C, Dynamic, S::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.
pub fn column_mut(
&mut self,
i: usize
) -> MatrixSliceMut<'_, T, R, U1, S::RStride, S::CStride>
pub fn column_mut(
&mut self,
i: usize
) -> MatrixSliceMut<'_, T, R, U1, S::RStride, S::CStride>
Returns a slice containing the i-th column of this matrix.
pub fn column_part_mut(
&mut self,
i: usize,
n: usize
) -> MatrixSliceMut<'_, T, Dynamic, U1, S::RStride, S::CStride>
pub fn column_part_mut(
&mut self,
i: usize,
n: usize
) -> MatrixSliceMut<'_, T, Dynamic, U1, S::RStride, S::CStride>
Returns a slice containing the n
first elements of the i-th column of this matrix.
pub fn columns_mut(
&mut self,
first_col: usize,
ncols: usize
) -> MatrixSliceMut<'_, T, R, Dynamic, S::RStride, S::CStride>
pub fn columns_mut(
&mut self,
first_col: usize,
ncols: usize
) -> MatrixSliceMut<'_, T, R, Dynamic, S::RStride, S::CStride>
Extracts from this matrix a set of consecutive columns.
pub fn columns_with_step_mut(
&mut self,
first_col: usize,
ncols: usize,
step: usize
) -> MatrixSliceMut<'_, T, R, Dynamic, S::RStride, Dynamic>
pub fn columns_with_step_mut(
&mut self,
first_col: usize,
ncols: usize,
step: usize
) -> MatrixSliceMut<'_, T, R, Dynamic, S::RStride, Dynamic>
Extracts from this matrix a set of consecutive columns regularly skipping step
columns.
pub fn fixed_columns_mut<const CSLICE: usize>(
&mut self,
first_col: usize
) -> MatrixSliceMut<'_, T, R, Const<CSLICE>, S::RStride, S::CStride>
pub fn fixed_columns_mut<const CSLICE: usize>(
&mut self,
first_col: usize
) -> MatrixSliceMut<'_, T, R, Const<CSLICE>, S::RStride, S::CStride>
Extracts a compile-time number of consecutive columns from this matrix.
pub fn fixed_columns_with_step_mut<const CSLICE: usize>(
&mut self,
first_col: usize,
step: usize
) -> MatrixSliceMut<'_, T, R, Const<CSLICE>, S::RStride, Dynamic>
pub fn fixed_columns_with_step_mut<const CSLICE: usize>(
&mut self,
first_col: usize,
step: usize
) -> MatrixSliceMut<'_, T, R, Const<CSLICE>, S::RStride, Dynamic>
Extracts from this matrix a compile-time number of columns regularly skipping
step
columns.
pub fn columns_generic_mut<CSlice: Dim>(
&mut self,
first_col: usize,
ncols: CSlice
) -> MatrixSliceMut<'_, T, R, CSlice, S::RStride, S::CStride>
pub fn columns_generic_mut<CSlice: Dim>(
&mut self,
first_col: usize,
ncols: CSlice
) -> MatrixSliceMut<'_, T, R, CSlice, S::RStride, S::CStride>
Extracts from this matrix ncols
columns. The number of columns may or may not be
known at compile-time.
pub fn columns_generic_with_step_mut<CSlice: Dim>(
&mut self,
first_col: usize,
ncols: CSlice,
step: usize
) -> MatrixSliceMut<'_, T, R, CSlice, S::RStride, Dynamic>
pub fn columns_generic_with_step_mut<CSlice: Dim>(
&mut self,
first_col: usize,
ncols: CSlice,
step: usize
) -> MatrixSliceMut<'_, T, R, CSlice, S::RStride, Dynamic>
Extracts from this matrix ncols
columns skipping step
columns. Both argument may
or may not be values known at compile-time.
Slices this matrix starting at its component (irow, icol)
and with (nrows, ncols)
consecutive elements.
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.
Slices this matrix starting at its component (irow, icol)
and with (R::dim(), CSlice::dim())
consecutive components.
Slices this matrix starting at its component (start.0, start.1)
and with
(RSLICE, CSLICE)
components. Each row (resp. column) of the sliced
matrix is separated by steps.0
(resp. steps.1
) ignored rows (resp. columns) of
the original matrix.
Creates a slice that may or may not have a fixed size and stride.
Creates a slice that may or may not have a fixed size and stride.
pub fn rows_range_pair_mut<Range1: SliceRange<R>, Range2: SliceRange<R>>(
&mut self,
r1: Range1,
r2: Range2
) -> (MatrixSliceMut<'_, T, Range1::Size, C, S::RStride, S::CStride>, MatrixSliceMut<'_, T, Range2::Size, C, S::RStride, S::CStride>)
pub fn rows_range_pair_mut<Range1: SliceRange<R>, Range2: SliceRange<R>>(
&mut self,
r1: Range1,
r2: Range2
) -> (MatrixSliceMut<'_, T, Range1::Size, C, S::RStride, S::CStride>, MatrixSliceMut<'_, T, Range2::Size, C, S::RStride, S::CStride>)
Splits this NxM
matrix into two parts delimited by two ranges.
Panics if the ranges overlap or if the first range is empty.
pub fn columns_range_pair_mut<Range1: SliceRange<C>, Range2: SliceRange<C>>(
&mut self,
r1: Range1,
r2: Range2
) -> (MatrixSliceMut<'_, T, R, Range1::Size, S::RStride, S::CStride>, MatrixSliceMut<'_, T, R, Range2::Size, S::RStride, S::CStride>)
pub fn columns_range_pair_mut<Range1: SliceRange<C>, Range2: SliceRange<C>>(
&mut self,
r1: Range1,
r2: Range2
) -> (MatrixSliceMut<'_, T, R, Range1::Size, S::RStride, S::CStride>, MatrixSliceMut<'_, T, R, Range2::Size, S::RStride, S::CStride>)
Splits this NxM
matrix into two parts delimited by two ranges.
Panics if the ranges overlap or if the first range is empty.
pub fn slice_range<RowRange, ColRange>(
&self,
rows: RowRange,
cols: ColRange
) -> MatrixSlice<'_, T, RowRange::Size, ColRange::Size, S::RStride, S::CStride> where
RowRange: SliceRange<R>,
ColRange: SliceRange<C>,
pub fn slice_range<RowRange, ColRange>(
&self,
rows: RowRange,
cols: ColRange
) -> MatrixSlice<'_, T, RowRange::Size, ColRange::Size, S::RStride, S::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
.
pub fn rows_range<RowRange: SliceRange<R>>(
&self,
rows: RowRange
) -> MatrixSlice<'_, T, RowRange::Size, C, S::RStride, S::CStride>
pub fn rows_range<RowRange: SliceRange<R>>(
&self,
rows: RowRange
) -> MatrixSlice<'_, T, RowRange::Size, C, S::RStride, S::CStride>
Slice containing all the rows indexed by the range rows
.
pub fn columns_range<ColRange: SliceRange<C>>(
&self,
cols: ColRange
) -> MatrixSlice<'_, T, R, ColRange::Size, S::RStride, S::CStride>
pub fn columns_range<ColRange: SliceRange<C>>(
&self,
cols: ColRange
) -> MatrixSlice<'_, T, R, ColRange::Size, S::RStride, S::CStride>
Slice containing all the columns indexed by the range rows
.
pub fn slice_range_mut<RowRange, ColRange>(
&mut self,
rows: RowRange,
cols: ColRange
) -> MatrixSliceMut<'_, T, RowRange::Size, ColRange::Size, S::RStride, S::CStride> where
RowRange: SliceRange<R>,
ColRange: SliceRange<C>,
pub fn slice_range_mut<RowRange, ColRange>(
&mut self,
rows: RowRange,
cols: ColRange
) -> MatrixSliceMut<'_, T, RowRange::Size, ColRange::Size, S::RStride, S::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
.
pub fn rows_range_mut<RowRange: SliceRange<R>>(
&mut self,
rows: RowRange
) -> MatrixSliceMut<'_, T, RowRange::Size, C, S::RStride, S::CStride>
pub fn rows_range_mut<RowRange: SliceRange<R>>(
&mut self,
rows: RowRange
) -> MatrixSliceMut<'_, T, RowRange::Size, C, S::RStride, S::CStride>
Slice containing all the rows indexed by the range rows
.
pub fn columns_range_mut<ColRange: SliceRange<C>>(
&mut self,
cols: ColRange
) -> MatrixSliceMut<'_, T, R, ColRange::Size, S::RStride, S::CStride>
pub fn columns_range_mut<ColRange: SliceRange<C>>(
&mut self,
cols: ColRange
) -> MatrixSliceMut<'_, T, R, ColRange::Size, S::RStride, S::CStride>
Slice containing all the columns indexed by the range cols
.
The squared L2 norm of this vector.
The L2 norm of this matrix.
Use .apply_norm
to apply a custom norm.
pub fn metric_distance<R2, C2, S2>(
&self,
rhs: &Matrix<T, R2, C2, S2>
) -> T::SimdRealField where
T: SimdComplexField,
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn metric_distance<R2, C2, S2>(
&self,
rhs: &Matrix<T, R2, C2, S2>
) -> T::SimdRealField where
T: SimdComplexField,
R2: Dim,
C2: Dim,
S2: Storage<T, 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.
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());
pub fn apply_metric_distance<R2, C2, S2>(
&self,
rhs: &Matrix<T, R2, C2, S2>,
norm: &impl Norm<T>
) -> T::SimdRealField where
T: SimdComplexField,
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
pub fn apply_metric_distance<R2, C2, S2>(
&self,
rhs: &Matrix<T, R2, C2, S2>,
norm: &impl Norm<T>
) -> T::SimdRealField where
T: SimdComplexField,
R2: Dim,
C2: Dim,
S2: Storage<T, 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());
A synonym for the norm of this matrix.
Aka the length.
This function is simply implemented as a call to norm()
A synonym for the squared norm of this matrix.
Aka the squared length.
This function is simply implemented as a call to norm_squared()
pub fn set_magnitude(&mut self, magnitude: T::SimdRealField) where
T: SimdComplexField,
S: StorageMut<T, R, C>,
pub fn set_magnitude(&mut self, magnitude: T::SimdRealField) where
T: SimdComplexField,
S: StorageMut<T, R, C>,
Sets the magnitude of this vector.
pub fn normalize(&self) -> OMatrix<T, R, C> where
T: SimdComplexField,
DefaultAllocator: Allocator<T, R, C>,
pub fn normalize(&self) -> OMatrix<T, R, C> where
T: SimdComplexField,
DefaultAllocator: Allocator<T, R, C>,
Returns a normalized version of this matrix.
The Lp norm of this matrix.
pub fn simd_try_normalize(
&self,
min_norm: T::SimdRealField
) -> SimdOption<OMatrix<T, R, C>> where
T: SimdComplexField,
T::Element: Scalar,
DefaultAllocator: Allocator<T, R, C> + Allocator<T::Element, R, C>,
pub fn simd_try_normalize(
&self,
min_norm: T::SimdRealField
) -> SimdOption<OMatrix<T, R, C>> where
T: SimdComplexField,
T::Element: Scalar,
DefaultAllocator: Allocator<T, R, C> + Allocator<T::Element, R, C>,
Attempts to normalize self
.
The components of this matrix can be SIMD types.
pub fn try_set_magnitude(
&mut self,
magnitude: T::RealField,
min_magnitude: T::RealField
) where
T: ComplexField,
S: StorageMut<T, R, C>,
pub fn try_set_magnitude(
&mut self,
magnitude: T::RealField,
min_magnitude: T::RealField
) where
T: ComplexField,
S: StorageMut<T, R, C>,
Sets the magnitude of this vector unless it is smaller than min_magnitude
.
If self.magnitude()
is smaller than min_magnitude
, it will be left unchanged.
Otherwise this is equivalent to: `*self = self.normalize() * magnitude.
pub fn cap_magnitude(&self, max: T::RealField) -> OMatrix<T, R, C> where
T: ComplexField,
DefaultAllocator: Allocator<T, R, C>,
pub fn cap_magnitude(&self, max: T::RealField) -> OMatrix<T, R, C> where
T: ComplexField,
DefaultAllocator: Allocator<T, R, C>,
Returns a new vector with the same magnitude as self
clamped between 0.0
and max
.
pub fn simd_cap_magnitude(&self, max: T::SimdRealField) -> OMatrix<T, R, C> where
T: SimdComplexField,
T::Element: Scalar,
DefaultAllocator: Allocator<T, R, C> + Allocator<T::Element, R, C>,
pub fn simd_cap_magnitude(&self, max: T::SimdRealField) -> OMatrix<T, R, C> where
T: SimdComplexField,
T::Element: Scalar,
DefaultAllocator: Allocator<T, R, C> + Allocator<T::Element, R, C>,
Returns a new vector with the same magnitude as self
clamped between 0.0
and max
.
pub fn try_normalize(&self, min_norm: T::RealField) -> Option<OMatrix<T, R, C>> where
T: ComplexField,
DefaultAllocator: Allocator<T, R, C>,
pub fn try_normalize(&self, min_norm: T::RealField) -> Option<OMatrix<T, R, C>> where
T: ComplexField,
DefaultAllocator: Allocator<T, R, C>,
Returns a normalized version of this matrix unless its norm as smaller or equal to eps
.
The components of this matrix cannot be SIMD types (see simd_try_normalize
) instead.
Normalizes this matrix in-place and returns its norm.
The components of the matrix cannot be SIMD types (see simd_try_normalize_mut
instead).
pub fn simd_try_normalize_mut(
&mut self,
min_norm: T::SimdRealField
) -> SimdOption<T::SimdRealField> where
T: SimdComplexField,
T::Element: Scalar,
DefaultAllocator: Allocator<T, R, C> + Allocator<T::Element, R, C>,
pub fn simd_try_normalize_mut(
&mut self,
min_norm: T::SimdRealField
) -> SimdOption<T::SimdRealField> where
T: SimdComplexField,
T::Element: Scalar,
DefaultAllocator: Allocator<T, R, C> + Allocator<T::Element, R, C>,
Normalizes this matrix in-place and return its norm.
The components of the matrix can be SIMD types.
pub fn try_normalize_mut(
&mut self,
min_norm: T::RealField
) -> Option<T::RealField> where
T: ComplexField,
pub fn try_normalize_mut(
&mut self,
min_norm: T::RealField
) -> Option<T::RealField> where
T: ComplexField,
Normalizes this matrix in-place or does nothing if its norm is smaller or equal to eps
.
If the normalization succeeded, returns the old norm of this matrix.
impl<T: ComplexField, D: DimName> Matrix<T, D, Const<1_usize>, <DefaultAllocator as Allocator<T, D, Const<1_usize>>>::Buffer> where
DefaultAllocator: Allocator<T, D>,
impl<T: ComplexField, D: DimName> Matrix<T, D, Const<1_usize>, <DefaultAllocator as Allocator<T, D, Const<1_usize>>>::Buffer> where
DefaultAllocator: Allocator<T, D>,
Orthonormalizes the given family of vectors. The largest free family of vectors is moved at the beginning of the array and its size is returned. Vectors at an indices larger or equal to this length can be modified to an arbitrary value.
The total number of elements of this matrix.
Examples:
let mat = Matrix3x4::<f32>::zeros();
assert_eq!(mat.len(), 12);
Returns true if the matrix contains no elements.
Examples:
let mat = Matrix3x4::<f32>::zeros();
assert!(!mat.is_empty());
pub fn is_identity(&self, eps: T::Epsilon) -> bool where
T: Zero + One + RelativeEq,
T::Epsilon: Clone,
pub fn is_identity(&self, eps: T::Epsilon) -> bool where
T: Zero + One + RelativeEq,
T::Epsilon: Clone,
Indicated if this is the identity matrix within a relative error of eps
.
If the matrix is diagonal, this checks that diagonal elements (i.e. at coordinates (i, i)
for i from 0
to min(R, C)
) are equal one; and that all other elements are zero.
pub fn is_orthogonal(&self, eps: T::Epsilon) -> bool where
T: Zero + One + ClosedAdd + ClosedMul + RelativeEq,
S: Storage<T, R, C>,
T::Epsilon: Clone,
DefaultAllocator: Allocator<T, R, C> + Allocator<T, C, C>,
pub fn is_orthogonal(&self, eps: T::Epsilon) -> bool where
T: Zero + One + ClosedAdd + ClosedMul + RelativeEq,
S: Storage<T, R, C>,
T::Epsilon: Clone,
DefaultAllocator: Allocator<T, R, C> + Allocator<T, C, C>,
Checks that Mᵀ × M = Id
.
In this definition Id
is approximately equal to the identity matrix with a relative error
equal to eps
.
pub fn is_special_orthogonal(&self, eps: T) -> bool where
D: DimMin<D, Output = D>,
DefaultAllocator: Allocator<(usize, usize), D>,
pub fn is_special_orthogonal(&self, eps: T) -> bool where
D: DimMin<D, Output = D>,
DefaultAllocator: Allocator<(usize, usize), D>,
Checks that this matrix is orthogonal and has a determinant equal to 1.
Returns true
if this matrix is invertible.
pub fn compress_rows(
&self,
f: impl Fn(VectorSlice<'_, T, R, S::RStride, S::CStride>) -> T
) -> RowOVector<T, C> where
DefaultAllocator: Allocator<T, U1, C>,
pub fn compress_rows(
&self,
f: impl Fn(VectorSlice<'_, T, R, S::RStride, S::CStride>) -> T
) -> RowOVector<T, C> where
DefaultAllocator: Allocator<T, U1, C>,
Returns a row vector where each element is the result of the application of f
on the
corresponding column of the original matrix.
pub fn compress_rows_tr(
&self,
f: impl Fn(VectorSlice<'_, T, R, S::RStride, S::CStride>) -> T
) -> OVector<T, C> where
DefaultAllocator: Allocator<T, C>,
pub fn compress_rows_tr(
&self,
f: impl Fn(VectorSlice<'_, T, R, S::RStride, S::CStride>) -> T
) -> OVector<T, C> where
DefaultAllocator: Allocator<T, 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()
.
pub fn compress_columns(
&self,
init: OVector<T, R>,
f: impl Fn(&mut OVector<T, R>, VectorSlice<'_, T, R, S::RStride, S::CStride>)
) -> OVector<T, R> where
DefaultAllocator: Allocator<T, R>,
pub fn compress_columns(
&self,
init: OVector<T, R>,
f: impl Fn(&mut OVector<T, R>, VectorSlice<'_, T, R, S::RStride, S::CStride>)
) -> OVector<T, R> where
DefaultAllocator: Allocator<T, R>,
Returns a column vector resulting from the folding of f
on each column of this matrix.
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);
pub fn row_sum(&self) -> RowOVector<T, C> where
T: ClosedAdd + Zero,
DefaultAllocator: Allocator<T, U1, C>,
pub fn row_sum(&self) -> RowOVector<T, C> where
T: ClosedAdd + Zero,
DefaultAllocator: Allocator<T, U1, C>,
The sum of all the rows of this matrix.
Use .row_sum_tr
if you need the result in a column vector instead.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.row_sum(), RowVector3::new(5.0, 7.0, 9.0));
let mint = Matrix3x2::new(1,2,3,4,5,6);
assert_eq!(mint.row_sum(), RowVector2::new(9,12));
pub fn row_sum_tr(&self) -> OVector<T, C> where
T: ClosedAdd + Zero,
DefaultAllocator: Allocator<T, C>,
pub fn row_sum_tr(&self) -> OVector<T, C> where
T: ClosedAdd + Zero,
DefaultAllocator: Allocator<T, 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));
pub fn column_sum(&self) -> OVector<T, R> where
T: ClosedAdd + Zero,
DefaultAllocator: Allocator<T, R>,
pub fn column_sum(&self) -> OVector<T, R> where
T: ClosedAdd + Zero,
DefaultAllocator: Allocator<T, 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));
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);
pub fn row_variance(&self) -> RowOVector<T, C> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, U1, C>,
pub fn row_variance(&self) -> RowOVector<T, C> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, U1, C>,
The variance of all the rows of this matrix.
Use .row_variance_tr
if you need the result in a column vector instead.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.row_variance(), RowVector3::new(2.25, 2.25, 2.25));
pub fn row_variance_tr(&self) -> OVector<T, C> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, C>,
pub fn row_variance_tr(&self) -> OVector<T, C> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, 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));
pub fn column_variance(&self) -> OVector<T, R> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, R>,
pub fn column_variance(&self) -> OVector<T, R> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, 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);
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);
pub fn row_mean(&self) -> RowOVector<T, C> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, U1, C>,
pub fn row_mean(&self) -> RowOVector<T, C> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, U1, C>,
The mean of all the rows of this matrix.
Use .row_mean_tr
if you need the result in a column vector instead.
Example
let m = Matrix2x3::new(1.0, 2.0, 3.0,
4.0, 5.0, 6.0);
assert_eq!(m.row_mean(), RowVector3::new(2.5, 3.5, 4.5));
pub fn row_mean_tr(&self) -> OVector<T, C> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, C>,
pub fn row_mean_tr(&self) -> OVector<T, C> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, 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));
pub fn column_mean(&self) -> OVector<T, R> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, R>,
pub fn column_mean(&self) -> OVector<T, R> where
T: Field + SupersetOf<f64>,
DefaultAllocator: Allocator<T, 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));
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
Builds a new vector from components of self
.
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));
Computes the spherical linear interpolation between two non-zero vectors.
The result is a unit vector.
Examples:
let v1 =Vector2::new(1.0, 2.0);
let v2 = Vector2::new(2.0, -3.0);
let v = v1.slerp(&v2, 1.0);
assert_eq!(v, v2.normalize());
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);
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);
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);
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);
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);
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);
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));
impl<T: Scalar + PartialOrd + Signed, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S>
impl<T: Scalar + PartialOrd + Signed, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S>
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);
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));
Computes the index of the vector component with the largest value.
Examples:
let vec = Vector3::new(11, -15, 13);
assert_eq!(vec.imax(), 2);
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);
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));
Computes the index of the vector component with the smallest value.
Examples:
let vec = Vector3::new(11, -15, 13);
assert_eq!(vec.imin(), 1);
pub fn convolve_same<D2, S2>(&self, kernel: Vector<T, D2, S2>) -> OVector<T, D1> where
D2: Dim,
S2: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
pub fn convolve_same<D2, S2>(&self, kernel: Vector<T, D2, S2>) -> OVector<T, D1> where
D2: Dim,
S2: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
pub fn determinant(&self) -> T where
DefaultAllocator: Allocator<T, D, D> + Allocator<(usize, usize), D>,
pub fn determinant(&self) -> T where
DefaultAllocator: Allocator<T, D, D> + Allocator<(usize, usize), D>,
Computes the matrix determinant.
If the matrix has a dimension larger than 3, an LU decomposition is used.
Rectangular matrix decomposition
This section contains the methods for computing some common decompositions of rectangular matrices with real or complex components. The following are currently supported:
Decomposition | Factors | Details |
---|---|---|
QR | Q * R | Q is an unitary matrix, and R is upper-triangular. |
QR with column pivoting | Q * R * P⁻¹ | Q is an unitary matrix, and R is upper-triangular. P is a permutation matrix. |
LU with partial pivoting | P⁻¹ * L * U | L is lower-triangular with a diagonal filled with 1 and U is upper-triangular. P is a permutation matrix. |
LU with full pivoting | P⁻¹ * L * U * Q⁻¹ | L is lower-triangular with a diagonal filled with 1 and U is upper-triangular. P and Q are permutation matrices. |
SVD | U * Σ * Vᵀ | U and V are two orthogonal matrices and Σ is a diagonal matrix containing the singular values. |
pub fn bidiagonalize(self) -> Bidiagonal<T, R, C> where
R: DimMin<C>,
DimMinimum<R, C>: DimSub<U1>,
DefaultAllocator: Allocator<T, R, C> + Allocator<T, C> + Allocator<T, R> + Allocator<T, DimMinimum<R, C>> + Allocator<T, DimDiff<DimMinimum<R, C>, U1>>,
pub fn bidiagonalize(self) -> Bidiagonal<T, R, C> where
R: DimMin<C>,
DimMinimum<R, C>: DimSub<U1>,
DefaultAllocator: Allocator<T, R, C> + Allocator<T, C> + Allocator<T, R> + Allocator<T, DimMinimum<R, C>> + Allocator<T, DimDiff<DimMinimum<R, C>, U1>>,
Computes the bidiagonalization using householder reflections.
pub fn full_piv_lu(self) -> FullPivLU<T, R, C> where
R: DimMin<C>,
DefaultAllocator: Allocator<T, R, C> + Allocator<(usize, usize), DimMinimum<R, C>>,
pub fn full_piv_lu(self) -> FullPivLU<T, R, C> where
R: DimMin<C>,
DefaultAllocator: Allocator<T, R, C> + Allocator<(usize, usize), DimMinimum<R, C>>,
Computes the LU decomposition with full pivoting of matrix
.
This effectively computes P, L, U, Q
such that P * matrix * Q = LU
.
Computes the LU decomposition with partial (row) pivoting of matrix
.
pub fn qr(self) -> QR<T, R, C> where
R: DimMin<C>,
DefaultAllocator: Allocator<T, R, C> + Allocator<T, R> + Allocator<T, DimMinimum<R, C>>,
pub fn qr(self) -> QR<T, R, C> where
R: DimMin<C>,
DefaultAllocator: Allocator<T, R, C> + Allocator<T, R> + Allocator<T, DimMinimum<R, C>>,
Computes the QR decomposition of this matrix.
pub fn col_piv_qr(self) -> ColPivQR<T, R, C> where
R: DimMin<C>,
DefaultAllocator: Allocator<T, R, C> + Allocator<T, R> + Allocator<T, DimMinimum<R, C>> + Allocator<(usize, usize), DimMinimum<R, C>>,
pub fn col_piv_qr(self) -> ColPivQR<T, R, C> where
R: DimMin<C>,
DefaultAllocator: Allocator<T, R, C> + Allocator<T, R> + Allocator<T, DimMinimum<R, C>> + Allocator<(usize, usize), DimMinimum<R, C>>,
Computes the QR decomposition (with column pivoting) of this matrix.
pub fn svd(self, compute_u: bool, compute_v: bool) -> SVD<T, R, C> where
R: DimMin<C>,
DimMinimum<R, C>: DimSub<U1>,
DefaultAllocator: Allocator<T, R, C> + Allocator<T, C> + Allocator<T, R> + Allocator<T, DimDiff<DimMinimum<R, C>, U1>> + Allocator<T, DimMinimum<R, C>, C> + Allocator<T, R, DimMinimum<R, C>> + Allocator<T, DimMinimum<R, C>> + Allocator<T::RealField, DimMinimum<R, C>> + Allocator<T::RealField, DimDiff<DimMinimum<R, C>, U1>>,
pub fn svd(self, compute_u: bool, compute_v: bool) -> SVD<T, R, C> where
R: DimMin<C>,
DimMinimum<R, C>: DimSub<U1>,
DefaultAllocator: Allocator<T, R, C> + Allocator<T, C> + Allocator<T, R> + Allocator<T, DimDiff<DimMinimum<R, C>, U1>> + Allocator<T, DimMinimum<R, C>, C> + Allocator<T, R, DimMinimum<R, C>> + Allocator<T, DimMinimum<R, C>> + Allocator<T::RealField, DimMinimum<R, C>> + Allocator<T::RealField, DimDiff<DimMinimum<R, C>, U1>>,
Computes the Singular Value Decomposition using implicit shift.
pub fn try_svd(
self,
compute_u: bool,
compute_v: bool,
eps: T::RealField,
max_niter: usize
) -> Option<SVD<T, R, C>> where
R: DimMin<C>,
DimMinimum<R, C>: DimSub<U1>,
DefaultAllocator: Allocator<T, R, C> + Allocator<T, C> + Allocator<T, R> + Allocator<T, DimDiff<DimMinimum<R, C>, U1>> + Allocator<T, DimMinimum<R, C>, C> + Allocator<T, R, DimMinimum<R, C>> + Allocator<T, DimMinimum<R, C>> + Allocator<T::RealField, DimMinimum<R, C>> + Allocator<T::RealField, DimDiff<DimMinimum<R, C>, U1>>,
pub fn try_svd(
self,
compute_u: bool,
compute_v: bool,
eps: T::RealField,
max_niter: usize
) -> Option<SVD<T, R, C>> where
R: DimMin<C>,
DimMinimum<R, C>: DimSub<U1>,
DefaultAllocator: Allocator<T, R, C> + Allocator<T, C> + Allocator<T, R> + Allocator<T, DimDiff<DimMinimum<R, C>, U1>> + Allocator<T, DimMinimum<R, C>, C> + Allocator<T, R, DimMinimum<R, C>> + Allocator<T, DimMinimum<R, C>> + Allocator<T::RealField, DimMinimum<R, C>> + Allocator<T::RealField, DimDiff<DimMinimum<R, C>, U1>>,
Attempts to compute the Singular Value Decomposition of matrix
using implicit shift.
Arguments
compute_u
− set this totrue
to enable the computation of left-singular vectors.compute_v
− set this totrue
to enable the computation of right-singular vectors.eps
− tolerance used to determine when a value converged to 0.max_niter
− maximum total number of iterations performed by the algorithm. If this number of iteration is exceeded,None
is returned. Ifniter == 0
, then the algorithm continues indefinitely until convergence.
Square matrix decomposition
This section contains the methods for computing some common decompositions of square matrices with real or complex components. The following are currently supported:
Decomposition | Factors | Details |
---|---|---|
Hessenberg | Q * H * Qᵀ | Q is a unitary matrix and H an upper-Hessenberg matrix. |
Cholesky | L * Lᵀ | L is a lower-triangular matrix. |
UDU | U * D * Uᵀ | U is a upper-triangular matrix, and D a diagonal matrix. |
Schur decomposition | Q * T * Qᵀ | Q is an unitary matrix and T a quasi-upper-triangular matrix. |
Symmetric eigendecomposition | Q ~ Λ ~ Qᵀ | Q is an unitary matrix, and Λ is a real diagonal matrix. |
Symmetric tridiagonalization | Q ~ T ~ Qᵀ | Q is an unitary matrix, and T is a tridiagonal matrix. |
Attempts to compute the Cholesky decomposition of this matrix.
Returns None
if the input matrix is not definite-positive. The input matrix is assumed
to be symmetric and only the lower-triangular part is read.
Attempts to compute the UDU decomposition of this matrix.
The input matrix self
is assumed to be symmetric and this decomposition will only read
the upper-triangular part of self
.
pub fn hessenberg(self) -> Hessenberg<T, D> where
D: DimSub<U1>,
DefaultAllocator: Allocator<T, D, D> + Allocator<T, D> + Allocator<T, DimDiff<D, U1>>,
pub fn hessenberg(self) -> Hessenberg<T, D> where
D: DimSub<U1>,
DefaultAllocator: Allocator<T, D, D> + Allocator<T, D> + Allocator<T, DimDiff<D, U1>>,
Computes the Hessenberg decomposition of this matrix using householder reflections.
Computes the Schur decomposition of a square matrix.
Attempts to compute the Schur decomposition of a square matrix.
If only eigenvalues are needed, it is more efficient to call the matrix method
.eigenvalues()
instead.
Arguments
eps
− tolerance used to determine when a value converged to 0.max_niter
− maximum total number of iterations performed by the algorithm. If this number of iteration is exceeded,None
is returned. Ifniter == 0
, then the algorithm continues indefinitely until convergence.
Computes the eigendecomposition of this symmetric matrix.
Only the lower-triangular part (including the diagonal) of m
is read.
Computes the eigendecomposition of the given symmetric matrix with user-specified convergence parameters.
Only the lower-triangular part (including the diagonal) of m
is read.
Arguments
eps
− tolerance used to determine when a value converged to 0.max_niter
− maximum total number of iterations performed by the algorithm. If this number of iteration is exceeded,None
is returned. Ifniter == 0
, then the algorithm continues indefinitely until convergence.
pub fn symmetric_tridiagonalize(self) -> SymmetricTridiagonal<T, D> where
D: DimSub<U1>,
DefaultAllocator: Allocator<T, D, D> + Allocator<T, DimDiff<D, U1>>,
pub fn symmetric_tridiagonalize(self) -> SymmetricTridiagonal<T, D> where
D: DimSub<U1>,
DefaultAllocator: Allocator<T, D, D> + Allocator<T, DimDiff<D, U1>>,
Computes the tridiagonalization of this symmetric matrix.
Only the lower-triangular part (including the diagonal) of m
is read.
impl<T: ComplexField, D> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
D: DimMin<D, Output = D>,
DefaultAllocator: Allocator<T, D, D> + Allocator<(usize, usize), DimMinimum<D, D>> + Allocator<T, D> + Allocator<T::RealField, D> + Allocator<T::RealField, D, D>,
impl<T: ComplexField, D> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer> where
D: DimMin<D, Output = D>,
DefaultAllocator: Allocator<T, D, D> + Allocator<(usize, usize), DimMinimum<D, D>> + Allocator<T, D> + Allocator<T::RealField, D> + Allocator<T::RealField, D, D>,
pub fn try_inverse(self) -> Option<OMatrix<T, D, D>> where
DefaultAllocator: Allocator<T, D, D>,
pub fn try_inverse(self) -> Option<OMatrix<T, D, D>> where
DefaultAllocator: Allocator<T, D, D>,
Attempts to invert this matrix.
Attempts to invert this matrix in-place. Returns false
and leaves self
untouched if
inversion fails.
impl<T: ComplexField, D, S> Matrix<T, D, D, S> where
D: DimMin<D, Output = D>,
S: StorageMut<T, D, D>,
DefaultAllocator: Allocator<T, D, D> + Allocator<T, D>,
impl<T: ComplexField, D, S> Matrix<T, D, D, S> where
D: DimMin<D, Output = D>,
S: StorageMut<T, D, D>,
DefaultAllocator: Allocator<T, D, D> + Allocator<T, D>,
Attempts to raise this matrix to an integral power e
in-place. If this
matrix is non-invertible and e
is negative, it leaves this matrix
untouched and returns false
. Otherwise, it returns true
and
overwrites this matrix with the result.
impl<T: ComplexField, D, S: Storage<T, D, D>> Matrix<T, D, D, S> where
D: DimMin<D, Output = D>,
S: StorageMut<T, D, D>,
DefaultAllocator: Allocator<T, D, D> + Allocator<T, D>,
impl<T: ComplexField, D, S: Storage<T, D, D>> Matrix<T, D, D, S> where
D: DimMin<D, Output = D>,
S: StorageMut<T, D, D>,
DefaultAllocator: Allocator<T, D, D> + Allocator<T, D>,
Computes the eigenvalues of this matrix.
pub fn complex_eigenvalues(&self) -> OVector<NumComplex<T>, D> where
T: RealField,
DefaultAllocator: Allocator<NumComplex<T>, D>,
pub fn complex_eigenvalues(&self) -> OVector<NumComplex<T>, D> where
T: RealField,
DefaultAllocator: Allocator<NumComplex<T>, D>,
Computes the eigenvalues of this matrix.
pub fn solve_lower_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_lower_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self . x = b
where x
is the unknown and only
the lower-triangular part of self
(including the diagonal) is considered not-zero.
pub fn solve_upper_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_upper_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self . x = b
where x
is the unknown and only
the upper-triangular part of self
(including the diagonal) is considered not-zero.
pub fn solve_lower_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_lower_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self . x = b
where x
is the unknown and only the
lower-triangular part of self
(including the diagonal) is considered not-zero.
pub fn solve_lower_triangular_with_diag_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>,
diag: T
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_lower_triangular_with_diag_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>,
diag: T
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self . x = b
where x
is the unknown and only the
lower-triangular part of self
is considered not-zero. The diagonal is never read as it is
assumed to be equal to diag
. Returns false
and does not modify its inputs if diag
is zero.
pub fn solve_upper_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_upper_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self . x = b
where x
is the unknown and only the
upper-triangular part of self
(including the diagonal) is considered not-zero.
pub fn tr_solve_lower_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_lower_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.transpose() . x = b
where x
is the unknown and only
the lower-triangular part of self
(including the diagonal) is considered not-zero.
pub fn tr_solve_upper_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_upper_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.transpose() . x = b
where x
is the unknown and only
the upper-triangular part of self
(including the diagonal) is considered not-zero.
pub fn tr_solve_lower_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_lower_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.transpose() . x = b
where x
is the unknown and only the
lower-triangular part of self
(including the diagonal) is considered not-zero.
pub fn tr_solve_upper_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_upper_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.transpose() . x = b
where x
is the unknown and only the
upper-triangular part of self
(including the diagonal) is considered not-zero.
pub fn ad_solve_lower_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_lower_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.adjoint() . x = b
where x
is the unknown and only
the lower-triangular part of self
(including the diagonal) is considered not-zero.
pub fn ad_solve_upper_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_upper_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.adjoint() . x = b
where x
is the unknown and only
the upper-triangular part of self
(including the diagonal) is considered not-zero.
pub fn ad_solve_lower_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_lower_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.adjoint() . x = b
where x
is the unknown and only the
lower-triangular part of self
(including the diagonal) is considered not-zero.
pub fn ad_solve_upper_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_upper_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.adjoint() . x = b
where x
is the unknown and only the
upper-triangular part of self
(including the diagonal) is considered not-zero.
pub fn solve_lower_triangular_unchecked<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> OMatrix<T, R2, C2> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_lower_triangular_unchecked<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> OMatrix<T, R2, C2> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self . x = b
where x
is the unknown and only
the lower-triangular part of self
(including the diagonal) is considered not-zero.
pub fn solve_upper_triangular_unchecked<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> OMatrix<T, R2, C2> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_upper_triangular_unchecked<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> OMatrix<T, R2, C2> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self . x = b
where x
is the unknown and only
the upper-triangular part of self
(including the diagonal) is considered not-zero.
pub fn solve_lower_triangular_unchecked_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_lower_triangular_unchecked_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self . x = b
where x
is the unknown and only the
lower-triangular part of self
(including the diagonal) is considered not-zero.
pub fn solve_lower_triangular_with_diag_unchecked_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>,
diag: T
) where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_lower_triangular_with_diag_unchecked_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>,
diag: T
) where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self . x = b
where x
is the unknown and only the
lower-triangular part of self
is considered not-zero. The diagonal is never read as it is
assumed to be equal to diag
. Returns false
and does not modify its inputs if diag
is zero.
pub fn solve_upper_triangular_unchecked_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_upper_triangular_unchecked_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self . x = b
where x
is the unknown and only the
upper-triangular part of self
(including the diagonal) is considered not-zero.
pub fn tr_solve_lower_triangular_unchecked<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> OMatrix<T, R2, C2> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_lower_triangular_unchecked<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> OMatrix<T, R2, C2> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.transpose() . x = b
where x
is the unknown and only
the lower-triangular part of self
(including the diagonal) is considered not-zero.
pub fn tr_solve_upper_triangular_unchecked<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> OMatrix<T, R2, C2> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_upper_triangular_unchecked<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> OMatrix<T, R2, C2> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.transpose() . x = b
where x
is the unknown and only
the upper-triangular part of self
(including the diagonal) is considered not-zero.
pub fn tr_solve_lower_triangular_unchecked_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_lower_triangular_unchecked_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.transpose() . x = b
where x
is the unknown and only the
lower-triangular part of self
(including the diagonal) is considered not-zero.
pub fn tr_solve_upper_triangular_unchecked_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn tr_solve_upper_triangular_unchecked_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.transpose() . x = b
where x
is the unknown and only the
upper-triangular part of self
(including the diagonal) is considered not-zero.
pub fn ad_solve_lower_triangular_unchecked<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> OMatrix<T, R2, C2> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_lower_triangular_unchecked<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> OMatrix<T, R2, C2> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.adjoint() . x = b
where x
is the unknown and only
the lower-triangular part of self
(including the diagonal) is considered not-zero.
pub fn ad_solve_upper_triangular_unchecked<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> OMatrix<T, R2, C2> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_upper_triangular_unchecked<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> OMatrix<T, R2, C2> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Computes the solution of the linear system self.adjoint() . x = b
where x
is the unknown and only
the upper-triangular part of self
(including the diagonal) is considered not-zero.
pub fn ad_solve_lower_triangular_unchecked_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_lower_triangular_unchecked_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.adjoint() . x = b
where x
is the unknown and only the
lower-triangular part of self
(including the diagonal) is considered not-zero.
pub fn ad_solve_upper_triangular_unchecked_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn ad_solve_upper_triangular_unchecked_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self.adjoint() . x = b
where x
is the unknown and only the
upper-triangular part of self
(including the diagonal) is considered not-zero.
impl<T: ComplexField, R: DimMin<C>, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> where
DimMinimum<R, C>: DimSub<U1>,
DefaultAllocator: Allocator<T, R, C> + Allocator<T, C> + Allocator<T, R> + Allocator<T, DimDiff<DimMinimum<R, C>, U1>> + Allocator<T, DimMinimum<R, C>, C> + Allocator<T, R, DimMinimum<R, C>> + Allocator<T, DimMinimum<R, C>> + Allocator<T::RealField, DimMinimum<R, C>> + Allocator<T::RealField, DimDiff<DimMinimum<R, C>, U1>>,
impl<T: ComplexField, R: DimMin<C>, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> where
DimMinimum<R, C>: DimSub<U1>,
DefaultAllocator: Allocator<T, R, C> + Allocator<T, C> + Allocator<T, R> + Allocator<T, DimDiff<DimMinimum<R, C>, U1>> + Allocator<T, DimMinimum<R, C>, C> + Allocator<T, R, DimMinimum<R, C>> + Allocator<T, DimMinimum<R, C>> + Allocator<T::RealField, DimMinimum<R, C>> + Allocator<T::RealField, DimDiff<DimMinimum<R, C>, U1>>,
Computes the singular values of this matrix.
Computes the rank of this matrix.
All singular values below eps
are considered equal to 0.
pub fn pseudo_inverse(
self,
eps: T::RealField
) -> Result<OMatrix<T, C, R>, &'static str> where
DefaultAllocator: Allocator<T, C, R>,
pub fn pseudo_inverse(
self,
eps: T::RealField
) -> Result<OMatrix<T, C, R>, &'static str> where
DefaultAllocator: Allocator<T, C, R>,
Computes the pseudo-inverse of this matrix.
All singular values below eps
are considered equal to 0.
Computes the eigenvalues of this symmetric matrix.
Only the lower-triangular part of the matrix is read.
Trait Implementations
The default tolerance to use when testing values that are close together. Read more
A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more
The inverse of AbsDiffEq::abs_diff_eq
.
impl<'a, 'b, T, D1, D2, SB> Add<&'b Matrix<T, D2, Const<1_usize>, SB>> for &'a OPoint<T, D1> where
T: Scalar + ClosedAdd,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<'a, 'b, T, D1, D2, SB> Add<&'b Matrix<T, D2, Const<1_usize>, SB>> for &'a OPoint<T, D1> where
T: Scalar + ClosedAdd,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<'b, T, D1, D2, SB> Add<&'b Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedAdd,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<'b, T, D1, D2, SB> Add<&'b Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedAdd,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<'b, T, R1, C1, R2, C2, SA, SB> Add<&'b Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedAdd,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<'b, T, R1, C1, R2, C2, SA, SB> Add<&'b Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedAdd,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<'a, 'b, T, R1, C1, R2, C2, SA, SB> Add<&'b Matrix<T, R2, C2, SB>> for &'a Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedAdd,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<'a, 'b, T, R1, C1, R2, C2, SA, SB> Add<&'b Matrix<T, R2, C2, SB>> for &'a Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedAdd,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<'a, T, D1, D2, SB> Add<Matrix<T, D2, Const<1_usize>, SB>> for &'a OPoint<T, D1> where
T: Scalar + ClosedAdd,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<'a, T, D1, D2, SB> Add<Matrix<T, D2, Const<1_usize>, SB>> for &'a OPoint<T, D1> where
T: Scalar + ClosedAdd,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<T, D1, D2, SB> Add<Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedAdd,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<T, D1, D2, SB> Add<Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedAdd,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<'a, T, R1, C1, R2, C2, SA, SB> Add<Matrix<T, R2, C2, SB>> for &'a Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedAdd,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R2, C2, R1, C1>,
ShapeConstraint: SameNumberOfRows<R2, R1> + SameNumberOfColumns<C2, C1>,
impl<'a, T, R1, C1, R2, C2, SA, SB> Add<Matrix<T, R2, C2, SB>> for &'a Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedAdd,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R2, C2, R1, C1>,
ShapeConstraint: SameNumberOfRows<R2, R1> + SameNumberOfColumns<C2, C1>,
impl<T, R1, C1, R2, C2, SA, SB> Add<Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedAdd,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<T, R1, C1, R2, C2, SA, SB> Add<Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedAdd,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<'b, T, D1: DimName, D2: Dim, SB> AddAssign<&'b Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedAdd,
SB: Storage<T, D2>,
ShapeConstraint: SameNumberOfRows<D1, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<'b, T, D1: DimName, D2: Dim, SB> AddAssign<&'b Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedAdd,
SB: Storage<T, D2>,
ShapeConstraint: SameNumberOfRows<D1, D2>,
DefaultAllocator: Allocator<T, D1>,
Performs the +=
operation. Read more
impl<'b, T, R1, C1, R2, C2, SA, SB> AddAssign<&'b Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedAdd,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<'b, T, R1, C1, R2, C2, SA, SB> AddAssign<&'b Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedAdd,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
Performs the +=
operation. Read more
impl<T, D1: DimName, D2: Dim, SB> AddAssign<Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedAdd,
SB: Storage<T, D2>,
ShapeConstraint: SameNumberOfRows<D1, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<T, D1: DimName, D2: Dim, SB> AddAssign<Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedAdd,
SB: Storage<T, D2>,
ShapeConstraint: SameNumberOfRows<D1, D2>,
DefaultAllocator: Allocator<T, D1>,
Performs the +=
operation. Read more
impl<T, R1, C1, R2, C2, SA, SB> AddAssign<Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedAdd,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<T, R1, C1, R2, C2, SA, SB> AddAssign<Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedAdd,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
Performs the +=
operation. Read more
impl<T: Scalar, S> Deref for Matrix<T, U1, U1, S> where
S: RawStorage<T, U1, U1> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U1, U1, S> where
S: RawStorage<T, U1, U1> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U2, U1, S> where
S: RawStorage<T, U2, U1> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U2, U1, S> where
S: RawStorage<T, U2, U1> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U1, U6, S> where
S: RawStorage<T, U1, U6> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U1, U6, S> where
S: RawStorage<T, U1, U6> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U2, U2, S> where
S: RawStorage<T, U2, U2> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U2, U2, S> where
S: RawStorage<T, U2, U2> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U2, U3, S> where
S: RawStorage<T, U2, U3> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U2, U3, S> where
S: RawStorage<T, U2, U3> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U2, U4, S> where
S: RawStorage<T, U2, U4> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U2, U4, S> where
S: RawStorage<T, U2, U4> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U2, U5, S> where
S: RawStorage<T, U2, U5> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U2, U5, S> where
S: RawStorage<T, U2, U5> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U2, U6, S> where
S: RawStorage<T, U2, U6> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U2, U6, S> where
S: RawStorage<T, U2, U6> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U3, U2, S> where
S: RawStorage<T, U3, U2> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U3, U2, S> where
S: RawStorage<T, U3, U2> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U3, U3, S> where
S: RawStorage<T, U3, U3> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U3, U3, S> where
S: RawStorage<T, U3, U3> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U3, U4, S> where
S: RawStorage<T, U3, U4> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U3, U4, S> where
S: RawStorage<T, U3, U4> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U3, U5, S> where
S: RawStorage<T, U3, U5> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U3, U5, S> where
S: RawStorage<T, U3, U5> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U3, U1, S> where
S: RawStorage<T, U3, U1> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U3, U1, S> where
S: RawStorage<T, U3, U1> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U3, U6, S> where
S: RawStorage<T, U3, U6> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U3, U6, S> where
S: RawStorage<T, U3, U6> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U4, U2, S> where
S: RawStorage<T, U4, U2> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U4, U2, S> where
S: RawStorage<T, U4, U2> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U4, U3, S> where
S: RawStorage<T, U4, U3> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U4, U3, S> where
S: RawStorage<T, U4, U3> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U4, U4, S> where
S: RawStorage<T, U4, U4> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U4, U4, S> where
S: RawStorage<T, U4, U4> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U4, U5, S> where
S: RawStorage<T, U4, U5> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U4, U5, S> where
S: RawStorage<T, U4, U5> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U4, U6, S> where
S: RawStorage<T, U4, U6> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U4, U6, S> where
S: RawStorage<T, U4, U6> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U5, U2, S> where
S: RawStorage<T, U5, U2> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U5, U2, S> where
S: RawStorage<T, U5, U2> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U5, U3, S> where
S: RawStorage<T, U5, U3> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U5, U3, S> where
S: RawStorage<T, U5, U3> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U5, U4, S> where
S: RawStorage<T, U5, U4> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U5, U4, S> where
S: RawStorage<T, U5, U4> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U5, U5, S> where
S: RawStorage<T, U5, U5> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U5, U5, S> where
S: RawStorage<T, U5, U5> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U4, U1, S> where
S: RawStorage<T, U4, U1> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U4, U1, S> where
S: RawStorage<T, U4, U1> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U5, U6, S> where
S: RawStorage<T, U5, U6> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U5, U6, S> where
S: RawStorage<T, U5, U6> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U6, U2, S> where
S: RawStorage<T, U6, U2> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U6, U2, S> where
S: RawStorage<T, U6, U2> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U6, U3, S> where
S: RawStorage<T, U6, U3> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U6, U3, S> where
S: RawStorage<T, U6, U3> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U6, U4, S> where
S: RawStorage<T, U6, U4> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U6, U4, S> where
S: RawStorage<T, U6, U4> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U6, U5, S> where
S: RawStorage<T, U6, U5> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U6, U5, S> where
S: RawStorage<T, U6, U5> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U6, U6, S> where
S: RawStorage<T, U6, U6> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U6, U6, S> where
S: RawStorage<T, U6, U6> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U5, U1, S> where
S: RawStorage<T, U5, U1> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U5, U1, S> where
S: RawStorage<T, U5, U1> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U6, U1, S> where
S: RawStorage<T, U6, U1> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U6, U1, S> where
S: RawStorage<T, U6, U1> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U1, U2, S> where
S: RawStorage<T, U1, U2> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U1, U2, S> where
S: RawStorage<T, U1, U2> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U1, U3, S> where
S: RawStorage<T, U1, U3> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U1, U3, S> where
S: RawStorage<T, U1, U3> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U1, U4, S> where
S: RawStorage<T, U1, U4> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U1, U4, S> where
S: RawStorage<T, U1, U4> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U1, U5, S> where
S: RawStorage<T, U1, U5> + IsContiguous,
impl<T: Scalar, S> Deref for Matrix<T, U1, U5, S> where
S: RawStorage<T, U1, U5> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U1, U1, S> where
S: RawStorageMut<T, U1, U1> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U1, U1, S> where
S: RawStorageMut<T, U1, U1> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U2, U1, S> where
S: RawStorageMut<T, U2, U1> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U2, U1, S> where
S: RawStorageMut<T, U2, U1> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U1, U6, S> where
S: RawStorageMut<T, U1, U6> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U1, U6, S> where
S: RawStorageMut<T, U1, U6> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U2, U2, S> where
S: RawStorageMut<T, U2, U2> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U2, U2, S> where
S: RawStorageMut<T, U2, U2> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U2, U3, S> where
S: RawStorageMut<T, U2, U3> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U2, U3, S> where
S: RawStorageMut<T, U2, U3> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U2, U4, S> where
S: RawStorageMut<T, U2, U4> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U2, U4, S> where
S: RawStorageMut<T, U2, U4> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U2, U5, S> where
S: RawStorageMut<T, U2, U5> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U2, U5, S> where
S: RawStorageMut<T, U2, U5> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U2, U6, S> where
S: RawStorageMut<T, U2, U6> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U2, U6, S> where
S: RawStorageMut<T, U2, U6> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U3, U2, S> where
S: RawStorageMut<T, U3, U2> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U3, U2, S> where
S: RawStorageMut<T, U3, U2> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U3, U3, S> where
S: RawStorageMut<T, U3, U3> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U3, U3, S> where
S: RawStorageMut<T, U3, U3> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U3, U4, S> where
S: RawStorageMut<T, U3, U4> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U3, U4, S> where
S: RawStorageMut<T, U3, U4> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U3, U5, S> where
S: RawStorageMut<T, U3, U5> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U3, U5, S> where
S: RawStorageMut<T, U3, U5> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U3, U1, S> where
S: RawStorageMut<T, U3, U1> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U3, U1, S> where
S: RawStorageMut<T, U3, U1> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U3, U6, S> where
S: RawStorageMut<T, U3, U6> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U3, U6, S> where
S: RawStorageMut<T, U3, U6> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U4, U2, S> where
S: RawStorageMut<T, U4, U2> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U4, U2, S> where
S: RawStorageMut<T, U4, U2> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U4, U3, S> where
S: RawStorageMut<T, U4, U3> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U4, U3, S> where
S: RawStorageMut<T, U4, U3> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U4, U4, S> where
S: RawStorageMut<T, U4, U4> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U4, U4, S> where
S: RawStorageMut<T, U4, U4> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U4, U5, S> where
S: RawStorageMut<T, U4, U5> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U4, U5, S> where
S: RawStorageMut<T, U4, U5> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U4, U6, S> where
S: RawStorageMut<T, U4, U6> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U4, U6, S> where
S: RawStorageMut<T, U4, U6> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U5, U2, S> where
S: RawStorageMut<T, U5, U2> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U5, U2, S> where
S: RawStorageMut<T, U5, U2> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U5, U3, S> where
S: RawStorageMut<T, U5, U3> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U5, U3, S> where
S: RawStorageMut<T, U5, U3> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U5, U4, S> where
S: RawStorageMut<T, U5, U4> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U5, U4, S> where
S: RawStorageMut<T, U5, U4> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U5, U5, S> where
S: RawStorageMut<T, U5, U5> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U5, U5, S> where
S: RawStorageMut<T, U5, U5> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U4, U1, S> where
S: RawStorageMut<T, U4, U1> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U4, U1, S> where
S: RawStorageMut<T, U4, U1> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U5, U6, S> where
S: RawStorageMut<T, U5, U6> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U5, U6, S> where
S: RawStorageMut<T, U5, U6> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U6, U2, S> where
S: RawStorageMut<T, U6, U2> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U6, U2, S> where
S: RawStorageMut<T, U6, U2> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U6, U3, S> where
S: RawStorageMut<T, U6, U3> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U6, U3, S> where
S: RawStorageMut<T, U6, U3> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U6, U4, S> where
S: RawStorageMut<T, U6, U4> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U6, U4, S> where
S: RawStorageMut<T, U6, U4> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U6, U5, S> where
S: RawStorageMut<T, U6, U5> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U6, U5, S> where
S: RawStorageMut<T, U6, U5> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U6, U6, S> where
S: RawStorageMut<T, U6, U6> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U6, U6, S> where
S: RawStorageMut<T, U6, U6> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U5, U1, S> where
S: RawStorageMut<T, U5, U1> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U5, U1, S> where
S: RawStorageMut<T, U5, U1> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U6, U1, S> where
S: RawStorageMut<T, U6, U1> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U6, U1, S> where
S: RawStorageMut<T, U6, U1> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U1, U2, S> where
S: RawStorageMut<T, U1, U2> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U1, U2, S> where
S: RawStorageMut<T, U1, U2> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U1, U3, S> where
S: RawStorageMut<T, U1, U3> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U1, U3, S> where
S: RawStorageMut<T, U1, U3> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U1, U4, S> where
S: RawStorageMut<T, U1, U4> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U1, U4, S> where
S: RawStorageMut<T, U1, U4> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U1, U5, S> where
S: RawStorageMut<T, U1, U5> + IsContiguous,
impl<T: Scalar, S> DerefMut for Matrix<T, U1, U5, S> where
S: RawStorageMut<T, U1, U5> + IsContiguous,
impl<'de, T, R, C, S> Deserialize<'de> for Matrix<T, R, C, S> where
T: Scalar,
R: Dim,
C: Dim,
S: Deserialize<'de>,
impl<'de, T, R, C, S> Deserialize<'de> for Matrix<T, R, C, S> where
T: Scalar,
R: Dim,
C: Dim,
S: Deserialize<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<'a, 'b, T, R1, C1, SA, const D2: usize> Div<&'b Rotation<T, D2>> for &'a Matrix<T, R1, C1, SA> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
R1: Dim,
C1: Dim,
SA: Storage<T, R1, C1>,
DefaultAllocator: Allocator<T, R1, Const<D2>>,
ShapeConstraint: AreMultipliable<R1, C1, Const<D2>, Const<D2>>,
impl<'a, 'b, T, R1, C1, SA, const D2: usize> Div<&'b Rotation<T, D2>> for &'a Matrix<T, R1, C1, SA> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
R1: Dim,
C1: Dim,
SA: Storage<T, R1, C1>,
DefaultAllocator: Allocator<T, R1, Const<D2>>,
ShapeConstraint: AreMultipliable<R1, C1, Const<D2>, Const<D2>>,
Performs the /=
operation. Read more
impl<T, R, S, RV, SV> Extend<Matrix<T, RV, Const<1_usize>, SV>> for Matrix<T, R, Dynamic, S> where
T: Scalar,
R: Dim,
S: Extend<Vector<T, RV, SV>>,
RV: Dim,
SV: RawStorage<T, RV>,
ShapeConstraint: SameNumberOfRows<R, RV>,
impl<T, R, S, RV, SV> Extend<Matrix<T, RV, Const<1_usize>, SV>> for Matrix<T, R, Dynamic, S> where
T: Scalar,
R: Dim,
S: Extend<Vector<T, RV, SV>>,
RV: Dim,
SV: RawStorage<T, RV>,
ShapeConstraint: SameNumberOfRows<R, RV>,
Extends the number of columns of a Matrix
with Vector
s
from a given iterator.
Example
let data = vec![0, 1, 2, // column 1
3, 4, 5]; // column 2
let mut matrix = DMatrix::from_vec(3, 2, data);
matrix.extend(
vec![Vector3::new(6, 7, 8), // column 3
Vector3::new(9, 10, 11)]); // column 4
assert!(matrix.eq(&Matrix3x4::new(0, 3, 6, 9,
1, 4, 7, 10,
2, 5, 8, 11)));
Panics
This function panics if the dimension of each Vector
yielded
by the given iterator is not equal to the number of rows of
this Matrix
.
let mut matrix =
DMatrix::from_vec(3, 2,
vec![0, 1, 2, // column 1
3, 4, 5]); // column 2
// The following panics because this matrix can only be extended with 3-dimensional vectors.
matrix.extend(
vec![Vector2::new(6, 7)]); // too few dimensions!
let mut matrix =
DMatrix::from_vec(3, 2,
vec![0, 1, 2, // column 1
3, 4, 5]); // column 2
// The following panics because this matrix can only be extended with 3-dimensional vectors.
matrix.extend(
vec![Vector4::new(6, 7, 8, 9)]); // too few dimensions!
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
impl<T, R, RV, SV> Extend<Matrix<T, RV, Const<1_usize>, SV>> for VecStorage<T, R, Dynamic> where
T: Scalar,
R: Dim,
RV: Dim,
SV: RawStorage<T, RV>,
ShapeConstraint: SameNumberOfRows<R, RV>,
impl<T, R, RV, SV> Extend<Matrix<T, RV, Const<1_usize>, SV>> for VecStorage<T, R, Dynamic> where
T: Scalar,
R: Dim,
RV: Dim,
SV: RawStorage<T, RV>,
ShapeConstraint: SameNumberOfRows<R, RV>,
Extends the number of columns of the VecStorage
with vectors
from the given iterator.
Panics
This function panics if the number of rows of each Vector
yielded by the iterator is not equal to the number of rows
of this VecStorage
.
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Extend the number of columns of the Matrix
with elements from
a given iterator.
Extend the number of columns of the Matrix
with elements
from the given iterator.
Example
let data = vec![0, 1, 2, // column 1
3, 4, 5]; // column 2
let mut matrix = DMatrix::from_vec(3, 2, data);
matrix.extend(vec![6, 7, 8]); // column 3
assert!(matrix.eq(&Matrix3::new(0, 3, 6,
1, 4, 7,
2, 5, 8)));
Panics
This function panics if the number of elements yielded by the
given iterator is not a multiple of the number of rows of the
Matrix
.
let data = vec![0, 1, 2, // column 1
3, 4, 5]; // column 2
let mut matrix = DMatrix::from_vec(3, 2, data);
// The following panics because the vec length is not a multiple of 3.
matrix.extend(vec![6, 7, 8, 9]);
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Extend the number of rows of the Vector
with elements from
a given iterator.
Extend the number of rows of a Vector
with elements
from the given iterator.
Example
let mut vector = DVector::from_vec(vec![0, 1, 2]);
vector.extend(vec![3, 4, 5]);
assert!(vector.eq(&DVector::from_vec(vec![0, 1, 2, 3, 4, 5])));
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
impl<'a, T, R, C, RSlice, CSlice, RStride, CStride, S> From<&'a Matrix<T, R, C, S>> for MatrixSlice<'a, T, RSlice, CSlice, RStride, CStride> where
T: Scalar,
R: Dim,
C: Dim,
RSlice: Dim,
CSlice: Dim,
RStride: Dim,
CStride: Dim,
S: RawStorage<T, R, C>,
ShapeConstraint: DimEq<R, RSlice> + DimEq<C, CSlice> + DimEq<RStride, S::RStride> + DimEq<CStride, S::CStride>,
impl<'a, T, R, C, RSlice, CSlice, RStride, CStride, S> From<&'a Matrix<T, R, C, S>> for MatrixSlice<'a, T, RSlice, CSlice, RStride, CStride> where
T: Scalar,
R: Dim,
C: Dim,
RSlice: Dim,
CSlice: Dim,
RStride: Dim,
CStride: Dim,
S: RawStorage<T, R, C>,
ShapeConstraint: DimEq<R, RSlice> + DimEq<C, CSlice> + DimEq<RStride, S::RStride> + DimEq<CStride, S::CStride>,
impl<'a, T: Scalar + Copy, R: Dim, C: Dim, S: RawStorage<T, R, C> + IsContiguous> From<&'a Matrix<T, R, C, S>> for &'a [T]
impl<'a, T: Scalar + Copy, R: Dim, C: Dim, S: RawStorage<T, R, C> + IsContiguous> From<&'a Matrix<T, R, C, S>> for &'a [T]
impl<'a, T, R, C, RSlice, CSlice, RStride, CStride, S> From<&'a mut Matrix<T, R, C, S>> for MatrixSlice<'a, T, RSlice, CSlice, RStride, CStride> where
T: Scalar,
R: Dim,
C: Dim,
RSlice: Dim,
CSlice: Dim,
RStride: Dim,
CStride: Dim,
S: RawStorage<T, R, C>,
ShapeConstraint: DimEq<R, RSlice> + DimEq<C, CSlice> + DimEq<RStride, S::RStride> + DimEq<CStride, S::CStride>,
impl<'a, T, R, C, RSlice, CSlice, RStride, CStride, S> From<&'a mut Matrix<T, R, C, S>> for MatrixSlice<'a, T, RSlice, CSlice, RStride, CStride> where
T: Scalar,
R: Dim,
C: Dim,
RSlice: Dim,
CSlice: Dim,
RStride: Dim,
CStride: Dim,
S: RawStorage<T, R, C>,
ShapeConstraint: DimEq<R, RSlice> + DimEq<C, CSlice> + DimEq<RStride, S::RStride> + DimEq<CStride, S::CStride>,
impl<'a, T, R, C, RSlice, CSlice, RStride, CStride, S> From<&'a mut Matrix<T, R, C, S>> for MatrixSliceMut<'a, T, RSlice, CSlice, RStride, CStride> where
T: Scalar,
R: Dim,
C: Dim,
RSlice: Dim,
CSlice: Dim,
RStride: Dim,
CStride: Dim,
S: RawStorageMut<T, R, C>,
ShapeConstraint: DimEq<R, RSlice> + DimEq<C, CSlice> + DimEq<RStride, S::RStride> + DimEq<CStride, S::CStride>,
impl<'a, T, R, C, RSlice, CSlice, RStride, CStride, S> From<&'a mut Matrix<T, R, C, S>> for MatrixSliceMut<'a, T, RSlice, CSlice, RStride, CStride> where
T: Scalar,
R: Dim,
C: Dim,
RSlice: Dim,
CSlice: Dim,
RStride: Dim,
CStride: Dim,
S: RawStorageMut<T, R, C>,
ShapeConstraint: DimEq<R, RSlice> + DimEq<C, CSlice> + DimEq<RStride, S::RStride> + DimEq<CStride, S::CStride>,
impl<'a, T: Scalar + Copy, R: Dim, C: Dim, S: RawStorageMut<T, R, C> + IsContiguous> From<&'a mut Matrix<T, R, C, S>> for &'a mut [T]
impl<'a, T: Scalar + Copy, R: Dim, C: Dim, S: RawStorageMut<T, R, C> + IsContiguous> From<&'a mut Matrix<T, R, C, S>> for &'a mut [T]
Performs the conversion.
impl<T: SimdRealField, R, const D: usize> From<Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for Isometry<T, R, D> where
R: AbstractRotation<T, D>,
impl<T: SimdRealField, R, const D: usize> From<Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for Isometry<T, R, D> where
R: AbstractRotation<T, D>,
Performs the conversion.
Performs the conversion.
impl<T: Scalar> From<Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, ArrayStorage<T, 4_usize, 1_usize>>> for Quaternion<T>
impl<T: Scalar> From<Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, ArrayStorage<T, 4_usize, 1_usize>>> for Quaternion<T>
Performs the conversion.
Performs the conversion.
impl<'a, T, R, C, RStride, CStride> From<Matrix<T, R, C, SliceStorageMut<'a, T, R, C, RStride, CStride>>> for MatrixSlice<'a, T, R, C, RStride, CStride> where
R: Dim,
C: Dim,
RStride: Dim,
CStride: Dim,
impl<'a, T, R, C, RStride, CStride> From<Matrix<T, R, C, SliceStorageMut<'a, T, R, C, RStride, CStride>>> for MatrixSlice<'a, T, R, C, RStride, CStride> where
R: Dim,
C: Dim,
RStride: Dim,
CStride: Dim,
Performs the conversion.
Performs the conversion.
Performs the conversion.
impl<'a, T: Scalar, R: Dim, C: Dim, S: RawStorage<T, R, C>> IntoIterator for &'a Matrix<T, R, C, S>
impl<'a, T: Scalar, R: Dim, C: Dim, S: RawStorage<T, R, C>> IntoIterator for &'a Matrix<T, R, C, S>
impl<'a, T: Scalar, R: Dim, C: Dim, S: RawStorageMut<T, R, C>> IntoIterator for &'a mut Matrix<T, R, C, S>
impl<'a, T: Scalar, R: Dim, C: Dim, S: RawStorageMut<T, R, C>> IntoIterator for &'a mut Matrix<T, R, C, S>
impl<'b, T: SimdRealField, S: Storage<T, Const<2>>> Mul<&'b Matrix<T, Const<2_usize>, Const<1_usize>, S>> for UnitComplex<T> where
T::Element: SimdRealField,
impl<'b, T: SimdRealField, S: Storage<T, Const<2>>> Mul<&'b Matrix<T, Const<2_usize>, Const<1_usize>, S>> for UnitComplex<T> where
T::Element: SimdRealField,
impl<'a, 'b, T: SimdRealField, S: Storage<T, Const<2>>> Mul<&'b Matrix<T, Const<2_usize>, Const<1_usize>, S>> for &'a UnitComplex<T> where
T::Element: SimdRealField,
impl<'a, 'b, T: SimdRealField, S: Storage<T, Const<2>>> Mul<&'b Matrix<T, Const<2_usize>, Const<1_usize>, S>> for &'a UnitComplex<T> where
T::Element: SimdRealField,
impl<'a, 'b, T: SimdRealField, SB: Storage<T, Const<3>>> Mul<&'b Matrix<T, Const<3_usize>, Const<1_usize>, SB>> for &'a UnitQuaternion<T> where
T::Element: SimdRealField,
impl<'a, 'b, T: SimdRealField, SB: Storage<T, Const<3>>> Mul<&'b Matrix<T, Const<3_usize>, Const<1_usize>, SB>> for &'a UnitQuaternion<T> where
T::Element: SimdRealField,
impl<'b, T: SimdRealField, R, const D: usize> Mul<&'b Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for Isometry<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<'b, T: SimdRealField, R, const D: usize> Mul<&'b Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for Isometry<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<'a, 'b, T: SimdRealField, R, const D: usize> Mul<&'b Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for &'a Isometry<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<'a, 'b, T: SimdRealField, R, const D: usize> Mul<&'b Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for &'a Isometry<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<'b, T: SimdRealField, R, const D: usize> Mul<&'b Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for Similarity<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<'b, T: SimdRealField, R, const D: usize> Mul<&'b Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for Similarity<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<'a, 'b, T: SimdRealField, R, const D: usize> Mul<&'b Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for &'a Similarity<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<'a, 'b, T: SimdRealField, R, const D: usize> Mul<&'b Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for &'a Similarity<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<'b, T, C, const D: usize> Mul<&'b Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for Transform<T, C, D> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul + RealField,
Const<D>: DimNameAdd<U1>,
C: TCategory,
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
impl<'b, T, C, const D: usize> Mul<&'b Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for Transform<T, C, D> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul + RealField,
Const<D>: DimNameAdd<U1>,
C: TCategory,
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
impl<'a, 'b, T, C, const D: usize> Mul<&'b Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for &'a Transform<T, C, D> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul + RealField,
Const<D>: DimNameAdd<U1>,
C: TCategory,
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
impl<'a, 'b, T, C, const D: usize> Mul<&'b Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for &'a Transform<T, C, D> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul + RealField,
Const<D>: DimNameAdd<U1>,
C: TCategory,
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
impl<'b, T: SimdRealField, SB: Storage<T, Const<3>>> Mul<&'b Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, SB>> for UnitQuaternion<T> where
T::Element: SimdRealField,
impl<'b, T: SimdRealField, SB: Storage<T, Const<3>>> Mul<&'b Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, SB>> for UnitQuaternion<T> where
T::Element: SimdRealField,
impl<'a, 'b, T: SimdRealField, SB: Storage<T, U3>> Mul<&'b Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, SB>> for &'a UnitDualQuaternion<T> where
T::Element: SimdRealField,
impl<'a, 'b, T: SimdRealField, SB: Storage<T, U3>> Mul<&'b Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, SB>> for &'a UnitDualQuaternion<T> where
T::Element: SimdRealField,
impl<'b, T: SimdRealField, SB: Storage<T, U3>> Mul<&'b Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, SB>> for UnitDualQuaternion<T> where
T::Element: SimdRealField,
impl<'b, T: SimdRealField, SB: Storage<T, U3>> Mul<&'b Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, SB>> for UnitDualQuaternion<T> where
T::Element: SimdRealField,
impl<'a, 'b, T, R1: Dim, C1: Dim, R2: Dim, C2: Dim, SA, SB> Mul<&'b Matrix<T, R2, C2, SB>> for &'a Matrix<T, R1, C1, SA> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R1, C2>,
ShapeConstraint: AreMultipliable<R1, C1, R2, C2>,
impl<'a, 'b, T, R1: Dim, C1: Dim, R2: Dim, C2: Dim, SA, SB> Mul<&'b Matrix<T, R2, C2, SB>> for &'a Matrix<T, R1, C1, SA> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R1, C2>,
ShapeConstraint: AreMultipliable<R1, C1, R2, C2>,
impl<'b, T, R1: Dim, C1: Dim, R2: Dim, C2: Dim, SA, SB> Mul<&'b Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
SB: Storage<T, R2, C2>,
SA: Storage<T, R1, C1>,
DefaultAllocator: Allocator<T, R1, C2>,
ShapeConstraint: AreMultipliable<R1, C1, R2, C2>,
impl<'b, T, R1: Dim, C1: Dim, R2: Dim, C2: Dim, SA, SB> Mul<&'b Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
SB: Storage<T, R2, C2>,
SA: Storage<T, R1, C1>,
DefaultAllocator: Allocator<T, R1, C2>,
ShapeConstraint: AreMultipliable<R1, C1, R2, C2>,
impl<'a, 'b, T, R2, C2, SB, const D1: usize> Mul<&'b Matrix<T, R2, C2, SB>> for &'a Rotation<T, D1> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, Const<D1>, C2>,
ShapeConstraint: AreMultipliable<Const<D1>, Const<D1>, R2, C2>,
impl<'a, 'b, T, R2, C2, SB, const D1: usize> Mul<&'b Matrix<T, R2, C2, SB>> for &'a Rotation<T, D1> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
R2: Dim,
C2: Dim,
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, Const<D1>, C2>,
ShapeConstraint: AreMultipliable<Const<D1>, Const<D1>, R2, C2>,
impl<'a, 'b, T, SA, const D2: usize, const R1: usize, const C1: usize> Mul<&'b OPoint<T, Const<D2>>> for &'a Matrix<T, Const<R1>, Const<C1>, SA> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
SA: Storage<T, Const<R1>, Const<C1>>,
ShapeConstraint: AreMultipliable<Const<R1>, Const<C1>, Const<D2>, U1>,
impl<'a, 'b, T, SA, const D2: usize, const R1: usize, const C1: usize> Mul<&'b OPoint<T, Const<D2>>> for &'a Matrix<T, Const<R1>, Const<C1>, SA> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
SA: Storage<T, Const<R1>, Const<C1>>,
ShapeConstraint: AreMultipliable<Const<R1>, Const<C1>, Const<D2>, U1>,
impl<'a, 'b, T, R1, C1, SA, const D2: usize> Mul<&'b Rotation<T, D2>> for &'a Matrix<T, R1, C1, SA> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
R1: Dim,
C1: Dim,
SA: Storage<T, R1, C1>,
DefaultAllocator: Allocator<T, R1, Const<D2>>,
ShapeConstraint: AreMultipliable<R1, C1, Const<D2>, Const<D2>>,
impl<'a, 'b, T, R1, C1, SA, const D2: usize> Mul<&'b Rotation<T, D2>> for &'a Matrix<T, R1, C1, SA> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
R1: Dim,
C1: Dim,
SA: Storage<T, R1, C1>,
DefaultAllocator: Allocator<T, R1, Const<D2>>,
ShapeConstraint: AreMultipliable<R1, C1, Const<D2>, Const<D2>>,
impl<T: SimdRealField, S: Storage<T, Const<2>>> Mul<Matrix<T, Const<2_usize>, Const<1_usize>, S>> for UnitComplex<T> where
T::Element: SimdRealField,
impl<T: SimdRealField, S: Storage<T, Const<2>>> Mul<Matrix<T, Const<2_usize>, Const<1_usize>, S>> for UnitComplex<T> where
T::Element: SimdRealField,
impl<'a, T: SimdRealField, S: Storage<T, Const<2>>> Mul<Matrix<T, Const<2_usize>, Const<1_usize>, S>> for &'a UnitComplex<T> where
T::Element: SimdRealField,
impl<'a, T: SimdRealField, S: Storage<T, Const<2>>> Mul<Matrix<T, Const<2_usize>, Const<1_usize>, S>> for &'a UnitComplex<T> where
T::Element: SimdRealField,
impl<T: SimdRealField, R, const D: usize> Mul<Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for Isometry<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<T: SimdRealField, R, const D: usize> Mul<Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for Isometry<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<'a, T: SimdRealField, R, const D: usize> Mul<Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for &'a Isometry<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<'a, T: SimdRealField, R, const D: usize> Mul<Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for &'a Isometry<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<T: SimdRealField, R, const D: usize> Mul<Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for Similarity<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<T: SimdRealField, R, const D: usize> Mul<Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for Similarity<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<'a, T: SimdRealField, R, const D: usize> Mul<Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for &'a Similarity<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<'a, T: SimdRealField, R, const D: usize> Mul<Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for &'a Similarity<T, R, D> where
T::Element: SimdRealField,
R: AbstractRotation<T, D>,
impl<T, C, const D: usize> Mul<Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for Transform<T, C, D> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul + RealField,
Const<D>: DimNameAdd<U1>,
C: TCategory,
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
impl<T, C, const D: usize> Mul<Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for Transform<T, C, D> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul + RealField,
Const<D>: DimNameAdd<U1>,
C: TCategory,
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
impl<'a, T, C, const D: usize> Mul<Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for &'a Transform<T, C, D> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul + RealField,
Const<D>: DimNameAdd<U1>,
C: TCategory,
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
impl<'a, T, C, const D: usize> Mul<Matrix<T, Const<D>, Const<1_usize>, ArrayStorage<T, D, 1_usize>>> for &'a Transform<T, C, D> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul + RealField,
Const<D>: DimNameAdd<U1>,
C: TCategory,
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
impl<'a, T: SimdRealField, SB: Storage<T, Const<3>>> Mul<Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, SB>> for &'a UnitQuaternion<T> where
T::Element: SimdRealField,
impl<'a, T: SimdRealField, SB: Storage<T, Const<3>>> Mul<Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, SB>> for &'a UnitQuaternion<T> where
T::Element: SimdRealField,
impl<T: SimdRealField, SB: Storage<T, Const<3>>> Mul<Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, SB>> for UnitQuaternion<T> where
T::Element: SimdRealField,
impl<T: SimdRealField, SB: Storage<T, Const<3>>> Mul<Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, SB>> for UnitQuaternion<T> where
T::Element: SimdRealField,
impl<'a, T: SimdRealField, SB: Storage<T, U3>> Mul<Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, SB>> for &'a UnitDualQuaternion<T> where
T::Element: SimdRealField,
impl<'a, T: SimdRealField, SB: Storage<T, U3>> Mul<Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, SB>> for &'a UnitDualQuaternion<T> where
T::Element: SimdRealField,
impl<T: SimdRealField, SB: Storage<T, U3>> Mul<Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, SB>> for UnitDualQuaternion<T> where
T::Element: SimdRealField,
impl<T: SimdRealField, SB: Storage<T, U3>> Mul<Matrix<T, Const<{ typenum::$D::USIZE }>, Const<1_usize>, SB>> for UnitDualQuaternion<T> where
T::Element: SimdRealField,
impl<'a, T, R1: Dim, C1: Dim, R2: Dim, C2: Dim, SA, SB> Mul<Matrix<T, R2, C2, SB>> for &'a Matrix<T, R1, C1, SA> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
SB: Storage<T, R2, C2>,
SA: Storage<T, R1, C1>,
DefaultAllocator: Allocator<T, R1, C2>,
ShapeConstraint: AreMultipliable<R1, C1, R2, C2>,
impl<'a, T, R1: Dim, C1: Dim, R2: Dim, C2: Dim, SA, SB> Mul<Matrix<T, R2, C2, SB>> for &'a Matrix<T, R1, C1, SA> where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
SB: Storage<T, R2, C2>,
SA: Storage<T, R1, C1>,
DefaultAllocator: Allocator<T, R1, C2>,
ShapeConstraint: AreMultipliable<R1, C1, R2, C2>,
impl<'b, T, R1, C1, R2, SA, SB> MulAssign<&'b Matrix<T, R2, C1, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
SB: Storage<T, R2, C1>,
SA: StorageMut<T, R1, C1> + IsContiguous + Clone,
ShapeConstraint: AreMultipliable<R1, C1, R2, C1>,
DefaultAllocator: Allocator<T, R1, C1, Buffer = SA>,
impl<'b, T, R1, C1, R2, SA, SB> MulAssign<&'b Matrix<T, R2, C1, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
SB: Storage<T, R2, C1>,
SA: StorageMut<T, R1, C1> + IsContiguous + Clone,
ShapeConstraint: AreMultipliable<R1, C1, R2, C1>,
DefaultAllocator: Allocator<T, R1, C1, Buffer = SA>,
Performs the *=
operation. Read more
impl<T, R1, C1, R2, SA, SB> MulAssign<Matrix<T, R2, C1, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
SB: Storage<T, R2, C1>,
SA: StorageMut<T, R1, C1> + IsContiguous + Clone,
ShapeConstraint: AreMultipliable<R1, C1, R2, C1>,
DefaultAllocator: Allocator<T, R1, C1, Buffer = SA>,
impl<T, R1, C1, R2, SA, SB> MulAssign<Matrix<T, R2, C1, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
SB: Storage<T, R2, C1>,
SA: StorageMut<T, R1, C1> + IsContiguous + Clone,
ShapeConstraint: AreMultipliable<R1, C1, R2, C1>,
DefaultAllocator: Allocator<T, R1, C1, Buffer = SA>,
Performs the *=
operation. Read more
Performs the *=
operation. Read more
impl<T, R: Dim, C: Dim, S> PartialOrd<Matrix<T, R, C, S>> for Matrix<T, R, C, S> where
T: Scalar + PartialOrd,
S: RawStorage<T, R, C>,
impl<T, R: Dim, C: Dim, S> PartialOrd<Matrix<T, R, C, S>> for Matrix<T, R, C, S> where
T: Scalar + PartialOrd,
S: RawStorage<T, R, C>,
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
The default relative tolerance for testing values that are far-apart. Read more
A test for equality that uses a relative comparison if the values are far apart.
The inverse of RelativeEq::relative_eq
.
impl<'a, 'b, T, D1, D2, SB> Sub<&'b Matrix<T, D2, Const<1_usize>, SB>> for &'a OPoint<T, D1> where
T: Scalar + ClosedSub,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<'a, 'b, T, D1, D2, SB> Sub<&'b Matrix<T, D2, Const<1_usize>, SB>> for &'a OPoint<T, D1> where
T: Scalar + ClosedSub,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<'b, T, D1, D2, SB> Sub<&'b Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedSub,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<'b, T, D1, D2, SB> Sub<&'b Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedSub,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<'b, T, R1, C1, R2, C2, SA, SB> Sub<&'b Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedSub,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<'b, T, R1, C1, R2, C2, SA, SB> Sub<&'b Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedSub,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<'a, 'b, T, R1, C1, R2, C2, SA, SB> Sub<&'b Matrix<T, R2, C2, SB>> for &'a Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedSub,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<'a, 'b, T, R1, C1, R2, C2, SA, SB> Sub<&'b Matrix<T, R2, C2, SB>> for &'a Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedSub,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<'a, T, D1, D2, SB> Sub<Matrix<T, D2, Const<1_usize>, SB>> for &'a OPoint<T, D1> where
T: Scalar + ClosedSub,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<'a, T, D1, D2, SB> Sub<Matrix<T, D2, Const<1_usize>, SB>> for &'a OPoint<T, D1> where
T: Scalar + ClosedSub,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<T, D1, D2, SB> Sub<Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedSub,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<T, D1, D2, SB> Sub<Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedSub,
ShapeConstraint: SameNumberOfRows<D1, D2, Representative = D1> + SameNumberOfColumns<U1, U1, Representative = U1>,
D1: DimName,
D2: Dim,
SB: Storage<T, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<'a, T, R1, C1, R2, C2, SA, SB> Sub<Matrix<T, R2, C2, SB>> for &'a Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedSub,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R2, C2, R1, C1>,
ShapeConstraint: SameNumberOfRows<R2, R1> + SameNumberOfColumns<C2, C1>,
impl<'a, T, R1, C1, R2, C2, SA, SB> Sub<Matrix<T, R2, C2, SB>> for &'a Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedSub,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R2, C2, R1, C1>,
ShapeConstraint: SameNumberOfRows<R2, R1> + SameNumberOfColumns<C2, C1>,
impl<T, R1, C1, R2, C2, SA, SB> Sub<Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedSub,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<T, R1, C1, R2, C2, SA, SB> Sub<Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedSub,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: SameShapeAllocator<T, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<'b, T, D1: DimName, D2: Dim, SB> SubAssign<&'b Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedSub,
SB: Storage<T, D2>,
ShapeConstraint: SameNumberOfRows<D1, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<'b, T, D1: DimName, D2: Dim, SB> SubAssign<&'b Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedSub,
SB: Storage<T, D2>,
ShapeConstraint: SameNumberOfRows<D1, D2>,
DefaultAllocator: Allocator<T, D1>,
Performs the -=
operation. Read more
impl<'b, T, R1, C1, R2, C2, SA, SB> SubAssign<&'b Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedSub,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<'b, T, R1, C1, R2, C2, SA, SB> SubAssign<&'b Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedSub,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
Performs the -=
operation. Read more
impl<T, D1: DimName, D2: Dim, SB> SubAssign<Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedSub,
SB: Storage<T, D2>,
ShapeConstraint: SameNumberOfRows<D1, D2>,
DefaultAllocator: Allocator<T, D1>,
impl<T, D1: DimName, D2: Dim, SB> SubAssign<Matrix<T, D2, Const<1_usize>, SB>> for OPoint<T, D1> where
T: Scalar + ClosedSub,
SB: Storage<T, D2>,
ShapeConstraint: SameNumberOfRows<D1, D2>,
DefaultAllocator: Allocator<T, D1>,
Performs the -=
operation. Read more
impl<T, R1, C1, R2, C2, SA, SB> SubAssign<Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedSub,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<T, R1, C1, R2, C2, SA, SB> SubAssign<Matrix<T, R2, C2, SB>> for Matrix<T, R1, C1, SA> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T: Scalar + ClosedSub,
SA: StorageMut<T, R1, C1>,
SB: Storage<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
Performs the -=
operation. Read more
impl<T1, T2, const D: usize> SubsetOf<Matrix<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <DefaultAllocator as Allocator<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output>>::Buffer>> for Rotation<T1, D> where
T1: RealField,
T2: RealField + SupersetOf<T1>,
Const<D>: DimNameAdd<U1> + DimMin<Const<D>, Output = Const<D>>,
DefaultAllocator: Allocator<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
impl<T1, T2, const D: usize> SubsetOf<Matrix<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <DefaultAllocator as Allocator<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output>>::Buffer>> for Rotation<T1, D> where
T1: RealField,
T2: RealField + SupersetOf<T1>,
Const<D>: DimNameAdd<U1> + DimMin<Const<D>, Output = Const<D>>,
DefaultAllocator: Allocator<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
The inclusion map: converts self
to the equivalent element of its superset.
Checks if element
is actually part of the subset Self
(and can be converted to it).
fn from_superset_unchecked(
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
) -> Self
fn from_superset_unchecked(
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
) -> Self
Use with care! Same as self.to_superset
but without any property checks. Always succeeds.
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
impl<T1, T2, const D: usize> SubsetOf<Matrix<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <DefaultAllocator as Allocator<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output>>::Buffer>> for Translation<T1, D> where
T1: RealField,
T2: RealField + SupersetOf<T1>,
Const<D>: DimNameAdd<U1>,
DefaultAllocator: Allocator<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
impl<T1, T2, const D: usize> SubsetOf<Matrix<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <DefaultAllocator as Allocator<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output>>::Buffer>> for Translation<T1, D> where
T1: RealField,
T2: RealField + SupersetOf<T1>,
Const<D>: DimNameAdd<U1>,
DefaultAllocator: Allocator<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
The inclusion map: converts self
to the equivalent element of its superset.
Checks if element
is actually part of the subset Self
(and can be converted to it).
fn from_superset_unchecked(
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
) -> Self
fn from_superset_unchecked(
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
) -> Self
Use with care! Same as self.to_superset
but without any property checks. Always succeeds.
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
impl<T1, T2, R, const D: usize> SubsetOf<Matrix<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <DefaultAllocator as Allocator<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output>>::Buffer>> for Isometry<T1, R, D> where
T1: RealField,
T2: RealField + SupersetOf<T1>,
R: AbstractRotation<T1, D> + SubsetOf<OMatrix<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>> + SubsetOf<OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>>,
Const<D>: DimNameAdd<U1> + DimMin<Const<D>, Output = Const<D>>,
DefaultAllocator: Allocator<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
impl<T1, T2, R, const D: usize> SubsetOf<Matrix<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <DefaultAllocator as Allocator<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output>>::Buffer>> for Isometry<T1, R, D> where
T1: RealField,
T2: RealField + SupersetOf<T1>,
R: AbstractRotation<T1, D> + SubsetOf<OMatrix<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>> + SubsetOf<OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>>,
Const<D>: DimNameAdd<U1> + DimMin<Const<D>, Output = Const<D>>,
DefaultAllocator: Allocator<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
The inclusion map: converts self
to the equivalent element of its superset.
Checks if element
is actually part of the subset Self
(and can be converted to it).
fn from_superset_unchecked(
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
) -> Self
fn from_superset_unchecked(
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
) -> Self
Use with care! Same as self.to_superset
but without any property checks. Always succeeds.
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
impl<T1, T2, R, const D: usize> SubsetOf<Matrix<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <DefaultAllocator as Allocator<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output>>::Buffer>> for Similarity<T1, R, D> where
T1: RealField,
T2: RealField + SupersetOf<T1>,
R: AbstractRotation<T1, D> + SubsetOf<OMatrix<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>> + SubsetOf<OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>>,
Const<D>: DimNameAdd<U1> + DimMin<Const<D>, Output = Const<D>>,
DefaultAllocator: Allocator<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
impl<T1, T2, R, const D: usize> SubsetOf<Matrix<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <DefaultAllocator as Allocator<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output>>::Buffer>> for Similarity<T1, R, D> where
T1: RealField,
T2: RealField + SupersetOf<T1>,
R: AbstractRotation<T1, D> + SubsetOf<OMatrix<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>> + SubsetOf<OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>>,
Const<D>: DimNameAdd<U1> + DimMin<Const<D>, Output = Const<D>>,
DefaultAllocator: Allocator<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
The inclusion map: converts self
to the equivalent element of its superset.
Checks if element
is actually part of the subset Self
(and can be converted to it).
fn from_superset_unchecked(
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
) -> Self
fn from_superset_unchecked(
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
) -> Self
Use with care! Same as self.to_superset
but without any property checks. Always succeeds.
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
impl<T1, T2, C, const D: usize> SubsetOf<Matrix<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <DefaultAllocator as Allocator<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output>>::Buffer>> for Transform<T1, C, D> where
T1: RealField + SubsetOf<T2>,
T2: RealField,
C: TCategory,
Const<D>: DimNameAdd<U1>,
DefaultAllocator: Allocator<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
T1::Epsilon: Copy,
T2::Epsilon: Copy,
impl<T1, T2, C, const D: usize> SubsetOf<Matrix<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <DefaultAllocator as Allocator<T2, <Const<D> as DimNameAdd<Const<1_usize>>>::Output, <Const<D> as DimNameAdd<Const<1_usize>>>::Output>>::Buffer>> for Transform<T1, C, D> where
T1: RealField + SubsetOf<T2>,
T2: RealField,
C: TCategory,
Const<D>: DimNameAdd<U1>,
DefaultAllocator: Allocator<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
T1::Epsilon: Copy,
T2::Epsilon: Copy,
The inclusion map: converts self
to the equivalent element of its superset.
Checks if element
is actually part of the subset Self
(and can be converted to it).
fn from_superset_unchecked(
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
) -> Self
fn from_superset_unchecked(
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
) -> Self
Use with care! Same as self.to_superset
but without any property checks. Always succeeds.
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
impl<T1, T2, D> SubsetOf<Matrix<T2, <D as DimNameAdd<Const<1_usize>>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<T2, <D as DimNameAdd<Const<1_usize>>>::Output, Const<1_usize>>>::Buffer>> for OPoint<T1, D> where
D: DimNameAdd<U1>,
T1: Scalar,
T2: Scalar + Zero + One + ClosedDiv + SupersetOf<T1>,
DefaultAllocator: Allocator<T1, D> + Allocator<T2, D> + Allocator<T1, DimNameSum<D, U1>> + Allocator<T2, DimNameSum<D, U1>>,
impl<T1, T2, D> SubsetOf<Matrix<T2, <D as DimNameAdd<Const<1_usize>>>::Output, Const<1_usize>, <DefaultAllocator as Allocator<T2, <D as DimNameAdd<Const<1_usize>>>::Output, Const<1_usize>>>::Buffer>> for OPoint<T1, D> where
D: DimNameAdd<U1>,
T1: Scalar,
T2: Scalar + Zero + One + ClosedDiv + SupersetOf<T1>,
DefaultAllocator: Allocator<T1, D> + Allocator<T2, D> + Allocator<T1, DimNameSum<D, U1>> + Allocator<T2, DimNameSum<D, U1>>,
The inclusion map: converts self
to the equivalent element of its superset.
Checks if element
is actually part of the subset Self
(and can be converted to it).
Use with care! Same as self.to_superset
but without any property checks. Always succeeds.
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
impl<T1: RealField, T2: RealField + SupersetOf<T1>> SubsetOf<Matrix<T2, Const<{ typenum::$D::USIZE }>, Const<{ typenum::$D::USIZE }>, ArrayStorage<T2, 3_usize, 3_usize>>> for UnitComplex<T1>
impl<T1: RealField, T2: RealField + SupersetOf<T1>> SubsetOf<Matrix<T2, Const<{ typenum::$D::USIZE }>, Const<{ typenum::$D::USIZE }>, ArrayStorage<T2, 3_usize, 3_usize>>> for UnitComplex<T1>
The inclusion map: converts self
to the equivalent element of its superset.
Checks if element
is actually part of the subset Self
(and can be converted to it).
Use with care! Same as self.to_superset
but without any property checks. Always succeeds.
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
impl<T1: RealField, T2: RealField + SupersetOf<T1>> SubsetOf<Matrix<T2, Const<{ typenum::$D::USIZE }>, Const<{ typenum::$D::USIZE }>, ArrayStorage<T2, 4_usize, 4_usize>>> for UnitQuaternion<T1>
impl<T1: RealField, T2: RealField + SupersetOf<T1>> SubsetOf<Matrix<T2, Const<{ typenum::$D::USIZE }>, Const<{ typenum::$D::USIZE }>, ArrayStorage<T2, 4_usize, 4_usize>>> for UnitQuaternion<T1>
The inclusion map: converts self
to the equivalent element of its superset.
Checks if element
is actually part of the subset Self
(and can be converted to it).
Use with care! Same as self.to_superset
but without any property checks. Always succeeds.
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
impl<T1: RealField, T2: RealField + SupersetOf<T1>> SubsetOf<Matrix<T2, Const<{ typenum::$D::USIZE }>, Const<{ typenum::$D::USIZE }>, ArrayStorage<T2, 4_usize, 4_usize>>> for UnitDualQuaternion<T1>
impl<T1: RealField, T2: RealField + SupersetOf<T1>> SubsetOf<Matrix<T2, Const<{ typenum::$D::USIZE }>, Const<{ typenum::$D::USIZE }>, ArrayStorage<T2, 4_usize, 4_usize>>> for UnitDualQuaternion<T1>
The inclusion map: converts self
to the equivalent element of its superset.
Checks if element
is actually part of the subset Self
(and can be converted to it).
Use with care! Same as self.to_superset
but without any property checks. Always succeeds.
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
impl<T1, T2, R1, C1, R2, C2> SubsetOf<Matrix<T2, R2, C2, <DefaultAllocator as Allocator<T2, R2, C2>>::Buffer>> for OMatrix<T1, R1, C1> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T1: Scalar,
T2: Scalar + SupersetOf<T1>,
DefaultAllocator: Allocator<T2, R2, C2> + Allocator<T1, R1, C1> + SameShapeAllocator<T1, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
impl<T1, T2, R1, C1, R2, C2> SubsetOf<Matrix<T2, R2, C2, <DefaultAllocator as Allocator<T2, R2, C2>>::Buffer>> for OMatrix<T1, R1, C1> where
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
T1: Scalar,
T2: Scalar + SupersetOf<T1>,
DefaultAllocator: Allocator<T2, R2, C2> + Allocator<T1, R1, C1> + SameShapeAllocator<T1, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
The inclusion map: converts self
to the equivalent element of its superset.
Checks if element
is actually part of the subset Self
(and can be converted to it).
Use with care! Same as self.to_superset
but without any property checks. Always succeeds.
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
Example
assert_eq!(vec![DVector::repeat(3, 1.0f64),
DVector::repeat(3, 1.0f64),
DVector::repeat(3, 1.0f64)].into_iter().sum::<DVector<f64>>(),
DVector::repeat(3, 1.0f64) + DVector::repeat(3, 1.0f64) + DVector::repeat(3, 1.0f64));
Panics
Panics if the iterator is empty:
iter::empty::<DMatrix<f64>>().sum::<DMatrix<f64>>(); // panics!
The default ULPs to tolerate when testing values that are far-apart. Read more
A test for equality that uses units in the last place (ULP) if the values are far apart.
Auto Trait Implementations
impl<T, R, C, S> RefUnwindSafe for Matrix<T, R, C, S> where
C: RefUnwindSafe,
R: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, R, C, S> UnwindSafe for Matrix<T, R, C, S> where
C: UnwindSafe,
R: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Lanewise greater than >
comparison.
Lanewise greater or equal >=
comparison.
Lanewise less or equal <=
comparison.
Clamps each lane of self
between the corresponding lane of min
and max
.
The min value among all lanes of self
.
The max value among all lanes of self
.
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
Checks if self
is actually part of its subset T
(and can be converted to it).
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
The inclusion map: converts self
to the equivalent element of its superset.