FFTの回転因子の表の鍵を構造体にする

このコミットが含まれているのは:
routersys committed 2026-10-08 12:24:14 +09:00
1 親 f9d34ba224
コミット 72972cae51
1ファイル変更
+4 -2
+4 -2
ファイルの表示
@@ -8,7 +8,7 @@ namespace SpectralConvolution;
internal static class FastFourierTransform
{
static readonly ConcurrentDictionary<long, Twiddles> TwiddleCache = new();
static readonly ConcurrentDictionary<TwiddleKey, Twiddles> TwiddleCache = new();
public static void Forward(Span<double> real, Span<double> imaginary) => Transform(real, imaginary, false);
@@ -294,7 +294,9 @@ internal static class FastFourierTransform
}
static Twiddles GetTwiddles(int count, bool inverse) =>
TwiddleCache.GetOrAdd(((long)count << 1) | (inverse ? 1L : 0L), static key => new Twiddles((int)(key >> 1), (key & 1L) != 0));
TwiddleCache.GetOrAdd(new TwiddleKey(count, inverse), static key => new Twiddles(key.Count, key.Inverse));
readonly record struct TwiddleKey(int Count, bool Inverse);
sealed class Twiddles
{