On Wednesday, 18 January 2012 at 01:50:00 UTC, Timon Gehr wrote:

Anyway, I was after a general matrix*matrix multiplication, where the operands can get arbitrarily large and where any potential use of __restrict is rendered unnecessary by array vector ops.

Here you go. But I agree there are use cases for restrict where vector operations don't help

void matmul(A,B,C)(A a, B b, C c, size_t n, size_t m, size_t l)
{
   for(size_t i = 0; i < n; i++)
   {
       c[i*l..i*l + l] = 0;
       for(size_t j = 0; j < m; j++)
           c[i*l..i*l + l] += a[i*m + j] * b[j*l..j*l + l];
   }
}


Reply via email to