示例#1
0
        public float CosineDistance(IVector vector)
        {
            Debug.Assert(IsValid && vector.IsValid);
            var other = (GpuVector)vector;

            Debug.Assert(other.Count == Count);

            return(_cuda.CosineDistance(_data, other._data, Count));
            //var ab = DotProduct(other);
            //var a2 = DotProduct(this);
            //var b2 = other.DotProduct(other);
            //return (float)(1d - (ab / (Math.Sqrt(a2 * b2))));
        }