A matrix utility - C#