誤差の上限の計算でタイルの大きさの対数を直接求める
このコミットが含まれているのは:
3ファイル変更
+29
-6
検索条件に一致するファイルはありません
@@ -146,6 +146,25 @@ public sealed class TilePlanTests
|
||||
Assert.Equal(plan.TileCount * expected, plan.GroupCount);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(64, 6)]
|
||||
[InlineData(128, 7)]
|
||||
[InlineData(256, 8)]
|
||||
[InlineData(512, 9)]
|
||||
public void TheLogarithmOfASupportedSizeIsItsExponent(int size, int expected)
|
||||
{
|
||||
Assert.Equal(expected, TilePlan.Log2Of(size));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(32)]
|
||||
[InlineData(96)]
|
||||
[InlineData(1024)]
|
||||
public void TheLogarithmOfAnUnsupportedSizeIsRejected(int size)
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => TilePlan.Log2Of(size));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AKernelThatDoesNotFitTheTileIsRejected()
|
||||
{
|
||||
|
||||
@@ -36,16 +36,14 @@ internal static class ConvolutionBound
|
||||
|
||||
public static double SpectrumError(int size)
|
||||
{
|
||||
var plan = TilePlan.Create(size, 0, 0, 0, 1, 1);
|
||||
var transform = Transform(2 * plan.Log2Size, DoubleRounding, DoubleTwiddleError) * size;
|
||||
var transform = Transform(2 * TilePlan.Log2Of(size), DoubleRounding, DoubleTwiddleError) * size;
|
||||
return SingleRounding * (1d + transform) + transform + Math.Sqrt(2d) * SmallestNormal;
|
||||
}
|
||||
|
||||
public static double Relative(int size, double operationError)
|
||||
{
|
||||
var plan = TilePlan.Create(size, 0, 0, 0, 1, 1);
|
||||
var multiplication = ComplexMultiplication(operationError);
|
||||
var transform = Transform(2 * plan.Log2Size, operationError, SingleTwiddleError);
|
||||
var transform = Transform(2 * TilePlan.Log2Of(size), operationError, SingleTwiddleError);
|
||||
var spectrum = SpectrumError(size);
|
||||
var product = transform * (1d + spectrum) * (1d + multiplication) + spectrum * (1d + multiplication) + multiplication;
|
||||
var convolution = product + transform * (1d + product);
|
||||
@@ -71,8 +69,7 @@ internal static class ConvolutionBound
|
||||
|
||||
public static int FlushedOperations(int size)
|
||||
{
|
||||
var plan = TilePlan.Create(size, 0, 0, 0, 1, 1);
|
||||
return (int)Math.Ceiling(2d * (4 * plan.Log2Size + 2) * 4d * Math.Sqrt(2d) * size);
|
||||
return (int)Math.Ceiling(2d * (4 * TilePlan.Log2Of(size) + 2) * 4d * Math.Sqrt(2d) * size);
|
||||
}
|
||||
|
||||
public static double Absolute(int size, double operationError, double norm)
|
||||
|
||||
@@ -76,6 +76,13 @@ internal readonly record struct TilePlan
|
||||
public static TilePlan Create(int radius, int regionX, int regionY, int regionWidth, int regionHeight)
|
||||
=> Create(SelectSize(radius), radius, regionX, regionY, regionWidth, regionHeight);
|
||||
|
||||
public static int Log2Of(int size)
|
||||
{
|
||||
if (!IsSupportedSize(size))
|
||||
throw new ArgumentOutOfRangeException(nameof(size));
|
||||
return BitOperations.Log2((uint)size);
|
||||
}
|
||||
|
||||
public static void ValidateKernel(int size, int radius)
|
||||
{
|
||||
if (!IsSupportedSize(size))
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする