A MATLAB-Based Code Generator for Sparse Matrix Computations

  • Hideyuki Kawabata
  • Mutsumi Suzuki
  • Toshiaki Kitamura
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3302)


We present a matrix language compiler CMC which translates annotated MATLAB scripts into Fortran 90 programs. Distinguishing features of CMC include its applicability to programs with sparse matrix computations and its capability of source-level optimization in MATLAB language. Different from other existing similar translators, CMC has an ability to generate codes based on information on the shape of matrices such as triangular and diagonal. Integrating these functionalities, CMC provides the user with a simple way to develop fast large-scale numerical computation codes beyond prototyping. Experimental results show that the programs of SOR and CG methods generated by CMC can run several times as fast as the original MATLAB scripts.


Execution Time Sparse Matrix Sparse Code Sparse Matrice Sparse Structure 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Aho, A.V., Sethi, R., Ullman, J.D.: Compilers — Principles, Techniques, and Tools. Addison Wesley, Reading (1986)zbMATHGoogle Scholar
  2. 2.
    Almasi, G., Padua, D.: MaJIC: Compiling MATLAB for Speed and Responsiveness. In: Proc. PLDI 2002, pp. 294–303 (2002)Google Scholar
  3. 3.
    Barrett, R., et al.: Templates for the Solution of Linear Systems: Building Blocks for Iterative Methods. SIAM, Philadelphia (1994)CrossRefGoogle Scholar
  4. 4.
    Bik, A.J.C., Wijshoff, H.A.G.: Compilation Techniques for Sparse Matrix Computations. In: Proc. ICS 1993, pp. 416–424 (1993)Google Scholar
  5. 5.
    Bik, A.J.C., et al.: The Automatic Generation of Sparse Primitives. ACM Trans. Math. Softw. 24(2), 190–225 (1998)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Chang, R.-G., Chuang, T.-R., Lee, J.K.: Compiler Optimizations for Parallel Sparse Programs with Array Intrinsics of Fortran 90. In: Proc. Intl. Conf. Parallel Processing, pp. 103–110 (1999)Google Scholar
  7. 7.
    Chang, R.-G., Chuang, T.-R., Lee, J.K.: Efficient Support of Parallel Sparse Computation for Array Intrinsic Functions of Fortran 90. In: Proc. ICS 1998, pp. 45–52 (1998)Google Scholar
  8. 8.
    De Rose, L., Padua, D.: Techniques for the translation of MATLAB programs into Fortran 90. ACM Trans. Programming Languages and Systems 21(2), 286–323 (1999)CrossRefGoogle Scholar
  9. 9.
    Doornik, J.A.: Ox: Object-Oriented Matrix Language, 4th edn. Timberlake Consultants Press (2001)Google Scholar
  10. 10.
    Duff, I.S., et al.: Level 3 Basic Linear Algebra Subprograms for Sparse Matrices: A User-Level Interface. ACM Trans. Math. Softw. 23(3), 379–401 (1997)MathSciNetCrossRefzbMATHGoogle Scholar
  11. 11.
    Fitzpatrick, S., Clint, M., Kilpatrick, P.: The Automated Derivation of Sparse Implementations of Numerical Algorithms through Program Transformation, Tech. Rep. 1995/Apr-SF.MC.PLK, Dept. Comput. Sci. The Queen’s University of Belfast (1995)Google Scholar
  12. 12.
    Gilbert, J.R., Moler, C., Schreiber, R.: Sparse Matrices in MATLAB: Design and Implementation. SIAM J. Matrix Anal. Appl. 13(1), 333–356 (1992)MathSciNetCrossRefzbMATHGoogle Scholar
  13. 13.
    Kawabata, H., Suzuki, M.: CMC: A Compiler for Sparse Matrix Computations (in Japanese). IPSJ Trans. Advanced Computing Systems (to appear)Google Scholar
  14. 14.
    Koga, M.: MaTX User’s Manual,
  15. 15.
    The MathWorks, Inc. homepage,
  16. 16.
    The MathWorks, Inc.: MATLAB Compiler Version 3 User’s Guide (2002)Google Scholar
  17. 17.
    Menon, V., Pingali, K.: A Case for Source-Level Transformations in MATLAB. In: Proc. DSL 1999, pp. 53–65 (1999)Google Scholar
  18. 18.
    Ramaswamy, S., et al.: Compiling MATLAB Programs to ScaLAPACK: Exploiting Task and Data Parallelism. In: Proc. IPPS 1996, pp. 613–619 (1996)Google Scholar
  19. 19.
    Quinn, M.J., Malishevsky, A., Seelam, N.: Otter: Bridging the Gap between MATLAB and ScaLAPACK. In: Proc. 8th IEEE Intl. Symp. High Performance Distributed Computing (1998)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Hideyuki Kawabata
    • 1
  • Mutsumi Suzuki
    • 1
  • Toshiaki Kitamura
    • 1
  1. 1.Department of Computer EngineeringHiroshima City UniversityJapan

Personalised recommendations