Function opensn::OrthogonalizeMatrixSpan(const std::vector<std::vector<double>>&, const std::vector<double>&)

Function Documentation

std::vector<std::vector<double>> opensn::OrthogonalizeMatrixSpan(const std::vector<std::vector<double>> &matrix, const std::vector<double> &weights)

Orthogonalize the columns of a matrix under a weighted inner product.

Applies double-pass modified Gram-Schmidt and normalizes each column so that \(\langle q_i, q_j \rangle_w = \delta_{ij}\). Columns whose weighted norm falls below 1e-14 are left as zero vectors (linearly dependent directions).

Throws:

std::runtime_error – if the matrix is empty or has inconsistent row sizes.