public bool DoSerializing(string path,TwoDimentionsMatrixHolder mtrHolder)
        {
            bool res = false;

            using (FileStream fs = new FileStream(path,FileMode.OpenOrCreate))
            {
                formatter.Serialize(fs, mtrHolder);
                res = true;
            }

            return res;
        }
Exemple #2
0
 static void Main(string[] args)
 {
     TwoDimentionsMatrixHolder m1 = new TwoDimentionsMatrixHolder(2,3);
     m1.SetMember(0, 0, 1);
     m1.SetMember(0, 1, 2);
     m1.SetMember(0, 2, 7);
     m1.SetMember(1, 0, -8);
     m1.SetMember(1, 1, 7);
     m1.SetMember(1, 2, 9);
     TwoDimentionsMatrixHolder m2 = new TwoDimentionsMatrixHolder(2,3);
     m2.SetMember(0, 0, 7);
     m2.SetMember(0, 1, -6);
     m2.SetMember(0, 2, 2);
     m2.SetMember(1, 0, 8);
     m2.SetMember(1, 1, 65);
     m2.SetMember(1, 2, 8);
     TwoDimentionsMatrixHolder m3 = m1 + m2;
     Console.WriteLine(m3.TwoDimentionsMatrixToString());
     TwoDimentionsMatrixHolder t3 = new TwoDimentionsMatrixHolder(5, 5);
     TwoDimentionsMatrixHolder t4 = new TwoDimentionsMatrixHolder(new double[10,10]);
     t4[-7, -7] = 25;
     Console.ReadKey();
 }
        public static TwoDimentionsMatrixHolder operator *(TwoDimentionsMatrixHolder matr1, TwoDimentionsMatrixHolder matr2)
        {
            TwoDimentionsMatrixHolder resultMatr = null;
            bool testf = true;

            if (matr1.GetColumnsCount != matr2.GetRowsCount)
                testf = false;
            if (matr1 == null || matr2 == null)
                testf = false;
            if (testf)
            {
                resultMatr = new TwoDimentionsMatrixHolder(matr1.GetRowsCount, matr1.GetColumnsCount);
                for (uint i = 0; i < matr1.GetRowsCount; i++)
                {
                    for (uint j = 0; j < matr1.GetColumnsCount; j++)
                    {
                        resultMatr.SetMember(i, j, matr1.GetMember(i, j) * matr2.GetMember(j, i));
                    }
                }
            }

            return resultMatr;
        }
        public TwoDimentionsMatrixHolder CloneMarix()
        {
            double[,] mtrxArr = this.GetWholeMatrix();
            TwoDimentionsMatrixHolder resMtrx = new TwoDimentionsMatrixHolder(mtrxArr);

            return resMtrx;
        }