preserve shape for 0-sized Matrices
Merge pull request #2598 from smichr/4102

preserve shape for 0-sized Matrices