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

Jeff Hammond jeff.science at gmail.com
Mon Jun 1 14:48:06 CDT 2020

```I assume it's MKL sparse that fails for empty matrices, because the BLAS
and LAPACK should follow the Netlib convention.

I'm sorry that MKL is unwilling to do nothing for you :-)

Jeff

On Sat, May 30, 2020 at 4:26 PM Mills, Richard Tran via petsc-dev <
petsc-dev at mcs.anl.gov> wrote:

> Thanks for the replies, everyone. It suppose is not actually that hard for
> me to handle these dimensions properly -- I just hadn't personally
> encountered or thought much about when such operations with empty matrices
> might arise, and was initially puzzled about what multiplication by an
> "empty" matrix even means. I think I see now why I need to put in the work
> to handle these cases properly. (Sure wish that MKL could just do it,
> though!)
>
> --Richard
>
> On 5/30/20 4:09 PM, Stefano Zampini wrote:
>
> On May 31, 2020, at 1:03 AM, Jed Brown <jed at jedbrown.org> <jed at jedbrown.org> wrote:
>
> Stefano Zampini <stefano.zampini at gmail.com> <stefano.zampini at gmail.com> writes:
>
>
> If A is 0x8 and B is 8x5 then C is correct to be of size 0x5. The rows and columns of the resulting matrix have to follow the rules.
>
> Right, I think if you said C is 0x0 (which seems like Richard's proposal), you'd need to relax shape compatibility logic in many places, including in ways that might produce confusing errors.
>
>
> Richard
>
> In the triple matrix product case, your code will break, because the operation will no longer be associative
>
> A 3x0, B 0x8, C 8x7 -> (ABC) is a valid 3x7 matrix (empty)
>
> If I understand you right, (AB)  would be  a 0x0 matrix, and it can no longer be multiplied against C
>
>
> Richard, what is the hardship in preserving the shape relations?
>
>
>

--
Jeff Hammond
jeff.science at gmail.com
http://jeffhammond.github.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20200601/dbb414e5/attachment.html>
```