hlsf goes bad

This commit is contained in:
Youmu Liu
2026-05-08 18:09:12 +08:00
parent 8aa319a120
commit d1aca8f745
47 changed files with 5020 additions and 446 deletions
+13 -12
View File
@@ -25,7 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Mathematics.Memory;
using StgSharp.HighPerformance.Memory;
using StgSharp.Mathematics.Numeric;
using System;
using System.Collections.Generic;
@@ -41,10 +41,10 @@ namespace StgSharp
internal static partial class Program
{
private const long size = 1024L * 1024L * 1024L * 4L;
private static int sideLength = 1000;
private static readonly nuint size = (nuint)(1024UL * 1024UL * 1024UL * 4UL);
internal static unsafe void TestMatrix(
)
{
@@ -52,18 +52,18 @@ namespace StgSharp
/**/
HybridLayerSegregatedFitAllocator hlsf;
unchecked {
hlsf = new((nuint)size, 32, size);
hlsf = new(size, 32, size);
}
Matrix<T> m = Matrix<T>.Create(sideLength, sideLength, MatrixLayout.DenseRectangle,
hlsf);
Matrix<float> m = Matrix<float>.Create(sideLength, sideLength,
MatrixLayout.DenseRectangle, hlsf);
// MatrixCompute.Fill(m, 1.0f);
Matrix<T> n = Matrix<T>.Create(sideLength, sideLength, MatrixLayout.DenseRectangle,
hlsf);
Matrix<float> n = Matrix<float>.Create(sideLength, sideLength,
MatrixLayout.DenseRectangle, hlsf);
// MatrixCompute.Fill(n, 1.0f);
Matrix<T> p = Matrix<T>.Create(sideLength, sideLength, MatrixLayout.DenseRectangle,
hlsf);
Matrix<float> p = Matrix<float>.Create(sideLength, sideLength,
MatrixLayout.DenseRectangle, hlsf);
// MatrixCompute.Fill(p, 0.0f);
@@ -89,7 +89,7 @@ namespace StgSharp
for (int j = 0; j < 20; j++)
{
string extra = j % 4 == 3 ? " " : ",";
T value = p[j, i];
float value = p[j, i];
// value = T.Abs(value) < 1e-6 ? 0 : value;
@@ -102,7 +102,8 @@ namespace StgSharp
Console.WriteLine("===================================================");
/**/
hlsf.Dispose();
}
}
}
}