     return dtype_dispatcher(dtype_id, op, idx_start, keys_start, k, n, stream, memory);
 }
 
+
 /* -------- argsort -------- */
 void cupy::thrust::thrust_argsort(int dtype_id, size_t *idx_start, void *data_start,
     void *keys_start, const std::vector<ptrdiff_t>& shape, intptr_t stream, void *memory) {


// specialize thrust::less for __half
template <>
__host__ __device__ __forceinline__ bool less<__half>::operator() (const __half& lhs, const __half& rhs) const {
    return _real_less<__half>(lhs, rhs);
}

// specialize thrust::less for tuple<size_t, __half>
template <>
__host__ __device__ __forceinline__ bool less< tuple<size_t, __half> >::operator() (const tuple<size_t, __half>& lhs,
                                                                                    const tuple<size_t, __half>& rhs) const {
    return _tuple_real_less<__half>(lhs, rhs);
}

#endif  // include cupy_fp16.h

    }

    // pick 1 from 3 and compare the numerical values (nan+nan*I compares to itself as false)
    return (((lhsIm && rhsIm) && (lhs.real() < rhs.real())) || ((lhsRe && rhsRe) && (lhs.imag() < rhs.imag())));
}

// specialize thrust::less for single complex
template <>
__host__ __device__ __forceinline__ bool _less<complex<float>> (
    const complex<float>& lhs, const complex<float>& rhs) {

    return _cmp_less<complex<float>>(lhs, rhs);
}

template <>
__host__ __device__ __forceinline__ bool less<complex<float>>::operator() (
    const complex<float>& lhs, const complex<float>& rhs) const {

    return _less<complex<float>>(lhs, rhs);
}

// specialize thrust::less for double complex
template <>
__host__ __device__ __forceinline__ bool _less<complex<double>> (
    const complex<double>& lhs, const complex<double>& rhs) {

    return _cmp_less<complex<double>>(lhs, rhs);
}

template <>
__host__ __device__ __forceinline__ bool less<complex<double>>::operator() (
    const complex<double>& lhs, const complex<double>& rhs) const {

    return _less<complex<double>>(lhs, rhs);
}

// specialize thrust::less for tuple<size_t, complex<float>>
template <>
__host__ __device__ __forceinline__ bool less< tuple<size_t, complex<float>> >::operator() (
    const tuple<size_t, complex<float>>& lhs, const tuple<size_t, complex<float>>& rhs) const {

    return _tuple_less<complex<float>>(lhs, rhs);
}

// specialize thrust::less for tuple<size_t, complex<double>>
template <>
__host__ __device__ __forceinline__ bool less< tuple<size_t, complex<double>> >::operator() (
    const tuple<size_t, complex<double>>& lhs, const tuple<size_t, complex<double>>& rhs) const {

    return _tuple_less<complex<double>>(lhs, rhs);
}

/*
