stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

enhance `coo2csr` procedure by allowing to internally sort the coo matrix

Open jalvesz opened this issue 3 months ago • 1 comments

Motivation

In https://github.com/fortran-lang/stdlib/pull/1034#discussion_r2404572171 a discussion about sparse transformation for linear systems was opened.

Currently, if one first creates a COO matrix, it is requested to: call coo2sorted( COO,sort_data) : sort and ensure unique (i,j,v) entries. This procedure reallocates the COO matrix to remove duplicates. call coo2csr(COO,CSR) : assumes COO is sorted and unique

It could be possible to enhance the second call with a boolean flag to carry out both steps with a single call.

Prior Art

No response

Additional Information

No response

jalvesz avatar Oct 06 '25 06:10 jalvesz

Could it be something like:

call coo2csr(COO, CSR, [coo_sorted])

with coo_sorted=.true. is COO is sorted, and coo_sorted=.false. is COO must be sorted by coo2csr . The default would be .false., such there is no assumption that the user provides a sorted COO.

jvdp1 avatar Oct 06 '25 07:10 jvdp1