/// <summary> /// Pointwise multiplies this vector with another vector and stores the result into the result vector. /// </summary> /// <param name="other">The vector to pointwise multiply with this one.</param> /// <param name="result">The vector to store the result of the pointwise multiplication.</param> /// <exception cref="ArgumentNullException">If the other vector is <see langword="null" />.</exception> /// <exception cref="ArgumentNullException">If the result vector is <see langword="null" />.</exception> /// <exception cref="ArgumentException">If this vector and <paramref name="other"/> are not the same size.</exception> /// <exception cref="ArgumentException">If this vector and <paramref name="result"/> are not the same size.</exception> public override void PointWiseMultiply(Vector other, Vector result) { if (result == null) { throw new ArgumentNullException("result"); } if (other == null) { throw new ArgumentNullException("other"); } if (this.Count != other.Count) { throw new ArgumentException(Resources.ArgumentVectorsSameLength, "other"); } if (this.Count != result.Count) { throw new ArgumentException(Resources.ArgumentVectorsSameLength, "result"); } if (ReferenceEquals(this, result) || ReferenceEquals(other, result)) { var tmp = result.CreateVector(result.Count); this.PointWiseMultiply(other, tmp); tmp.CopyTo(result); } else { this.CopyTo(result); result.PointWiseMultiply(other); } }