Faster Copying in C#

Converting a List to an Array is a common operation: var listSource = new List<int> { 5, 7, 16, 3 }; int[] arrayDestination1 = listSource.ToArray(); // C# standard conversion int[] arrayDestination2 = listSource.ToArrayPar(); // HPCsharp parallel/multi-core/faster conversion This is convenient when calling some function, that only operates on Array, which is common in C#, since […]

Read more "Faster Copying in C#"

Better C# .Sum() in Many Ways

C# Linq provides a convenient way to add up all of the array elements. var arr = new int[] { 5, 7, 16, 3 }; int arrSum = arr.Sum(); This .Sum() supports some of the built-in numeric types: int, long, float, double, and decimal. It provides a nicely consistent and convenient way of adding up […]

Read more "Better C# .Sum() in Many Ways"

Faster LSD Radix Sort

LSD Radix Sort algorithm has been around for a long time with first computer usage in 1950’s and 1960’s to sort punch cards by performing several passes at the stack of cards. It has resurfaced in the last decade with GPUs having hundreds and even thousands of processor with internal local truly random access memories […]

Read more "Faster LSD Radix Sort"

Big-O by a Concrete Example

Computer Scientists develop algorithms for all kinds of tasks, such as sorting numbers, searching the web for information, showing web pages and interacting with them, and so on – thousands of different algorithms. Even a task such as sorting a bunch of numbers, has more than 20 different algorithms. When you need to choose one […]

Read more "Big-O by a Concrete Example"