This paper deals with the problem of statically inferring the shape of an array in languages such as MATLAB. Inferring an array’s shape is desirable because it empowers better compilation and interpretation; specifically, knowing an array’s shape could permit reductions in the number of run-time array conformability checks, enable memory preallocation optimizations, and facilitate the in-lining of “scalarized” code. This paper describes how the shape of a MATLAB expression can be determined statically, based on a methodology of systematic matrix formulations. The approach capitalizes on the algebraic properties that underlie MATLAB’s shape semantics and exactly captures the shape that the MATLAB expression assumes at run time. Some of the highlights of the approach are its applicability to a large class of MATLAB functions and its uniformity. Our methods are compared with the previous shadow variable scheme, and we show how the algebraic view allows inferences not deduced by...
Pramod G. Joisha, U. Nagaraj Shenoy, Prithviraj Ba