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; } }
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; } }
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; } }
public void Add(Base newBase) { list.Add(newBase); }
public static Base Sub(Base first, Base second) { return first.Sub(second); }
public static int Scalar(Base first, Base second) { return first.Scalar(second); }
public static Base Mult(Base first, int number) { return first.Mult(number); }
public static Base Mult(Base first, Base second) { return first.Mult(second); }
public static int Evkl(Base first) { return first.Evkl(); }
public static Base Add(Base first, Base second) { return first.Add(second); }
public abstract Base Mult(Base newBase);
public abstract Base Combine(Base newBase);
public abstract Base Add(Base newBase);
public abstract Base Sub(Base newBase);
public abstract int Scalar(Base newBase);
public override int Scalar(Base newBase) { Console.WriteLine("OPERATION NOT SUPPORTED"); return 0; }
public static Base Combine(Base first, Base second) { return first.Combine(second); }
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; }