/// <summary> /// Create a GPUBruteForce Matcher using the specific distance type /// </summary> /// <param name="distanceType">The distance type</param> public GpuBruteForceMatcher(DistanceType distanceType) { if (distanceType == DistanceType.Hamming) { if (typeof(T) != typeof(byte)) { throw new ArgumentException("Hamming distance type requires model descriptor to be Matrix<Byte>"); } } if (typeof(T) != typeof(byte) && typeof(T) != typeof(float)) { throw new NotImplementedException(String.Format("Data type of {0} is not supported", typeof(T).ToString())); } switch (distanceType) { case (DistanceType.Hamming): _distanceType = GpuMatcherDistanceType.HammingDist; break; case (DistanceType.L1): _distanceType = GpuMatcherDistanceType.L1Dist; break; case (DistanceType.L2): _distanceType = GpuMatcherDistanceType.L2Dist; break; default: throw new NotImplementedException(String.Format("Distance type of {0} is not implemented in GPU.", distanceType.ToString())); } _ptr = GpuInvoke.gpuBruteForceMatcherCreate(_distanceType); }