The Math.NET Numerics team is running a coding contest to see who can write the the fastest* (yet accurate) managed matrix multiplication code. Contestants will submit an implementation of a simplified version of the BLAS routine GEMM:

/// <summary>
/// Computes C := alpha * op(A) * op(B) + beta * C
/// where op(X) is one of
/// op(X) = X or op(X) = X'
/// </summary>
/// <param name="transposeA">To transpose matrix A or not.</param>
/// <param name="transposeB">To transpose matrix B or not.</param>
/// <param name="m">The number of rows of matrix op(A) and of the matrix C.</param>
/// <param name="n">The number of columns of matrix op(B) and of the matrix C.</param>
/// <param name="k">The number of columns of matrix op(A) and the of the matrix op(B).</param>
/// <param name="alpha">The value to scale the matrix A with.</param>
/// <param name="a">The matrix A.</param>
/// <param name="b">The matrix B.</param>
/// <param name="beta">The value to scale the matrix B with.</param>
/// <param name="c">The matrix C.</param>
public static void Gemm(Transpose transposeA, Transpose transposeB, int m, int n, int k, double alpha, 
                        double[] a, double[] b, double beta, double[] c) {} 

The matrices are stored in column-major arrays.

1st place - $1,500
2nd place - $500

  • Entries will be judged based on speed*, accuracy, and elegance. The Math.NET team will select the winner based on these three criteria.
  • To be eligible for the 1st price, your code must be on average, across different platforms and number of CPU cores, be 25% faster the current Math.NET Numerics implementation. That is, entries that are not at least 25% faster will only be eligible for the 2nd place prize.
  • Submissions should be emailed to and the submission should be announced in the discussion forum (DO NOT post your code to the forum). Contestants should use the benchmark harness (see downloads) to test their code. Only the GEMM implementation needs to be submitted.
  • Submissions must be received by June 30, 2011. The winner will announced by July 31, 2011.
  • Submissions must be written in C# or F#.
  • Any use of threads must use the MathNet.Numerics.Threading.CommonParallel class in Math.NET Numerics. Contestants may modify the CommonParallel class but must also submit those changes.
  • Submissions should be original work and the submitter should own the complete copyright to the code (DO NOT submit someone else's code or a port someone else’s code). However, submissions can be based on the current Math.NET Numerics version.
  • The winner will be required to grant the Math.NET Project and to recipients of software distributed by the Math.NET Project a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute submission and such derivative works.
  • Payment will be made via PayPal (other arrangements might be possible). The winner is responsible for any transfer fees and taxes.
  • Math.NET reserves the right to modify the rules of the contest at anytime and reject any submission for any reason.

*We are looking for code that performs well across different CPU architectures and scales with number of CPU cores. We'll be using both 32-bit and 64-bit versions of the Microsoft .NET 4.0 runtime for benchmarking.

Last edited May 9, 2011 at 7:41 PM by jvangael, version 6