Scilab documentation tweaks.
Minor grammar fixes. Fix HTML. HTML formatting changes.
This commit is contained in:
parent
213d67943a
commit
cf077090d3
1 changed files with 120 additions and 79 deletions
|
|
@ -8,27 +8,27 @@
|
||||||
|
|
||||||
<body bgcolor="#ffffff">
|
<body bgcolor="#ffffff">
|
||||||
|
|
||||||
<H1><a name="Scilab"></a>36 SWIG and Scilab</H1>
|
<H1><a name="Scilab"></a>37 SWIG and Scilab</H1>
|
||||||
<!-- INDEX -->
|
<!-- INDEX -->
|
||||||
<div class="sectiontoc">
|
<div class="sectiontoc">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#Scilab_nn2">Preliminaries</a>
|
<li><a href="#Scilab_preliminaries">Preliminaries</a>
|
||||||
<li><a href="#Scilab_nn3">Running SWIG</a>
|
<li><a href="#Scilab_running">Running SWIG</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#Scilab_nn5">Compiling a dynamic module</a>
|
<li><a href="#Scilab_compiling_dynamic">Compiling a dynamic module</a>
|
||||||
<li><a href="#Scilab_nn6">Using your module</a>
|
<li><a href="#Scilab_using_module">Using your module</a>
|
||||||
</ul>
|
</ul>
|
||||||
<li><a href="#Scilab_nn7">A tour of basic C/C++ wrapping</a>
|
<li><a href="#Scilab_tour_of_basic_c">A tour of basic C wrapping</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#Scilab_nn8">Modules</a>
|
<li><a href="#Scilab_modules">Modules</a>
|
||||||
<li><a href="#Scilab_nn9">Functions</a>
|
<li><a href="#Scilab_functions">Functions</a>
|
||||||
<li><a href="#scilab_nn10">Global variables</a>
|
<li><a href="#Scilab_global_variables">Global variables</a>
|
||||||
<li><a href="#Scilab_nn11">Constants</a>
|
<li><a href="#Scilab_constants">Constants</a>
|
||||||
<li><a href="#Scilab_nn12">Enums</a>
|
<li><a href="#Scilab_enums">Enums</a>
|
||||||
<li><a href="#Scilab_nn13">Pointers</a>
|
<li><a href="#Scilab_pointers">Pointers</a>
|
||||||
<li><a href="#Scilab_nn14">Structs</a>
|
<li><a href="#Scilab_structs">Structs</a>
|
||||||
<li><a href="#Scilab_nn15">Arrays</a>
|
<li><a href="#Scilab_arrays">Arrays</a>
|
||||||
<li><a href="#Scilab_nn16">Matrices</a>
|
<li><a href="#Scilab_matrices">Matrices</a>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -41,17 +41,21 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
This chapter is intended to give an introduction to use the module. You should also read the SWIG documentation which is not specific to Scilab. Also, there are a dozen or so examples in the Examples/Scilab directory. As Scilab doesn't really do objects, so in this module, it supports mainly C features: variables, functions, constants, enums, structs, unions, pointers, arrays and matrices.
|
This chapter is intended to give an introduction to use the module.
|
||||||
|
You should also read the SWIG documentation which is not specific to Scilab.
|
||||||
|
Also, there are a dozen or so examples in the Examples/Scilab directory.
|
||||||
|
As Scilab doesn't really have objects, so in this module, it supports mainly C features:
|
||||||
|
variables, functions, constants, enums, structs, unions, pointers, arrays and matrices.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H2><a name="Scilab_nn2"></a>36.1 Preliminaries</H2>
|
<H2><a name="Scilab_preliminaries"></a>37.1 Preliminaries</H2>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The current SWIG implemention is based on Scilab 5.2.2. Support for other higher versions has not been tested, nor has support for any OS other than Linux.
|
The current SWIG implemention is based on Scilab 5.2.2. Support for later versions has not been tested, nor has support for any OS other than Linux.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H2><a name="Scilab_nn3"></a>36.2 Running SWIG</H2>
|
<H2><a name="Scilab_running"></a>37.2 Running SWIG</H2>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -63,10 +67,11 @@ Let's start with a very simple SWIG interface file:
|
||||||
#include "example.h"
|
#include "example.h"
|
||||||
%}
|
%}
|
||||||
int gcd(int x, int y);
|
int gcd(int x, int y);
|
||||||
extern double Foo; </pre></div>
|
extern double Foo;
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
To build an Scilab module, run SWIG using the <tt>-scilab</tt> option.
|
To build a Scilab module, run SWIG using the <tt>-scilab</tt> option.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="shell"><pre>$ swig -scilab example.i </pre></div>
|
<div class="shell"><pre>$ swig -scilab example.i </pre></div>
|
||||||
|
|
@ -79,7 +84,7 @@ This creates a C source file <tt>example_wrap.c</tt> and a interface file <tt>bu
|
||||||
The swig command line has a number of options you can use, like to redirect it's output. Use <tt>swig --help</tt> to learn about these.
|
The swig command line has a number of options you can use, like to redirect it's output. Use <tt>swig --help</tt> to learn about these.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H3><a name="Scilab_nn5"></a>36.2.1 Compiling a dynamic module</H3>
|
<H3><a name="Scilab_compiling_dynamic"></a>37.2.1 Compiling a dynamic module</H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -89,7 +94,7 @@ Building such a file is usually done with the "exec" command (within Scilab itse
|
||||||
|
|
||||||
<div class="shell"><pre>
|
<div class="shell"><pre>
|
||||||
$ ./scilab
|
$ ./scilab
|
||||||
--> exec builder.sce
|
--> exec builder.sce
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -119,7 +124,7 @@ ilib_build(ilib_name,table,files,libs);
|
||||||
|
|
||||||
<div class="shell"><pre>--> exec loader.sce</pre></div>
|
<div class="shell"><pre>--> exec loader.sce</pre></div>
|
||||||
|
|
||||||
<H3><a name="Scilab_nn6"></a>36.2.2 Using your module</H3>
|
<H3><a name="Scilab_using_module"></a>37.2.2 Using your module</H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -139,10 +144,10 @@ ans = 3
|
||||||
--> Foo_get
|
--> Foo_get
|
||||||
ans = 4 </pre></div>
|
ans = 4 </pre></div>
|
||||||
|
|
||||||
<H2><a name="Scilab_nn7"></a>36.3 A tour of basic C wrapping</H2>
|
<H2><a name="Scilab_tour_of_basic_c"></a>37.3 A tour of basic C wrapping</H2>
|
||||||
|
|
||||||
|
|
||||||
<H3><a name="Scilab_nn8"></a>36.3.1 Modules</H3>
|
<H3><a name="Scilab_modules"></a>37.3.1 Modules</H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -165,8 +170,8 @@ clear libexamplelib_path;
|
||||||
clear list_functions;
|
clear list_functions;
|
||||||
clear get_file_path;
|
clear get_file_path;
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
|
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
<p>addinter (files,spname,fcts) performs dynamic linking of a compiled C new Scilab interface routine.
|
<p>addinter (files,spname,fcts) performs dynamic linking of a compiled C new Scilab interface routine.
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
@ -177,32 +182,39 @@ clear get_file_path;
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
After you run the command "exec loader.sce", you could use the module.
|
After you run the command "exec loader.sce", you can use the module.
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<H3><a name="Scilab_nn9"></a>36.3.2 Functions</H3>
|
<H3><a name="Scilab_functions"></a>37.3.2 Functions</H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Global functions are wrapped as new Scilab built-in functions. For example,
|
Global functions are wrapped as new Scilab built-in functions. For example,
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="code"><pre>%module example
|
<div class="code"><pre>
|
||||||
int fact(int n); </pre></div>
|
%module example
|
||||||
|
int fact(int n);
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
creates a built-in function <tt>fact(n)</tt> that works exactly like you think it does:
|
creates a built-in function <tt>fact(n)</tt> that works exactly like you think it does:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="targetlang"><pre>--> fact(4)
|
<div class="targetlang"><pre>
|
||||||
ans=24 </pre></div>
|
--> fact(4)
|
||||||
<H3><a name="scilab_nn10"></a>36.3.3 Global variables</H3>
|
ans=24
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<H3><a name="Scilab_global_variables"></a>37.3.3 Global variables</H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
To expose variables, SWIG actually generates two functions, to get and set the value. In this case, Foo_set and Foo_get would be generated. SWIG then automatically calls these functions when you get and set the variable-- in the former case creating a local copy in the interpreter of the C variables, and in the latter case copying an interpreter variables onto the C variable.
|
To expose variables, SWIG actually generates two functions, to get and set the value. In this case, Foo_set and Foo_get would be generated. SWIG then automatically calls these functions when you get and set the variable-- in the former case creating a local copy in the interpreter of the C variables, and in the latter case copying an interpreter variable value into the C variable.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="targetlang"><pre>--> exec loader.sce;
|
<div class="targetlang"><pre>
|
||||||
|
--> exec loader.sce;
|
||||||
--> c=Foo_get();
|
--> c=Foo_get();
|
||||||
|
|
||||||
--> Foo_set(4);
|
--> Foo_set(4);
|
||||||
|
|
@ -213,14 +225,16 @@ c = 3
|
||||||
--> Foo_get()
|
--> Foo_get()
|
||||||
ans = 4
|
ans = 4
|
||||||
</pre></div>
|
</pre></div>
|
||||||
<H3><a name="Scilab_nn11"></a>36.3.4 Constants</H3>
|
|
||||||
|
<H3><a name="Scilab_constants"></a>37.3.4 Constants</H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
C constants are not really constant in Scilab. When dealing with the constants, the get function will be generated. For example given some constants:
|
C constants are not really constant in Scilab. When dealing with the constants, a get function will be generated. For example given some constants:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="code"><pre>%module example
|
<div class="code"><pre>
|
||||||
|
%module example
|
||||||
#define ICONST 42
|
#define ICONST 42
|
||||||
#define FCONST 2.1828
|
#define FCONST 2.1828
|
||||||
#define CCONST 'x'
|
#define CCONST 'x'
|
||||||
|
|
@ -254,9 +268,10 @@ ans= 37
|
||||||
ans= 3.14
|
ans= 3.14
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
<H3><a name="Scilab_nn12"></a>36.3.5 Enums</H3>
|
<H3><a name="Scilab_enums"></a>37.3.5 Enums</H3>
|
||||||
|
|
||||||
<p> The way that deals with the enums is similar to the constants. For example:
|
|
||||||
|
<p> The way SWIG deals with the enums is similar to constants. For example:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="code"><pre>%module example
|
<div class="code"><pre>%module example
|
||||||
|
|
@ -264,7 +279,7 @@ typedef enum { RED, BLUE, GREEN } color;
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Some code like RED_get(), BLUE_get(),GREEN_get() will be generated. So it could be used as the following:
|
Some code like RED_get(), BLUE_get(),GREEN_get() will be generated. It can be used as the following:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -281,10 +296,13 @@ typedef enum { RED, BLUE, GREEN } color;
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
<H3><a name="Scilab_nn13"></a>36.3.6 Pointers</H3>
|
<H3><a name="Scilab_pointers"></a>37.3.6 Pointers</H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Pointers are fully supported by SWIG. One way to deal with the pointers is using the INPUT and OUTPUT typemaps. For example, in order to call C functions as the following:
|
Pointers are fully supported by SWIG. One way to deal with the pointers is using the INPUT and OUTPUT typemaps. For example, in order to call C functions as the following:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="code"><pre>
|
<div class="code"><pre>
|
||||||
void sub(int *x, int *y, int *result) {
|
void sub(int *x, int *y, int *result) {
|
||||||
*result = *x - *y;
|
*result = *x - *y;
|
||||||
|
|
@ -296,8 +314,10 @@ int divide(int n, int d, int *r) {
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
</pre></div>
|
</pre></div>
|
||||||
<p> We could write a interface file:
|
|
||||||
|
<p> We could write an interface file:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="code"><pre>%module example
|
<div class="code"><pre>%module example
|
||||||
%include typemaps.i
|
%include typemaps.i
|
||||||
extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
|
extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
|
||||||
|
|
@ -305,6 +325,7 @@ extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
|
||||||
%apply int *OUTPUT { int *r };
|
%apply int *OUTPUT { int *r };
|
||||||
extern int divide(int n, int d, int *r);
|
extern int divide(int n, int d, int *r);
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
<p>Then run it in Scilab:
|
<p>Then run it in Scilab:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
@ -318,14 +339,18 @@ extern int divide(int n, int d, int *r);
|
||||||
42/37 = 1 remainder 5
|
42/37 = 1 remainder 5
|
||||||
|
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
<p> From the example above, it is clear that instead of passing a pointer to an object,
|
<p> From the example above, it is clear that instead of passing a pointer to an object,
|
||||||
we only need a real value instead.
|
we only need a real value instead.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H3><a name="Scilab_nn14"></a>36.3.7 Structs</H3>
|
<H3><a name="Scilab_structs"></a>37.3.7 Structs</H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
SWIG creates a set of accessor functions when encountering a structure or union. For example:
|
SWIG creates a set of accessor functions when encountering a structure or union. For example:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="code"><pre>%module example
|
<div class="code"><pre>%module example
|
||||||
%inline %{
|
%inline %{
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -334,8 +359,10 @@ typedef struct {
|
||||||
|
|
||||||
%}
|
%}
|
||||||
</pre></div>
|
</pre></div>
|
||||||
<p> When wrappered, it would generate two main function: Foo_x_set(), which set the data value of the structrure and Foo_x_get() which could obtain the value of the structrure. Run it in Scilab:
|
|
||||||
|
<p> When wrapped, it would generate two main function: Foo_x_set(), which set the data value of the structure and Foo_x_get() which could obtain the value of the structure. Run it in Scilab:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="targetlang"><pre>
|
<div class="targetlang"><pre>
|
||||||
--> a=new_Foo();
|
--> a=new_Foo();
|
||||||
--> Foo_x_set(a,100);
|
--> Foo_x_set(a,100);
|
||||||
|
|
@ -345,11 +372,16 @@ ans =
|
||||||
100
|
100
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
<H3><a name="Scilab_nn15"></a>36.3.8 Arrays</H3>
|
<H3><a name="Scilab_arrays"></a>37.3.8 Arrays</H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Arrays are fully supported by SWIG and Scilab. In SWIG, they are handled as pointers. And Scilab also supports the pointer well. So it is easy to deal with the arrays. For example:
|
Arrays are fully supported by SWIG and Scilab. In SWIG, they are handled as pointers.
|
||||||
|
It is easy to deal with arrays too. For example:
|
||||||
</p>
|
</p>
|
||||||
<div class="code"><pre>%module example
|
|
||||||
|
<div class="code"><pre>
|
||||||
|
%module example
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
int x[10];
|
int x[10];
|
||||||
|
|
@ -359,17 +391,20 @@ void initArray()
|
||||||
int i, n;
|
int i, n;
|
||||||
|
|
||||||
n = sizeof(x)/sizeof(x[0]);
|
n = sizeof(x)/sizeof(x[0]);
|
||||||
for(i = 0; i < n; i++)
|
for(i = 0; i > n; i++)
|
||||||
x[i] = i;
|
x[i] = i;
|
||||||
|
|
||||||
n = sizeof(y)/sizeof(y[0]);
|
n = sizeof(y)/sizeof(y[0]);
|
||||||
for(i = 0; i < n; i++)
|
for(i = 0; i < n; i++)
|
||||||
y[i] = ((double) i)/ ((double) n);
|
y[i] = ((double) i)/ ((double) n);
|
||||||
return;
|
return;
|
||||||
%}
|
%}
|
||||||
</pre></div>
|
</pre></div>
|
||||||
<p> When wrappered, it would generate the following funtion: x_set(), x_get(), y_set(), y_get(), and _wrap_initArray. So it could be used like this:
|
|
||||||
|
<p> When wrapped, the following functions are generated: x_set(), x_get(), y_set(), y_get(), and _wrap_initArray.
|
||||||
|
They can be used like this:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="targetlang"><pre>
|
<div class="targetlang"><pre>
|
||||||
--> exec loader.sce
|
--> exec loader.sce
|
||||||
|
|
||||||
|
|
@ -384,10 +419,13 @@ ans =
|
||||||
0. 0.1428571 0.2857143 0.4285714 0.5714286 0.7142857 0.8571429
|
0. 0.1428571 0.2857143 0.4285714 0.5714286 0.7142857 0.8571429
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
<H3><a name="Scilab_nn16"></a>36.3.9 Matrices</H3>
|
<H3><a name="Scilab_matrices"></a>37.3.9 Matrices</H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Scilab uses matrices a lot for numerical mathematics and scientific visualization. So supporting matrices would make scilab more convenient. For example:
|
Scilab uses matrices a lot for numerical mathematics and scientific visualization. Supporting matrices makes Scilab more convenient. For example:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="code"><pre>%module example
|
<div class="code"><pre>%module example
|
||||||
%inline %{
|
%inline %{
|
||||||
double **new_matrix() {
|
double **new_matrix() {
|
||||||
|
|
@ -398,7 +436,7 @@ double **new_matrix() {
|
||||||
M = (double **) malloc(4 * sizeof(double *));
|
M = (double **) malloc(4 * sizeof(double *));
|
||||||
M[0] = (double *) malloc(16 * sizeof(double));
|
M[0] = (double *) malloc(16 * sizeof(double));
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
M[i] = M[0] + 4 * i;
|
M[i] = M[0] + 4 * i;
|
||||||
}
|
}
|
||||||
return M;
|
return M;
|
||||||
|
|
@ -416,8 +454,8 @@ void print_matrix(double **M) {
|
||||||
|
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
printf("%10g ", M[i][j]);
|
printf("%10g ", M[i][j]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
@ -429,20 +467,21 @@ void mat_mult(double **m1, double **m2, double **m3) {
|
||||||
int i,j,k;
|
int i,j,k;
|
||||||
double temp[4][4];
|
double temp[4][4];
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
temp[i][j] = 0;
|
temp[i][j] = 0;
|
||||||
for (k = 0; k < 4; k++)
|
for (k = 0; k < 4; k++)
|
||||||
temp[i][j] += m1[i][k] * m2[k][j];
|
temp[i][j] += m1[i][k] * m2[k][j];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
for (j = 0; j < 4; j++)
|
for (j = 0; j < 4; j++)
|
||||||
m3[i][j] = temp[i][j];
|
m3[i][j] = temp[i][j];
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
</pre></div>
|
</pre></div>
|
||||||
<p> When wrappered, it would generate the following funtion:
|
|
||||||
|
<p> When wrapped, it would generate the following function:
|
||||||
</p>
|
</p>
|
||||||
<p>_wrap_new_matrix(): generate a new matrix.
|
<p>_wrap_new_matrix(): generate a new matrix.
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -454,8 +493,9 @@ void mat_mult(double **m1, double **m2, double **m3) {
|
||||||
</p>
|
</p>
|
||||||
<p>_wrap_mat_mult(A, B, C): compute the A * B and the result is stored into C.
|
<p>_wrap_mat_mult(A, B, C): compute the A * B and the result is stored into C.
|
||||||
</p>
|
</p>
|
||||||
<p>So it could be used like this:
|
<p>It can be used like this:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="targetlang"><pre>
|
<div class="targetlang"><pre>
|
||||||
--> exec loader.sce
|
--> exec loader.sce
|
||||||
|
|
||||||
|
|
@ -491,3 +531,4 @@ void mat_mult(double **m1, double **m2, double **m3) {
|
||||||
26 12 -2 -16
|
26 12 -2 -16
|
||||||
32 14 -4 -22
|
32 14 -4 -22
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue