Asked by:
System.Numerics: A possibly wrong implementation of Matrix3x2 Multiply method in Matrix3x2 class
Question

Hello.
Working with namespace System.Numerics I found that a method Matrix3x2.Multiply exist in the Matrix3x2 Structure, that seems to implement an unknown matrix multiplication method. In order for two matrices to be able to multiply, by definition, we need to ensure that in the A.B product, the number of columns of A is equal to the number of rows of B. This is how matrix multiplication is defined in linear algebra and everywhere else in Physics and Engineering. Please explain the purpose of this Multiply method which is the first time I see. Thank you.
John Piliounis, BSc/MScPhysics, MScECE
Tuesday, October 16, 2018 3:31 PM
All replies

The implementation of such multiplication can be found here:
 https://referencesource.microsoft.com/#System.Numerics/System/Numerics/Matrix3x2.cs,8b8d67bb6823c1b6
Seems that a Matrix3x2 is a part of a 3x3 matrix, where the last column is always 0, 0, 1 and is not kept. (See the Matrix class too).
 Edited by Viorel_MVP Tuesday, October 16, 2018 9:01 PM
Tuesday, October 16, 2018 9:01 PM 
That is exactly what I'm saying Viorel. That is the link I'm referring to @ my post, but still, in Math nothing is implied but has to be explicitly declared. Otherwise is not valid. That Matrix3x2 multiplication is a completely wrong implementation and I hope NuGet/Microsoft will take it out. It is and it can be very confusing and misleading for programmers with low exposure in mathematics and may result in dangerous implementations.
John
Wednesday, October 17, 2018 9:58 AM 
Bug reports against .NET should be reported to either the GitHub repo where it resides or directly to MS via Developer Community. In most cases in the documentation there should be a link at the bottom that allows you to provide product feedback.
For documentation issues all the docs pages now have the ability to directly report issues which the doc team can then address.
Michael Taylor http://www.michaeltaylorp3.net
Wednesday, October 17, 2018 2:00 PM 
What's needed here is not code fixes, but clarifications in the documentation. Matrix3x2 is not intended to be a generalpurpose matrix class. As Viorel said, it is a 3x2 view of a 3x3 matrix. This is used for the very specific purpose of doing 2D graphics transformations. The concepts and the operations here are extremely common in 2D graphics work, and people expect it to work exactly as it does here. If you have a scaling matrix and a transform matrix, you combine them by assuming that hidden third row and doing a 3x3 matrix multiply.
The concepts here back many decades. Postscript, developed in 1980, specifies its scaling, rotation, and transform matrices in exactly this way: [1 0 0 1 0 0] with an assumed third column.
Tim Roberts  Driver MVP Emeritus  Providenza & Boekelheide, Inc.
Wednesday, October 17, 2018 6:58 PM