예제 #1
0
        private void btnMatrix_Click(object sender, EventArgs e)
        {
            MM2.MyMath2Client mmc = new MM2.MyMath2Client(); // proxy
            MM2.Matrix        A   = mmc.InitMatrix(2, 2);
            A.Data[0][0] = 5; A.Data[0][1] = 7; A.Data[1][0] = 3; A.Data[1][1] = 4;
            MM2.Matrix B = mmc.InitMatrix(2, 2);
            B.Data[0][0] = 3; B.Data[0][1] = 5; B.Data[1][0] = 1; B.Data[1][1] = 6;
            MM2.Matrix C    = mmc.MultiplyMatrix(A, B);
            string     out1 = "";

            for (int i = 0; i < C.Rows; i++)
            {
                for (int j = 0; j < C.Cols; j++)
                {
                    out1 += "C[" + i.ToString() + "][" + j.ToString() + "]=" +
                            C.Data[i][j].ToString() + " ";
                }
                out1 += "\n";
            }
            MessageBox.Show(out1);
        }
예제 #2
0
        private void voBtnMatMult_Click(object sender, EventArgs e)
        {
            MM2.MyMath2Client mmc = new MM2.MyMath2Client( );
            MM2.Matrix        A   = mmc.InitMatrix(2, 2);
            MM2.Matrix        B   = mmc.InitMatrix(2, 2);
            MM2.Matrix        C;
            string            koOut = "";

            A.Data[0][0] = 5; A.Data[0][1] = 7; A.Data[1][0] = 3; A.Data[1][1] = 4;
            B.Data[0][0] = 3; B.Data[0][1] = 5; B.Data[1][0] = 1; B.Data[1][1] = 6;
            C            = mmc.MultiplyMatrix(A, B);
            for (int i = 0; i < C.Rows; i++)
            {
                for (int j = 0; j < C.Cols; j++)
                {
                    koOut += "C[" + i.ToString( ) + "][" + j.ToString( ) + "]=";
                    koOut += C.Data[i][j].ToString( ) + " ";
                }
                koOut += Environment.NewLine;
            }
            MessageBox.Show(koOut);
        }