Provide DiagonalMatrix Product and Initializers

What does this implement/fix?

This includes two tiny additions to DiagonalMatrix: 1. diag*diag products and 2. static initializers for zero and identity.

// dumb example
DiagType m = ...;
DiagType n = ...;
DiagType B = (m * n) + 2 * DiagType::Identity();

Additional information

These are just things I've tried before and sort of assumed would work. Just for convenience, so nbd if stuff like this isn't desired!
I'm guessing DiagonalMatrix is meant to be lightweight since most stuff is pretty easy to do with vector ops on .diagonal()? Maybe there could be other methods for stuff like operatorNorm, determinant, etc as well that have simple, but not totally obvious, implementations for diagonal matrices 🤷

Merge request reports

Loading