Exemplo n.º 1
0
            public override VectorBase Add(VectorBase other)
            {
                if (other.Length != this.Length)
                {
                    throw new ArgumentException("Adding vectors of unequal length.");
                }

                if (other is ZeroVector)
                {
                    return(this);
                }

                if (other is BasisVector)
                {
                    return(other.Add(this));
                }


                double[] result = new double[Length];

                for (int i = 0; i < Length; i++)
                {
                    result[i] = this[i] + other[i];
                }
                return(new FullVector(result));
            }
Exemplo n.º 2
0
 public void Add(Vector other)
 {
     _vector = _vector.Add(other._vector);
 }