Force diagonal elements of a triangular matrix to be positive
Force diagonal elements of a triangular matrix to be positive
This function ensures that the triangular matrix in a QR (or other) decomposition has positive values along its diagonal.
force_posiDiag(x)
Arguments
x: A matrix, which must be either upper-triangular or lower-triangular.
Returns
An upper or lower triangular matrix with positive diagonal entries such that the matrix is still a valid decomposition of the matrix the input x is a decomposition of.