Class BsrMatrix<T>
- Namespace
- NVMathNet.Sparse
- Assembly
- NVMath.Net.dll
A sparse matrix stored in Block Sparse Row (BSR) format on the GPU. All non-zero values are grouped into dense sub-blocks of a fixed size (NVMathNet.Sparse.BsrMatrix`1.RowBlockDim × NVMathNet.Sparse.BsrMatrix`1.ColBlockDim), which enables better memory coalescing and higher throughput than element-level CSR on modern GPUs.
public sealed class BsrMatrix<T> : IDisposable where T : unmanaged, INumberBase<T>Type Parameters
T-
Unmanaged numeric value type (float, double, etc.).
Inheritance
Implements
Inherited Members
Constructors
BsrMatrix(long, long, int, int, DeviceBuffer<int>, DeviceBuffer<int>, DeviceBuffer<T>, bool)
Creates a BSR sparse matrix from pre-allocated device buffers.
public BsrMatrix(long blockRows, long blockCols, int rowBlockDim, int colBlockDim, DeviceBuffer<int> rowOffsets, DeviceBuffer<int> colIndices, DeviceBuffer<T> values, bool columnMajorBlocks = false)Parameters
blockRowslong-
Number of block rows.
blockColslong-
Number of block columns.
rowBlockDimint-
Number of rows in each dense block.
colBlockDimint-
Number of columns in each dense block.
rowOffsetsDeviceBuffer<int>-
Block row offsets (length
blockRows+1). colIndicesDeviceBuffer<int>-
Block column indices (length BlockNNZ).
valuesDeviceBuffer<T>-
Non-zero block values (length BlockNNZ × rowBlockDim × colBlockDim).
columnMajorBlocksbool-
trueif block data is column-major;false(default) for row-major.
Properties
BlockCols
Number of block columns.
public long BlockCols { get; }Property Value
BlockNNZ
Number of non-zero blocks.
public long BlockNNZ { get; }Property Value
BlockRows
Number of block rows.
public long BlockRows { get; }Property Value
ColBlockDim
Number of columns in each block.
public int ColBlockDim { get; }Property Value
ColIndices
Block column indices — length BlockNNZ.
public DeviceBuffer<int> ColIndices { get; }Property Value
Cols
Total matrix column count (BlockCols * ColBlockDim).
public long Cols { get; }Property Value
RowBlockDim
Number of rows in each block.
public int RowBlockDim { get; }Property Value
RowOffsets
Block row offsets — length BlockRows+1.
public DeviceBuffer<int> RowOffsets { get; }Property Value
Rows
Total matrix row count (BlockRows * RowBlockDim).
public long Rows { get; }Property Value
Values
Non-zero block values — length BlockNNZ × RowBlockDim × ColBlockDim. Blocks are stored in row-major order by default.
public DeviceBuffer<T> Values { get; }Property Value
- DeviceBuffer<T>
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()