Skip to content

Update SVD Module with Options template parameter

Reference issue

Take 2 of !658 (merged). This MR is a less devastating API break 😅
Updated following discussion in !750 (closed).

What does this implement/fix?

This makes several API breaking changes to the SVD module. However, it stays compatible with the most common use of the old API.

  1. Adds the Options template parameter to the SVD module: JacobiSVD<MatrixType, ComputeThinU | ComputeThinV> svd(m);
    • This "improved" API allows computing thin unitaries of fixed-size matrices, which is not possible at the moment.
  2. "Deprecates" the constructor taking computation options: SvdType svd(m, ComputeThinU); to stay compatible with the old version.
  3. Disallows using both the Options template parameter and deprecated constructor at the same time.
    • This is so it can use a static assert to fail early, rather than failing at runtime or silently preferring one setting over the other.
    • I.e., doing JacobiSVD<MatrixType, Options> svd(m, options); raises a static assert.
  4. Removes the overload of compute that could change the computation options: svd.compute(m2, newOptions);

The plugin methods are essentially in the same situation as the constructor. Can use either

  • m.template jacobiSvd<Options>();
  • m.jacobiSvd(options);

Additional information

Worked on this very sporadically, but the majority of this should be essentially the same as the original MR.

Edited by Arthur

Merge request reports

Loading