Table of Contents

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

blockRows long

Number of block rows.

blockCols long

Number of block columns.

rowBlockDim int

Number of rows in each dense block.

colBlockDim int

Number of columns in each dense block.

rowOffsets DeviceBuffer<int>

Block row offsets (length blockRows+1).

colIndices DeviceBuffer<int>

Block column indices (length BlockNNZ).

values DeviceBuffer<T>

Non-zero block values (length BlockNNZ × rowBlockDim × colBlockDim).

columnMajorBlocks bool

true if block data is column-major; false (default) for row-major.

Properties

BlockCols

Number of block columns.

public long BlockCols { get; }

Property Value

long

BlockNNZ

Number of non-zero blocks.

public long BlockNNZ { get; }

Property Value

long

BlockRows

Number of block rows.

public long BlockRows { get; }

Property Value

long

ColBlockDim

Number of columns in each block.

public int ColBlockDim { get; }

Property Value

int

ColIndices

Block column indices — length BlockNNZ.

public DeviceBuffer<int> ColIndices { get; }

Property Value

DeviceBuffer<int>

Cols

Total matrix column count (BlockCols * ColBlockDim).

public long Cols { get; }

Property Value

long

RowBlockDim

Number of rows in each block.

public int RowBlockDim { get; }

Property Value

int

RowOffsets

Block row offsets — length BlockRows+1.

public DeviceBuffer<int> RowOffsets { get; }

Property Value

DeviceBuffer<int>

Rows

Total matrix row count (BlockRows * RowBlockDim).

public long Rows { get; }

Property Value

long

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()