pub fn qr_decomposition_tensor<T, S, I>(
tensor: I,
) -> Option<QRDecompositionTensor<T>>Expand description
Computes a QR decomposition of a MxN matrix where M >= N.
For an input matrix A, decomposes this matrix into a product of QR, where Q is an orthogonal matrix and R is an upper triangular matrix (all entries below the diagonal are 0), and QR = A.
The first dimension in the Tensor’s shape will be taken as the rows of the matrix, and the second dimension as the columns. If you instead have columns and then rows for the Tensor’s shape, you should reorder the Tensor before calling this function to get the appropriate matrix.
If the input matrix has more columns than rows, returns None.
The shape of R will be the same as the input, and the shape of Q will be of lengths MxM in relation to the MxN input matrix with the same dimension names as the input. Hence, QR yields the same shape as the input.
§Warning
With some uses of this function the Rust compiler gets confused about what type T
should be and you will get the error:
overflow evaluating the requirement
&'a _: easy_ml::numeric::RealByValue<_, _>
In this case you need to manually specify the type of T by using the
turbofish syntax like:
linear_algebra::qr_decomposition_tensor::<f32, _, _>(&tensor)