[petsc-dev] Meaning of PETSc matrices with zero rows but nonzero columns?
    Lisandro Dalcin 
    dalcinl at gmail.com
       
    Mon Jun  1 04:15:47 CDT 2020
    
    
  
On Sun, 31 May 2020 at 02:26, 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!)
>
>
Just FYI, this is how NumPy handles it:
In [1]: import numpy as np
In [2]: A = np.empty([3,0])
In [3]: B = np.empty([0,8])
In [4]: C = np.dot(A,B)
In [5]: C.shape
Out[5]: (3, 8)
If we do not follow these rules, it will bite us in the future.
-- 
Lisandro Dalcin
============
Research Scientist
Extreme Computing Research Center (ECRC)
King Abdullah University of Science and Technology (KAUST)
http://ecrc.kaust.edu.sa/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20200601/0714985a/attachment-0001.html>
    
    
More information about the petsc-dev
mailing list