Expand description
Dense row-major matrix type and utility functions.
Matrix<T> is a simple dense 2D matrix in row-major layout, indexed
by m[[row, col]]. It is used throughout the TCI infrastructure for
pivot block computations, cross interpolation factors, and dense
submatrix extraction.
§Examples
use tensor4all_tcicore::{Matrix, from_vec2d, matrix};
let m = from_vec2d(vec![
vec![1.0_f64, 2.0],
vec![3.0, 4.0],
]);
assert_eq!(m.nrows(), 2);
assert_eq!(m.ncols(), 2);
assert_eq!(m[[0, 1]], 2.0);
assert_eq!(m[[1, 0]], 3.0);Structs§
- Matrix
- A dense 2D matrix in row-major layout.
Traits§
- BlasMul
- BLAS-backed matrix multiplication dispatch.
Functions§
- a_
inv_ times_ b - Calculates A^{-1} * B using Gaussian elimination.
- a_
times_ b_ inv - Calculates A * B^{-1} using Gaussian elimination.
- append_
col - Append a column to the right of a matrix.
- append_
row - Append a row to the bottom of a matrix.
- dot
- Dot product of two vectors.
- eye
- Create an
n x nidentity matrix. - from_
vec2d - Create a matrix from a 2D vector (row-major).
- get_col
- Get a column as a vector.
- get_row
- Get a row as a vector.
- mat_mul
- Matrix multiplication: A * B.
- ncols
- Get number of columns.
- nrows
- Get number of rows.
- random_
subset - Select a random subset of up to
nelements from a slice. - set_
diff - Set difference: elements in
setthat are not inexclude. - submatrix
- Get a submatrix by selecting specific rows and columns.
- submatrix_
argmax - Find the position and value of the maximum absolute value in a submatrix.
- swap_
cols - Swap two columns in a matrix in-place.
- swap_
rows - Swap two rows in a matrix in-place.
- transpose
- Transpose the matrix.
- zeros
- Create a zeros matrix with given dimensions.