Search code examples
multidimensional-arrayslicesparse-matrixhpcchapel

On the Subtleties of Sparseness in Chapel


Given a dense domain dom: domain(n); where n < 3, the declaration sps1: sparse subdomain(dom); yields a sparse subdomain sps1 of dom. With sps1 the usual array/matrix slicing is possible. That is, given a matrix A: [sps1] one can take n - 1 dimensional slices of A. However, the usual matrix operation transpose() is not applicable.

Defining a second matrix B:[sps2] over another sparse subdomain sps2 = CSRDomain(dom) enables one to take transpose()s of B, but the ability to slice into B is forfeit.

Both of these abilities would seem to be that which one should always have access to. Is there a better way to declare sparse subdomains that preserves the two?


Solution

  • Is there a better way to declare sparse subdomains that preserves the two?

    I think you are just hitting a shortcoming of the current implementation as of Chapel 1.16.0.

    COO sparse arrays & domains, the language's default sparse distribution, created with sps1: sparse subdomain(dom), are not yet supported in the LinearAlgebra.Sparse module, so there is no library-supported transpose.

    CSR sparse arrays & domains, LinearAlgebra's default (and only supported) sparse distribution, created with sps2 = CSRDomain(dom), do not yet support slicing.

    Both of these should be possible some day as sparse arrays and Linear Algebra features are further developed.