08.11.2014 Views

COMPILER TECHNIQUES FOR MATLAB PROGRAMS ... - CiteSeerX

COMPILER TECHNIQUES FOR MATLAB PROGRAMS ... - CiteSeerX

COMPILER TECHNIQUES FOR MATLAB PROGRAMS ... - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Although not due to a limitation of our inference mechanism, the current version of<br />

our compiler does not support global variables or sparse constructions, and supports<br />

only a limited number of input/output commands. The support of global variables<br />

and the reminder of the input/output constructions is straightforward, and should be<br />

available in a second version of the compiler. Support for sparse computation requires<br />

more research. This issue is being addressed for the FALCON system in the work by<br />

Gallivan et. al. [GMBW95].<br />

3.2 Phases of the <strong>MATLAB</strong> Compiler<br />

The main challenge of the <strong>MATLAB</strong> compiler is to perform inference on the input program<br />

to determine the variable properties: intrinsic type, rank, shape, and structure.<br />

These<br />

properties are used by the compiler to generate the Fortran 90 declarations and to optimize<br />

the output code.<br />

The <strong>MATLAB</strong> compiler was structured in a conventional way [ASU85] with a series of<br />

dierent passes, as shown in Figure 3.1.<br />

This section discusses the main issues and the<br />

overall strategy adopted for each of the phases of the compiler.<br />

3.2.1 Structure of a <strong>MATLAB</strong> Program<br />

<strong>MATLAB</strong> is a procedural language. Its current version works with essentially one kind of<br />

data structure: a rectangular numerical matrix [Mat92a]. A <strong>MATLAB</strong> program consists of<br />

one or more Fortran-like statements which may include function calls.<br />

There are two types of functions in <strong>MATLAB</strong>: intrinsic or built-in functions, and M-les.<br />

Built-in functions range from elementary mathematical functions, such assqrt, log, and<br />

sin, to more advanced matrix functions, such asinv (for matrix inverse), qr (for orthogonal<br />

triangular decomposition), and eig (for eigenvalues and eigenvectors).<br />

M-les consist of a sequence of <strong>MATLAB</strong> statements, which possibly include references<br />

to other M-les. There are two types of M-les: scripts and functions. A script does not<br />

13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!