summaryrefslogtreecommitdiff
path: root/Examples/guile/matrix/matrix.i
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/guile/matrix/matrix.i')
-rw-r--r--Examples/guile/matrix/matrix.i36
1 files changed, 36 insertions, 0 deletions
diff --git a/Examples/guile/matrix/matrix.i b/Examples/guile/matrix/matrix.i
new file mode 100644
index 0000000..d61f0dc
--- /dev/null
+++ b/Examples/guile/matrix/matrix.i
@@ -0,0 +1,36 @@
+//
+// 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*/
+
+}