rocsparse_spmat_scale Interface Reference#
Sparse matrix scaling. More...
Public Member Functions | |
| integer(c_int) function | rocsparse_spmat_scale_ (handle, alpha, source, target, p_error) |
Detailed Description
Sparse matrix scaling.
rocsparse_spmat_scale multiplies the values of the sparse matrix source ( \(A\)) by the scalar \(\alpha\) and writes them into the sparse matrix target ( \(C\)):
\[ C := \alpha \cdot A. \]
Only the value array of target is written; its data type is scaled by \(\alpha\). This is a uniform scalar multiply of the matrix values; it is unrelated to row/column equilibration scaling. No temporary storage buffer is required.
This routine does not copy the sparsity pattern. target is assumed to already describe the same sparsity pattern as source (same format, dimensions and nonzero count), so its index arrays are left untouched. When target and source alias the same value array the scaling is performed in place; otherwise the scaled source values are written into target. In-place operation is the common case. A value of \(\alpha = 0\) writes all-zero values into target (the pattern is not dropped).
The scaling factor \(\alpha\) is passed as a size-one dense vector descriptor. It can live in host or device memory; the memory space is taken from the descriptor itself (see rocsparse_dnvec_descr_create_scalar), so the handle pointer mode does not affect it. The data type of alpha must match the data type of the matrices.
- Note
- The following formats are supported:
rocsparse_format_coo,rocsparse_format_coo_aos,rocsparse_format_csr,rocsparse_format_csc,rocsparse_format_bsr,rocsparse_format_ell,rocsparse_format_bellandrocsparse_format_sell.sourceandtargetmust use the same format. - Batched matrices are not supported.
- This routine does not support execution in a hipGraph context.
- Uniform Precisions:
-
Uniform Precisions alpha / A / C rocsparse_datatype_f32_r rocsparse_datatype_f64_r rocsparse_datatype_f32_c rocsparse_datatype_f64_c
- Parameters
-
[in] handle - handle to the rocSPARSE library context queue. [in] alpha - size-one dense vector descriptor holding the scalar \(\alpha\). [in] source - sparse matrix \(A\) descriptor. [out] target - sparse matrix \(C\) descriptor. [out] p_error - error descriptor created if the returned status is not rocsparse_status_success. A null pointer can be passed if an error descriptor is not required.
- Return values
-
rocsparse_status_success the operation completed successfully. rocsparse_status_invalid_handle the library context was not initialized. rocsparse_status_invalid_pointer alpha,sourceortargetpointer is invalid.rocsparse_status_not_implemented the formats of sourceandtargetdiffer, the format is not one of the supported formats, or a batched matrix is passed.
Member Function/Subroutine Documentation
◆ rocsparse_spmat_scale_()
| integer(c_int) function hipfort_rocsparse::rocsparse_spmat_scale::rocsparse_spmat_scale_ | ( | type(c_ptr), value | handle, |
| type(c_ptr), value | alpha, | ||
| type(c_ptr), value | source, | ||
| type(c_ptr), value | target, | ||
| type(c_ptr), optional | p_error | ||
| ) |
The documentation for this interface was generated from the following file: