Exemple #1
0
        static public StringVector4 Mult(StringMatrix l, StringVector4 r)
        {
            StringVector4 res = new StringVector4();

            for (int i = 0; i < 4; i++)
            {
                int    left     = i * 4;
                string equation = "";
                for (int j = 0; j < 4; j++)
                {
                    var    a = l.Element[left + j];
                    var    b = r.Element[i];
                    string m = Mult(a, b);
                    equation = equation.AppendPrePad(m, " + ");
                }

                equation       = equation != "" ? equation : "0";
                res.Element[i] = equation;
            }
            return(res);
        }
Exemple #2
0
        static public StringMatrix Mult(StringMatrix l, StringMatrix r)
        {
            StringMatrix res = new StringMatrix();

            for (int i = 0; i < 16; i++)
            {
                int    left     = (i / 4) * 4;
                int    right    = i % 4;
                string equation = "";
                for (int j = 0; j < 4; j++)
                {
                    var    a = l.Element[left + j];
                    var    b = r.Element[right + j * 4];
                    string m = Mult(a, b);
                    equation = equation.AppendPrePad(m, " + ");
                }

                equation = equation != "" ? equation : "0";

                res.Element[i] = equation;
            }
            return(res);
        }