[][src]Struct nalgebra::base::Matrix

#[repr(C)]
pub struct Matrix<N: Scalar, R: Dim, C: Dim, S> {
    pub data: S,
    // some fields omitted
}

The most generic column-major matrix (and vector) type.

It combines four type parameters:

  • N: 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 the nalgebra:: root module. All numbers from 0 to 127 are defined that way.
  • type-level unsigned integer constants (e.g. U1024, U10000) from the typenum:: crate. Using those, you will not get error messages as nice as for numbers smaller than 128 defined on the nalgebra:: module.
  • the special value Dynamic from the nalgebra:: root module. This indicates that the specified dimension is not known at compile-time. Note that this will generally imply that the matrix data storage S 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<N, Dynamic, U1, S> (given some concrete types for N and a compatible data storage type S).

Fields

data: S

The data storage that contains all the matrix components and informations about its number of rows and column (if needed).

Methods

impl<N: ComplexField, D: Dim, S: Storage<N, D>> Matrix<N, D, U1, S>[src]

pub fn icamax(&self) -> usize[src]

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);

impl<N: Scalar + PartialOrd, D: Dim, S: Storage<N, D>> Matrix<N, D, U1, S>[src]

pub fn argmax(&self) -> (usize, N)[src]

Computes the index and value of the vector component with the largest value.

Examples:

let vec = Vector3::new(11, -15, 13);
assert_eq!(vec.argmax(), (2, 13));

pub fn imax(&self) -> usize[src]

Computes the index of the vector component with the largest value.

Examples:

let vec = Vector3::new(11, -15, 13);
assert_eq!(vec.imax(), 2);

pub fn iamax(&self) -> usize where
    N: Signed
[src]

Computes the index of the vector component with the largest absolute value.

Examples:

let vec = Vector3::new(11, -15, 13);
assert_eq!(vec.iamax(), 1);

pub fn argmin(&self) -> (usize, N)[src]

Computes the index and value of the vector component with the smallest value.

Examples:

let vec = Vector3::new(11, -15, 13);
assert_eq!(vec.argmin(), (1, -15));

pub fn imin(&self) -> usize[src]

Computes the index of the vector component with the smallest value.

Examples:

let vec = Vector3::new(11, -15, 13);
assert_eq!(vec.imin(), 1);

pub fn iamin(&self) -> usize where
    N: Signed
[src]

Computes the index of the vector component with the smallest absolute value.

Examples:

let vec = Vector3::new(11, -15, 13);
assert_eq!(vec.iamin(), 0);

impl<N: ComplexField, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S>[src]

pub fn icamax_full(&self) -> (usize, usize)[src]

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<N: Scalar + PartialOrd + Signed, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S>[src]

pub fn iamax_full(&self) -> (usize, usize)[src]

Computes the index of the matrix component with the largest absolute value.

Examples:

let mat = Matrix2x3::new(11, -12, 13,
                         21, 22, -23);
assert_eq!(mat.iamax_full(), (1, 2));

impl<N, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> where
    N: Scalar + Zero + ClosedAdd + ClosedMul, 
[src]

pub fn dot<R2: Dim, C2: Dim, SB>(&self, rhs: &Matrix<N, R2, C2, SB>) -> N where
    SB: Storage<N, R2, C2>,
    ShapeConstraint: DimEq<R, R2> + DimEq<C, C2>, 
[src]

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<N, R2, C2, SB>) -> N where
    N: ComplexField,
    SB: Storage<N, R2, C2>,
    ShapeConstraint: DimEq<R, R2> + DimEq<C, C2>, 
[src]

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<N, R2, C2, SB>) -> N where
    SB: Storage<N, R2, C2>,
    ShapeConstraint: DimEq<C, R2> + DimEq<R, C2>, 
[src]

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);

impl<N, D: Dim, S> Matrix<N, D, U1, S> where
    N: Scalar + Zero + ClosedAdd + ClosedMul,
    S: StorageMut<N, D>, 
[src]

pub fn axcpy<D2: Dim, SB>(&mut self, a: N, x: &Vector<N, D2, SB>, c: N, b: N) where
    SB: Storage<N, D2>,
    ShapeConstraint: DimEq<D, D2>, 
[src]

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));

pub fn axpy<D2: Dim, SB>(&mut self, a: N, x: &Vector<N, D2, SB>, b: N) where
    N: One,
    SB: Storage<N, D2>,
    ShapeConstraint: DimEq<D, D2>, 
[src]

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));

pub fn gemv<R2: Dim, C2: Dim, D3: Dim, SB, SC>(
    &mut self,
    alpha: N,
    a: &Matrix<N, R2, C2, SB>,
    x: &Vector<N, D3, SC>,
    beta: N
) where
    N: One,
    SB: Storage<N, R2, C2>,
    SC: Storage<N, D3>,
    ShapeConstraint: DimEq<D, R2> + AreMultipliable<R2, C2, D3, U1>, 
[src]

Computes self = alpha * a * x + beta * self, where a is a matrix, x a vector, and alpha, beta two scalars.

If beta is zero, self is never read.

Examples:

let mut vec1 = Vector2::new(1.0, 2.0);
let vec2 = Vector2::new(0.1, 0.2);
let mat = Matrix2::new(1.0, 2.0,
                       3.0, 4.0);
vec1.gemv(10.0, &mat, &vec2, 5.0);
assert_eq!(vec1, Vector2::new(10.0, 21.0));

pub fn gemv_symm<D2: Dim, D3: Dim, SB, SC>(
    &mut self,
    alpha: N,
    a: &SquareMatrix<N, D2, SB>,
    x: &Vector<N, D3, SC>,
    beta: N
) where
    N: One,
    SB: Storage<N, D2, D2>,
    SC: Storage<N, D3>,
    ShapeConstraint: DimEq<D, D2> + AreMultipliable<D2, D2, D3, U1>, 
[src]

Deprecated:

This is renamed sygemv to match the original BLAS terminology.

Computes self = alpha * a * x + beta * self, where a is a symmetric matrix, x a vector, and alpha, beta two scalars. DEPRECATED: use sygemv instead.

pub fn sygemv<D2: Dim, D3: Dim, SB, SC>(
    &mut self,
    alpha: N,
    a: &SquareMatrix<N, D2, SB>,
    x: &Vector<N, D3, SC>,
    beta: N
) where
    N: One,
    SB: Storage<N, D2, D2>,
    SC: Storage<N, D3>,
    ShapeConstraint: DimEq<D, D2> + AreMultipliable<D2, D2, D3, U1>, 
[src]

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: N,
    a: &SquareMatrix<N, D2, SB>,
    x: &Vector<N, D3, SC>,
    beta: N
) where
    N: ComplexField,
    SB: Storage<N, D2, D2>,
    SC: Storage<N, D3>,
    ShapeConstraint: DimEq<D, D2> + AreMultipliable<D2, D2, D3, U1>, 
[src]

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)));

pub fn gemv_tr<R2: Dim, C2: Dim, D3: Dim, SB, SC>(
    &mut self,
    alpha: N,
    a: &Matrix<N, R2, C2, SB>,
    x: &Vector<N, D3, SC>,
    beta: N
) where
    N: One,
    SB: Storage<N, R2, C2>,
    SC: Storage<N, D3>,
    ShapeConstraint: DimEq<D, C2> + AreMultipliable<C2, R2, D3, U1>, 
[src]

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: N,
    a: &Matrix<N, R2, C2, SB>,
    x: &Vector<N, D3, SC>,
    beta: N
) where
    N: ComplexField,
    SB: Storage<N, R2, C2>,
    SC: Storage<N, D3>,
    ShapeConstraint: DimEq<D, C2> + AreMultipliable<C2, R2, D3, U1>, 
[src]

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);

impl<N, R1: Dim, C1: Dim, S: StorageMut<N, R1, C1>> Matrix<N, R1, C1, S> where
    N: Scalar + Zero + ClosedAdd + ClosedMul, 
[src]

pub fn ger<D2: Dim, D3: Dim, SB, SC>(
    &mut self,
    alpha: N,
    x: &Vector<N, D2, SB>,
    y: &Vector<N, D3, SC>,
    beta: N
) where
    N: One,
    SB: Storage<N, D2>,
    SC: Storage<N, D3>,
    ShapeConstraint: DimEq<R1, D2> + DimEq<C1, D3>, 
[src]

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);

pub fn gerc<D2: Dim, D3: Dim, SB, SC>(
    &mut self,
    alpha: N,
    x: &Vector<N, D2, SB>,
    y: &Vector<N, D3, SC>,
    beta: N
) where
    N: ComplexField,
    SB: Storage<N, D2>,
    SC: Storage<N, D3>,
    ShapeConstraint: DimEq<R1, D2> + DimEq<C1, D3>, 
[src]

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: N,
    a: &Matrix<N, R2, C2, SB>,
    b: &Matrix<N, R3, C3, SC>,
    beta: N
) where
    N: One,
    SB: Storage<N, R2, C2>,
    SC: Storage<N, R3, C3>,
    ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C3> + AreMultipliable<R2, C2, R3, C3>, 
[src]

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: N,
    a: &Matrix<N, R2, C2, SB>,
    b: &Matrix<N, R3, C3, SC>,
    beta: N
) where
    N: One,
    SB: Storage<N, R2, C2>,
    SC: Storage<N, R3, C3>,
    ShapeConstraint: SameNumberOfRows<R1, C2> + SameNumberOfColumns<C1, C3> + AreMultipliable<C2, R2, R3, C3>, 
[src]

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: N,
    a: &Matrix<N, R2, C2, SB>,
    b: &Matrix<N, R3, C3, SC>,
    beta: N
) where
    N: ComplexField,
    SB: Storage<N, R2, C2>,
    SC: Storage<N, R3, C3>,
    ShapeConstraint: SameNumberOfRows<R1, C2> + SameNumberOfColumns<C1, C3> + AreMultipliable<C2, R2, R3, C3>, 
[src]

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);

impl<N, R1: Dim, C1: Dim, S: StorageMut<N, R1, C1>> Matrix<N, R1, C1, S> where
    N: Scalar + Zero + ClosedAdd + ClosedMul, 
[src]

pub fn ger_symm<D2: Dim, D3: Dim, SB, SC>(
    &mut self,
    alpha: N,
    x: &Vector<N, D2, SB>,
    y: &Vector<N, D3, SC>,
    beta: N
) where
    N: One,
    SB: Storage<N, D2>,
    SC: Storage<N, D3>,
    ShapeConstraint: DimEq<R1, D2> + DimEq<C1, D3>, 
[src]

Deprecated:

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.

pub fn syger<D2: Dim, D3: Dim, SB, SC>(
    &mut self,
    alpha: N,
    x: &Vector<N, D2, SB>,
    y: &Vector<N, D3, SC>,
    beta: N
) where
    N: One,
    SB: Storage<N, D2>,
    SC: Storage<N, D3>,
    ShapeConstraint: DimEq<R1, D2> + DimEq<C1, D3>, 
[src]

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.

pub fn hegerc<D2: Dim, D3: Dim, SB, SC>(
    &mut self,
    alpha: N,
    x: &Vector<N, D2, SB>,
    y: &Vector<N, D3, SC>,
    beta: N
) where
    N: ComplexField,
    SB: Storage<N, D2>,
    SC: Storage<N, D3>,
    ShapeConstraint: DimEq<R1, D2> + DimEq<C1, D3>, 
[src]

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.

impl<N, D1: Dim, S: StorageMut<N, D1, D1>> Matrix<N, D, D, S> where
    N: Scalar + Zero + One + ClosedAdd + ClosedMul, 
[src]

pub fn quadform_tr_with_workspace<D2, S2, R3, C3, S3, D4, S4>(
    &mut self,
    work: &mut Vector<N, D2, S2>,
    alpha: N,
    lhs: &Matrix<N, R3, C3, S3>,
    mid: &SquareMatrix<N, D4, S4>,
    beta: N
) where
    D2: Dim,
    R3: Dim,
    C3: Dim,
    D4: Dim,
    S2: StorageMut<N, D2>,
    S3: Storage<N, R3, C3>,
    S4: Storage<N, D4, D4>,
    ShapeConstraint: DimEq<D1, D2> + DimEq<D1, R3> + DimEq<D2, R3> + DimEq<C3, D4>, 
[src]

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: N,
    lhs: &Matrix<N, R3, C3, S3>,
    mid: &SquareMatrix<N, D4, S4>,
    beta: N
) where
    R3: Dim,
    C3: Dim,
    D4: Dim,
    S3: Storage<N, R3, C3>,
    S4: Storage<N, D4, D4>,
    ShapeConstraint: DimEq<D1, D1> + DimEq<D1, R3> + DimEq<C3, D4>,
    DefaultAllocator: Allocator<N, D1>, 
[src]

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<N, D2, S2>,
    alpha: N,
    mid: &SquareMatrix<N, D3, S3>,
    rhs: &Matrix<N, R4, C4, S4>,
    beta: N
) where
    D2: Dim,
    D3: Dim,
    R4: Dim,
    C4: Dim,
    S2: StorageMut<N, D2>,
    S3: Storage<N, D3, D3>,
    S4: Storage<N, R4, C4>,
    ShapeConstraint: DimEq<D3, R4> + DimEq<D1, C4> + DimEq<D2, D3> + AreMultipliable<C4, R4, D2, U1>, 
[src]

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: N,
    mid: &SquareMatrix<N, D2, S2>,
    rhs: &Matrix<N, R3, C3, S3>,
    beta: N
) where
    D2: Dim,
    R3: Dim,
    C3: Dim,
    S2: Storage<N, D2, D2>,
    S3: Storage<N, R3, C3>,
    ShapeConstraint: DimEq<D2, R3> + DimEq<D1, C3> + AreMultipliable<C3, R3, D2, U1>,
    DefaultAllocator: Allocator<N, D2>, 
[src]

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);

impl<N, R: Dim, C: Dim, S> Matrix<N, R, C, S> where
    N: Scalar + ClosedNeg,
    S: StorageMut<N, R, C>, 
[src]

pub fn neg_mut(&mut self)[src]

Negates self in-place.

impl<N, R1: Dim, C1: Dim, SA: Storage<N, R1, C1>> Matrix<N, R1, C1, SA> where
    N: Scalar + ClosedAdd, 
[src]

pub fn add_to<R2: Dim, C2: Dim, SB, R3: Dim, C3: Dim, SC>(
    &self,
    rhs: &Matrix<N, R2, C2, SB>,
    out: &mut Matrix<N, R3, C3, SC>
) where
    SB: Storage<N, R2, C2>,
    SC: StorageMut<N, R3, C3>,
    ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + SameNumberOfColumns<C1, C3>, 
[src]

Equivalent to self + rhs but stores the result into out to avoid allocations.

impl<N, R1: Dim, C1: Dim, SA: Storage<N, R1, C1>> Matrix<N, R1, C1, SA> where
    N: Scalar + ClosedSub, 
[src]

pub fn sub_to<R2: Dim, C2: Dim, SB, R3: Dim, C3: Dim, SC>(
    &self,
    rhs: &Matrix<N, R2, C2, SB>,
    out: &mut Matrix<N, R3, C3, SC>
) where
    SB: Storage<N, R2, C2>,
    SC: StorageMut<N, R3, C3>,
    ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + SameNumberOfColumns<C1, C3>, 
[src]

Equivalent to self + rhs but stores the result into out to avoid allocations.

impl<N, R1: Dim, C1: Dim, SA> Matrix<N, R1, C1, SA> where
    N: Scalar + Zero + One + ClosedAdd + ClosedMul,
    SA: Storage<N, R1, C1>, 
[src]

pub fn tr_mul<R2: Dim, C2: Dim, SB>(
    &self,
    rhs: &Matrix<N, R2, C2, SB>
) -> MatrixMN<N, C1, C2> where
    SB: Storage<N, R2, C2>,
    DefaultAllocator: Allocator<N, C1, C2>,
    ShapeConstraint: SameNumberOfRows<R1, R2>, 
[src]

Equivalent to self.transpose() * rhs.

pub fn ad_mul<R2: Dim, C2: Dim, SB>(
    &self,
    rhs: &Matrix<N, R2, C2, SB>
) -> MatrixMN<N, C1, C2> where
    N: ComplexField,
    SB: Storage<N, R2, C2>,
    DefaultAllocator: Allocator<N, C1, C2>,
    ShapeConstraint: SameNumberOfRows<R1, R2>, 
[src]

Equivalent to self.adjoint() * rhs.

pub fn tr_mul_to<R2: Dim, C2: Dim, SB, R3: Dim, C3: Dim, SC>(
    &self,
    rhs: &Matrix<N, R2, C2, SB>,
    out: &mut Matrix<N, R3, C3, SC>
) where
    SB: Storage<N, R2, C2>,
    SC: StorageMut<N, R3, C3>,
    ShapeConstraint: SameNumberOfRows<R1, R2> + DimEq<C1, R3> + DimEq<C2, C3>, 
[src]

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<N, R2, C2, SB>,
    out: &mut Matrix<N, R3, C3, SC>
) where
    N: ComplexField,
    SB: Storage<N, R2, C2>,
    SC: StorageMut<N, R3, C3>,
    ShapeConstraint: SameNumberOfRows<R1, R2> + DimEq<C1, R3> + DimEq<C2, C3>, 
[src]

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<N, R2, C2, SB>,
    out: &mut Matrix<N, R3, C3, SC>
) where
    SB: Storage<N, R2, C2>,
    SC: StorageMut<N, R3, C3>,
    ShapeConstraint: SameNumberOfRows<R3, R1> + SameNumberOfColumns<C3, C2> + AreMultipliable<R1, C1, R2, C2>, 
[src]

Equivalent to self * rhs but stores the result into out to avoid allocations.

pub fn kronecker<R2: Dim, C2: Dim, SB>(
    &self,
    rhs: &Matrix<N, R2, C2, SB>
) -> MatrixMN<N, DimProd<R1, R2>, DimProd<C1, C2>> where
    N: ClosedMul,
    R1: DimMul<R2>,
    C1: DimMul<C2>,
    SB: Storage<N, R2, C2>,
    DefaultAllocator: Allocator<N, DimProd<R1, R2>, DimProd<C1, C2>>, 
[src]

The kronecker product of two matrices (aka. tensor product of the corresponding linear maps).

impl<N: Scalar + ClosedAdd, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S>[src]

#[must_use = "Did you mean to use add_scalar_mut()?"] pub fn add_scalar(&self, rhs: N) -> MatrixMN<N, R, C> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

Adds a scalar to self.

pub fn add_scalar_mut(&mut self, rhs: N) where
    S: StorageMut<N, R, C>, 
[src]

Adds a scalar to self in-place.

impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S>[src]

pub fn amax(&self) -> N where
    N: PartialOrd + Signed
[src]

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);

pub fn camax(&self) -> N::RealField where
    N: ComplexField
[src]

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);

pub fn max(&self) -> N where
    N: PartialOrd + Zero
[src]

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);

pub fn amin(&self) -> N where
    N: PartialOrd + Signed
[src]

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);

pub fn camin(&self) -> N::RealField where
    N: ComplexField
[src]

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);

pub fn min(&self) -> N where
    N: PartialOrd + Zero
[src]

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);

impl<N, D: DimName> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer> where
    N: Scalar + Ring,
    DefaultAllocator: Allocator<N, D, D>, 
[src]

pub fn new_scaling(scaling: N) -> Self[src]

Creates a new homogeneous matrix that applies the same scaling factor on each dimension.

pub fn new_nonuniform_scaling<SB>(
    scaling: &Vector<N, DimNameDiff<D, U1>, SB>
) -> Self where
    D: DimNameSub<U1>,
    SB: Storage<N, DimNameDiff<D, U1>>, 
[src]

Creates a new homogeneous matrix that applies a distinct scaling factor for each dimension.

pub fn new_translation<SB>(
    translation: &Vector<N, DimNameDiff<D, U1>, SB>
) -> Self where
    D: DimNameSub<U1>,
    SB: Storage<N, DimNameDiff<D, U1>>, 
[src]

Creates a new homogeneous matrix that applies a pure translation.

impl<N: RealField> Matrix<N, U3, U3, <DefaultAllocator as Allocator<N, U3, U3>>::Buffer>[src]

pub fn new_rotation(angle: N) -> Self[src]

Builds a 2 dimensional homogeneous rotation matrix from an angle in radian.

impl<N: RealField> Matrix<N, U4, U4, <DefaultAllocator as Allocator<N, U4, U4>>::Buffer>[src]

pub fn new_rotation(axisangle: Vector3<N>) -> Self[src]

Builds a 3D homogeneous rotation matrix from an axis and an angle (multiplied together).

Returns the identity matrix if the given argument is zero.

pub fn new_rotation_wrt_point(axisangle: Vector3<N>, pt: Point3<N>) -> Self[src]

Builds a 3D homogeneous rotation matrix from an axis and an angle (multiplied together).

Returns the identity matrix if the given argument is zero.

pub fn from_scaled_axis(axisangle: Vector3<N>) -> Self[src]

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.

pub fn from_euler_angles(roll: N, pitch: N, yaw: N) -> Self[src]

Creates a new rotation from Euler angles.

The primitive rotations are applied in order: 1 roll − 2 pitch − 3 yaw.

pub fn from_axis_angle(axis: &Unit<Vector3<N>>, angle: N) -> Self[src]

Builds a 3D homogeneous rotation matrix from an axis and a rotation angle.

pub fn new_orthographic(
    left: N,
    right: N,
    bottom: N,
    top: N,
    znear: N,
    zfar: N
) -> Self
[src]

Creates a new homogeneous matrix for an orthographic projection.

pub fn new_perspective(aspect: N, fovy: N, znear: N, zfar: N) -> Self[src]

Creates a new homogeneous matrix for a perspective projection.

pub fn face_towards(
    eye: &Point3<N>,
    target: &Point3<N>,
    up: &Vector3<N>
) -> Self
[src]

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.

pub fn new_observer_frame(
    eye: &Point3<N>,
    target: &Point3<N>,
    up: &Vector3<N>
) -> Self
[src]

Deprecated:

renamed to face_towards

Deprecated: Use [Matrix4::face_towards] instead.

pub fn look_at_rh(eye: &Point3<N>, target: &Point3<N>, up: &Vector3<N>) -> Self[src]

Builds a right-handed look-at view matrix.

pub fn look_at_lh(eye: &Point3<N>, target: &Point3<N>, up: &Vector3<N>) -> Self[src]

Builds a left-handed look-at view matrix.

impl<N: Scalar + Ring, D: DimName, S: Storage<N, D, D>> Matrix<N, D, D, S>[src]

#[must_use = "Did you mean to use append_scaling_mut()?"] pub fn append_scaling(&self, scaling: N) -> MatrixN<N, D> where
    D: DimNameSub<U1>,
    DefaultAllocator: Allocator<N, D, D>, 
[src]

Computes the transformation equal to self followed by an uniform scaling factor.

#[must_use = "Did you mean to use prepend_scaling_mut()?"] pub fn prepend_scaling(&self, scaling: N) -> MatrixN<N, D> where
    D: DimNameSub<U1>,
    DefaultAllocator: Allocator<N, D, D>, 
[src]

Computes the transformation equal to an uniform scaling factor followed by self.

#[must_use = "Did you mean to use append_nonuniform_scaling_mut()?"] pub fn append_nonuniform_scaling<SB>(
    &self,
    scaling: &Vector<N, DimNameDiff<D, U1>, SB>
) -> MatrixN<N, D> where
    D: DimNameSub<U1>,
    SB: Storage<N, DimNameDiff<D, U1>>,
    DefaultAllocator: Allocator<N, D, D>, 
[src]

Computes the transformation equal to self followed by a non-uniform scaling factor.

#[must_use = "Did you mean to use prepend_nonuniform_scaling_mut()?"] pub fn prepend_nonuniform_scaling<SB>(
    &self,
    scaling: &Vector<N, DimNameDiff<D, U1>, SB>
) -> MatrixN<N, D> where
    D: DimNameSub<U1>,
    SB: Storage<N, DimNameDiff<D, U1>>,
    DefaultAllocator: Allocator<N, D, D>, 
[src]

Computes the transformation equal to a non-uniform scaling factor followed by self.

#[must_use = "Did you mean to use append_translation_mut()?"] pub fn append_translation<SB>(
    &self,
    shift: &Vector<N, DimNameDiff<D, U1>, SB>
) -> MatrixN<N, D> where
    D: DimNameSub<U1>,
    SB: Storage<N, DimNameDiff<D, U1>>,
    DefaultAllocator: Allocator<N, D, D>, 
[src]

Computes the transformation equal to self followed by a translation.

#[must_use = "Did you mean to use prepend_translation_mut()?"] pub fn prepend_translation<SB>(
    &self,
    shift: &Vector<N, DimNameDiff<D, U1>, SB>
) -> MatrixN<N, D> where
    D: DimNameSub<U1>,
    SB: Storage<N, DimNameDiff<D, U1>>,
    DefaultAllocator: Allocator<N, D, D> + Allocator<N, DimNameDiff<D, U1>>, 
[src]

Computes the transformation equal to a translation followed by self.

impl<N: Scalar + Ring, D: DimName, S: StorageMut<N, D, D>> Matrix<N, D, D, S>[src]

pub fn append_scaling_mut(&mut self, scaling: N) where
    D: DimNameSub<U1>, 
[src]

Computes in-place the transformation equal to self followed by an uniform scaling factor.

pub fn prepend_scaling_mut(&mut self, scaling: N) where
    D: DimNameSub<U1>, 
[src]

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<N, DimNameDiff<D, U1>, SB>
) where
    D: DimNameSub<U1>,
    SB: Storage<N, DimNameDiff<D, U1>>, 
[src]

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<N, DimNameDiff<D, U1>, SB>
) where
    D: DimNameSub<U1>,
    SB: Storage<N, DimNameDiff<D, U1>>, 
[src]

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<N, DimNameDiff<D, U1>, SB>
) where
    D: DimNameSub<U1>,
    SB: Storage<N, DimNameDiff<D, U1>>, 
[src]

Computes the transformation equal to self followed by a translation.

pub fn prepend_translation_mut<SB>(
    &mut self,
    shift: &Vector<N, DimNameDiff<D, U1>, SB>
) where
    D: DimNameSub<U1>,
    SB: Storage<N, DimNameDiff<D, U1>>,
    DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>, 
[src]

Computes the transformation equal to a translation followed by self.

impl<N: RealField, D: DimNameSub<U1>, S: Storage<N, D, D>> Matrix<N, D, D, S> where
    DefaultAllocator: Allocator<N, D, D> + Allocator<N, DimNameDiff<D, U1>> + Allocator<N, DimNameDiff<D, U1>, DimNameDiff<D, U1>>, 
[src]

pub fn transform_vector(
    &self,
    v: &VectorN<N, DimNameDiff<D, U1>>
) -> VectorN<N, DimNameDiff<D, U1>>
[src]

Transforms the given vector, assuming the matrix self uses homogeneous coordinates.

pub fn transform_point(
    &self,
    pt: &Point<N, DimNameDiff<D, U1>>
) -> Point<N, DimNameDiff<D, U1>>
[src]

Transforms the given point, assuming the matrix self uses homogeneous coordinates.

impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S>[src]

pub fn abs(&self) -> MatrixMN<N, R, C> where
    N: Signed,
    DefaultAllocator: Allocator<N, R, C>, 
[src]

Computes the component-wise absolute value.

Example

let a = Matrix2::new(0.0, 1.0,
                     -2.0, -3.0);
assert_eq!(a.abs(), Matrix2::new(0.0, 1.0, 2.0, 3.0))

impl<N: Scalar, R1: Dim, C1: Dim, SA: Storage<N, R1, C1>> Matrix<N, R1, C1, SA>[src]

pub fn component_mul<R2, C2, SB>(
    &self,
    rhs: &Matrix<N, R2, C2, SB>
) -> MatrixSum<N, R1, C1, R2, C2> where
    N: ClosedMul,
    R2: Dim,
    C2: Dim,
    SB: Storage<N, R2, C2>,
    DefaultAllocator: SameShapeAllocator<N, R1, C1, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>, 
[src]

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);

impl<N: Scalar, R1: Dim, C1: Dim, SA: StorageMut<N, R1, C1>> Matrix<N, R1, C1, SA>[src]

pub fn cmpy<R2, C2, SB, R3, C3, SC>(
    &mut self,
    alpha: N,
    a: &Matrix<N, R2, C2, SB>,
    b: &Matrix<N, R3, C3, SC>,
    beta: N
) where
    N: ClosedMul + Zero + Mul<N, Output = N> + Add<N, Output = N>,
    R2: Dim,
    C2: Dim,
    R3: Dim,
    C3: Dim,
    SB: Storage<N, R2, C2>,
    SC: Storage<N, R3, C3>,
    ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + SameNumberOfColumns<C1, C3>, 
[src]

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<N, R2, C2, SB>) where
    N: ClosedMul,
    R2: Dim,
    C2: Dim,
    SB: Storage<N, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>, 
[src]

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<N, R2, C2, SB>) where
    N: ClosedMul,
    R2: Dim,
    C2: Dim,
    SB: Storage<N, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>, 
[src]

Deprecated:

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);

impl<N: Scalar, R1: Dim, C1: Dim, SA: Storage<N, R1, C1>> Matrix<N, R1, C1, SA>[src]

pub fn component_div<R2, C2, SB>(
    &self,
    rhs: &Matrix<N, R2, C2, SB>
) -> MatrixSum<N, R1, C1, R2, C2> where
    N: ClosedDiv,
    R2: Dim,
    C2: Dim,
    SB: Storage<N, R2, C2>,
    DefaultAllocator: SameShapeAllocator<N, R1, C1, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>, 
[src]

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);

impl<N: Scalar, R1: Dim, C1: Dim, SA: StorageMut<N, R1, C1>> Matrix<N, R1, C1, SA>[src]

pub fn cdpy<R2, C2, SB, R3, C3, SC>(
    &mut self,
    alpha: N,
    a: &Matrix<N, R2, C2, SB>,
    b: &Matrix<N, R3, C3, SC>,
    beta: N
) where
    N: ClosedDiv + Zero + Mul<N, Output = N> + Add<N, Output = N>,
    R2: Dim,
    C2: Dim,
    R3: Dim,
    C3: Dim,
    SB: Storage<N, R2, C2>,
    SC: Storage<N, R3, C3>,
    ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2> + SameNumberOfRows<R1, R3> + SameNumberOfColumns<C1, C3>, 
[src]

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<N, R2, C2, SB>) where
    N: ClosedDiv,
    R2: Dim,
    C2: Dim,
    SB: Storage<N, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>, 
[src]

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<N, R2, C2, SB>) where
    N: ClosedDiv,
    R2: Dim,
    C2: Dim,
    SB: Storage<N, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>, 
[src]

Deprecated:

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);

impl<N: Scalar, R: Dim, C: Dim> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

pub unsafe fn new_uninitialized_generic(nrows: R, ncols: C) -> Self[src]

Creates a new uninitialized matrix. If the matrix has a compile-time dimension, this panics if nrows != R::to_usize() or ncols != C::to_usize().

pub fn from_element_generic(nrows: R, ncols: C, elem: N) -> Self[src]

Creates a matrix with all its elements set to elem.

pub fn repeat_generic(nrows: R, ncols: C, elem: N) -> Self[src]

Creates a matrix with all its elements set to elem.

Same as from_element_generic.

pub fn zeros_generic(nrows: R, ncols: C) -> Self where
    N: Zero
[src]

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 = N>, 
[src]

Creates a matrix with all its elements filled by an iterator.

pub fn from_row_slice_generic(nrows: R, ncols: C, slice: &[N]) -> Self[src]

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.

pub fn from_column_slice_generic(nrows: R, ncols: C, slice: &[N]) -> Self[src]

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).

pub fn from_fn_generic<F>(nrows: R, ncols: C, f: F) -> Self where
    F: FnMut(usize, usize) -> N, 
[src]

Creates a matrix filled with the results of a function applied to each of its component coordinates.

pub fn identity_generic(nrows: R, ncols: C) -> Self where
    N: Zero + One
[src]

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.

pub fn from_diagonal_element_generic(nrows: R, ncols: C, elt: N) -> Self where
    N: Zero + One
[src]

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.

pub fn from_partial_diagonal_generic(nrows: R, ncols: C, elts: &[N]) -> Self where
    N: Zero
[src]

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.

pub fn from_rows<SB>(rows: &[Matrix<N, U1, C, SB>]) -> Self where
    SB: Storage<N, U1, C>, 
[src]

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);

pub fn from_columns<SB>(columns: &[Vector<N, R, SB>]) -> Self where
    SB: Storage<N, R>, 
[src]

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);

pub fn new_random_generic(nrows: R, ncols: C) -> Self where
    Standard: Distribution<N>, 
[src]

Creates a matrix filled with random values.

pub fn from_distribution_generic<Distr: Distribution<N> + ?Sized, G: Rng + ?Sized>(
    nrows: R,
    ncols: C,
    distribution: &Distr,
    rng: &mut G
) -> Self
[src]

Creates a matrix filled with random values from the given distribution.

pub fn from_vec_generic(nrows: R, ncols: C, data: Vec<N>) -> Self[src]

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()), U1, 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<N, D: Dim> Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, D, D>, 
[src]

pub fn from_diagonal<SB: Storage<N, D>>(diag: &Vector<N, D, SB>) -> Self where
    N: Zero
[src]

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<N: Scalar, R: DimName, C: DimName> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

pub unsafe fn new_uninitialized() -> Self[src]

Creates a new uninitialized matrix or vector.

pub fn from_element(elem: N) -> Self[src]

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);

pub fn repeat(elem: N) -> Self[src]

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);

pub fn zeros() -> Self where
    N: Zero
[src]

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>(iter: I) -> Self where
    I: IntoIterator<Item = N>, 
[src]

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);

pub fn from_fn<F>(f: F) -> Self where
    F: FnMut(usize, usize) -> N, 
[src]

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);

pub fn identity() -> Self where
    N: Zero + One
[src]

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);

pub fn from_diagonal_element(elt: N) -> Self where
    N: Zero + One
[src]

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);

pub fn from_partial_diagonal(elts: &[N]) -> Self where
    N: Zero
[src]

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);

pub fn from_distribution<Distr: Distribution<N> + ?Sized, G: Rng + ?Sized>(
    distribution: &Distr,
    rng: &mut G
) -> Self
[src]

Creates a matrix or vector filled with random values from the given distribution.

impl<N: Scalar, R: DimName, C: DimName> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, R, C>,
    Standard: Distribution<N>, 
[src]

pub fn new_random() -> Self[src]

Creates a matrix filled with random values.

impl<N: Scalar, R: DimName> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, R, Dynamic>, 
[src]

pub unsafe fn new_uninitialized(ncols: usize) -> Self[src]

Creates a new uninitialized matrix or vector.

pub fn from_element(ncols: usize, elem: N) -> Self[src]

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);

pub fn repeat(ncols: usize, elem: N) -> Self[src]

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);

pub fn zeros(ncols: usize) -> Self where
    N: Zero
[src]

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>(ncols: usize, iter: I) -> Self where
    I: IntoIterator<Item = N>, 
[src]

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);

pub fn from_fn<F>(ncols: usize, f: F) -> Self where
    F: FnMut(usize, usize) -> N, 
[src]

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);

pub fn identity(ncols: usize) -> Self where
    N: Zero + One
[src]

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);

pub fn from_diagonal_element(ncols: usize, elt: N) -> Self where
    N: Zero + One
[src]

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);

pub fn from_partial_diagonal(ncols: usize, elts: &[N]) -> Self where
    N: Zero
[src]

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);

pub fn from_distribution<Distr: Distribution<N> + ?Sized, G: Rng + ?Sized>(
    ncols: usize,
    distribution: &Distr,
    rng: &mut G
) -> Self
[src]

Creates a matrix or vector filled with random values from the given distribution.

impl<N: Scalar, R: DimName> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, R, Dynamic>,
    Standard: Distribution<N>, 
[src]

pub fn new_random(ncols: usize) -> Self[src]

Creates a matrix filled with random values.

impl<N: Scalar, C: DimName> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, Dynamic, C>, 
[src]

pub unsafe fn new_uninitialized(nrows: usize) -> Self[src]

Creates a new uninitialized matrix or vector.

pub fn from_element(nrows: usize, elem: N) -> Self[src]

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);

pub fn repeat(nrows: usize, elem: N) -> Self[src]

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);

pub fn zeros(nrows: usize) -> Self where
    N: Zero
[src]

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, iter: I) -> Self where
    I: IntoIterator<Item = N>, 
[src]

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);

pub fn from_fn<F>(nrows: usize, f: F) -> Self where
    F: FnMut(usize, usize) -> N, 
[src]

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);

pub fn identity(nrows: usize) -> Self where
    N: Zero + One
[src]

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);

pub fn from_diagonal_element(nrows: usize, elt: N) -> Self where
    N: Zero + One
[src]

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);

pub fn from_partial_diagonal(nrows: usize, elts: &[N]) -> Self where
    N: Zero
[src]

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);

pub fn from_distribution<Distr: Distribution<N> + ?Sized, G: Rng + ?Sized>(
    nrows: usize,
    distribution: &Distr,
    rng: &mut G
) -> Self
[src]

Creates a matrix or vector filled with random values from the given distribution.

impl<N: Scalar, C: DimName> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, Dynamic, C>,
    Standard: Distribution<N>, 
[src]

pub fn new_random(nrows: usize) -> Self[src]

Creates a matrix filled with random values.

impl<N: Scalar> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, Dynamic, Dynamic>, 
[src]

pub unsafe fn new_uninitialized(nrows: usize, ncols: usize) -> Self[src]

Creates a new uninitialized matrix or vector.

pub fn from_element(nrows: usize, ncols: usize, elem: N) -> Self[src]

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);

pub fn repeat(nrows: usize, ncols: usize, elem: N) -> Self[src]

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);

pub fn zeros(nrows: usize, ncols: usize) -> Self where
    N: Zero
[src]

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 = N>, 
[src]

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);

pub fn from_fn<F>(nrows: usize, ncols: usize, f: F) -> Self where
    F: FnMut(usize, usize) -> N, 
[src]

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);

pub fn identity(nrows: usize, ncols: usize) -> Self where
    N: Zero + One
[src]

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);

pub fn from_diagonal_element(nrows: usize, ncols: usize, elt: N) -> Self where
    N: Zero + One
[src]

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);

pub fn from_partial_diagonal(nrows: usize, ncols: usize, elts: &[N]) -> Self where
    N: Zero
[src]

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);

pub fn from_distribution<Distr: Distribution<N> + ?Sized, G: Rng + ?Sized>(
    nrows: usize,
    ncols: usize,
    distribution: &Distr,
    rng: &mut G
) -> Self
[src]

Creates a matrix or vector filled with random values from the given distribution.

impl<N: Scalar> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, Dynamic, Dynamic>,
    Standard: Distribution<N>, 
[src]

pub fn new_random(nrows: usize, ncols: usize) -> Self[src]

Creates a matrix filled with random values.

impl<N: Scalar, R: DimName, C: DimName> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

pub fn from_row_slice(data: &[N]) -> Self[src]

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);

pub fn from_column_slice(data: &[N]) -> Self[src]

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);

pub fn from_vec(data: Vec<N>) -> Self[src]

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<N: Scalar, R: DimName> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, R, Dynamic>, 
[src]

pub fn from_row_slice(data: &[N]) -> Self[src]

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);

pub fn from_column_slice(data: &[N]) -> Self[src]

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);

pub fn from_vec(data: Vec<N>) -> Self[src]

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<N: Scalar, C: DimName> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, Dynamic, C>, 
[src]

pub fn from_row_slice(data: &[N]) -> Self[src]

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);

pub fn from_column_slice(data: &[N]) -> Self[src]

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);

pub fn from_vec(data: Vec<N>) -> Self[src]

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<N: Scalar> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, Dynamic, Dynamic>, 
[src]

pub fn from_row_slice(nrows: usize, ncols: usize, data: &[N]) -> Self[src]

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);

pub fn from_column_slice(nrows: usize, ncols: usize, data: &[N]) -> Self[src]

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);

pub fn from_vec(nrows: usize, ncols: usize, data: Vec<N>) -> Self[src]

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<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U2, U2>, 
[src]

pub fn new(m11: N, m12: N, m21: N, m22: N) -> Self[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U3, U3>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m21: N,
    m22: N,
    m23: N,
    m31: N,
    m32: N,
    m33: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U4, U4>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U5, U5>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m45: N,
    m51: N,
    m52: N,
    m53: N,
    m54: N,
    m55: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U6, U6>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m16: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m26: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N,
    m36: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m45: N,
    m46: N,
    m51: N,
    m52: N,
    m53: N,
    m54: N,
    m55: N,
    m56: N,
    m61: N,
    m62: N,
    m63: N,
    m64: N,
    m65: N,
    m66: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U2, U3>, 
[src]

pub fn new(m11: N, m12: N, m13: N, m21: N, m22: N, m23: N) -> Self[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U2, U4>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U2, U5>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U2, U6>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m16: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m26: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U3, U2>, 
[src]

pub fn new(m11: N, m12: N, m21: N, m22: N, m31: N, m32: N) -> Self[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U3, U4>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U3, U5>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U3, U6>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m16: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m26: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N,
    m36: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U4, U2>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m21: N,
    m22: N,
    m31: N,
    m32: N,
    m41: N,
    m42: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U4, U3>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m21: N,
    m22: N,
    m23: N,
    m31: N,
    m32: N,
    m33: N,
    m41: N,
    m42: N,
    m43: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U4, U5>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m45: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U4, U6>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m16: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m26: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N,
    m36: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m45: N,
    m46: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U5, U2>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m21: N,
    m22: N,
    m31: N,
    m32: N,
    m41: N,
    m42: N,
    m51: N,
    m52: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U5, U3>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m21: N,
    m22: N,
    m23: N,
    m31: N,
    m32: N,
    m33: N,
    m41: N,
    m42: N,
    m43: N,
    m51: N,
    m52: N,
    m53: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U5, U4>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m51: N,
    m52: N,
    m53: N,
    m54: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U5, U6>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m16: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m26: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N,
    m36: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m45: N,
    m46: N,
    m51: N,
    m52: N,
    m53: N,
    m54: N,
    m55: N,
    m56: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U6, U2>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m21: N,
    m22: N,
    m31: N,
    m32: N,
    m41: N,
    m42: N,
    m51: N,
    m52: N,
    m61: N,
    m62: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U6, U3>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m21: N,
    m22: N,
    m23: N,
    m31: N,
    m32: N,
    m33: N,
    m41: N,
    m42: N,
    m43: N,
    m51: N,
    m52: N,
    m53: N,
    m61: N,
    m62: N,
    m63: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U6, U4>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m51: N,
    m52: N,
    m53: N,
    m54: N,
    m61: N,
    m62: N,
    m63: N,
    m64: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U6, U5>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m45: N,
    m51: N,
    m52: N,
    m53: N,
    m54: N,
    m55: N,
    m61: N,
    m62: N,
    m63: N,
    m64: N,
    m65: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U1>, 
[src]

pub fn new(x: N) -> Self[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U2>, 
[src]

pub fn new(x: N, y: N) -> Self[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U3>, 
[src]

pub fn new(x: N, y: N, z: N) -> Self[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U4>, 
[src]

pub fn new(x: N, y: N, z: N, w: N) -> Self[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U5>, 
[src]

pub fn new(x: N, y: N, z: N, w: N, a: N) -> Self[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U6>, 
[src]

pub fn new(x: N, y: N, z: N, w: N, a: N, b: N) -> Self[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U2, U1>, 
[src]

pub fn new(x: N, y: N) -> Self[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U3, U1>, 
[src]

pub fn new(x: N, y: N, z: N) -> Self[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U4, U1>, 
[src]

pub fn new(x: N, y: N, z: N, w: N) -> Self[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U5, U1>, 
[src]

pub fn new(x: N, y: N, z: N, w: N, a: N) -> Self[src]

Initializes this matrix from its components.

impl<N> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U6, U1>, 
[src]

pub fn new(x: N, y: N, z: N, w: N, a: N, b: N) -> Self[src]

Initializes this matrix from its components.

impl<N, R: DimName> Matrix<N, D, U1, <DefaultAllocator as Allocator<N, D, U1>>::Buffer> where
    N: Scalar + Zero + One,
    DefaultAllocator: Allocator<N, R>, 
[src]

pub fn x() -> Self where
    R::Value: Cmp<U0, Output = Greater>, 
[src]

The column vector with a 1 as its first component, and zero elsewhere.

pub fn y() -> Self where
    R::Value: Cmp<U1, Output = Greater>, 
[src]

The column vector with a 1 as its second component, and zero elsewhere.

pub fn z() -> Self where
    R::Value: Cmp<U2, Output = Greater>, 
[src]

The column vector with a 1 as its third component, and zero elsewhere.

pub fn w() -> Self where
    R::Value: Cmp<U3, Output = Greater>, 
[src]

The column vector with a 1 as its fourth component, and zero elsewhere.

pub fn a() -> Self where
    R::Value: Cmp<U4, Output = Greater>, 
[src]

The column vector with a 1 as its fifth component, and zero elsewhere.

pub fn b() -> Self where
    R::Value: Cmp<U5, Output = Greater>, 
[src]

The column vector with a 1 as its sixth component, and zero elsewhere.

pub fn x_axis() -> Unit<Self> where
    R::Value: Cmp<U0, Output = Greater>, 
[src]

The unit column vector with a 1 as its first component, and zero elsewhere.

pub fn y_axis() -> Unit<Self> where
    R::Value: Cmp<U1, Output = Greater>, 
[src]

The unit column vector with a 1 as its second component, and zero elsewhere.

pub fn z_axis() -> Unit<Self> where
    R::Value: Cmp<U2, Output = Greater>, 
[src]

The unit column vector with a 1 as its third component, and zero elsewhere.

pub fn w_axis() -> Unit<Self> where
    R::Value: Cmp<U3, Output = Greater>, 
[src]

The unit column vector with a 1 as its fourth component, and zero elsewhere.

pub fn a_axis() -> Unit<Self> where
    R::Value: Cmp<U4, Output = Greater>, 
[src]

The unit column vector with a 1 as its fifth component, and zero elsewhere.

pub fn b_axis() -> Unit<Self> where
    R::Value: Cmp<U5, Output = Greater>, 
[src]

The unit column vector with a 1 as its sixth component, and zero elsewhere.

impl<'a, N: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim> Matrix<N, R, C, SliceStorage<'a, N, R, C, RStride, CStride>>[src]

pub unsafe fn from_slice_with_strides_generic_unchecked(
    data: &'a [N],
    start: usize,
    nrows: R,
    ncols: C,
    rstride: RStride,
    cstride: CStride
) -> Self
[src]

Creates, without bound-checking, a matrix slice from an array and with dimensions and strides specified by generic types instances.

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 [N],
    nrows: R,
    ncols: C,
    rstride: RStride,
    cstride: CStride
) -> Self
[src]

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().

impl<'a, N: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim> Matrix<N, R, C, SliceStorageMut<'a, N, R, C, RStride, CStride>>[src]

pub unsafe fn from_slice_with_strides_generic_unchecked(
    data: &'a mut [N],
    start: usize,
    nrows: R,
    ncols: C,
    rstride: RStride,
    cstride: CStride
) -> Self
[src]

Creates, without bound-checking, a mutable matrix slice from an array and with dimensions and strides specified by generic types instances.

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 [N],
    nrows: R,
    ncols: C,
    rstride: RStride,
    cstride: CStride
) -> Self
[src]

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().

impl<'a, N: Scalar, R: Dim, C: Dim> Matrix<N, R, C, SliceStorage<'a, N, R, C, RStride, CStride>>[src]

pub unsafe fn from_slice_generic_unchecked(
    data: &'a [N],
    start: usize,
    nrows: R,
    ncols: C
) -> Self
[src]

Creates, without bound-checking, a matrix slice from an array and with dimensions specified by generic types instances.

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().

pub fn from_slice_generic(data: &'a [N], nrows: R, ncols: C) -> Self[src]

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().

impl<'a, N: Scalar, R: Dim, C: Dim> Matrix<N, R, C, SliceStorageMut<'a, N, R, C, RStride, CStride>>[src]

pub unsafe fn from_slice_generic_unchecked(
    data: &'a mut [N],
    start: usize,
    nrows: R,
    ncols: C
) -> Self
[src]

Creates, without bound-checking, a mutable matrix slice from an array and with dimensions specified by generic types instances.

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().

pub fn from_slice_generic(data: &'a mut [N], nrows: R, ncols: C) -> Self[src]

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().

impl<'a, N: Scalar, R: DimName, C: DimName> Matrix<N, R, C, SliceStorage<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice(data: &'a [N]) -> Self[src]

Creates a new matrix slice from the given data array.

Panics if data does not contain enough elements.

pub unsafe fn from_slice_unchecked(data: &'a [N], start: usize) -> Self[src]

Creates, without bound checking, a new matrix slice from the given data array.

impl<'a, N: Scalar, R: DimName, C: DimName> Matrix<N, R, C, SliceStorage<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice_with_strides(
    data: &'a [N],
    rstride: usize,
    cstride: usize
) -> Self
[src]

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_unchecked(
    data: &'a [N],
    start: usize,
    rstride: usize,
    cstride: usize
) -> Self
[src]

Creates, without bound checking, a new matrix slice with the specified strides from the given data array.

impl<'a, N: Scalar, R: DimName> Matrix<N, R, C, SliceStorage<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice(data: &'a [N], ncols: usize) -> Self[src]

Creates a new matrix slice from the given data array.

Panics if data does not contain enough elements.

pub unsafe fn from_slice_unchecked(
    data: &'a [N],
    start: usize,
    ncols: usize
) -> Self
[src]

Creates, without bound checking, a new matrix slice from the given data array.

impl<'a, N: Scalar, R: DimName> Matrix<N, R, C, SliceStorage<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice_with_strides(
    data: &'a [N],
    ncols: usize,
    rstride: usize,
    cstride: usize
) -> Self
[src]

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_unchecked(
    data: &'a [N],
    start: usize,
    ncols: usize,
    rstride: usize,
    cstride: usize
) -> Self
[src]

Creates, without bound checking, a new matrix slice with the specified strides from the given data array.

impl<'a, N: Scalar, C: DimName> Matrix<N, R, C, SliceStorage<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice(data: &'a [N], nrows: usize) -> Self[src]

Creates a new matrix slice from the given data array.

Panics if data does not contain enough elements.

pub unsafe fn from_slice_unchecked(
    data: &'a [N],
    start: usize,
    nrows: usize
) -> Self
[src]

Creates, without bound checking, a new matrix slice from the given data array.

impl<'a, N: Scalar, C: DimName> Matrix<N, R, C, SliceStorage<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice_with_strides(
    data: &'a [N],
    nrows: usize,
    rstride: usize,
    cstride: usize
) -> Self
[src]

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_unchecked(
    data: &'a [N],
    start: usize,
    nrows: usize,
    rstride: usize,
    cstride: usize
) -> Self
[src]

Creates, without bound checking, a new matrix slice with the specified strides from the given data array.

impl<'a, N: Scalar> Matrix<N, R, C, SliceStorage<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice(data: &'a [N], nrows: usize, ncols: usize) -> Self[src]

Creates a new matrix slice from the given data array.

Panics if data does not contain enough elements.

pub unsafe fn from_slice_unchecked(
    data: &'a [N],
    start: usize,
    nrows: usize,
    ncols: usize
) -> Self
[src]

Creates, without bound checking, a new matrix slice from the given data array.

impl<'a, N: Scalar> Matrix<N, R, C, SliceStorage<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice_with_strides(
    data: &'a [N],
    nrows: usize,
    ncols: usize,
    rstride: usize,
    cstride: usize
) -> Self
[src]

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_unchecked(
    data: &'a [N],
    start: usize,
    nrows: usize,
    ncols: usize,
    rstride: usize,
    cstride: usize
) -> Self
[src]

Creates, without bound checking, a new matrix slice with the specified strides from the given data array.

impl<'a, N: Scalar, R: DimName, C: DimName> Matrix<N, R, C, SliceStorageMut<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice(data: &'a mut [N]) -> Self[src]

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 [N], start: usize) -> Self[src]

Creates, without bound checking, a new mutable matrix slice from the given data array.

impl<'a, N: Scalar, R: DimName, C: DimName> Matrix<N, R, C, SliceStorageMut<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice_with_strides_mut(
    data: &'a mut [N],
    rstride: usize,
    cstride: usize
) -> Self
[src]

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 [N],
    start: usize,
    rstride: usize,
    cstride: usize
) -> Self
[src]

Creates, without bound checking, a new mutable matrix slice with the specified strides from the given data array.

impl<'a, N: Scalar, R: DimName> Matrix<N, R, C, SliceStorageMut<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice(data: &'a mut [N], ncols: usize) -> Self[src]

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 [N],
    start: usize,
    ncols: usize
) -> Self
[src]

Creates, without bound checking, a new mutable matrix slice from the given data array.

impl<'a, N: Scalar, R: DimName> Matrix<N, R, C, SliceStorageMut<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice_with_strides_mut(
    data: &'a mut [N],
    ncols: usize,
    rstride: usize,
    cstride: usize
) -> Self
[src]

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 [N],
    start: usize,
    ncols: usize,
    rstride: usize,
    cstride: usize
) -> Self
[src]

Creates, without bound checking, a new mutable matrix slice with the specified strides from the given data array.

impl<'a, N: Scalar, C: DimName> Matrix<N, R, C, SliceStorageMut<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice(data: &'a mut [N], nrows: usize) -> Self[src]

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 [N],
    start: usize,
    nrows: usize
) -> Self
[src]

Creates, without bound checking, a new mutable matrix slice from the given data array.

impl<'a, N: Scalar, C: DimName> Matrix<N, R, C, SliceStorageMut<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice_with_strides_mut(
    data: &'a mut [N],
    nrows: usize,
    rstride: usize,
    cstride: usize
) -> Self
[src]

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 [N],
    start: usize,
    nrows: usize,
    rstride: usize,
    cstride: usize
) -> Self
[src]

Creates, without bound checking, a new mutable matrix slice with the specified strides from the given data array.

impl<'a, N: Scalar> Matrix<N, R, C, SliceStorageMut<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice(data: &'a mut [N], nrows: usize, ncols: usize) -> Self[src]

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 [N],
    start: usize,
    nrows: usize,
    ncols: usize
) -> Self
[src]

Creates, without bound checking, a new mutable matrix slice from the given data array.

impl<'a, N: Scalar> Matrix<N, R, C, SliceStorageMut<'a, N, R, C, RStride, CStride>>[src]

pub fn from_slice_with_strides_mut(
    data: &'a mut [N],
    nrows: usize,
    ncols: usize,
    rstride: usize,
    cstride: usize
) -> Self
[src]

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 [N],
    start: usize,
    nrows: usize,
    ncols: usize,
    rstride: usize,
    cstride: usize
) -> Self
[src]

Creates, without bound checking, a new mutable matrix slice with the specified strides from the given data array.

impl<N: Scalar + Zero, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S>[src]

pub fn upper_triangle(&self) -> MatrixMN<N, R, C> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

Extracts the upper triangular part of this matrix (including the diagonal).

pub fn lower_triangle(&self) -> MatrixMN<N, R, C> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

Extracts the lower triangular part of this matrix (including the diagonal).

pub fn select_rows<'a, I>(&self, irows: I) -> MatrixMN<N, Dynamic, C> where
    I: IntoIterator<Item = &'a usize>,
    I::IntoIter: ExactSizeIterator + Clone,
    DefaultAllocator: Allocator<N, Dynamic, C>, 
[src]

Creates a new matrix by extracting the given set of rows from self.

pub fn select_columns<'a, I>(&self, icols: I) -> MatrixMN<N, R, Dynamic> where
    I: IntoIterator<Item = &'a usize>,
    I::IntoIter: ExactSizeIterator,
    DefaultAllocator: Allocator<N, R, Dynamic>, 
[src]

Creates a new matrix by extracting the given set of columns from self.

impl<N: Scalar, R: Dim, C: Dim, S: StorageMut<N, R, C>> Matrix<N, R, C, S>[src]

pub fn fill(&mut self, val: N)[src]

Sets all the elements of this matrix to val.

pub fn fill_with_identity(&mut self) where
    N: Zero + One
[src]

Fills self with the identity matrix.

pub fn fill_diagonal(&mut self, val: N)[src]

Sets all the diagonal elements of this matrix to val.

pub fn fill_row(&mut self, i: usize, val: N)[src]

Sets all the elements of the selected row to val.

pub fn fill_column(&mut self, j: usize, val: N)[src]

Sets all the elements of the selected column to val.

pub fn set_diagonal<R2: Dim, S2>(&mut self, diag: &Vector<N, R2, S2>) where
    R: DimMin<C>,
    S2: Storage<N, R2>,
    ShapeConstraint: DimEq<DimMinimum<R, C>, R2>, 
[src]

Fills the diagonal of this matrix with the content of the given vector.

pub fn set_partial_diagonal(&mut self, diag: impl Iterator<Item = N>)[src]

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<N, C2, S2>) where
    S2: Storage<N, U1, C2>,
    ShapeConstraint: SameNumberOfColumns<C, C2>, 
[src]

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<N, R2, S2>) where
    S2: Storage<N, R2, U1>,
    ShapeConstraint: SameNumberOfRows<R, R2>, 
[src]

Fills the selected column of this matrix with the content of the given vector.

pub fn fill_lower_triangle(&mut self, val: N, shift: usize)[src]

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 first shift - 1 subdiagonals are left untouched.

pub fn fill_upper_triangle(&mut self, val: N, shift: usize)[src]

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 first shift - 1 superdiagonals are left untouched.

pub fn swap_rows(&mut self, irow1: usize, irow2: usize)[src]

Swaps two rows in-place.

pub fn swap_columns(&mut self, icol1: usize, icol2: usize)[src]

Swaps two columns in-place.

impl<N: Scalar, D: Dim, S: StorageMut<N, D, D>> Matrix<N, D, D, S>[src]

pub fn fill_lower_triangle_with_upper_triangle(&mut self)[src]

Copies the upper-triangle of this matrix to its lower-triangular part.

This makes the matrix symmetric. Panics if the matrix is not square.

pub fn fill_upper_triangle_with_lower_triangle(&mut self)[src]

Copies the upper-triangle of this matrix to its upper-triangular part.

This makes the matrix symmetric. Panics if the matrix is not square.

impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S>[src]

pub fn remove_column(self, i: usize) -> MatrixMN<N, R, DimDiff<C, U1>> where
    C: DimSub<U1>,
    DefaultAllocator: Reallocator<N, R, C, R, DimDiff<C, U1>>, 
[src]

Removes the i-th column from this matrix.

pub fn remove_columns_at(self, indices: &[usize]) -> MatrixMN<N, R, Dynamic> where
    C: DimSub<Dynamic, Output = Dynamic>,
    DefaultAllocator: Reallocator<N, R, C, R, Dynamic>, 
[src]

Removes all columns in indices

pub fn remove_rows_at(self, indices: &[usize]) -> MatrixMN<N, Dynamic, C> where
    R: DimSub<Dynamic, Output = Dynamic>,
    DefaultAllocator: Reallocator<N, R, C, Dynamic, C>, 
[src]

Removes all rows in indices

pub fn remove_fixed_columns<D>(self, i: usize) -> MatrixMN<N, R, DimDiff<C, D>> where
    D: DimName,
    C: DimSub<D>,
    DefaultAllocator: Reallocator<N, R, C, R, DimDiff<C, D>>, 
[src]

Removes D::dim() consecutive columns from this matrix, starting with the i-th (included).

pub fn remove_columns(self, i: usize, n: usize) -> MatrixMN<N, R, Dynamic> where
    C: DimSub<Dynamic, Output = Dynamic>,
    DefaultAllocator: Reallocator<N, R, C, R, Dynamic>, 
[src]

Removes n consecutive columns from this matrix, starting with the i-th (included).

pub fn remove_columns_generic<D>(
    self,
    i: usize,
    nremove: D
) -> MatrixMN<N, R, DimDiff<C, D>> where
    D: Dim,
    C: DimSub<D>,
    DefaultAllocator: Reallocator<N, R, C, R, DimDiff<C, D>>, 
[src]

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) -> MatrixMN<N, DimDiff<R, U1>, C> where
    R: DimSub<U1>,
    DefaultAllocator: Reallocator<N, R, C, DimDiff<R, U1>, C>, 
[src]

Removes the i-th row from this matrix.

pub fn remove_fixed_rows<D>(self, i: usize) -> MatrixMN<N, DimDiff<R, D>, C> where
    D: DimName,
    R: DimSub<D>,
    DefaultAllocator: Reallocator<N, R, C, DimDiff<R, D>, C>, 
[src]

Removes D::dim() consecutive rows from this matrix, starting with the i-th (included).

pub fn remove_rows(self, i: usize, n: usize) -> MatrixMN<N, Dynamic, C> where
    R: DimSub<Dynamic, Output = Dynamic>,
    DefaultAllocator: Reallocator<N, R, C, Dynamic, C>, 
[src]

Removes n consecutive rows from this matrix, starting with the i-th (included).

pub fn remove_rows_generic<D>(
    self,
    i: usize,
    nremove: D
) -> MatrixMN<N, DimDiff<R, D>, C> where
    D: Dim,
    R: DimSub<D>,
    DefaultAllocator: Reallocator<N, R, C, DimDiff<R, D>, C>, 
[src]

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: N) -> MatrixMN<N, R, DimSum<C, U1>> where
    C: DimAdd<U1>,
    DefaultAllocator: Reallocator<N, R, C, R, DimSum<C, U1>>, 
[src]

Inserts a column filled with val at the i-th position.

pub fn insert_fixed_columns<D>(
    self,
    i: usize,
    val: N
) -> MatrixMN<N, R, DimSum<C, D>> where
    D: DimName,
    C: DimAdd<D>,
    DefaultAllocator: Reallocator<N, R, C, R, DimSum<C, D>>, 
[src]

Inserts D::dim() columns filled with val starting at the i-th position.

pub fn insert_columns(
    self,
    i: usize,
    n: usize,
    val: N
) -> MatrixMN<N, R, Dynamic> where
    C: DimAdd<Dynamic, Output = Dynamic>,
    DefaultAllocator: Reallocator<N, R, C, R, Dynamic>, 
[src]

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
) -> MatrixMN<N, R, DimSum<C, D>> where
    D: Dim,
    C: DimAdd<D>,
    DefaultAllocator: Reallocator<N, R, C, R, DimSum<C, D>>, 
[src]

Inserts ninsert.value() columns starting at the i-th place of this matrix.

The added column values are not initialized.

pub fn insert_row(self, i: usize, val: N) -> MatrixMN<N, DimSum<R, U1>, C> where
    R: DimAdd<U1>,
    DefaultAllocator: Reallocator<N, R, C, DimSum<R, U1>, C>, 
[src]

Inserts a row filled with val at the i-th position.

pub fn insert_fixed_rows<D>(
    self,
    i: usize,
    val: N
) -> MatrixMN<N, DimSum<R, D>, C> where
    D: DimName,
    R: DimAdd<D>,
    DefaultAllocator: Reallocator<N, R, C, DimSum<R, D>, C>, 
[src]

Inserts D::dim() rows filled with val starting at the i-th position.

pub fn insert_rows(self, i: usize, n: usize, val: N) -> MatrixMN<N, Dynamic, C> where
    R: DimAdd<Dynamic, Output = Dynamic>,
    DefaultAllocator: Reallocator<N, R, C, Dynamic, C>, 
[src]

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
) -> MatrixMN<N, DimSum<R, D>, C> where
    D: Dim,
    R: DimAdd<D>,
    DefaultAllocator: Reallocator<N, R, C, DimSum<R, D>, C>, 
[src]

Inserts ninsert.value() rows at the i-th place of this matrix.

The added rows values are not initialized. This is the generic implementation of .insert_rows(...) and .insert_fixed_rows(...) which have nicer API interfaces.

pub fn resize(self, new_nrows: usize, new_ncols: usize, val: N) -> DMatrix<N> where
    DefaultAllocator: Reallocator<N, R, C, Dynamic, Dynamic>, 
[src]

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: N
) -> MatrixMN<N, Dynamic, C> where
    DefaultAllocator: Reallocator<N, R, C, Dynamic, C>, 
[src]

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: N
) -> MatrixMN<N, R, Dynamic> where
    DefaultAllocator: Reallocator<N, R, C, R, Dynamic>, 
[src]

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<R2: DimName, C2: DimName>(
    self,
    val: N
) -> MatrixMN<N, R2, C2> where
    DefaultAllocator: Reallocator<N, R, C, R2, C2>, 
[src]

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: N
) -> MatrixMN<N, R2, C2> where
    DefaultAllocator: Reallocator<N, R, C, R2, C2>, 
[src]

Resizes self such that it has dimensions new_nrows × now_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.

impl<N: Scalar> Matrix<N, Dynamic, Dynamic, <DefaultAllocator as Allocator<N, Dynamic, Dynamic>>::Buffer>[src]

pub fn resize_mut(&mut self, new_nrows: usize, new_ncols: usize, val: N) where
    DefaultAllocator: Reallocator<N, Dynamic, Dynamic, Dynamic, Dynamic>, 
[src]

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<N: Scalar, C: Dim> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, Dynamic, C>, 
[src]

pub fn resize_vertically_mut(&mut self, new_nrows: usize, val: N) where
    DefaultAllocator: Reallocator<N, Dynamic, C, Dynamic, C>, 
[src]

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<N: Scalar, R: Dim> Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer> where
    DefaultAllocator: Allocator<N, R, Dynamic>, 
[src]

pub fn resize_horizontally_mut(&mut self, new_ncols: usize, val: N) where
    DefaultAllocator: Reallocator<N, R, Dynamic, R, Dynamic>, 
[src]

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).

impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S>[src]

Indexing Operations

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((U1.., 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, N, R, C, S>, 
[src]

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: StorageMut<N, R, C>,
    I: MatrixIndexMut<'a, N, R, C, S>, 
[src]

Produces a mutable view of the data at the given index, or None if the index is out of bounds.

pub fn index<'a, I>(&'a self, index: I) -> I::Output where
    I: MatrixIndex<'a, N, R, C, S>, 
[src]

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: StorageMut<N, R, C>,
    I: MatrixIndexMut<'a, N, R, C, S>, 
[src]

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, N, R, C, S>, 
[src]

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: StorageMut<N, R, C>,
    I: MatrixIndexMut<'a, N, R, C, S>, 
[src]

Returns a mutable view of the data at the given index, without doing any bounds checking.

impl<N: Scalar, R: Dim, C: Dim, S> Matrix<N, R, C, S>[src]

pub unsafe fn from_data_statically_unchecked(data: S) -> Matrix<N, R, C, S>[src]

Creates a new matrix with the given data without statically checking that the matrix dimension matches the storage dimension.

impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S>[src]

pub fn from_data(data: S) -> Self[src]

Creates a new matrix with the given data.

pub fn len(&self) -> usize[src]

The total number of elements of this matrix.

Examples:

let mat = Matrix3x4::<f32>::zeros();
assert_eq!(mat.len(), 12);

pub fn shape(&self) -> (usize, usize)[src]

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));

pub fn nrows(&self) -> usize[src]

The number of rows of this matrix.

Examples:

let mat = Matrix3x4::<f32>::zeros();
assert_eq!(mat.nrows(), 3);

pub fn ncols(&self) -> usize[src]

The number of columns of this matrix.

Examples:

let mat = Matrix3x4::<f32>::zeros();
assert_eq!(mat.ncols(), 4);

pub fn strides(&self) -> (usize, usize)[src]

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));

Important traits for MatrixIter<'a, N, R, C, S>
pub fn iter(&self) -> MatrixIter<N, R, C, S>[src]

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());

Important traits for RowIter<'a, N, R, C, S>
pub fn row_iter(&self) -> RowIter<N, R, C, S>[src]

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))
}

Important traits for ColumnIter<'a, N, R, C, S>
pub fn column_iter(&self) -> ColumnIter<N, R, C, S>[src]

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 vector_to_matrix_index(&self, i: usize) -> (usize, usize)[src]

Computes the row and column coordinates of the i-th element of this matrix seen as a vector.

pub fn as_ptr(&self) -> *const N[src]

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.

pub fn relative_eq<R2, C2, SB>(
    &self,
    other: &Matrix<N, R2, C2, SB>,
    eps: N::Epsilon,
    max_relative: N::Epsilon
) -> bool where
    N: RelativeEq,
    R2: Dim,
    C2: Dim,
    SB: Storage<N, R2, C2>,
    N::Epsilon: Copy,
    ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>, 
[src]

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<N, R2, C2, SB>) -> bool where
    N: PartialEq,
    R2: Dim,
    C2: Dim,
    SB: Storage<N, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>, 
[src]

Tests whether self and rhs are exactly equal.

pub fn into_owned(self) -> MatrixMN<N, R, C> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

Moves this matrix into one that owns its data.

pub fn into_owned_sum<R2, C2>(self) -> MatrixSum<N, R, C, R2, C2> where
    R2: Dim,
    C2: Dim,
    DefaultAllocator: SameShapeAllocator<N, R, C, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>, 
[src]

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) -> MatrixMN<N, R, C> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

Clones this matrix to one that owns its data.

pub fn clone_owned_sum<R2, C2>(&self) -> MatrixSum<N, R, C, R2, C2> where
    R2: Dim,
    C2: Dim,
    DefaultAllocator: SameShapeAllocator<N, R, C, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>, 
[src]

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 map<N2: Scalar, F: FnMut(N) -> N2>(&self, f: F) -> MatrixMN<N2, R, C> where
    DefaultAllocator: Allocator<N2, R, C>, 
[src]

Returns a matrix containing the result of f applied to each of its entries.

pub fn map_with_location<N2: Scalar, F: FnMut(usize, usize, N) -> N2>(
    &self,
    f: F
) -> MatrixMN<N2, R, C> where
    DefaultAllocator: Allocator<N2, R, C>, 
[src]

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).

pub fn zip_map<N2, N3, S2, F>(
    &self,
    rhs: &Matrix<N2, R, C, S2>,
    f: F
) -> MatrixMN<N3, R, C> where
    N2: Scalar,
    N3: Scalar,
    S2: Storage<N2, R, C>,
    F: FnMut(N, N2) -> N3,
    DefaultAllocator: Allocator<N3, R, C>, 
[src]

Returns a matrix containing the result of f applied to each entries of self and rhs.

pub fn zip_zip_map<N2, N3, N4, S2, S3, F>(
    &self,
    b: &Matrix<N2, R, C, S2>,
    c: &Matrix<N3, R, C, S3>,
    f: F
) -> MatrixMN<N4, R, C> where
    N2: Scalar,
    N3: Scalar,
    N4: Scalar,
    S2: Storage<N2, R, C>,
    S3: Storage<N3, R, C>,
    F: FnMut(N, N2, N3) -> N4,
    DefaultAllocator: Allocator<N4, R, C>, 
[src]

Returns a matrix containing the result of f applied to each entries of self and b, and c.

pub fn fold<Acc>(&self, init: Acc, f: impl FnMut(Acc, N) -> Acc) -> Acc[src]

Folds a function f on each entry of self.

pub fn zip_fold<N2, R2, C2, S2, Acc>(
    &self,
    rhs: &Matrix<N2, R2, C2, S2>,
    init: Acc,
    f: impl FnMut(Acc, N, N2) -> Acc
) -> Acc where
    N2: Scalar,
    R2: Dim,
    C2: Dim,
    S2: Storage<N2, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>, 
[src]

Folds a function f on each pairs of entries from self and rhs.

pub fn transpose_to<R2, C2, SB>(&self, out: &mut Matrix<N, R2, C2, SB>) where
    R2: Dim,
    C2: Dim,
    SB: StorageMut<N, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>, 
[src]

Transposes self and store the result into out.

#[must_use = "Did you mean to use transpose_mut()?"] pub fn transpose(&self) -> MatrixMN<N, C, R> where
    DefaultAllocator: Allocator<N, C, R>, 
[src]

Transposes self.

impl<N: Scalar, R: Dim, C: Dim, S: StorageMut<N, R, C>> Matrix<N, R, C, S>[src]

Important traits for MatrixIterMut<'a, N, R, C, S>
pub fn iter_mut(&mut self) -> MatrixIterMut<N, R, C, S>[src]

Mutably iterates through this matrix coordinates.

pub fn as_mut_ptr(&mut self) -> *mut N[src]

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.

Important traits for RowIterMut<'a, N, R, C, S>
pub fn row_iter_mut(&mut self) -> RowIterMut<N, R, C, S>[src]

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);

Important traits for ColumnIterMut<'a, N, R, C, S>
pub fn column_iter_mut(&mut self) -> ColumnIterMut<N, R, C, S>[src]

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);

pub unsafe fn swap_unchecked(
    &mut self,
    row_cols1: (usize, usize),
    row_cols2: (usize, usize)
)
[src]

Swaps two entries without bound-checking.

pub fn swap(&mut self, row_cols1: (usize, usize), row_cols2: (usize, usize))[src]

Swaps two entries.

pub fn copy_from_slice(&mut self, slice: &[N])[src]

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<N, R2, C2, SB>) where
    R2: Dim,
    C2: Dim,
    SB: Storage<N, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>, 
[src]

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<N, R2, C2, SB>) where
    R2: Dim,
    C2: Dim,
    SB: Storage<N, R2, C2>,
    ShapeConstraint: DimEq<R, C2> + SameNumberOfColumns<C, R2>, 
[src]

Fills this matrix with the content of the transpose another one.

pub fn apply_into<F: FnMut(N) -> N>(self, f: F) -> Self[src]

Returns self with each of its components replaced by the result of a closure f applied on it.

pub fn apply<F: FnMut(N) -> N>(&mut self, f: F)[src]

Replaces each component of self by the result of a closure f applied on it.

pub fn zip_apply<N2, R2, C2, S2>(
    &mut self,
    rhs: &Matrix<N2, R2, C2, S2>,
    f: impl FnMut(N, N2) -> N
) where
    N2: Scalar,
    R2: Dim,
    C2: Dim,
    S2: Storage<N2, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>, 
[src]

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<N2, R2, C2, S2, N3, R3, C3, S3>(
    &mut self,
    b: &Matrix<N2, R2, C2, S2>,
    c: &Matrix<N3, R3, C3, S3>,
    f: impl FnMut(N, N2, N3) -> N
) where
    N2: Scalar,
    R2: Dim,
    C2: Dim,
    S2: Storage<N2, R2, C2>,
    N3: Scalar,
    R3: Dim,
    C3: Dim,
    S3: Storage<N3, R3, C3>,
    ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>,
    ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>, 
[src]

Replaces each component of self by the result of a closure f applied on its components joined with the components from b and c.

impl<N: Scalar, D: Dim, S: Storage<N, D>> Matrix<N, D, U1, S>[src]

pub unsafe fn vget_unchecked(&self, i: usize) -> &N[src]

Gets a reference to the i-th element of this column vector without bound checking.

impl<N: Scalar, D: Dim, S: StorageMut<N, D>> Matrix<N, D, U1, S>[src]

pub unsafe fn vget_unchecked_mut(&mut self, i: usize) -> &mut N[src]

Gets a mutable reference to the i-th element of this column vector without bound checking.

impl<N: Scalar, R: Dim, C: Dim, S: ContiguousStorage<N, R, C>> Matrix<N, R, C, S>[src]

pub fn as_slice(&self) -> &[N][src]

Extracts a slice containing the entire matrix entries ordered column-by-columns.

impl<N: Scalar, R: Dim, C: Dim, S: ContiguousStorageMut<N, R, C>> Matrix<N, R, C, S>[src]

pub fn as_mut_slice(&mut self) -> &mut [N][src]

Extracts a mutable slice containing the entire matrix entries ordered column-by-columns.

impl<N: Scalar, D: Dim, S: StorageMut<N, D, D>> Matrix<N, D, D, S>[src]

pub fn transpose_mut(&mut self)[src]

Transposes the square matrix self in-place.

impl<N: ComplexField, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S>[src]

pub fn adjoint_to<R2, C2, SB>(&self, out: &mut Matrix<N, R2, C2, SB>) where
    R2: Dim,
    C2: Dim,
    SB: StorageMut<N, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>, 
[src]

Takes the adjoint (aka. conjugate-transpose) of self and store the result into out.

#[must_use = "Did you mean to use adjoint_mut()?"] pub fn adjoint(&self) -> MatrixMN<N, C, R> where
    DefaultAllocator: Allocator<N, C, R>, 
[src]

The adjoint (aka. conjugate-transpose) of self.

pub fn conjugate_transpose_to<R2, C2, SB>(
    &self,
    out: &mut Matrix<N, R2, C2, SB>
) where
    R2: Dim,
    C2: Dim,
    SB: StorageMut<N, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R, C2> + SameNumberOfColumns<C, R2>, 
[src]

Deprecated:

Renamed self.adjoint_to(out).

Takes the conjugate and transposes self and store the result into out.

pub fn conjugate_transpose(&self) -> MatrixMN<N, C, R> where
    DefaultAllocator: Allocator<N, C, R>, 
[src]

Deprecated:

Renamed self.adjoint().

The conjugate transposition of self.

#[must_use = "Did you mean to use conjugate_mut()?"] pub fn conjugate(&self) -> MatrixMN<N, R, C> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

The conjugate of self.

#[must_use = "Did you mean to use unscale_mut()?"] pub fn unscale(&self, real: N::RealField) -> MatrixMN<N, R, C> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

Divides each component of the complex matrix self by the given real.

#[must_use = "Did you mean to use scale_mut()?"] pub fn scale(&self, real: N::RealField) -> MatrixMN<N, R, C> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

Multiplies each component of the complex matrix self by the given real.

impl<N: ComplexField, R: Dim, C: Dim, S: StorageMut<N, R, C>> Matrix<N, R, C, S>[src]

pub fn conjugate_mut(&mut self)[src]

The conjugate of the complex matrix self computed in-place.

pub fn unscale_mut(&mut self, real: N::RealField)[src]

Divides each component of the complex matrix self by the given real.

pub fn scale_mut(&mut self, real: N::RealField)[src]

Multiplies each component of the complex matrix self by the given real.

impl<N: ComplexField, D: Dim, S: StorageMut<N, D, D>> Matrix<N, D, D, S>[src]

pub fn conjugate_transform_mut(&mut self)[src]

Deprecated:

Renamed to self.adjoint_mut().

Sets self to its adjoint.

pub fn adjoint_mut(&mut self)[src]

Sets self to its adjoint (aka. conjugate-transpose).

impl<N: Scalar, D: Dim, S: Storage<N, D, D>> Matrix<N, D, D, S>[src]

pub fn diagonal(&self) -> VectorN<N, D> where
    DefaultAllocator: Allocator<N, D>, 
[src]

The diagonal of this matrix.

pub fn map_diagonal<N2: Scalar>(&self, f: impl FnMut(N) -> N2) -> VectorN<N2, D> where
    DefaultAllocator: Allocator<N2, D>, 
[src]

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.

pub fn trace(&self) -> N where
    N: Ring, 
[src]

Computes a trace of a square matrix, i.e., the sum of its diagonal elements.

impl<N: ComplexField, D: Dim, S: Storage<N, D, D>> Matrix<N, D, D, S>[src]

pub fn symmetric_part(&self) -> MatrixMN<N, D, D> where
    DefaultAllocator: Allocator<N, D, D>, 
[src]

The symmetric part of self, i.e., 0.5 * (self + self.transpose()).

pub fn hermitian_part(&self) -> MatrixMN<N, D, D> where
    DefaultAllocator: Allocator<N, D, D>, 
[src]

The hermitian part of self, i.e., 0.5 * (self + self.adjoint()).

impl<N: Scalar + Zero + One, D: DimAdd<U1> + IsNotStaticOne, S: Storage<N, D, D>> Matrix<N, D, D, S>[src]

pub fn to_homogeneous(&self) -> MatrixN<N, DimSum<D, U1>> where
    DefaultAllocator: Allocator<N, DimSum<D, U1>, DimSum<D, U1>>, 
[src]

Yields the homogeneous matrix for this matrix, i.e., appending an additional dimension and and setting the diagonal element to 1.

impl<N: Scalar + Zero, D: DimAdd<U1>, S: Storage<N, D>> Matrix<N, D, U1, S>[src]

pub fn to_homogeneous(&self) -> VectorN<N, DimSum<D, U1>> where
    DefaultAllocator: Allocator<N, DimSum<D, U1>>, 
[src]

Computes the coordinates in projective space of this vector, i.e., appends a 0 to its coordinates.

pub fn from_homogeneous<SB>(
    v: Vector<N, DimSum<D, U1>, SB>
) -> Option<VectorN<N, D>> where
    SB: Storage<N, DimSum<D, U1>>,
    DefaultAllocator: Allocator<N, D>, 
[src]

Constructs a vector from coordinates in projective space, i.e., removes a 0 at the end of self. Returns None if this last component is not zero.

impl<N: Scalar + Zero, D: DimAdd<U1>, S: Storage<N, D>> Matrix<N, D, U1, S>[src]

pub fn push(&self, element: N) -> VectorN<N, DimSum<D, U1>> where
    DefaultAllocator: Allocator<N, DimSum<D, U1>>, 
[src]

Constructs a new vector of higher dimension by appending element to the end of self.

impl<N: Scalar + Ring, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S>[src]

pub fn perp<R2, C2, SB>(&self, b: &Matrix<N, R2, C2, SB>) -> N where
    R2: Dim,
    C2: Dim,
    SB: Storage<N, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R, U2> + SameNumberOfColumns<C, U1> + SameNumberOfRows<R2, U2> + SameNumberOfColumns<C2, U1>, 
[src]

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<N, R2, C2, SB>
) -> MatrixCross<N, R, C, R2, C2> where
    R2: Dim,
    C2: Dim,
    SB: Storage<N, R2, C2>,
    DefaultAllocator: SameShapeAllocator<N, R, C, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R, R2> + SameNumberOfColumns<C, C2>, 
[src]

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.

impl<N: Scalar + Field, S: Storage<N, U3>> Matrix<N, D, U1, S> where
    DefaultAllocator: Allocator<N, U3>, 
[src]

pub fn cross_matrix(&self) -> MatrixN<N, U3>[src]

Computes the matrix M such that for all vector v we have M * v == self.cross(&v).

impl<N: ComplexField, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S>[src]

pub fn angle<R2: Dim, C2: Dim, SB>(
    &self,
    other: &Matrix<N, R2, C2, SB>
) -> N::RealField where
    SB: Storage<N, R2, C2>,
    ShapeConstraint: DimEq<R, R2> + DimEq<C, C2>, 
[src]

The smallest angle between two vectors.

impl<N: Scalar + Zero + One + ClosedAdd + ClosedSub + ClosedMul, D: Dim, S: Storage<N, D>> Matrix<N, D, U1, S>[src]

pub fn lerp<S2: Storage<N, D>>(
    &self,
    rhs: &Vector<N, D, S2>,
    t: N
) -> VectorN<N, D> where
    DefaultAllocator: Allocator<N, D>, 
[src]

Returns self * (1.0 - t) + rhs * t, i.e., the linear blend of the vectors x and y using the scalar value a.

The value for a is not restricted to the range [0, 1].

Examples:

let x = Vector3::new(1.0, 2.0, 3.0);
let y = Vector3::new(10.0, 20.0, 30.0);
assert_eq!(x.lerp(&y, 0.1), Vector3::new(1.9, 3.8, 5.7));

impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S>[src]

pub fn row(&self, i: usize) -> MatrixSlice<N, U1, C, S::RStride, S::CStride>[src]

Returns a slice containing the i-th row of this matrix.

pub fn row_part(
    &self,
    i: usize,
    n: usize
) -> MatrixSlice<N, U1, Dynamic, S::RStride, S::CStride>
[src]

Returns a slice containing the n first elements of the i-th row of this matrix.

pub fn rows(
    &self,
    first_row: usize,
    nrows: usize
) -> MatrixSlice<N, Dynamic, C, S::RStride, S::CStride>
[src]

Extracts from this matrix a set of consecutive rows.

pub fn rows_with_step(
    &self,
    first_row: usize,
    nrows: usize,
    step: usize
) -> MatrixSlice<N, Dynamic, C, Dynamic, S::CStride>
[src]

Extracts from this matrix a set of consecutive rows regularly skipping step rows.

pub fn fixed_rows<RSlice: DimName>(
    &self,
    first_row: usize
) -> MatrixSlice<N, RSlice, C, S::RStride, S::CStride>
[src]

Extracts a compile-time number of consecutive rows from this matrix.

pub fn fixed_rows_with_step<RSlice: DimName>(
    &self,
    first_row: usize,
    step: usize
) -> MatrixSlice<N, RSlice, C, Dynamic, S::CStride>
[src]

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<N, RSlice, C, S::RStride, S::CStride>
[src]

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<N, RSlice, C, Dynamic, S::CStride> where
    RSlice: Dim
[src]

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(&self, i: usize) -> MatrixSlice<N, R, U1, S::RStride, S::CStride>[src]

Returns a slice containing the i-th column of this matrix.

pub fn column_part(
    &self,
    i: usize,
    n: usize
) -> MatrixSlice<N, Dynamic, U1, S::RStride, S::CStride>
[src]

Returns a slice containing the n first elements of the i-th column of this matrix.

pub fn columns(
    &self,
    first_col: usize,
    ncols: usize
) -> MatrixSlice<N, R, Dynamic, S::RStride, S::CStride>
[src]

Extracts from this matrix a set of consecutive columns.

pub fn columns_with_step(
    &self,
    first_col: usize,
    ncols: usize,
    step: usize
) -> MatrixSlice<N, R, Dynamic, S::RStride, Dynamic>
[src]

Extracts from this matrix a set of consecutive columns regularly skipping step columns.

pub fn fixed_columns<CSlice: DimName>(
    &self,
    first_col: usize
) -> MatrixSlice<N, R, CSlice, S::RStride, S::CStride>
[src]

Extracts a compile-time number of consecutive columns from this matrix.

pub fn fixed_columns_with_step<CSlice: DimName>(
    &self,
    first_col: usize,
    step: usize
) -> MatrixSlice<N, R, CSlice, S::RStride, Dynamic>
[src]

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<N, R, CSlice, S::RStride, S::CStride>
[src]

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<N, R, CSlice, S::RStride, Dynamic>
[src]

Extracts from this matrix ncols columns skipping step columns. Both argument may or may not be values known at compile-time.

pub fn slice(
    &self,
    start: (usize, usize),
    shape: (usize, usize)
) -> MatrixSlice<N, Dynamic, Dynamic, S::RStride, S::CStride>
[src]

Slices this matrix starting at its component (irow, icol) and with (nrows, ncols) consecutive elements.

pub fn slice_with_steps(
    &self,
    start: (usize, usize),
    shape: (usize, usize),
    steps: (usize, usize)
) -> MatrixSlice<N, Dynamic, Dynamic, Dynamic, Dynamic>
[src]

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.

pub fn fixed_slice<RSlice, CSlice>(
    &self,
    irow: usize,
    icol: usize
) -> MatrixSlice<N, RSlice, CSlice, S::RStride, S::CStride> where
    RSlice: DimName,
    CSlice: DimName
[src]

Slices this matrix starting at its component (irow, icol) and with (R::dim(), CSlice::dim()) consecutive components.

pub fn fixed_slice_with_steps<RSlice, CSlice>(
    &self,
    start: (usize, usize),
    steps: (usize, usize)
) -> MatrixSlice<N, RSlice, CSlice, Dynamic, Dynamic> where
    RSlice: DimName,
    CSlice: DimName
[src]

Slices this matrix starting at its component (start.0, start.1) and with (R::dim(), CSlice::dim()) components. Each row (resp. column) of the sliced matrix is separated by steps.0 (resp. steps.1) ignored rows (resp. columns) of the original matrix.

pub fn generic_slice<RSlice, CSlice>(
    &self,
    start: (usize, usize),
    shape: (RSlice, CSlice)
) -> MatrixSlice<N, RSlice, CSlice, S::RStride, S::CStride> where
    RSlice: Dim,
    CSlice: Dim
[src]

Creates a slice that may or may not have a fixed size and stride.

pub fn generic_slice_with_steps<RSlice, CSlice>(
    &self,
    start: (usize, usize),
    shape: (RSlice, CSlice),
    steps: (usize, usize)
) -> MatrixSlice<N, RSlice, CSlice, Dynamic, Dynamic> where
    RSlice: Dim,
    CSlice: Dim
[src]

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<N, Range1::Size, C, S::RStride, S::CStride>, MatrixSlice<N, Range2::Size, C, S::RStride, S::CStride>)
[src]

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<N, R, Range1::Size, S::RStride, S::CStride>, MatrixSlice<N, R, Range2::Size, S::RStride, S::CStride>)
[src]

Splits this NxM matrix into two parts delimited by two ranges.

Panics if the ranges overlap or if the first range is empty.

impl<N: Scalar, R: Dim, C: Dim, S: StorageMut<N, R, C>> Matrix<N, R, C, S>[src]

pub fn row_mut(
    &mut self,
    i: usize
) -> MatrixSliceMut<N, U1, C, S::RStride, S::CStride>
[src]

Returns a slice containing the i-th row of this matrix.

pub fn row_part_mut(
    &mut self,
    i: usize,
    n: usize
) -> MatrixSliceMut<N, U1, Dynamic, S::RStride, S::CStride>
[src]

Returns a slice containing the n first elements of the i-th row of this matrix.

pub fn rows_mut(
    &mut self,
    first_row: usize,
    nrows: usize
) -> MatrixSliceMut<N, Dynamic, C, S::RStride, S::CStride>
[src]

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<N, Dynamic, C, Dynamic, S::CStride>
[src]

Extracts from this matrix a set of consecutive rows regularly skipping step rows.

pub fn fixed_rows_mut<RSlice: DimName>(
    &mut self,
    first_row: usize
) -> MatrixSliceMut<N, RSlice, C, S::RStride, S::CStride>
[src]

Extracts a compile-time number of consecutive rows from this matrix.

pub fn fixed_rows_with_step_mut<RSlice: DimName>(
    &mut self,
    first_row: usize,
    step: usize
) -> MatrixSliceMut<N, RSlice, C, Dynamic, S::CStride>
[src]

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<N, RSlice, C, S::RStride, S::CStride>
[src]

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<N, RSlice, C, Dynamic, S::CStride> where
    RSlice: Dim
[src]

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<N, R, U1, S::RStride, S::CStride>
[src]

Returns a slice containing the i-th column of this matrix.

pub fn column_part_mut(
    &mut self,
    i: usize,
    n: usize
) -> MatrixSliceMut<N, Dynamic, U1, S::RStride, S::CStride>
[src]

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<N, R, Dynamic, S::RStride, S::CStride>
[src]

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<N, R, Dynamic, S::RStride, Dynamic>
[src]

Extracts from this matrix a set of consecutive columns regularly skipping step columns.

pub fn fixed_columns_mut<CSlice: DimName>(
    &mut self,
    first_col: usize
) -> MatrixSliceMut<N, R, CSlice, S::RStride, S::CStride>
[src]

Extracts a compile-time number of consecutive columns from this matrix.

pub fn fixed_columns_with_step_mut<CSlice: DimName>(
    &mut self,
    first_col: usize,
    step: usize
) -> MatrixSliceMut<N, R, CSlice, S::RStride, Dynamic>
[src]

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<N, R, CSlice, S::RStride, S::CStride>
[src]

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<N, R, CSlice, S::RStride, Dynamic>
[src]

Extracts from this matrix ncols columns skipping step columns. Both argument may or may not be values known at compile-time.

pub fn slice_mut(
    &mut self,
    start: (usize, usize),
    shape: (usize, usize)
) -> MatrixSliceMut<N, Dynamic, Dynamic, S::RStride, S::CStride>
[src]

Slices this matrix starting at its component (irow, icol) and with (nrows, ncols) consecutive elements.

pub fn slice_with_steps_mut(
    &mut self,
    start: (usize, usize),
    shape: (usize, usize),
    steps: (usize, usize)
) -> MatrixSliceMut<N,