Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 4
0
 public void Add(Base newBase)
 {
     list.Add(newBase);
 }
Exemplo n.º 5
0
 public static Base Sub(Base first, Base second)
 {
     return first.Sub(second);
 }
Exemplo n.º 6
0
 public static int Scalar(Base first, Base second)
 {
     return first.Scalar(second);
 }
Exemplo n.º 7
0
 public static Base Mult(Base first, int number)
 {
     return first.Mult(number);
 }
Exemplo n.º 8
0
 public static Base Mult(Base first, Base second)
 {
     return first.Mult(second);
 }
Exemplo n.º 9
0
 public static int Evkl(Base first)
 {
     return first.Evkl();
 }
Exemplo n.º 10
0
 public static Base Add(Base first, Base second)
 {
     return first.Add(second);
 }
Exemplo n.º 11
0
 public abstract Base Mult(Base newBase);
Exemplo n.º 12
0
 public abstract Base Combine(Base newBase);
Exemplo n.º 13
0
 public abstract Base Add(Base newBase);
Exemplo n.º 14
0
 public abstract Base Sub(Base newBase);
Exemplo n.º 15
0
 public abstract int Scalar(Base newBase);
Exemplo n.º 16
0
 public override int Scalar(Base newBase)
 {
     Console.WriteLine("OPERATION NOT SUPPORTED");
     return 0;
 }
Exemplo n.º 17
0
 public static Base Combine(Base first, Base second)
 {
     return first.Combine(second);
 }
Exemplo n.º 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;
 }