pytc.solver.bug_core.orth_directions¶
- pytc.solver.bug_core.orth_directions(W, rel_tol=1e-10, *, donate=False)[source]¶
Rank-revealing QR of projected directions, optionally consuming
W.The RPA iteration never reads the residual block after this call. Donating it lets XLA reuse that device buffer for the equally shaped Q factor rather than holding both multi-GB arrays through the factorization.
Pivoting the full tall matrix serializes column-norm updates and is slow. First reduce
W = Q Rwith the accelerator’s unpivoted tall QR, then pivot only the small squareR. Orthogonality of Q makes the second factorization rank-equivalent to pivoting W itself. When every direction survives (the common case), Q already spans the required subspace and no large post-rotation is needed.