Пример #1
0
 public override Base Add(Base newBase)
 {
     try {
         string resultName = string.Format("{0}+{1}", this.Name, newBase.Name);
         int size = this.VectorArray.Length;
         int[] resultArray = new int[size];
         for (int i = 0; i < size; i++)
         {
             resultArray[i] = this[i] + newBase[i];
         }
         Log.ToLog(DateTime.Now.ToString(), "vector +", "success");
         return new Vector(resultName, resultArray);
     }
     catch(Exception e)
     {
         Log.ToLog(DateTime.Now.ToString(), "vector +", "failed");
         Console.Write(e.ToString());
         return null;
     }
 }
Пример #2
0
 public override Base Combine(Base newBase)
 {
     try {
         string ResultName = string.Format("{0}*{1}", this.Name, newBase.Name);
         int size = this.VectorArray.Length;
         int[] resultArray = new int[size];
         for (int i = 0; i < size; i++)
         {
             for (int j = 0; j < size; j++)
                 resultArray[i] += this[i] * newBase[i, j];
         }
         Log.ToLog(DateTime.Now.ToString(), "vector * matrix", "success");
         return new Vector(ResultName, resultArray);
     }
     catch (Exception e)
     {
         Log.ToLog(DateTime.Now.ToString(), "vector * matrix", "failed");
         Console.Write(e.ToString());
         return null;
     }
 }
Пример #3
0
 public override Base Add(Base newBase)
 {
     try {
         string resultName = string.Format("{0}+{1}", this.Name, newBase.Name);
         int size = (int)Math.Sqrt(this.MatrixArray.Length);
         int[,] resultArray = new int[size, size];
         for (int i = 0; i < size; i++)
         {
             for (int j = 0; j < size; j++)
                 resultArray[i, j] = this[i, j] + newBase[i, j];
         }
         Log.ToLog(DateTime.Now.ToString(), "matrix +", "success");
         return new Matrix(resultName, resultArray);
     }
     catch (Exception e)
     {
         Log.ToLog(DateTime.Now.ToString(), "matrix +", "failed");
         Console.Write(e.ToString());
         return null;
     }
 }
Пример #4
0
 public void Add(Base newBase)
 {
     list.Add(newBase);
 }
Пример #5
0
 public static Base Sub(Base first, Base second)
 {
     return first.Sub(second);
 }
Пример #6
0
 public static int Scalar(Base first, Base second)
 {
     return first.Scalar(second);
 }
Пример #7
0
 public static Base Mult(Base first, int number)
 {
     return first.Mult(number);
 }
Пример #8
0
 public static Base Mult(Base first, Base second)
 {
     return first.Mult(second);
 }
Пример #9
0
 public static int Evkl(Base first)
 {
     return first.Evkl();
 }
Пример #10
0
 public static Base Add(Base first, Base second)
 {
     return first.Add(second);
 }
Пример #11
0
 public abstract Base Mult(Base newBase);
Пример #12
0
 public abstract Base Combine(Base newBase);
Пример #13
0
 public abstract Base Add(Base newBase);
Пример #14
0
 public abstract Base Sub(Base newBase);
Пример #15
0
 public abstract int Scalar(Base newBase);
Пример #16
0
 public override int Scalar(Base newBase)
 {
     Console.WriteLine("OPERATION NOT SUPPORTED");
     return 0;
 }
Пример #17
0
 public static Base Combine(Base first, Base second)
 {
     return first.Combine(second);
 }
Пример #18
0
 public override int Scalar(Base newBase)
 {
     int scalar = 0;
     for (int i = 0; i < this.VectorArray.Length; i++)
     {
         scalar += this[i] * newBase[i];
     }
     Log.ToLog(DateTime.Now.ToString(), "vector scalar", "success");
     return scalar;
 }