Skip to main content

ExactMatrix

Struct ExactMatrix 

Source
pub struct ExactMatrix<T: ExactScalar> { /* private fields */ }
Expand description

Dense row-major matrix with exact numeric entries.

Use the aliases ZMatrix (BigInt entries) and QMatrix (Ratio<BigInt> entries). Shapes are always non-empty (nrows, ncols ≥ 1), like Matrix.

Element access follows Matrix: get / indexing panic on out-of-range indices (a logic error, like slice indexing); try_get returns Option. Shape-checked arithmetic (add, sub, matmul) returns Result; the operators + − * panic on a shape mismatch.

Implementations§

Source§

impl<T: ExactScalar> ExactMatrix<T>

Source

pub fn new(rows: Vec<Vec<T>>) -> Result<Self, SymplexError>

Build from rows.

§Errors

SymplexError::InvalidArgument if there are no rows, a row is empty, or the rows have different lengths.

§Examples
use symplex::matrix::ZMatrix;
use symplex::num_bigint::BigInt;

let m = ZMatrix::new(vec![vec![BigInt::from(1), BigInt::from(2)]]).unwrap();
assert_eq!(m.shape(), (1, 2));
assert!(ZMatrix::new(vec![vec![BigInt::from(1)], vec![]]).is_err());
Source

pub fn from_flat( nrows: usize, ncols: usize, data: Vec<T>, ) -> Result<Self, SymplexError>

Build from a flat row-major buffer of length nrows · ncols.

§Errors

SymplexError::InvalidArgument if a dimension is zero or the buffer length does not match.

Source

pub fn from_i64(rows: &[&[i64]]) -> Result<Self, SymplexError>

Build from machine-integer rows.

§Errors

SymplexError::InvalidArgument for empty or jagged input.

§Examples
use symplex::matrix::QMatrix;
use symplex::linprog::q;

let m = QMatrix::from_i64(&[&[1, 2], &[3, 4]]).unwrap();
assert_eq!(m[(1, 0)], q(3, 1));
Source

pub fn from_fn( nrows: usize, ncols: usize, f: impl FnMut(usize, usize) -> T, ) -> Self

Build an nrows × ncols matrix from f(i, j).

§Panics

Panics if nrows == 0 or ncols == 0.

Source

pub fn zeros(nrows: usize, ncols: usize) -> Self

The nrows × ncols zero matrix.

§Panics

Panics if nrows == 0 or ncols == 0.

Source

pub fn identity(n: usize) -> Self

The n × n identity matrix.

§Panics

Panics if n == 0.

Source

pub fn diag(entries: &[T]) -> Self

Square matrix with entries on the diagonal.

§Panics

Panics if entries is empty.

Source

pub fn row_vector(entries: Vec<T>) -> Self

A 1 × n matrix.

§Panics

Panics if entries is empty.

Source

pub fn col_vector(entries: Vec<T>) -> Self

An n × 1 matrix.

§Panics

Panics if entries is empty.

Source

pub fn nrows(&self) -> usize

Number of rows.

Source

pub fn ncols(&self) -> usize

Number of columns.

Source

pub fn shape(&self) -> (usize, usize)

(nrows, ncols).

Source

pub fn is_square(&self) -> bool

true if nrows == ncols.

Source

pub fn get(&self, i: usize, j: usize) -> &T

Reference to entry (i, j).

§Panics

Panics if i >= nrows or j >= ncols; see try_get.

Source

pub fn try_get(&self, i: usize, j: usize) -> Option<&T>

Checked reference to entry (i, j).

Source

pub fn get_mut(&mut self, i: usize, j: usize) -> &mut T

Mutable reference to entry (i, j).

§Panics

Panics if i >= nrows or j >= ncols.

Source

pub fn set(&mut self, i: usize, j: usize, value: T)

Overwrite entry (i, j).

§Panics

Panics if i >= nrows or j >= ncols.

Source

pub fn row(&self, i: usize) -> &[T]

Row i as a slice.

§Panics

Panics if i >= nrows.

Source

pub fn col(&self, j: usize) -> Vec<T>

Column j as an owned vector.

§Panics

Panics if j >= ncols.

Source

pub fn diagonal(&self) -> Vec<T>

The diagonal entries (0,0), (1,1), … (length min(nrows, ncols)).

Source

pub fn rows(&self) -> impl Iterator<Item = &[T]> + '_

Iterator over the rows as slices.

Source

pub fn iter(&self) -> impl Iterator<Item = &T> + '_

Iterator over all entries, row-major.

Source

pub fn as_slice(&self) -> &[T]

The entries as a flat row-major slice.

Source

pub fn to_rows(&self) -> Vec<Vec<T>>

The entries as nested vectors.

Source

pub fn into_flat(self) -> Vec<T>

Consume into the flat row-major buffer.

Source

pub fn is_zero(&self) -> bool

true if every entry is zero.

Source

pub fn is_identity(&self) -> bool

true if this is a square identity matrix.

Source

pub fn transpose(&self) -> Self

Transpose.

Source

pub fn submatrix( &self, rows: Range<usize>, cols: Range<usize>, ) -> Result<Self, SymplexError>

The sub-block with rows in rows and columns in cols.

§Errors

SymplexError::InvalidArgument if a range is empty or out of bounds.

Source

pub fn hstack(parts: &[&Self]) -> Result<Self, SymplexError>

Horizontal concatenation [A | B | …].

§Errors

SymplexError::InvalidArgument if the list is empty or the row counts differ.

Source

pub fn vstack(parts: &[&Self]) -> Result<Self, SymplexError>

Vertical concatenation.

§Errors

SymplexError::InvalidArgument if the list is empty or the column counts differ.

Source

pub fn map<U: ExactScalar>(&self, f: impl FnMut(&T) -> U) -> ExactMatrix<U>

Apply f to every entry.

Source

pub fn add(&self, other: &Self) -> Result<Self, SymplexError>

Entry-wise sum.

§Errors

SymplexError::InvalidArgument on a shape mismatch.

Source

pub fn sub(&self, other: &Self) -> Result<Self, SymplexError>

Entry-wise difference.

§Errors

SymplexError::InvalidArgument on a shape mismatch.

Source

pub fn neg(&self) -> Self

Entry-wise negation.

Source

pub fn scale(&self, k: &T) -> Self

Multiply every entry by k.

Source

pub fn matmul(&self, other: &Self) -> Result<Self, SymplexError>

Matrix product.

§Errors

SymplexError::InvalidArgument if self.ncols != other.nrows.

Source

pub fn trace(&self) -> Result<T, SymplexError>

Sum of the diagonal entries.

§Errors

SymplexError::InvalidArgument if the matrix is not square.

Source§

impl<T: ExactScalar> ExactMatrix<T>

Source

pub fn permanent(&self) -> Result<T, SymplexError>

Permanent per(A) = Σ_σ ∏ᵢ a_{i,σ(i)} (the determinant without the signs), by Ryser’s inclusion–exclusion formula walked in Gray-code order: O(2ⁿ · n) ring operations and O(n) memory. SymPy: Matrix.per().

The cost is exponential in n; matrices larger than 20×20 are rejected rather than left to run for an unbounded time.

§Errors
§Examples
use symplex::matrix::ZMatrix;
use symplex::num_bigint::BigInt;

let m = ZMatrix::from_i64(&[&[1, 2], &[3, 4]]).unwrap();
assert_eq!(m.permanent().unwrap(), BigInt::from(10)); // 1·4 + 2·3
let m3 = ZMatrix::from_i64(&[&[1, 2, 3], &[4, 5, 6], &[7, 8, 9]]).unwrap();
assert_eq!(m3.permanent().unwrap(), BigInt::from(450));
Source§

impl ExactMatrix<BigInt>

Source

pub fn to_qmatrix(&self) -> QMatrix

Convert to a QMatrix (every entry becomes n/1).

Source

pub fn to_matrix(&self, ctx: &Context) -> Matrix

Convert to a symbolic Matrix of integer literals in ctx.

Source

pub fn det(&self) -> Result<BigInt, SymplexError>

Determinant by Bareiss fraction-free elimination (O(n³) integer operations, no fractions at any stage).

§Errors

SymplexError::InvalidArgument if the matrix is not square.

§Examples
use symplex::matrix::ZMatrix;
use symplex::num_bigint::BigInt;

let m = ZMatrix::from_i64(&[&[2, 1, 0], &[1, 3, 1], &[0, 1, 4]]).unwrap();
assert_eq!(m.det().unwrap(), BigInt::from(18));
assert!(ZMatrix::from_i64(&[&[1, 2, 3]]).unwrap().det().is_err());
Source

pub fn rank(&self) -> usize

Rank over ℚ (equivalently over ℤ as a lattice).

§Examples
use symplex::matrix::ZMatrix;

assert_eq!(ZMatrix::from_i64(&[&[1, 2], &[2, 4]]).unwrap().rank(), 1);
Source

pub fn content(&self) -> BigInt

Greatest common divisor of all entries (0 for the zero matrix).

Source

pub fn hermite_normal_form(&self) -> ZMatrix

Row-style Hermite normal form H = U·A (U unimodular).

H is in row echelon form with positive pivots, every entry above a pivot reduced into [0, pivot), zero rows at the bottom. This form is unique. See normalforms for the conventions in detail.

§Examples
use symplex::matrix::ZMatrix;

let a = ZMatrix::from_i64(&[&[1, 2], &[2, 4]]).unwrap();
assert_eq!(a.hermite_normal_form(), ZMatrix::from_i64(&[&[1, 2], &[0, 0]]).unwrap());
Source

pub fn hermite_normal_form_with_transform(&self) -> (ZMatrix, ZMatrix)

Row-style Hermite normal form with its transform: (H, U), H = U·A, det U = ±1.

Source

pub fn column_hermite_normal_form(&self) -> ZMatrix

Column-style Hermite normal form H = A·V (Cohen’s Algorithm 2.4.5, SymPy’s convention): zero columns first, each pivot the lowest nonzero entry of its column, pivots positive and strictly descending from left to right, entries to the right of a pivot in [0, pivot).

§Examples
use symplex::matrix::ZMatrix;

let a = ZMatrix::from_i64(&[&[12, 6, 4], &[3, 9, 6], &[2, 16, 14]]).unwrap();
assert_eq!(
    a.column_hermite_normal_form(),
    ZMatrix::from_i64(&[&[10, 0, 2], &[0, 15, 3], &[0, 0, 2]]).unwrap()
);
Source

pub fn smith_normal_form(&self) -> ZMatrix

Smith normal form diag(d₁, …, dᵣ, 0, …) with dᵢ > 0, dᵢ | dᵢ₊₁.

§Examples
use symplex::matrix::ZMatrix;

let a = ZMatrix::from_i64(&[&[2, 0], &[0, 3]]).unwrap();
assert_eq!(a.smith_normal_form(), ZMatrix::from_i64(&[&[1, 0], &[0, 6]]).unwrap());
Source

pub fn smith_normal_form_with_transforms(&self) -> (ZMatrix, ZMatrix, ZMatrix)

Smith normal form with transforms (S, U, V), S = U·A·V, det U = det V = ±1.

Source

pub fn integer_nullspace(&self) -> Vec<ZMatrix>

A ℤ-basis of the integer kernel {x ∈ ℤⁿ : A·x = 0}, as n × 1 column vectors (n − rank of them; empty for full column rank).

§Examples
use symplex::matrix::ZMatrix;

let a = ZMatrix::from_i64(&[&[2, 4, 6]]).unwrap();
let basis = a.integer_nullspace();
assert_eq!(basis.len(), 2);
for k in &basis {
    assert!((&a * k).is_zero());
}
Source

pub fn is_unimodular(&self) -> bool

Is this a square matrix with det = ±1 (invertible over ℤ)? Non-square matrices give false.

Source

pub fn lattice_determinant(&self) -> Result<BigInt, SymplexError>

Index [ℤᵐ : A·ℤⁿ] of the lattice spanned by the columns (|det A| for a square nonsingular matrix).

§Errors

SymplexError::InvalidArgument if A does not have full row rank (the index would be infinite).

Source§

impl ExactMatrix<BigInt>

Source

pub fn inv_mod(&self, m: &BigInt) -> Result<ZMatrix, SymplexError>

Inverse modulo m: the integer matrix B with entries in [0, m) and A·B ≡ I (mod m), computed as adj(A) · det(A)⁻¹ mod m. SymPy: Matrix.inv_mod(m).

§Errors

SymplexError::InvalidArgument if the matrix is not square, m < 2, or gcd(det A, m) ≠ 1 (which includes every singular matrix).

§Examples
use symplex::matrix::ZMatrix;
use symplex::num_bigint::BigInt;

let a = ZMatrix::from_i64(&[&[1, 2], &[3, 4]]).unwrap();
let b = a.inv_mod(&BigInt::from(5)).unwrap();
assert_eq!(b, ZMatrix::from_i64(&[&[3, 1], &[4, 2]]).unwrap());
// det = −2 shares the factor 2 with the modulus 4.
assert!(a.inv_mod(&BigInt::from(4)).is_err());
Source

pub fn lll_default(&self) -> Result<ZMatrix, SymplexError>

LLL-reduced basis of the lattice spanned by the rows, with the standard Lovász parameter δ = 3/4. See lll.

§Errors

Same as lll.

Source

pub fn lll(&self, delta: (i64, i64)) -> Result<ZMatrix, SymplexError>

Lenstra–Lenstra–Lovász reduction of the lattice basis formed by the rows, with Lovász parameter δ = num/den. SymPy: Matrix.lll(delta).

The Gram–Schmidt data is kept as exact rationals, so the result is exactly LLL-reduced: with μ_ij = ⟨b_i, b*_j⟩ / ⟨b*_j, b*_j⟩, every |μ_ij| ≤ 1/2 (size condition) and ‖b*_k‖² ≥ (δ − μ²_{k,k−1}) ‖b*_{k−1}‖² (Lovász condition). The reduced rows span the same lattice as the input (they differ by a unimodular transform, see lll_with_transform), and the first row is within a factor 2^{(n−1)/2} of a shortest lattice vector. The reduction order and rounding follow SymPy’s DomainMatrix.lll, so the output coincides with SymPy’s for the same input.

§Errors

SymplexError::InvalidArgument if δ is not in the open interval (1/4, 1), or the rows are linearly dependent (this includes having more rows than columns).

§Examples
use symplex::matrix::ZMatrix;

let b = ZMatrix::from_i64(&[&[1, 1, 1], &[-1, 0, 2], &[3, 5, 6]]).unwrap();
let r = b.lll((3, 4)).unwrap();
assert_eq!(r, ZMatrix::from_i64(&[&[0, 1, 0], &[1, 0, 1], &[-1, 0, 2]]).unwrap());
// Same lattice: identical Hermite normal forms.
assert_eq!(r.hermite_normal_form(), b.hermite_normal_form());
assert!(b.lll((1, 4)).is_err());
Source

pub fn lll_with_transform( &self, delta: (i64, i64), ) -> Result<(ZMatrix, ZMatrix), SymplexError>

LLL reduction together with the unimodular transform: (R, T) with R = T·A (det T = ±1). SymPy: Matrix.lll_transform(delta).

§Errors

Same as lll.

§Examples
use symplex::matrix::ZMatrix;

let b = ZMatrix::from_i64(&[&[1, 1, 1], &[-1, 0, 2], &[3, 5, 6]]).unwrap();
let (r, t) = b.lll_with_transform((3, 4)).unwrap();
assert_eq!(&t * &b, r);
assert!(t.is_unimodular());
Source§

impl ExactMatrix<Ratio<BigInt>>

Source

pub fn to_zmatrix(&self) -> Option<ZMatrix>

Convert to a ZMatrix if every entry is an integer.

Source

pub fn is_integer(&self) -> bool

true if every entry is an integer.

Source

pub fn to_matrix(&self, ctx: &Context) -> Matrix

Convert to a symbolic Matrix of rational literals in ctx.

Source

pub fn clear_denominators(&self) -> (ZMatrix, BigInt)

Clear denominators: (Z, s) with Z = s · self integral and s the least common multiple of all denominators.

§Examples
use symplex::matrix::{QMatrix, ZMatrix};
use symplex::linprog::q;
use symplex::num_bigint::BigInt;

let m = QMatrix::new(vec![vec![q(1, 2), q(1, 3)], vec![q(2, 1), q(-1, 6)]]).unwrap();
let (z, s) = m.clear_denominators();
assert_eq!(s, BigInt::from(6));
assert_eq!(z, ZMatrix::from_i64(&[&[3, 2], &[12, -1]]).unwrap());
Source

pub fn rref(&self) -> (QMatrix, Vec<usize>)

Reduced row-echelon form and the pivot columns.

Computed fraction-free (Bareiss Gauss–Jordan on the row-wise integerised matrix); the result is the unique RREF over ℚ.

§Examples
use symplex::matrix::QMatrix;
use symplex::linprog::q;

let a = QMatrix::from_i64(&[&[1, 2, 3], &[4, 5, 6], &[7, 8, 9]]).unwrap();
let (r, pivots) = a.rref();
assert_eq!(pivots, vec![0, 1]);
assert_eq!(r, QMatrix::from_i64(&[&[1, 0, -1], &[0, 1, 2], &[0, 0, 0]]).unwrap());
assert_eq!(QMatrix::from_i64(&[&[2, 4], &[1, 3]]).unwrap().rref().0[(0, 0)], q(1, 1));
Source

pub fn rank(&self) -> usize

Rank.

Source

pub fn nullspace(&self) -> Vec<QMatrix>

Basis of {x : A·x = 0} as n × 1 column vectors (empty for full column rank). Each basis vector has a 1 in one free column and zeros in the other free columns (the standard RREF construction).

§Examples
use symplex::matrix::QMatrix;

let a = QMatrix::from_i64(&[&[1, 2, 3], &[4, 5, 6]]).unwrap();
let ns = a.nullspace();
assert_eq!(ns.len(), 1);
assert!((&a * &ns[0]).is_zero());
Source

pub fn det(&self) -> Result<Q, SymplexError>

Determinant: the rows are scaled to integers, Bareiss’s fraction-free elimination runs over ℤ, and the row scales are divided back out.

§Errors

SymplexError::InvalidArgument if the matrix is not square.

§Examples
use symplex::matrix::QMatrix;
use symplex::linprog::q;

let m = QMatrix::new(vec![vec![q(1, 2), q(1, 3)], vec![q(1, 4), q(1, 5)]]).unwrap();
assert_eq!(m.det().unwrap(), q(1, 60));
Source

pub fn solve(&self, b: &QMatrix) -> Result<QMatrix, SymplexError>

Solve A·X = B for square nonsingular A (B may have several columns).

§Errors
§Examples
use symplex::matrix::QMatrix;
use symplex::linprog::q;

let a = QMatrix::from_i64(&[&[2, 1], &[1, 3]]).unwrap();
let b = QMatrix::from_i64(&[&[1], &[1]]).unwrap();
assert_eq!(a.solve(&b).unwrap().col(0), vec![q(2, 5), q(1, 5)]);
assert!(QMatrix::from_i64(&[&[1, 2], &[2, 4]]).unwrap().solve(&b).is_err());
Source

pub fn inv(&self) -> Result<QMatrix, SymplexError>

Inverse.

§Errors
§Examples
use symplex::matrix::QMatrix;

let a = QMatrix::from_i64(&[&[2, 1], &[1, 1]]).unwrap();
let inv = a.inv().unwrap();
assert!((&a * &inv).is_identity());
Source

pub fn is_symmetric(&self) -> bool

true if self equals its transpose.

Source

pub fn ldl_psd(&self) -> Option<(QMatrix, Vec<Q>)>

Exact L·D·Lᵀ factorisation of a symmetric positive semidefinite matrix: L unit lower triangular, D = diag(d) with every dₖ ≥ 0. Returns None if the matrix is not square, not symmetric, or not PSD — this is an exact PSD test. When a pivot dₖ is zero the remaining entries of its column must vanish (as they do for a PSD matrix), and L’s column is left zero.

§Examples
use symplex::matrix::QMatrix;
use symplex::linprog::{q, qi};

let a = QMatrix::from_i64(&[&[4, 2], &[2, 1]]).unwrap();       // rank 1, PSD
let (l, d) = a.ldl_psd().unwrap();
assert_eq!(d, vec![qi(4), qi(0)]);
assert_eq!(l[(1, 0)], q(1, 2));
assert!(QMatrix::from_i64(&[&[1, 2], &[2, 1]]).unwrap().ldl_psd().is_none());   // indefinite
Source

pub fn is_positive_semidefinite(&self) -> bool

Exact positive-semidefiniteness test (symmetric and every xᵀAx ≥ 0), via ldl_psd.

Source

pub fn columnspace(&self) -> Vec<QMatrix>

Basis of the column space: the pivot columns of self.

Source

pub fn rowspace(&self) -> Vec<QMatrix>

Basis of the row space: the nonzero rows of the RREF.

Source§

impl ExactMatrix<Ratio<BigInt>>

Source

pub fn rank_decomposition(&self) -> Result<(QMatrix, QMatrix), SymplexError>

Full-rank factorisation A = C·F: C (m × r) holds the pivot columns of A, F (r × n) the nonzero rows of rref(A), where r = rank A. SymPy: Matrix.rank_decomposition().

§Errors

SymplexError::ComputationFailed for the zero matrix (rank 0; the factors would have an empty dimension).

§Examples
use symplex::matrix::QMatrix;

let a = QMatrix::from_i64(&[&[1, 2, 3], &[4, 5, 6], &[7, 8, 9]]).unwrap();
let (c, f) = a.rank_decomposition().unwrap();
assert_eq!(c, QMatrix::from_i64(&[&[1, 2], &[4, 5], &[7, 8]]).unwrap());
assert_eq!(f, QMatrix::from_i64(&[&[1, 0, -1], &[0, 1, 2]]).unwrap());
assert_eq!(&c * &f, a);
Source

pub fn pinv(&self) -> Result<QMatrix, SymplexError>

Moore–Penrose pseudo-inverse A⁺ (n × m), exact for any rank. SymPy: Matrix.pinv().

Uses the full-rank factorisation A = C·F of rank_decomposition: A⁺ = Fᵀ (F Fᵀ)⁻¹ (Cᵀ C)⁻¹ Cᵀ. The zero matrix maps to the zero n × m matrix.

§Errors

SymplexError::ComputationFailed only if an internal invariant is violated (CᵀC and FFᵀ are invertible by construction).

§Examples
use symplex::matrix::QMatrix;
use symplex::linprog::q;

let a = QMatrix::from_i64(&[&[1, 2], &[2, 4]]).unwrap();   // rank 1
let p = a.pinv().unwrap();
assert_eq!(p[(0, 0)], q(1, 25));
assert_eq!(p[(1, 1)], q(4, 25));
assert_eq!(&(&a * &p) * &a, a);    // A A⁺ A = A
Source

pub fn hessenberg(&self) -> Result<(QMatrix, QMatrix), SymplexError>

Upper Hessenberg form by Gaussian similarity transforms: (H, P) with H = P⁻¹ A P and h_ij = 0 for i > j + 1. SymPy: Matrix.upper_hessenberg_decomposition() (which uses Householder reflections and therefore radicals; this variant stays in ℚ).

Column k is cleared below the sub-diagonal with the first nonzero candidate as pivot (a symmetric row/column swap when it is not already in row k + 1), followed by the row operations row_j −= f·row_{k+1} and the compensating column operations col_{k+1} += f·col_j.

§Errors

SymplexError::InvalidArgument if the matrix is not square.

§Examples
use symplex::matrix::QMatrix;
use symplex::linprog::q;

let a = QMatrix::from_i64(&[&[1, 2, 3], &[4, 5, 6], &[7, 8, 10]]).unwrap();
let (h, p) = a.hessenberg().unwrap();
assert_eq!(h[(2, 0)], q(0, 1));
assert_eq!(&a * &p, &p * &h);          // A P = P H
assert_eq!(p.inv().unwrap() * &a * &p, h);

Trait Implementations§

Source§

impl<T: ExactScalar> Add for ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: ExactMatrix<T>) -> ExactMatrix<T>

Performs the + operation. Read more
Source§

impl<T: ExactScalar> Add<&ExactMatrix<T>> for &ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &ExactMatrix<T>) -> ExactMatrix<T>

Performs the + operation. Read more
Source§

impl<T: ExactScalar> Add<&ExactMatrix<T>> for ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &ExactMatrix<T>) -> ExactMatrix<T>

Performs the + operation. Read more
Source§

impl<T: ExactScalar> Add<ExactMatrix<T>> for &ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: ExactMatrix<T>) -> ExactMatrix<T>

Performs the + operation. Read more
Source§

impl<T: Clone + ExactScalar> Clone for ExactMatrix<T>

Source§

fn clone(&self) -> ExactMatrix<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: ExactScalar> Debug for ExactMatrix<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

QMatrix(2×2, [[1/2, 3], [0, 1]]).

Source§

impl<T: ExactScalar> Display for ExactMatrix<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Same layout as Matrix: single rows inline as [[a, b]], larger matrices one row per line with right-aligned columns.

Source§

impl<T: Eq + ExactScalar> Eq for ExactMatrix<T>

Source§

impl From<&ExactMatrix<BigInt>> for QMatrix

Source§

fn from(z: &ZMatrix) -> Self

Converts to this type from the input type.
Source§

impl From<ExactMatrix<BigInt>> for QMatrix

Source§

fn from(z: ZMatrix) -> Self

Converts to this type from the input type.
Source§

impl<T: Hash + ExactScalar> Hash for ExactMatrix<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: ExactScalar> Index<(usize, usize)> for ExactMatrix<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, (i, j): (usize, usize)) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<T: ExactScalar> IndexMut<(usize, usize)> for ExactMatrix<T>

Source§

fn index_mut(&mut self, (i, j): (usize, usize)) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T: ExactScalar> Mul for ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: ExactMatrix<T>) -> ExactMatrix<T>

Performs the * operation. Read more
Source§

impl<T: ExactScalar> Mul<&ExactMatrix<T>> for &ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &ExactMatrix<T>) -> ExactMatrix<T>

Performs the * operation. Read more
Source§

impl<T: ExactScalar> Mul<&ExactMatrix<T>> for ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &ExactMatrix<T>) -> ExactMatrix<T>

Performs the * operation. Read more
Source§

impl<T: ExactScalar> Mul<&T> for &ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the * operator.
Source§

fn mul(self, k: &T) -> ExactMatrix<T>

Performs the * operation. Read more
Source§

impl<T: ExactScalar> Mul<ExactMatrix<T>> for &ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: ExactMatrix<T>) -> ExactMatrix<T>

Performs the * operation. Read more
Source§

impl<T: ExactScalar> Neg for &ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> ExactMatrix<T>

Performs the unary - operation. Read more
Source§

impl<T: ExactScalar> Neg for ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> ExactMatrix<T>

Performs the unary - operation. Read more
Source§

impl<T: PartialEq + ExactScalar> PartialEq for ExactMatrix<T>

Source§

fn eq(&self, other: &ExactMatrix<T>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: PartialEq + ExactScalar> StructuralPartialEq for ExactMatrix<T>

Source§

impl<T: ExactScalar> Sub for ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: ExactMatrix<T>) -> ExactMatrix<T>

Performs the - operation. Read more
Source§

impl<T: ExactScalar> Sub<&ExactMatrix<T>> for &ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &ExactMatrix<T>) -> ExactMatrix<T>

Performs the - operation. Read more
Source§

impl<T: ExactScalar> Sub<&ExactMatrix<T>> for ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &ExactMatrix<T>) -> ExactMatrix<T>

Performs the - operation. Read more
Source§

impl<T: ExactScalar> Sub<ExactMatrix<T>> for &ExactMatrix<T>

Source§

type Output = ExactMatrix<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: ExactMatrix<T>) -> ExactMatrix<T>

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<T> Freeze for ExactMatrix<T>
where Vec<T>: Freeze,

§

impl<T> RefUnwindSafe for ExactMatrix<T>
where Vec<T>: RefUnwindSafe,

§

impl<T> Send for ExactMatrix<T>
where Vec<T>: Send,

§

impl<T> Sync for ExactMatrix<T>
where Vec<T>: Sync,

§

impl<T> Unpin for ExactMatrix<T>
where Vec<T>: Unpin,

§

impl<T> UnsafeUnpin for ExactMatrix<T>
where Vec<T>: UnsafeUnpin,

§

impl<T> UnwindSafe for ExactMatrix<T>
where Vec<T>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more