Example #1
0
 public static LTMatrix operator+(LTMatrix lt1, LTMatrix lt2)
 {
     if (lt1.Size() != lt2.Size())
     {
         throw new Exception("cannot add different sized matrices");
     }
     else
     {
         LTMatrix result = new LTMatrix(lt1.Size());
         for (int i = 0; i < lt1.Size(); i++)
         {
             for (int j = 0; j < lt1.Size(); j++)
             {
                 int value = lt1.Get(i, j) + lt2.Get(i, j);
                 result.Set(i, j, value);
             }
         }
         return(result);
     }
 }