generize orthonormal_constraints helper function