Example #1
0
 public double NormalizedProduct(IntVector otherIntVector)
 {
     if (this.Count() != otherIntVector.Count())
     {
         throw new ArgumentException("vectors need to have equal elements!");
     }
     if (!this.Any()) return 0;
     var dotProduct = this.DotProduct(otherIntVector);
     var magnitudeProduct = this.Magnitude() * otherIntVector.Magnitude();
     if (magnitudeProduct == 0) return 0;
     return (double)dotProduct / magnitudeProduct;
 }