Sysquake Pro – Table of Contents
Sysquake for LaTeX – Table of Contents
Compatibility
Compatibility Notes
LME is mostly compatible with the language of MATLAB(R) 4.x. It includes most features of MATLAB 5 to 7, such as integer data types, structures, and switch and try control structure. Other functions are enhanced; e.g. functions which manipulate polynomials (such as addpol and roots) also accept matrices containing multiple polynomials. Because of these extensions, it would be a bad idea to attempt to learn the language of MATLAB by reading this material. However, with a background in MATLAB, you will learn LME very quickly.
Except for a number of advanced mathematic functions such as qz, and eigs (some of them are provided in the LAPACK extension), and a few minor differences described in the list of functions as "Caveat", here is the list of the main differences. Knowing them, it is very easy to write code compatible with both Matlab and LME.
- Functions are stored in libraries, not in separate files. Libraries are files with the suffix .lml. They contain a sequence of related functions. They are made known to LME with the use instruction. use instructions define a network of dependencies which permit to avoid name clashes. Inside libraries, functions can be public or private. Functions can also be stored directly in SQ files (Sysquake applications) and typed at the command prompt.
- Constants can be defined with define.
- Inline functions are not restricted to simple expressions; they can be created with the normal function syntax too.
- Methods (functions overloaded for objects) are recognized as such with the syntax classname::methodname in the function definition instead of a classdef block or their location in the file system.
- Looping construct repeat/until for loops which are executed at least once.
- Access to the fields of a structure with the dot syntax (a.b), or to the elements of a matrix or a list with parenthesis or braces (A(i,j) or L{k}) is possible not only with variables, but also with any expression (e.g. odeset().RelTol or odeset.RelTol calls function odeset which returns a structure, then gets its field RelTol).
- Conditional evaluation in expression with operator ? : (same behavior as in C).
- In strings, control sequences beginning with a backslash are converted during parsing; therefore they are not reserved to a few special functions.
- if, elseif, while, and until take the imaginary part of complex numbers into account for consistency with boolean operators and functions.
- Matrices are stored row by row, which has an impact on M(:), reshape, M(index), and the order of the indices when they are matrices (for instance, with a=1:4, b=[1,2;3,4], a(b) -> [1;2;3;4] in LME and [1;3;2;4] in MATLAB). Please do not take advantage of this, because it might change in the future; function info can be used to check the data layout.
- The preferred syntax for a list of output arguments is to enclose them in parenthesis, not in square brackets. Square brackets should be reserved for arrays. They can also be used for output arguments, to preserve compatibility.
- eval has a single argument (the catch part is not supported), and it cannot create a new variable; however, it can change the value of an existing variable.
- Empty matrices always have the size 0 x 0 (i.e. sum(zeros(0,2)) = [] instead of [0,0]).
- In addition to cell arrays, lists are cell arrays with one row.
- rand, randn and randi have (currently) a 64-bit seed, and consequently a lower quality.
- Sparse matrices are not supported.