Skip to main content

Module utils

Module utils 

Source
Expand description

Utility functions for matrix printing, shape retrieval, identity generation, Kronecker product, trace, transpose operations, …

This module contains small user-facing utilities, plus hidden unstable helpers used by backend implementation crates. It is not meant to be a complete collection of linear algebra utilities at this time.

Functions§

diag
Creates a diagonal matrix from a 1D slice, placing its elements on the main diagonal.
identity
Creates an identity matrix of size n x n.
identity_k
Creates a diagonal matrix of size n x n with ones on a specified diagonal.
kron
Computes the Kronecker product of two 2D tensors.
pretty_print
Displays a numeric mdarray in a human-readable format (NumPy-style)
trace
Computes the trace of a square matrix (sum of diagonal elements).
unravel_index
Converts a flat index to multidimensional coordinates.