[petsc-dev] Meaning of PETSc matrices with zero rows but nonzero columns?

Mills, Richard Tran rtmills at anl.gov
Sat May 30 13:04:42 CDT 2020


I'm working on adding support for matrix products to AIJMKL, and I'm uncertain about some issues surrounding empty matrices. PETSc will happily let me multiply an empty matrix with another (and this arises in the sequential matrix-matrix multiplication routines when running with multiple MPI ranks and using MPIAIJ), but MKL does not like empty matrices (or matrices with no nonzeros), so I've got code in various places in the existing AIJMKL routines to handle these cases without calling MKL.

I'm not quite sure what needs to be done in, say, MatMatMultSymbolic_SeqAIJMKL_SeqAIJMKL(). In the SeqAIJ version, if a matrix A is passed in that has zero rows (that is, A->rmap->N = 0), and matrix B has N columns (B->cmap->N = N), then a matrix C with zero rows and N columns is created. My question boils down to "Does it mean anything in PETSc to have a matrix with 0 rows but a nonzero number of columns"? It is less complicated if I handle the empty matrix cases by creating a matrix with 0 rows and 0 columns, but I am not sure if this breaks something. (I'm also not sure what a "matrix" with 0 rows even means.) Also not sure if there is any other info that I need to preserve in the result matrix C, of if it is OK to handle the case of any empty A or B by always producing the same empty matrix C.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20200530/4764a666/attachment.html>

More information about the petsc-dev mailing list