Advertisement

Computing Array Shapes in MATLAB

  • Pramod G. Joisha
  • U. Nagaraj Shenoy
  • Prithviraj Banerjee
Conference paper
  • 326 Downloads
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2624)

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.

Keywords

Code Fragment Substitution Property Conformability Check Scalar Shape Matrix Arithmetic 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [1]
    T. Budd. An APL Compiler. Springer-Verlag New York, Inc., New York City, NY 10010, USA, 1988. ISBN 0-387-96643-9.zbMATHGoogle Scholar
  2. [2]
    S. Chauveau and F. Bodin. “Menhir: An Environment for High Performance MATLAB”. Lecture Notes in Computer Science, 1511:27–40, 1998. Proceedings of the 4th International Workshop on Languages, Compilers and Run-Time Systems, Pittsburgh, PA, USA, May 1998.CrossRefGoogle Scholar
  3. [3]
    R. Cytron, J. Ferrante, B. K. Rosen, and M. N. Wegman. “Efficiently Computing Static Single Assignment Form and the Control Dependence Graph”. ACM Transactions on Programming Languages and Systems, 13(4):451–490, October 1991.CrossRefGoogle Scholar
  4. [4]
    P. Drakenberg, P. Jacobson, and B. Kågström. “A CONLAB Compiler for a Distributed-Memory Multicomputer”. In the Proceedings of the 6th SIAM Conference on Parallel Processing for Scientific Computing, pages 814–821, Norfolk, VA, USA, March 1993.Google Scholar
  5. [5]
    L. A. De Rose. “Compiler Techniques for MATLAB Programs”. Ph.D. dissertation, University of Illinois at Urbana-Champaign, Department of Computer Science, May 1996.Google Scholar
  6. [6]
    B. C. Jay. “A Semantics for Shape”. Science of Computer Programming, 25:251–283, 1995.zbMATHCrossRefMathSciNetGoogle Scholar
  7. [7]
    P. G. Joisha, U. N. Shenoy, and P. Banerjee. “An Approach to Array Shape Determination in MATLAB”. Technical Report CPDC-TR-2000-10-010, Center for Parallel and Distributed Computing, Department of Electrical and Computer Engineering, Northwestern University, Evanston, IL 60208-3118, USA, October 2000.Google Scholar
  8. [8]
    M. A. Kaplan and J. D. Ullman. “A Scheme for the Automatic Inference of Variable Types”. Journal of the ACM, 27(1):128–145, January 1980.zbMATHCrossRefMathSciNetGoogle Scholar
  9. [9]
  10. [10]
    The Math Works, Inc., 24 Prime Park Way, Natick, MA 01760-1500, USA. MATLAB—The Language of Technical Computing, January 1997. Using MATLAB (Version 5).Google Scholar
  11. [11]
    MATLAB Compiler and C/C++ Math Library 2.0.2, at http://www.mathworks.com/products/compilerlibrary/.
  12. [12]
    V. Menon and K. Pingali. “A Case for Source-Level Transformations in MATLAB”. In the Proceedings of the 2nd Conference on Domain-Specific Languages, pages 53–65, Austin, TX, USA, October 1999.Google Scholar
  13. [13]
    M. J. Quinn, A. Malishevsky, N. Seelam, and Y. Zhao. “Preliminary Results from a Parallel MATLAB Compiler”. In the Proceedings of the 12th International Parallel Processing Symposium, pages 81–87, Orlando, FL, USA, April 1998.Google Scholar
  14. [14]
    J. P. Tremblay and R. Manohar. Discrete Mathematical Structures with Applications to Computer Science. Computer Science Series. McGraw-Hill, Inc., New York City, NY 10121, USA, 1975. ISBN 0-07-065142-6.zbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Pramod G. Joisha
    • 1
  • U. Nagaraj Shenoy
    • 1
  • Prithviraj Banerjee
    • 1
  1. 1.Department of Electrical and Computer EngineeringNorthwestern UniversityUSA

Personalised recommendations