Making a Gentle Transition from Gauss to Matlab

(by Cameron Rookley)

Overview

This webpage provides advice, programs, and procedures aimed at helping Gauss programmers make a gentle transition from the Gauss programming language to Matlab. Users are assumed to be proficient in Gauss and are either interested in, or contemplating making a transition from Gauss to Matlab. Both languages are matrix programming languages and have many similarities. There are however certain key differences between these languages which can discourage the busy professional, or experienced Gauss programmer with a substantial library of user-defined code, from making such a transition. It is hoped that the resources of this webpage can help make such a transition as gentle as possible.

Resources

GTOML (Gauss to Matlab) Perl script for converting Gauss source code (scripts or procedures) into Matlab M files. Perl is a language which can perform a dizzying array of tasks, and is ideal for complicated (as well as simple) search and replace functions. It is usually accessable on most UNIX systems and can be downloaded for free off the web for Windows 95 & NT. Click here for more information on Perl as well as download information. In order to convert your Gauss programs to Matlab using this program, you do not need to know Perl, unless you decide to extend some of the features of GTOML yourself.

Overload Functions

Functions aimed at overloading basic Matlab operators to behave like Gauss operators. Matlab is less liberal with matrix dimensions than Gauss. For example, in Gauss you can multiply a 1xk vector by an nxk matrix. Matlab's built in functions will not allow you to do such an operation though. Fortunately Matlab allows you to overload (in other words redefine) operators. By copying these files into a directory titled @double within the Matlab working path, you can continue to perform both mathematical and logical operations the same way you did in Gauss, while leaving the workings of all other Matlab functions more-or-less unaffected. Alternatively, in order to improve efficiency you can place these functions in an alternative directory (other than @double), rename them, and call them selectively for cases where you need more liberal dimensions. eg. x=y.*z would be replaced with x=gprod(y,z), where grod now stands for "Gauss product".

Gauss Functions Translated into M-files

This section includes m-files to read and write binary Gauss datasets as well as Gauss Functions which have been reverse engineered to work in Matlab. By creating M-files with the same name as Gauss functions you're familiar with, and placing them within the Matlab working path, it is possible to program in Matlab and call many functions the same way in Matlab as you would in Gauss.

Sample Code Fragments

Quick and dirty list of Gauss code fragments and Matlab equivalents. Use this as a quick reference to jump start your transition from Gauss to Matlab.

Archive of Finance and Econometrics Related Gauss & Matlab Code

A sample of some of my Finance and Econometrics programs I wrote in Gauss and translated to Matlab using GTOML.

FAQ's

Answers to Frequently asked Questions. Such as: Why switch to Matlab? Why did I create this page? How can you contribute?


[Top|Cameron Rookley's Home Page]


Revised -- 1/1/2003
URL: http://www.cameronrookley.com/gtoml/maingtm.html