Zur Nutzung der Programmierschnittstelle mit Matlab R2009a unter RHEP 5 (halis)
Ein Beispielverzeichnis befindet sich im Installationsbereich:
/progsys/matlab/2009a/extern/examples
Das Verzeichnis kann in ein eigenes Verzeichnis kopiert werden.
Nach dem Wechsel ins Unterverzeichnis compiler sind vor den
Testlaeufen noch einige Umgebungsvariablen zu setzen und an die
eigene Umgebung anzupassen (fuer 2008b ist analog vorzugehen):
setenv MATLAB /progsys/matlab/2009a
setenv MATLABROOT $MATLAB
setenv TMW_ROOT $MATLAB
setenv LD_LIBRARY_PATH $MATLABROOT/bin/glnxa64:$MATLABROOT/sys/os/glnxa64
setenv LD_LIBRARY_PATH $TMP/matlab/examples/compiler:$LD_LIBRARY_PATH
setenv PATH /sbin:$MATLAB/bin:$PATH (ifconfig wird aufgerufen)
In dem Script engopts.sh, das sich im Kommando-Verzeichnis Matlabs
befindet, werden die GNU-Compiler benutzt. Sollen andere Compiler,
wie z.B. die Intel-Compiler verwendet werden, ist das Script abzuaendern.
Unterstuetzte Compiler
gmake -f Makefile MATLABROOT=/progsys/matlab/2009a bnt_exes
(Es kann etwas dauern ... )
/progsys/matlab/2009a/bin/mcc -m main.m mrank.m -o mrank
/progsys/matlab/2009a/bin/mcc -m hello.m -o hello
/progsys/matlab/2009a/bin/mcc -m magicsquare.m -o magicsquare
/progsys/matlab/2009a/bin/mcc -W lib:libPkg -T link:exe mrankp.c main_for_lib.c mrank.m printmatrix.m
/progsys/matlab/2009a/bin/mcc -W lib:libMultpkg -T link:exe multargp.c main_for_lib.c multarg.m printmatrix.m
/progsys/matlab/2009a/bin/mcc -W lib:libmatrix -T link:exe matrixdriver.c addmatrix.m eigmatrix.m multiplymatrix.m
/progsys/matlab/2009a/bin/mcc -m collect.m measure.c
/progsys/matlab/2009a/bin/mcc -m flames.m -a flames.mat
/progsys/matlab/2009a/bin/mcc -W lib:libtriangle -T link:exe triangle.c main_for_lib.c sierpinski.m
/progsys/matlab/2009a/bin/mcc -B cpplib:libmatrixp addmatrix.m eigmatrix.m multiplymatrix.m
/progsys/matlab/2009a/bin/mbuild matrixdriver.cpp -L. -lmatrixp -output matrixdriverp
/progsys/matlab/2009a/bin/mcc -B cpplib:libtrianglep sierpinski.m
/progsys/matlab/2009a/bin/mbuild triangle.cpp main_for_lib.c -L. -ltrianglep -output trianglep
*********** testing mrank ***********
./mrank
r =
1
2
3
3
5
*********** testing hello ***********
./hello
Hello, World
*********** testing flames ***********
./flames
*********** testing magicsquare 4 ***********
./magicsquare 4
m =
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
*********** testing mrankp ***********
./mrankp
Extracting CTF archive. This may take a few seconds, depending on the
size of your application. Please wait...
...CTF archive extraction complete.
1
2
3
3
5
5
7
3
9
7
11
3
*********** testing multargp ***********
./multargp
Extracting CTF archive. This may take a few seconds, depending on the
size of your application. Please wait...
...CTF archive extraction complete.
The first return value is:
6.2832 +34.5575i 25.1327 +25.1327i 43.9823 +43.9823i
12.5664 +34.5575i 31.4159 +31.4159i 50.2655 +28.2743i
18.8496 +18.8496i 37.6991 +37.6991i 56.5487 +28.2743i
The second return value is :
143.4164
*********** testing matrixdriver ***********
./matrixdriver
Extracting CTF archive. This may take a few seconds, depending on the
size of your application. Please wait...
...CTF archive extraction complete.
The value of added matrix is:
2.00 8.00 14.00
4.00 10.00 16.00
6.00 12.00 18.00
The value of the multiplied matrix is:
30.00 66.00 102.00
36.00 81.00 126.00
42.00 96.00 150.00
The eigenvalues of the first matrix are:
16.12 -1.12 -0.00
*********** testing triangle ***********
./triangle
Extracting CTF archive. This may take a few seconds, depending on the
size of your application. Please wait...
...CTF archive extraction complete.
Calculated 7500 points
*********** testing collect ***********
./collect
*********** testing trianglep ***********
./trianglep
Calculated 7500 points
*********** testing matrixdriverp ***********
./matrixdriverp
The value of added matrix is:
2 8 14
4 10 16
6 12 18
The value of the multiplied matrix is:
30 66 102
36 81 126
42 96 150
The eigenvalues of the first matrix are:
16.1168
-1.1168
-0.0000
Weitere Infos sind den Manuals bzw. dem Matlab-Help und der
README-Datei im Beispielverzeichnis zu entnehmen.