Skip to main content

singe_cusparse/
types.rs

1use num_enum::{IntoPrimitive, TryFromPrimitive};
2use singe_core::{impl_enum_conversion, impl_enum_display};
3use singe_cusparse_sys as sys;
4
5/// Indicates whether scalar values are read from host memory or device memory.
6/// If an operation uses several scalar values, all of them use the same pointer mode.
7/// The pointer mode can be set and retrieved with [`Context::set_scalar_pointer_mode`](crate::context::Context::set_scalar_pointer_mode) and [`Context::scalar_pointer_mode`](crate::context::Context::scalar_pointer_mode), respectively.
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
9#[repr(u32)]
10#[non_exhaustive]
11pub enum PointerMode {
12    /// Scalars are read from host memory.
13    Host = sys::cusparsePointerMode_t::CUSPARSE_POINTER_MODE_HOST as _,
14    /// Scalars are read from device memory.
15    Device = sys::cusparsePointerMode_t::CUSPARSE_POINTER_MODE_DEVICE as _,
16}
17
18impl_enum_conversion!(sys::cusparsePointerMode_t, PointerMode);
19
20/// Selects whether an operation processes only indices or both data and indices.
21#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
22#[repr(u32)]
23#[non_exhaustive]
24pub enum Action {
25    /// Process only indices.
26    Symbolic = sys::cusparseAction_t::CUSPARSE_ACTION_SYMBOLIC as _,
27    /// Process data and indices.
28    Numeric = sys::cusparseAction_t::CUSPARSE_ACTION_NUMERIC as _,
29}
30
31impl_enum_conversion!(sys::cusparseAction_t, Action);
32
33/// Describes the matrix kind stored in sparse storage.
34/// For symmetric, Hermitian, and triangular matrices, only their lower or upper part is assumed to be stored.
35///
36/// Matrix type and fill mode minimize storage for symmetric or Hermitian matrices and let SpMV operations use symmetry when useful.
37/// To compute `y=A*x` when `A` is symmetric and only lower triangular part is stored, two steps are needed.
38/// First step is to compute `y=(L+D)*x` and second step is to compute `y=L^T*x + y`.
39/// Because the transpose operation `y=L^T*x` is much slower than the non-transpose version `y=L*x`, the symmetric property does not always improve performance.
40/// It is usually more efficient to expand the symmetric matrix to a general matrix and
41/// apply `y=A*x` with matrix type [`MatrixType::General`].
42///
43/// In general, SpMV, preconditioners (incomplete Cholesky or incomplete LU) and triangular solver are combined together in iterative solvers, for example PCG and GMRES.
44/// If applications use general matrices instead of symmetric matrices, preconditioners
45/// only need to support general matrices.
46/// Therefore the newer `\[bsr|csr\]sv2` (triangular solver), `\[bsr|csr\]ilu02` (incomplete LU), and `\[bsr|csr\]ic02` (incomplete Cholesky) operations only support matrix type [`MatrixType::General`].
47#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
48#[repr(u32)]
49#[non_exhaustive]
50pub enum MatrixType {
51    /// The matrix is general.
52    General = sys::cusparseMatrixType_t::CUSPARSE_MATRIX_TYPE_GENERAL as _,
53    /// The matrix is symmetric.
54    Symmetric = sys::cusparseMatrixType_t::CUSPARSE_MATRIX_TYPE_SYMMETRIC as _,
55    /// The matrix is Hermitian.
56    Hermitian = sys::cusparseMatrixType_t::CUSPARSE_MATRIX_TYPE_HERMITIAN as _,
57    /// The matrix is triangular.
58    Triangular = sys::cusparseMatrixType_t::CUSPARSE_MATRIX_TYPE_TRIANGULAR as _,
59}
60
61impl_enum_conversion!(sys::cusparseMatrixType_t, MatrixType);
62
63/// Selects whether the lower or upper part of a matrix is stored in sparse storage.
64#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
65#[repr(u32)]
66#[non_exhaustive]
67pub enum FillMode {
68    /// The lower triangular part is stored.
69    Lower = sys::cusparseFillMode_t::CUSPARSE_FILL_MODE_LOWER as _,
70    /// The upper triangular part is stored.
71    Upper = sys::cusparseFillMode_t::CUSPARSE_FILL_MODE_UPPER as _,
72}
73
74impl_enum_conversion!(sys::cusparseFillMode_t, FillMode);
75
76/// Selects whether matrix diagonal entries are treated as unity.
77/// The diagonal elements are always assumed to be present, but if
78/// [`DiagonalType::Unit`] is passed to an operation, the operation assumes that
79/// all diagonal entries are one and does not read or modify them.
80/// This behavior is independent of the actual values stored in memory.
81#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
82#[repr(u32)]
83#[non_exhaustive]
84pub enum DiagonalType {
85    /// The matrix diagonal has non-unit elements.
86    NonUnit = sys::cusparseDiagType_t::CUSPARSE_DIAG_TYPE_NON_UNIT as _,
87    /// The matrix diagonal has unit elements.
88    Unit = sys::cusparseDiagType_t::CUSPARSE_DIAG_TYPE_UNIT as _,
89}
90
91impl_enum_conversion!(sys::cusparseDiagType_t, DiagonalType);
92
93/// Selects whether matrix indices are zero-based or one-based.
94#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
95#[repr(u32)]
96#[non_exhaustive]
97pub enum IndexBase {
98    /// The base index is zero (C compatibility).
99    Zero = sys::cusparseIndexBase_t::CUSPARSE_INDEX_BASE_ZERO as _,
100    /// The base index is one (one-based indexing compatibility).
101    One = sys::cusparseIndexBase_t::CUSPARSE_INDEX_BASE_ONE as _,
102}
103
104impl_enum_conversion!(sys::cusparseIndexBase_t, IndexBase);
105
106/// Selects the operation applied to an input, such as a sparse matrix or vector.
107#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
108#[repr(u32)]
109#[non_exhaustive]
110pub enum Operation {
111    /// Non-transpose operation.
112    NonTranspose = sys::cusparseOperation_t::CUSPARSE_OPERATION_NON_TRANSPOSE as _,
113    /// Transpose operation.
114    Transpose = sys::cusparseOperation_t::CUSPARSE_OPERATION_TRANSPOSE as _,
115    /// Conjugate transpose operation.
116    ConjugateTranspose = sys::cusparseOperation_t::CUSPARSE_OPERATION_CONJUGATE_TRANSPOSE as _,
117}
118
119impl Operation {
120    pub const HERMITIAN: Self = Self::ConjugateTranspose;
121}
122
123impl_enum_conversion!(sys::cusparseOperation_t, Operation);
124
125/// Selects whether dense matrix elements are scanned by rows or columns in `cusparse[S|D|C|Z]nnz`.
126/// This also controls block storage format in BSR matrices.
127#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
128#[repr(u32)]
129#[non_exhaustive]
130pub enum Direction {
131    /// Matrix elements are scanned by rows.
132    Row = sys::cusparseDirection_t::CUSPARSE_DIRECTION_ROW as _,
133    /// Matrix elements are scanned by columns.
134    Column = sys::cusparseDirection_t::CUSPARSE_DIRECTION_COLUMN as _,
135}
136
137impl_enum_conversion!(sys::cusparseDirection_t, Direction);
138
139#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
140#[repr(u32)]
141#[non_exhaustive]
142pub enum ColorAlgorithm {
143    Algorithm0 = sys::cusparseColorAlg_t::CUSPARSE_COLOR_ALG0 as _,
144    Algorithm1 = sys::cusparseColorAlg_t::CUSPARSE_COLOR_ALG1 as _,
145}
146
147impl_enum_conversion!(sys::cusparseColorAlg_t, ColorAlgorithm);
148
149#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
150#[repr(u32)]
151#[non_exhaustive]
152pub enum CsrToCscAlgorithm {
153    Default = sys::cusparseCsr2CscAlg_t::CUSPARSE_CSR2CSC_ALG_DEFAULT as _,
154}
155
156impl_enum_conversion!(sys::cusparseCsr2CscAlg_t, CsrToCscAlgorithm);
157
158/// Describes the sparse matrix storage format.
159#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
160#[repr(u32)]
161#[non_exhaustive]
162pub enum Format {
163    /// The matrix is stored in Compressed Sparse Row (CSR) format.
164    Csr = sys::cusparseFormat_t::CUSPARSE_FORMAT_CSR as _,
165    /// The matrix is stored in Compressed Sparse Column (CSC) format.
166    Csc = sys::cusparseFormat_t::CUSPARSE_FORMAT_CSC as _,
167    /// The matrix is stored in Coordinate (COO) format organized in *Structure of Arrays (SoA)* layout.
168    Coo = sys::cusparseFormat_t::CUSPARSE_FORMAT_COO as _,
169    /// The matrix is stored in Blocked-Ellpack (Blocked-ELL) format.
170    BlockedEll = sys::cusparseFormat_t::CUSPARSE_FORMAT_BLOCKED_ELL as _,
171    /// The matrix is stored in Block Sparse Row (BSR) format.
172    Bsr = sys::cusparseFormat_t::CUSPARSE_FORMAT_BSR as _,
173    SlicedEllpack = sys::cusparseFormat_t::CUSPARSE_FORMAT_SLICED_ELLPACK as _,
174}
175
176impl_enum_conversion!(sys::cusparseFormat_t, Format);
177
178/// Describes the memory layout of a dense matrix.
179#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
180#[repr(u32)]
181#[non_exhaustive]
182pub enum Order {
183    /// The matrix is stored in column-major.
184    Column = sys::cusparseOrder_t::CUSPARSE_ORDER_COL as _,
185    /// The matrix is stored in row-major.
186    Row = sys::cusparseOrder_t::CUSPARSE_ORDER_ROW as _,
187}
188
189impl_enum_conversion!(sys::cusparseOrder_t, Order);
190
191/// Describes the integer type used for sparse matrix indices.
192#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
193#[repr(u32)]
194#[non_exhaustive]
195pub enum IndexType {
196    I16 = sys::cusparseIndexType_t::CUSPARSE_INDEX_16U as _,
197    /// 32-bit signed integer \[0, 2^31 - 1\].
198    I32 = sys::cusparseIndexType_t::CUSPARSE_INDEX_32I as _,
199    /// 64-bit signed integer \[0, 2^63 - 1\].
200    I64 = sys::cusparseIndexType_t::CUSPARSE_INDEX_64I as _,
201}
202
203impl_enum_conversion!(sys::cusparseIndexType_t, IndexType);
204
205#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
206#[repr(u32)]
207#[non_exhaustive]
208pub enum SparseMatrixAttribute {
209    FillMode = sys::cusparseSpMatAttribute_t::CUSPARSE_SPMAT_FILL_MODE as _,
210    DiagonalType = sys::cusparseSpMatAttribute_t::CUSPARSE_SPMAT_DIAG_TYPE as _,
211}
212
213impl_enum_conversion!(sys::cusparseSpMatAttribute_t, SparseMatrixAttribute);
214
215pub trait IndexTypeLike: Copy + 'static {
216    fn index_type() -> IndexType;
217}
218
219impl IndexTypeLike for u16 {
220    fn index_type() -> IndexType {
221        IndexType::I16
222    }
223}
224
225impl IndexTypeLike for i32 {
226    fn index_type() -> IndexType {
227        IndexType::I32
228    }
229}
230
231impl IndexTypeLike for i64 {
232    fn index_type() -> IndexType {
233        IndexType::I64
234    }
235}
236
237#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
238#[repr(u32)]
239#[non_exhaustive]
240pub enum SpMvAlgorithm {
241    Default = sys::cusparseSpMVAlg_t::CUSPARSE_SPMV_ALG_DEFAULT as _,
242    Csr1 = sys::cusparseSpMVAlg_t::CUSPARSE_SPMV_CSR_ALG1 as _,
243    Csr2 = sys::cusparseSpMVAlg_t::CUSPARSE_SPMV_CSR_ALG2 as _,
244    Coo1 = sys::cusparseSpMVAlg_t::CUSPARSE_SPMV_COO_ALG1 as _,
245    Coo2 = sys::cusparseSpMVAlg_t::CUSPARSE_SPMV_COO_ALG2 as _,
246    Sell1 = sys::cusparseSpMVAlg_t::CUSPARSE_SPMV_SELL_ALG1 as _,
247    Bsr1 = sys::cusparseSpMVAlg_t::CUSPARSE_SPMV_BSR_ALG1 as _,
248}
249
250impl_enum_conversion!(sys::cusparseSpMVAlg_t, SpMvAlgorithm);
251
252#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
253#[repr(u32)]
254#[non_exhaustive]
255pub enum SpSvAlgorithm {
256    Default = sys::cusparseSpSVAlg_t::CUSPARSE_SPSV_ALG_DEFAULT as _,
257}
258
259impl_enum_conversion!(sys::cusparseSpSVAlg_t, SpSvAlgorithm);
260
261#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
262#[repr(u32)]
263#[non_exhaustive]
264pub enum SpSvUpdate {
265    General = sys::cusparseSpSVUpdate_t::CUSPARSE_SPSV_UPDATE_GENERAL as _,
266    Diagonal = sys::cusparseSpSVUpdate_t::CUSPARSE_SPSV_UPDATE_DIAGONAL as _,
267}
268
269impl_enum_conversion!(sys::cusparseSpSVUpdate_t, SpSvUpdate);
270
271#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
272#[repr(u32)]
273#[non_exhaustive]
274pub enum SpSMAlgorithm {
275    Default = sys::cusparseSpSMAlg_t::CUSPARSE_SPSM_ALG_DEFAULT as _,
276}
277
278impl_enum_conversion!(sys::cusparseSpSMAlg_t, SpSMAlgorithm);
279
280#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
281#[repr(u32)]
282#[non_exhaustive]
283pub enum SpSmUpdate {
284    General = sys::cusparseSpSMUpdate_t::CUSPARSE_SPSM_UPDATE_GENERAL as _,
285    Diagonal = sys::cusparseSpSMUpdate_t::CUSPARSE_SPSM_UPDATE_DIAGONAL as _,
286}
287
288impl_enum_conversion!(sys::cusparseSpSMUpdate_t, SpSmUpdate);
289
290#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
291#[repr(u32)]
292#[non_exhaustive]
293pub enum SparseToDenseAlgorithm {
294    Default = sys::cusparseSparseToDenseAlg_t::CUSPARSE_SPARSETODENSE_ALG_DEFAULT as _,
295}
296
297impl_enum_conversion!(sys::cusparseSparseToDenseAlg_t, SparseToDenseAlgorithm);
298
299#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
300#[repr(u32)]
301#[non_exhaustive]
302pub enum DenseToSparseAlgorithm {
303    Default = sys::cusparseDenseToSparseAlg_t::CUSPARSE_DENSETOSPARSE_ALG_DEFAULT as _,
304}
305
306impl_enum_conversion!(sys::cusparseDenseToSparseAlg_t, DenseToSparseAlgorithm);
307
308#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
309#[repr(u32)]
310#[non_exhaustive]
311pub enum SpMmAlgorithm {
312    Default = sys::cusparseSpMMAlg_t::CUSPARSE_SPMM_ALG_DEFAULT as _,
313    Coo1 = sys::cusparseSpMMAlg_t::CUSPARSE_SPMM_COO_ALG1 as _,
314    Coo2 = sys::cusparseSpMMAlg_t::CUSPARSE_SPMM_COO_ALG2 as _,
315    Coo3 = sys::cusparseSpMMAlg_t::CUSPARSE_SPMM_COO_ALG3 as _,
316    Coo4 = sys::cusparseSpMMAlg_t::CUSPARSE_SPMM_COO_ALG4 as _,
317    Csr1 = sys::cusparseSpMMAlg_t::CUSPARSE_SPMM_CSR_ALG1 as _,
318    Csr2 = sys::cusparseSpMMAlg_t::CUSPARSE_SPMM_CSR_ALG2 as _,
319    Csr3 = sys::cusparseSpMMAlg_t::CUSPARSE_SPMM_CSR_ALG3 as _,
320    BlockedEll1 = sys::cusparseSpMMAlg_t::CUSPARSE_SPMM_BLOCKED_ELL_ALG1 as _,
321    Bsr1 = sys::cusparseSpMMAlg_t::CUSPARSE_SPMM_BSR_ALG1 as _,
322}
323
324impl_enum_conversion!(sys::cusparseSpMMAlg_t, SpMmAlgorithm);
325
326#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
327#[repr(u32)]
328#[non_exhaustive]
329pub enum SpMmOpAlgorithm {
330    Default = sys::cusparseSpMMOpAlg_t::CUSPARSE_SPMM_OP_ALG_DEFAULT as _,
331}
332
333impl_enum_conversion!(sys::cusparseSpMMOpAlg_t, SpMmOpAlgorithm);
334
335#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
336#[repr(u32)]
337#[non_exhaustive]
338pub enum SpGemmAlgorithm {
339    Default = sys::cusparseSpGEMMAlg_t::CUSPARSE_SPGEMM_DEFAULT as _,
340    CsrDeterministic = sys::cusparseSpGEMMAlg_t::CUSPARSE_SPGEMM_CSR_ALG_DETERMINITIC as _,
341    CsrNondeterministic = sys::cusparseSpGEMMAlg_t::CUSPARSE_SPGEMM_CSR_ALG_NONDETERMINITIC as _,
342    Algorithm1 = sys::cusparseSpGEMMAlg_t::CUSPARSE_SPGEMM_ALG1 as _,
343    Algorithm2 = sys::cusparseSpGEMMAlg_t::CUSPARSE_SPGEMM_ALG2 as _,
344    Algorithm3 = sys::cusparseSpGEMMAlg_t::CUSPARSE_SPGEMM_ALG3 as _,
345}
346
347impl_enum_conversion!(sys::cusparseSpGEMMAlg_t, SpGemmAlgorithm);
348
349#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
350#[repr(u32)]
351#[non_exhaustive]
352pub enum SddmmAlgorithm {
353    Default = sys::cusparseSDDMMAlg_t::CUSPARSE_SDDMM_ALG_DEFAULT as _,
354}
355
356impl_enum_conversion!(sys::cusparseSDDMMAlg_t, SddmmAlgorithm);
357
358impl_enum_display!(PointerMode, {
359    PointerMode::Host => "CUSPARSE_POINTER_MODE_HOST",
360    PointerMode::Device => "CUSPARSE_POINTER_MODE_DEVICE",
361});
362
363impl_enum_display!(Action, {
364    Action::Symbolic => "CUSPARSE_ACTION_SYMBOLIC",
365    Action::Numeric => "CUSPARSE_ACTION_NUMERIC",
366});
367
368impl_enum_display!(MatrixType, {
369    MatrixType::General => "CUSPARSE_MATRIX_TYPE_GENERAL",
370    MatrixType::Symmetric => "CUSPARSE_MATRIX_TYPE_SYMMETRIC",
371    MatrixType::Hermitian => "CUSPARSE_MATRIX_TYPE_HERMITIAN",
372    MatrixType::Triangular => "CUSPARSE_MATRIX_TYPE_TRIANGULAR",
373});
374
375impl_enum_display!(FillMode, {
376    FillMode::Lower => "CUSPARSE_FILL_MODE_LOWER",
377    FillMode::Upper => "CUSPARSE_FILL_MODE_UPPER",
378});
379
380impl_enum_display!(DiagonalType, {
381    DiagonalType::NonUnit => "CUSPARSE_DIAG_TYPE_NON_UNIT",
382    DiagonalType::Unit => "CUSPARSE_DIAG_TYPE_UNIT",
383});
384
385impl_enum_display!(IndexBase, {
386    IndexBase::Zero => "CUSPARSE_INDEX_BASE_ZERO",
387    IndexBase::One => "CUSPARSE_INDEX_BASE_ONE",
388});
389
390impl_enum_display!(Operation, {
391    Operation::NonTranspose => "CUSPARSE_OPERATION_NON_TRANSPOSE",
392    Operation::Transpose => "CUSPARSE_OPERATION_TRANSPOSE",
393    Operation::ConjugateTranspose => "CUSPARSE_OPERATION_CONJUGATE_TRANSPOSE",
394});
395
396impl_enum_display!(Direction, {
397    Direction::Row => "CUSPARSE_DIRECTION_ROW",
398    Direction::Column => "CUSPARSE_DIRECTION_COLUMN",
399});
400
401impl_enum_display!(ColorAlgorithm, {
402    ColorAlgorithm::Algorithm0 => "CUSPARSE_COLOR_ALG0",
403    ColorAlgorithm::Algorithm1 => "CUSPARSE_COLOR_ALG1",
404});
405
406impl_enum_display!(CsrToCscAlgorithm, {
407    CsrToCscAlgorithm::Default => "CUSPARSE_CSR2CSC_ALG_DEFAULT",
408});
409
410impl_enum_display!(Format, {
411    Format::Csr => "CUSPARSE_FORMAT_CSR",
412    Format::Csc => "CUSPARSE_FORMAT_CSC",
413    Format::Coo => "CUSPARSE_FORMAT_COO",
414    Format::BlockedEll => "CUSPARSE_FORMAT_BLOCKED_ELL",
415    Format::Bsr => "CUSPARSE_FORMAT_BSR",
416    Format::SlicedEllpack => "CUSPARSE_FORMAT_SLICED_ELLPACK",
417});
418
419impl_enum_display!(Order, {
420    Order::Column => "CUSPARSE_ORDER_COL",
421    Order::Row => "CUSPARSE_ORDER_ROW",
422});
423
424impl_enum_display!(IndexType, {
425    IndexType::I16 => "CUSPARSE_INDEX_16U",
426    IndexType::I32 => "CUSPARSE_INDEX_32I",
427    IndexType::I64 => "CUSPARSE_INDEX_64I",
428});
429
430impl_enum_display!(SparseMatrixAttribute, {
431    SparseMatrixAttribute::FillMode => "CUSPARSE_SPMAT_FILL_MODE",
432    SparseMatrixAttribute::DiagonalType => "CUSPARSE_SPMAT_DIAG_TYPE",
433});
434
435impl_enum_display!(SpMvAlgorithm, {
436    SpMvAlgorithm::Default => "CUSPARSE_SPMV_ALG_DEFAULT",
437    SpMvAlgorithm::Csr1 => "CUSPARSE_SPMV_CSR_ALG1",
438    SpMvAlgorithm::Csr2 => "CUSPARSE_SPMV_CSR_ALG2",
439    SpMvAlgorithm::Coo1 => "CUSPARSE_SPMV_COO_ALG1",
440    SpMvAlgorithm::Coo2 => "CUSPARSE_SPMV_COO_ALG2",
441    SpMvAlgorithm::Sell1 => "CUSPARSE_SPMV_SELL_ALG1",
442    SpMvAlgorithm::Bsr1 => "CUSPARSE_SPMV_BSR_ALG1",
443});
444
445impl_enum_display!(SpSvAlgorithm, {
446    SpSvAlgorithm::Default => "CUSPARSE_SPSV_ALG_DEFAULT",
447});
448
449impl_enum_display!(SpSvUpdate, {
450    SpSvUpdate::General => "CUSPARSE_SPSV_UPDATE_GENERAL",
451    SpSvUpdate::Diagonal => "CUSPARSE_SPSV_UPDATE_DIAGONAL",
452});
453
454impl_enum_display!(SpSMAlgorithm, {
455    SpSMAlgorithm::Default => "CUSPARSE_SPSM_ALG_DEFAULT",
456});
457
458impl_enum_display!(SpSmUpdate, {
459    SpSmUpdate::General => "CUSPARSE_SPSM_UPDATE_GENERAL",
460    SpSmUpdate::Diagonal => "CUSPARSE_SPSM_UPDATE_DIAGONAL",
461});
462
463impl_enum_display!(SparseToDenseAlgorithm, {
464    SparseToDenseAlgorithm::Default => "CUSPARSE_SPARSETODENSE_ALG_DEFAULT",
465});
466
467impl_enum_display!(DenseToSparseAlgorithm, {
468    DenseToSparseAlgorithm::Default => "CUSPARSE_DENSETOSPARSE_ALG_DEFAULT",
469});
470
471impl_enum_display!(SpMmAlgorithm, {
472    SpMmAlgorithm::Default => "CUSPARSE_SPMM_ALG_DEFAULT",
473    SpMmAlgorithm::Coo1 => "CUSPARSE_SPMM_COO_ALG1",
474    SpMmAlgorithm::Coo2 => "CUSPARSE_SPMM_COO_ALG2",
475    SpMmAlgorithm::Coo3 => "CUSPARSE_SPMM_COO_ALG3",
476    SpMmAlgorithm::Coo4 => "CUSPARSE_SPMM_COO_ALG4",
477    SpMmAlgorithm::Csr1 => "CUSPARSE_SPMM_CSR_ALG1",
478    SpMmAlgorithm::Csr2 => "CUSPARSE_SPMM_CSR_ALG2",
479    SpMmAlgorithm::Csr3 => "CUSPARSE_SPMM_CSR_ALG3",
480    SpMmAlgorithm::BlockedEll1 => "CUSPARSE_SPMM_BLOCKED_ELL_ALG1",
481    SpMmAlgorithm::Bsr1 => "CUSPARSE_SPMM_BSR_ALG1",
482});
483
484impl_enum_display!(SpMmOpAlgorithm, {
485    SpMmOpAlgorithm::Default => "CUSPARSE_SPMM_OP_ALG_DEFAULT",
486});
487
488impl_enum_display!(SpGemmAlgorithm, {
489    SpGemmAlgorithm::Default => "CUSPARSE_SPGEMM_DEFAULT",
490    SpGemmAlgorithm::CsrDeterministic => "CUSPARSE_SPGEMM_CSR_ALG_DETERMINITIC",
491    SpGemmAlgorithm::CsrNondeterministic => "CUSPARSE_SPGEMM_CSR_ALG_NONDETERMINITIC",
492    SpGemmAlgorithm::Algorithm1 => "CUSPARSE_SPGEMM_ALG1",
493    SpGemmAlgorithm::Algorithm2 => "CUSPARSE_SPGEMM_ALG2",
494    SpGemmAlgorithm::Algorithm3 => "CUSPARSE_SPGEMM_ALG3",
495});
496
497impl_enum_display!(SddmmAlgorithm, {
498    SddmmAlgorithm::Default => "CUSPARSE_SDDMM_ALG_DEFAULT",
499});