Computing array shapes in MATLAB

  • Authors:
  • Pramod G. Joisha;U. Nagaraj Shenoy;Prithviraj Banerjee

  • Affiliations:
  • Department of Electrical and Computer Engineering, Northwestern University;Department of Electrical and Computer Engineering, Northwestern University;Department of Electrical and Computer Engineering, Northwestern University

  • Venue:
  • LCPC'01 Proceedings of the 14th international conference on Languages and compilers for parallel computing
  • Year:
  • 2001

Quantified Score

Hi-index 0.00

Visualization

Abstract

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 the traditional approach.