/// <summary>
        /// Creates a new radix sort operation.
        /// </summary>
        /// <typeparam name="T">The underlying type of the sort operation.</typeparam>
        /// <typeparam name="TRadixSortOperation">
        /// The type of the radix-sort operation.
        /// </typeparam>
        /// <returns>The created radix sort handler.</returns>
        public BufferedRadixSort <T> CreateRadixSort <T, TRadixSortOperation>()
            where T : unmanaged
            where TRadixSortOperation : struct, IRadixSortOperation <T>
        {
            var radixSort = Accelerator.CreateRadixSort <T, TRadixSortOperation>();

            return((stream, input) =>
            {
                var tempView = AllocateTempRadixSortView <T, TRadixSortOperation>(input);
                radixSort(stream, input, tempView);
            });
        }
Пример #2
0
        /// <summary>
        /// Creates a new radix sort operation.
        /// </summary>
        /// <typeparam name="T">The underlying type of the sort operation.</typeparam>
        /// <typeparam name="TRadixSortMapper">The type of the radix sort mapper.</typeparam>
        /// <param name="kind">The radix sort kind.</param>
        /// <returns>The created radix sort handler.</returns>
        public BufferedRadixSort <T, TRadixSortMapper> CreateRadixSort <T, TRadixSortMapper>(RadixSortKind kind)
            where T : struct
            where TRadixSortMapper : struct, IRadixSortMapper <T>
        {
            var radixSort = Accelerator.CreateRadixSort <T, TRadixSortMapper>(kind);

            return((stream, input, output, mapper) =>
            {
                var tempView = AllocateTempRadixSortView(input);
                radixSort(stream, input, output, tempView, mapper);
            });
        }