summaryrefslogtreecommitdiff
path: root/Examples/scilab/matrix/example.i
blob: c930e92f5d29de8827c3a8ef4553a7b737390bfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
%module example
// FILE : matrix.i

%{

void set_m(double **M, int i, int j, double val) {
  M[i][j] = val;
}

double get_m(double **M, int i, int j) {
  return M[i][j];
}
%}

%inline {
/*** Matrix Operations ***/

extern double **new_matrix();
/* Creates a new matrix and returns a pointer to it */

extern void   destroy_matrix(double **M);
/* Destroys the matrix M */

extern void print_matrix(double **M);
/* Prints out the matrix M */

extern void   set_m(double **M, int i, int j, double val);
/* Sets M[i][j] = val*/

extern double get_m(double **M, int i, int j);
/* Returns M[i][j] */

extern void   mat_mult(double **a, double **b, double **c);
/* Multiplies matrix a by b and places the result in c*/

}