Working on Factorize

This commit is contained in:
Youmu Liu
2025-12-17 16:56:13 +08:00
parent 88ed5a95c5
commit 688a420574
8 changed files with 181 additions and 14 deletions
@@ -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