За одно N делается два прохода, так что радиус 40 это примерно N=20.
Померил на i7 2600K. Да, действительно ТОРМОЗИТ!!!
namespace ConsoleApplication67
{
class Program
{
static void Main (string[] args)
{
const int H = 480;
const int W = 640;
double[,] a = new double[H, W];
double[,] b = new double[H, W];
System.Random r = new System.Random();
System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
for (int N = 1; N < 21; N++)
{
for (int y = 0; y < H; y++)
{
for (int x = 0; x < W; x++)
{
a[y, x] = r.NextDouble();
}
}
timer.Start();
for (int n = 0; n < N; n++)
{
for (int y = 1; y < H-1; y++)
{
for (int x = 1; x < W-1; x++)
{
b[y, x] = 0.25 * (a[y - 1, x] + a[y + 1, x] + a[y, x - 1] + a[y, x + 1]);
}
}
for (int y = 1; y < H-1; y++)
{
for (int x = 1; x < W-1; x++)
{
a[y, x] = 0.25 * (b[y - 1, x] + b[y + 1, x] + b[y, x - 1] + b[y, x + 1]);
}
}
}
timer.Stop();
System.Console.WriteLine("N={0}, t={1} seconds", N, timer.Elapsed.TotalSeconds);
}
System.Console.ReadLine();
}
}
}
N=1, t=0.0025269 seconds
N=2, t=0.0070202 seconds
N=3, t=0.0136165 seconds
N=4, t=0.0224988 seconds
N=5, t=0.0334735 seconds
N=6, t=0.046629 seconds
N=7, t=0.0619759 seconds
N=8, t=0.0795237 seconds
N=9, t=0.0992912 seconds
N=10, t=0.1212711 seconds
N=11, t=0.1455351 seconds
N=12, t=0.1721706 seconds
N=13, t=0.2007201 seconds
N=14, t=0.2315255 seconds
N=15, t=0.2645839 seconds
N=16, t=0.2999006 seconds
N=17, t=0.3371634 seconds
N=18, t=0.3767296 seconds
N=19, t=0.4186069 seconds
N=20, t=0.462693 seconds
При N=20 на i7 2600K будет 2 FPS.
Замена double на int ускорения не даёт.