Merge "Fix direction of matrix inversion" into sc-v2-dev