samer@0
|
1 *** Prolog Matlab interface
|
samer@0
|
2 ***
|
samer@0
|
3 *** Authors:
|
samer@0
|
4 *** Samer Abdallah
|
samer@0
|
5 *** Centre for Digital Music,
|
samer@0
|
6 *** Queen Mary, University of London
|
samer@0
|
7 ***
|
samer@0
|
8 *** Christophe Rhodes
|
samer@0
|
9 *** Centre for Computational Creativity
|
samer@0
|
10 *** Goldsmiths College, University of London
|
samer@0
|
11 ***
|
samer@0
|
12 *** Dec 2004--Nov 2006
|
samer@0
|
13
|
samer@0
|
14
|
samer@37
|
15 NB. This repository is deprecated. Code is now maintained on GitHub at
|
samer@37
|
16 https://github.com/samer--/plml
|
samer@37
|
17
|
samer@0
|
18 PLML is a foreign interface that enables Matlab to be used as a computational
|
samer@0
|
19 engine from within SWI Prolog. The basic idea is that instead of using
|
samer@0
|
20 the standard is/2 operator to evaluate a certain class of terms, we can
|
samer@0
|
21 use the ===/2 operator to get Matlab to evaluate a (much richer) class of
|
samer@0
|
22 terms, eg
|
samer@0
|
23
|
samer@0
|
24 ?- float(A)===trace(eye(3)).
|
samer@0
|
25
|
samer@0
|
26 A = 3.0
|
samer@0
|
27
|
samer@0
|
28 We can also get Matlab to perform actions with side effects, like
|
samer@0
|
29 making sounds and graphics; obviously these do not fit into the declartive
|
samer@0
|
30 semantics of Prolog and have to be dealt with under the procedural semantics.
|
samer@0
|
31 If you want to execute a Matlab command in an imperative way and see the
|
samer@0
|
32 textual output, use the ??/1 operator, eg
|
samer@0
|
33
|
samer@0
|
34 ?- ??disp(`hello).
|
samer@0
|
35
|
samer@0
|
36 >> hello
|
samer@0
|
37
|
samer@0
|
38
|
samer@0
|
39 The interface works by using the Matlab Engine API, which starts up a Matlab
|
samer@0
|
40 process on the end of a pipe. The Matlab process can be on another machine,
|
samer@0
|
41 and multiple Matlab engines can be started on the same or different machines.
|
samer@0
|
42 Matlab expressions are sent down the pipe and executed. Matlab's textual
|
samer@0
|
43 output comes back through the pipe. In addition, Matlab variables can be
|
samer@0
|
44 transferred directly between the Matlab engine's memory space and SWI's
|
samer@0
|
45 memory space.
|
samer@0
|
46
|
samer@0
|
47 See README for further details.
|
samer@0
|
48
|
samer@0
|
49
|
samer@0
|
50 RELEASE NOTES for version 0.2
|
samer@0
|
51
|
samer@0
|
52 - Added option to enable Matlab's JVM
|
samer@0
|
53 - Now closing Matlab engines properly at halt
|
samer@0
|
54 - Added support for valid but non-evaluable expressions
|
samer@0
|
55 - Fixed bug when returning integers from Matlab
|
samer@0
|
56 - Errors in user's Matlab functions now generate mlerror(_,_) expections
|
samer@0
|
57
|