Merge branch 'giga' of ssh://ssh.github.com:443/Nitload-NSI/CCD_Github into local

This commit is contained in:
Nitload
2025-12-17 22:00:44 +08:00
8 changed files with 181 additions and 14 deletions
+10 -4
View File
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="Matrix"
// Project: StgSharp
@@ -52,7 +52,8 @@ namespace StgSharp.Mathematics.Numeric
public static MatrixAllocation DefaultAllocation { get; set; } = MatrixAllocation.GC;
public static Matrix<T> FromDefault<T>(int columnLength, int rowLength) where T : unmanaged, INumber<T>
public static Matrix<T> FromDefault<T>(int columnLength, int rowLength)
where T : unmanaged, INumber<T>
{
return DefaultAllocation switch
{
@@ -62,15 +63,20 @@ namespace StgSharp.Mathematics.Numeric
};
}
public static Matrix<T> FromGC<T>(int columnLength, int rowLength) where T : unmanaged, INumber<T>
public static Matrix<T> FromGC<T>(int columnLength, int rowLength)
where T : unmanaged, INumber<T>
{
return new GCMatrix<T>(columnLength, rowLength);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix<T> FromHlsf<T>(int columnLength, int rowLength, hlsfAllocator allocator)
public static Matrix<T> FromHlsf<T>(
int columnLength,
int rowLength,
hlsfAllocator allocator)
where T : unmanaged, INumber<T>
{
ArgumentNullException.ThrowIfNull(allocator, nameof(allocator));
return new HlsfMatrix<T>(columnLength, rowLength, allocator);
}
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="Matrix_T.HLSF"
// Project: StgSharp
@@ -52,7 +52,11 @@ namespace StgSharp.Mathematics.Numeric
KernelRowLength = (row + 3) / t_count;
ColumnLength = column;
RowLength = row;
this.handle = allocator.Alloc((uint)(KernelColumnLength * KernelRowLength * sizeof(MatrixKernel<T>)));
long size = (long)KernelColumnLength * (long)KernelRowLength * (long)sizeof(MatrixKernel<T>);
this.handle = allocator.Alloc((uint)(size));
if (handle.AllocSize < size) {
throw new InsufficientMemoryException();
}
k_buffer = (MatrixKernel<T>*)handle.Pointer;
}
@@ -68,7 +72,9 @@ namespace StgSharp.Mathematics.Numeric
}
}
public override Matrix<T> this[ReadOnlySpan<MatrixIndex> column, ReadOnlySpan<MatrixIndex> row]
public override Matrix<T> this[
ReadOnlySpan<MatrixIndex> column,
ReadOnlySpan<MatrixIndex> row]
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
@@ -106,14 +112,15 @@ namespace StgSharp.Mathematics.Numeric
public override unsafe MatrixSegmentEnumeration<T> ColumnEnumeration
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => new MatrixSegmentEnumeration<T>(k_buffer, KernelColumnLength, KernelColumnLength * KernelRowLength,
1, KernelColumnLength);
get => new MatrixSegmentEnumeration<T>(k_buffer, KernelColumnLength,
KernelColumnLength * KernelRowLength, 1,
KernelColumnLength);
}
public override unsafe MatrixSegmentEnumeration<T> GetRowEnumeration()
{
return new MatrixSegmentEnumeration<T>(k_buffer, 1, KernelColumnLength, KernelColumnLength,
KernelRowLength);
return new MatrixSegmentEnumeration<T>(k_buffer, 1, KernelColumnLength,
KernelColumnLength, KernelRowLength);
}
public override unsafe MatrixSegmentEnumeration<T> SequentialEnumeration