7

Why does the System.Numerics namespace define types Matrix3x2 and Matrix4x4 but not offer 2x2 or 3x3 matrices? These would be at least as useful.

Colonel Panic
  • 132,665
  • 89
  • 401
  • 465
  • I think 3x2 and 4x4 matrices frequently arise in graphics programming contexts. Certainly, many of the methods on those types imply that their use-cases are predominantly coordinate transformations. – Damien_The_Unbeliever Feb 01 '16 at 14:24
  • Because SIMD/SSE according to the [changelog](https://msdn.microsoft.com/en-us/library/ms171868(v=vs.110).aspx), but I don't know whether that's a valid excuse (e.g. perhaps there's CPU support for differently-sizes matrices, no idea). – CodeCaster Feb 01 '16 at 14:28
  • 3
    They come from the Win2D library, micro-optimized to try to take advantage of SIMD. Blog post [is here](http://blogs.msdn.com/b/win2d/archive/2015/06/02/winrt-vector-and-matrix-types-in-windows-10.aspx). – Hans Passant Feb 01 '16 at 15:31

1 Answers1

6

(Disclaimer: I work on the System.Numerics libraries at Microsoft)

The comments above are correct. We support a few fixed-size types because they are very commonly used in 2D and 3D graphics applications, for interoperation with core Windows numerics types, as well as for libraries like Win2D.

In the near future, it is likely that we will focus on improving the current types in the library (by adding more and better SIMD code generation capabilities) before we add any new types to the library.

Eric Mellino
  • 722
  • 5
  • 7