pub struct MatrixDescriptor { /* private fields */ }Implementations§
Source§impl MatrixDescriptor
impl MatrixDescriptor
Sourcepub fn create() -> Result<Self>
pub fn create() -> Result<Self>
Initializes a matrix descriptor.
It sets MatrixType and IndexBase to MatrixType::General and
IndexBase::Zero, respectively, while leaving other fields uninitialized.
§Errors
Returns an error if cuSPARSE cannot create the descriptor or if it returns a null handle.
Sourcepub fn matrix_type(&self) -> MatrixType
pub fn matrix_type(&self) -> MatrixType
Returns the MatrixType field of this matrix descriptor.
Sourcepub fn set_matrix_type(&mut self, matrix_type: MatrixType) -> Result<()>
pub fn set_matrix_type(&mut self, matrix_type: MatrixType) -> Result<()>
Sets the MatrixType field of this matrix descriptor.
§Errors
Returns an error if cuSPARSE rejects matrix_type.
Sourcepub fn set_fill_mode(&mut self, fill_mode: FillMode) -> Result<()>
pub fn set_fill_mode(&mut self, fill_mode: FillMode) -> Result<()>
Sourcepub fn diagonal_type(&self) -> DiagonalType
pub fn diagonal_type(&self) -> DiagonalType
Returns the DiagonalType field of this matrix descriptor.
Sourcepub fn set_diagonal_type(&mut self, diagonal_type: DiagonalType) -> Result<()>
pub fn set_diagonal_type(&mut self, diagonal_type: DiagonalType) -> Result<()>
Sets the DiagonalType field of this matrix descriptor.
§Errors
Returns an error if cuSPARSE rejects diagonal_type.
Sourcepub fn index_base(&self) -> IndexBase
pub fn index_base(&self) -> IndexBase
Returns the IndexBase field of this matrix descriptor.
Sourcepub fn set_index_base(&mut self, index_base: IndexBase) -> Result<()>
pub fn set_index_base(&mut self, index_base: IndexBase) -> Result<()>
pub fn as_raw(&self) -> cusparseMatDescr_t
Sourcepub unsafe fn from_raw(handle: cusparseMatDescr_t) -> Result<Self>
pub unsafe fn from_raw(handle: cusparseMatDescr_t) -> Result<Self>
Wraps an existing cuSPARSE legacy matrix descriptor and takes ownership of it.
§Safety
handle must be a valid cusparseMatDescr_t. Ownership of handle is
transferred to the returned descriptor, and the handle must not be
destroyed elsewhere after calling this function.
Sourcepub fn into_raw(self) -> cusparseMatDescr_t
pub fn into_raw(self) -> cusparseMatDescr_t
Consumes the descriptor and returns the raw cuSPARSE handle without destroying it.
The caller becomes responsible for eventually destroying the returned
handle with cusparseDestroyMatDescr.