简体   繁体   English

C#矩阵乘法库

[英]C# Matrix Multiplication Library

I am trying to multiply 2 matrices. 我正在尝试将2个矩阵相乘。 I am using System.Windows.Media , but I am still getting the red squigglies under Matrix. 我正在using System.Windows.Media ,但仍在Matrix下出现红色的弯曲。 I can tell that using System.Windows.Media is registering, because it wants me to decide if I want to use System.Windows.Media or System.Drawing for my Color s. 我可以告诉我正在using System.Windows.Media进行注册,因为它需要我决定是否要为Color使用System.Windows.MediaSystem.Drawing Here is my code: 这是我的代码:

        Matrix matrix1 = new Matrix(5, 10, 15, 20, 25, 30);
        Matrix matrix2 = new Matrix(2, 4, 6, 8, 10, 12);

        // matrixResult is equal to (70,100,150,220,240,352) 
        Matrix matrixResult = Matrix.Multiply(matrix1, matrix2);

        // matrixResult2 is also 
        // equal to (70,100,150,220,240,352) 
        Matrix matrixResult2 = matrix1 * matrix2;

Any suggestions why the code is not picking up on using System.Windows.Media ? 有什么建议为什么using System.Windows.Media不能使代码正确? I have added the PresentationCore reference already. 我已经添加了PresentationCore参考。

try putting this at the top of your .cs: 尝试将其放在.cs的顶部:

using Matrix = System.Windows.Media.Matrix;

This is probably occurring because you have System.Windows.Media as well as System.Drawing in your imports 这可能是因为您的导入中包含System.Windows.Media以及System.Drawing

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM