|
36 | 36 | mutable struct CuDenseVectorDescriptor
|
37 | 37 | handle::cusparseDnVecDescr_t
|
38 | 38 |
|
| 39 | + function CuDenseVectorDescriptor(T::DataType, n::Integer) |
| 40 | + desc_ref = Ref{cusparseDnVecDescr_t}() |
| 41 | + cusparseCreateDnVec(desc_ref, n, CU_NULL, T) |
| 42 | + obj = new(desc_ref[]) |
| 43 | + finalizer(cusparseDestroyDnVec, obj) |
| 44 | + return obj |
| 45 | + end |
| 46 | + |
39 | 47 | function CuDenseVectorDescriptor(x::DenseCuVector)
|
40 | 48 | desc_ref = Ref{cusparseDnVecDescr_t}()
|
41 | 49 | cusparseCreateDnVec(desc_ref, length(x), x, eltype(x))
|
@@ -71,6 +79,18 @@ Base.unsafe_convert(::Type{cusparseSpVecDescr_t}, desc::CuSparseVectorDescriptor
|
71 | 79 | mutable struct CuDenseMatrixDescriptor
|
72 | 80 | handle::cusparseDnMatDescr_t
|
73 | 81 |
|
| 82 | + function CuDenseMatrixDescriptor(T::DataType, m::Integer, n::Integer; transposed::Bool=false) |
| 83 | + desc_ref = Ref{cusparseDnMatDescr_t}() |
| 84 | + if transposed |
| 85 | + cusparseCreateDnMat(desc_ref, n, m, m, CU_NULL, T, 'R') |
| 86 | + else |
| 87 | + cusparseCreateDnMat(desc_ref, m, n, m, CU_NULL, T, 'C') |
| 88 | + end |
| 89 | + obj = new(desc_ref[]) |
| 90 | + finalizer(cusparseDestroyDnMat, obj) |
| 91 | + return obj |
| 92 | + end |
| 93 | + |
74 | 94 | function CuDenseMatrixDescriptor(A::DenseCuMatrix; transposed::Bool=false)
|
75 | 95 | desc_ref = Ref{cusparseDnMatDescr_t}()
|
76 | 96 | if transposed
|
|
0 commit comments