Пример #1
0
        public bool Equals(CoolMatrix coolMatrix)
        {
            if ((object)coolMatrix == null)
            {
                return false;
            }

            if (ReferenceEquals(this, coolMatrix))
                return true;

            for (int i = 0; i < Size.Wight; i++)
            {
                for (int j = 0; j < Size.Height; j++)
                {
                    if (this[i, j] != coolMatrix[i, j])
                        return false;
                }
            }
            return true;
        }
Пример #2
0
 // Overloading '+' operator:
 public static CoolMatrix operator +(CoolMatrix one, CoolMatrix two)
 {
     CoolMatrix rez = new CoolMatrix(one.arr);
     if ((one.Size.Wight != two.Size.Wight) || (one.Size.Height != two.Size.Height))
     {
         throw new ArgumentException();
     }
     for (int i = 0; i < one.Size.Height; i++)
         for (int j = 0; j < one.Size.Wight; j++)
             rez[i, j] = one[i, j] + two[i, j];
     return rez;
 }