HLSF full functionally available. Working on Matrix.
Signed-off-by: Youmu Liu <105042599+Nitload-NSI@users.noreply.github.com>
This commit is contained in:
@@ -29,28 +29,30 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using StgSharp.HighPerformance;
|
||||
using StgSharp.HighPerformance.Memory;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle;
|
||||
|
||||
namespace StgSharp.Mathematics
|
||||
{
|
||||
public abstract unsafe partial class Matrix<T> where T: unmanaged, INumber<T>
|
||||
{
|
||||
|
||||
public abstract ref float this[int column, int row]
|
||||
private protected readonly int t_count = 16 / sizeof(T);
|
||||
|
||||
private protected readonly int t_size = sizeof(T);
|
||||
|
||||
public abstract ref T this[int column, int row]
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract unsafe Matrix<T> this[ReadOnlySpan<MatrixIndex> column, ReadOnlySpan<MatrixIndex> row]
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public abstract MatrixKernel* GetMatrixKernel(int column, int row);
|
||||
|
||||
[Obsolete("This method does not contain boarder check, so be careful on size or use indexer instead.", false)]
|
||||
@@ -58,9 +60,34 @@ namespace StgSharp.Mathematics
|
||||
|
||||
}
|
||||
|
||||
private unsafe class HlsfMatrix<T> : Matrix<T> where T : unmanaged, INumber<T>
|
||||
internal unsafe class GCMatrix<T> : Matrix<T> where T: unmanaged, INumber<T>
|
||||
{
|
||||
public override ref float this[int column, int row] => throw new NotImplementedException();
|
||||
|
||||
private MatrixKernel[,] buffer;
|
||||
|
||||
public GCMatrix(int column, int row)
|
||||
{
|
||||
int columnSet = (column + 3) / 4;
|
||||
int rowSet = (row + 3) / 4;
|
||||
buffer = new MatrixKernel[columnSet, rowSet];
|
||||
}
|
||||
|
||||
public override ref T this[int column, int row]
|
||||
{
|
||||
get
|
||||
{
|
||||
int kernelColumn = column / 4, c = column % 4;
|
||||
int kernelRow = row / t_count,r = row % t_count;
|
||||
ref MatrixKernel kernel = ref buffer[kernelColumn, kernelRow];
|
||||
return ref kernel.UnsafeIndex<T>(c, r);
|
||||
}
|
||||
}
|
||||
|
||||
public override Matrix<T> this[ReadOnlySpan<MatrixIndex> column, ReadOnlySpan<MatrixIndex> row]
|
||||
{
|
||||
get => throw new NotImplementedException();
|
||||
set => throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override unsafe MatrixKernel* GetMatrixKernel(int column, int row)
|
||||
{
|
||||
@@ -71,5 +98,29 @@ namespace StgSharp.Mathematics
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal unsafe class HlsfMatrix<T> : Matrix<T> where T: unmanaged, INumber<T>
|
||||
{
|
||||
|
||||
public override ref T this[int column, int row] => throw new NotImplementedException();
|
||||
|
||||
public override Matrix<T> this[ReadOnlySpan<MatrixIndex> column, ReadOnlySpan<MatrixIndex> row]
|
||||
{
|
||||
get => throw new NotImplementedException();
|
||||
set => throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override unsafe MatrixKernel* GetMatrixKernel(int column, int row)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override unsafe T* UnsafeIndex(int column, int row)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user