For more details, and talks in past semesters, consult the full schedule of talks.
Past topics can (and should) be repeated occasionally. In addition, here are some topics people might like to hear about:
To give a talk, please contact swig@math.arizona.edu.
Fmex and cmex are compilers for turning Fortran and C subroutines into functions – called .mex files – that can be called by Matlab. The appeal is that there are many powerful routines written for Fortran and C, which as compiled would run much faster than a Matlab script for the same task, especially if the Matlab script would need many for loops. Moreover, there is a saving of the time it would take to translate a tried and true program or function to Matlab. Finally, fmex and cmex can enable one to run their favorite Fortran and C routines from within a Matlab session, enabling one to take advantage of the graphics capabilities and the interactive nature of Matlab. So, one can have their cake and eat it too.
The most challenging aspect the creation of .mex files is the creation of a gateway function that acts as an interpreter between Matlab and either fortran or C. The original code and gateway file must be compiled together. Instructions for how to create a gateway file can be found at the Mathworks website. However, it is believed that the best way to begin learning this is to work through an example.
It should be noted that one shouldn't explore fmex and cmex until one has a certain facility with Matlab, especially the syntax of functions. Even for the Matlab expert, working through and learning how to create gateway files is not trivial. However the reward is potentially great, especially for those who rely on powerful, specialized code in Fortran or C that is not easily rewritten in Matlab.
Here is an example of a fortran routine for multiplying a vector by a matrix. Of course, Matlab can do this already. This example was chosen because it can so easily be verified to work, and also because it contains several examples of important issues in creating a gateway file. In particular, variables of all types (integer, float, character) are passed, and in the case of float, we use scalar, vector, and matrix forms. Also addressed the issue of when an input parameter in fortran is modified and is output as well. This is distinct from functions in Matlab, where input and output to and from a function are distinct. This example contains most of the commands that would be needed by someone using numerical algorithms.
dgemv.f is a fortran subroutine for multiplying a vector by a matrix. It is from the Blas set of routines, downloaded from Netlib.
xerbla.f and lsame.f are called by dgemv.f.
dgemvg.f is the gateway routine that links the fortran code to Matlab.
mvmults.m is a Matlab script that defines the matrix and vector we wish to multiply, and calls the routine for doing the multiplication.
To compile this code, type
fmex dgemv.f xerbla.f lsame.f dgemvg.f
at the system prompt.
To call this routine from Matlab:
y = dgemv(...)
where ... represents the input to dgemv.f as it
would be called in fortran. Examine the file dgemv.f for
details. The Matlab call to the function is also contained in
the script mvmults.m (see above).
Here is an analogue of the above example, but in C.
mvmult.c is a C subroutine for multiplying a vector by a matrix. It is a modified form of a C function from the Blas set of routines, downloaded from Netlib.
xerbla.c and lsame.c are called by mvmult.c.
mvmultg.c is the gateway routine that links the C code to Matlab.
To compile this code, type
cmex mvmult.c xerbla.c lsame.c mvmultg.c
at the system prompt.
To call this routine from Matlab:
y = mvmult(...)
where ... represents the input to mvmult.c as it
would be called in C. Examine the file mvmult.c for details.
The Matlab call to the function is also contained in the
script mvmults.m (see above).
Other Examples
There are are a few examples at the Mathworks web site. In each of those examples, the C code and gateway routine are in the same file. Click here to see those examples.