Class CsrMatrix<T>
- Namespace
- NVMathNet.Sparse
- Assembly
- NVMath.Net.dll
A sparse matrix stored in Compressed Sparse Row (CSR) format on the GPU. Row offsets, column indices, and values are each held in a separate NVMathNet.DeviceBuffer`1.
public sealed class CsrMatrix<T> : IDisposable where T : unmanaged, INumberBase<T>Type Parameters
T-
Unmanaged numeric value element type (float, double, etc.).
Inheritance
Implements
Inherited Members
Constructors
CsrMatrix(long, long, DeviceBuffer<int>, DeviceBuffer<int>, DeviceBuffer<T>, long?)
Creates a CSR sparse matrix from pre-allocated device buffers.
public CsrMatrix(long rows, long cols, DeviceBuffer<int> rowOffsets, DeviceBuffer<int> colIndices, DeviceBuffer<T> values, long? nnz = null)Parameters
rowslong-
Number of rows.
colslong-
Number of columns.
rowOffsetsDeviceBuffer<int>-
Row offsets (length rows+1).
colIndicesDeviceBuffer<int>-
Column indices (length NNZ).
valuesDeviceBuffer<T>-
Non-zero values (length NNZ).
nnzlong?-
Number of stored entries when it is smaller than the buffer length (for example
0for an empty matrix backed by one-element placeholder buffers);nulluses the length ofvalues.
Properties
ColIndices
Column indices — length NNZ.
public DeviceBuffer<int> ColIndices { get; }Property Value
Cols
Number of columns.
public long Cols { get; }Property Value
NNZ
Number of non-zero elements.
public long NNZ { get; }Property Value
RowOffsets
Row offsets — length Rows+1.
public DeviceBuffer<int> RowOffsets { get; }Property Value
Rows
Number of rows.
public long Rows { get; }Property Value
Values
Non-zero values — length NNZ.
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()ToCsc()
Returns this matrix converted to CSC. The caller owns the result.
public CscMatrix<T> ToCsc()Returns
- CscMatrix<T>
Transpose()
Returns a new CSR matrix holding the transpose of this matrix (equivalently, this matrix converted to CSC). The caller owns the result.
public CsrMatrix<T> Transpose()Returns
- CsrMatrix<T>