aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-09-19 12:51:27 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-09-19 12:51:27 +0000
commit365bfca88395f6608121d37ed1b5f7c22403f98f (patch)
treedf48b32aabf16991cf9dc9fff3e910c5c8c0e350
parent20836806ed83c0d6683364d04da9d048fa514a9c (diff)
new objects
svn path=/trunk/externals/iem/iemmatrix/; revision=3590
-rw-r--r--src/mtx_abs.c84
-rw-r--r--src/mtx_and.c23
-rw-r--r--src/mtx_bitand.c23
-rw-r--r--src/mtx_bitleft.c23
-rw-r--r--src/mtx_bitor.c23
-rw-r--r--src/mtx_bitright.c23
-rw-r--r--src/mtx_cos.c84
-rw-r--r--src/mtx_eq.c23
-rw-r--r--src/mtx_ge.c23
-rw-r--r--src/mtx_gt.c23
-rw-r--r--src/mtx_int.c84
-rw-r--r--src/mtx_le.c23
-rw-r--r--src/mtx_lt.c23
-rw-r--r--src/mtx_neq.c23
-rw-r--r--src/mtx_or.c23
-rw-r--r--src/mtx_sin.c84
16 files changed, 612 insertions, 0 deletions
diff --git a/src/mtx_abs.c b/src/mtx_abs.c
new file mode 100644
index 0000000..81f0eb0
--- /dev/null
+++ b/src/mtx_abs.c
@@ -0,0 +1,84 @@
+/*
+ * iemmatrix
+ *
+ * objects for manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+#include "iemmatrix.h"
+
+/* mtx_abs: B=abs(A); */
+
+static t_class *mtx_abs_class;
+
+static void mtx_abs_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int row=atom_getfloat(argv++);
+ int col=atom_getfloat(argv++);
+ t_atom *m;
+ int n = argc-2;
+
+ if (argc<2){ post("mtx_abs: crippled matrix"); return; }
+ if ((col<1)||(row<1)) { post("mtx_abs: invalid dimensions"); return; }
+ if (col*row>argc-2){ post("sparse matrix not yet supported : use \"mtx_check\""); return; }
+
+ adjustsize(&x->m, row, col);
+ m = x->m.atombuffer+2;
+
+ while(n--){
+ t_float f = (t_float)abs(atom_getfloat(argv++));
+ SETFLOAT(m, f);
+ m++;
+ }
+
+ outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
+}
+
+static void mtx_abs_list(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int n=argc;
+ t_atom *m;
+ t_float factor = x->f;
+
+ adjustsize(&x->m, 1, argc);
+ m = x->m.atombuffer;
+
+ while(n--){
+ m->a_type = A_FLOAT;
+ (m++)->a_w.w_float = (t_float)abs(atom_getfloat(argv++));
+ }
+
+ outlet_list(x->x_obj.ob_outlet, gensym("list"), argc, x->m.atombuffer);
+}
+
+static void *mtx_abs_new(t_symbol *s)
+{
+ /* element abs */
+ t_matrix *x = (t_matrix *)pd_new(mtx_abs_class);
+ outlet_new(&x->x_obj, 0);
+ x->col = x->row = 0;
+ x->atombuffer = 0;
+ return(x);
+}
+
+void mtx_abs_setup(void)
+{
+ mtx_abs_class = class_new(gensym("mtx_abs"), (t_newmethod)mtx_abs_new, (t_method)mtx_binmtx_free,
+ sizeof(t_mtx_binmtx), 0, A_GIMME, 0);
+ class_addmethod(mtx_abs_class, (t_method)mtx_abs_matrix, gensym("matrix"), A_GIMME, 0);
+ class_addlist (mtx_abs_class, mtx_abs_list);
+ class_addbang (mtx_abs_class, mtx_binmtx_bang);
+
+ class_sethelpsymbol(mtx_abs_class, gensym("iemmatrix/mtx_abs"));
+}
+
+void iemtx_abs_setup(void)
+{
+ mtx_abs_setup();
+}
diff --git a/src/mtx_and.c b/src/mtx_and.c
new file mode 100644
index 0000000..e576fb4
--- /dev/null
+++ b/src/mtx_and.c
@@ -0,0 +1,23 @@
+/*
+ * iemmatrix
+ *
+ * objects fand manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+
+/* name of the object and the classes */
+#define MTXBIN_GENERIC__NAME mtx_and
+/* operator; also used for abbreviation of object */
+#define MTXBIN_GENERIC__OPERATOR &&
+
+/* the operator operates on integers instead of floats */
+#define MTXBIN_GENERIC__INTEGEROP
+
+#include "mtx_binop_generic.h"
diff --git a/src/mtx_bitand.c b/src/mtx_bitand.c
new file mode 100644
index 0000000..61f4d0f
--- /dev/null
+++ b/src/mtx_bitand.c
@@ -0,0 +1,23 @@
+/*
+ * iemmatrix
+ *
+ * objects fand manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+
+/* name of the object and the classes */
+#define MTXBIN_GENERIC__NAME mtx_bitand
+/* operator; also used for abbreviation of object */
+#define MTXBIN_GENERIC__OPERATOR &
+
+/* the operator operates on integers instead of floats */
+#define MTXBIN_GENERIC__INTEGEROP
+
+#include "mtx_binop_generic.h"
diff --git a/src/mtx_bitleft.c b/src/mtx_bitleft.c
new file mode 100644
index 0000000..1dc06c8
--- /dev/null
+++ b/src/mtx_bitleft.c
@@ -0,0 +1,23 @@
+/*
+ * iemmatrix
+ *
+ * objects fand manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+
+/* name of the object and the classes */
+#define MTXBIN_GENERIC__NAME mtx_bitleft
+/* operator; also used for abbreviation of object */
+#define MTXBIN_GENERIC__OPERATOR <<
+
+/* the operator operates on integers instead of floats */
+#define MTXBIN_GENERIC__INTEGEROP
+
+#include "mtx_binop_generic.h"
diff --git a/src/mtx_bitor.c b/src/mtx_bitor.c
new file mode 100644
index 0000000..b5d2d38
--- /dev/null
+++ b/src/mtx_bitor.c
@@ -0,0 +1,23 @@
+/*
+ * iemmatrix
+ *
+ * objects fand manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+
+/* name of the object and the classes */
+#define MTXBIN_GENERIC__NAME mtx_bitor
+/* operator; also used for abbreviation of object */
+#define MTXBIN_GENERIC__OPERATOR |
+
+/* the operator operates on integers instead of floats */
+#define MTXBIN_GENERIC__INTEGEROP
+
+#include "mtx_binop_generic.h"
diff --git a/src/mtx_bitright.c b/src/mtx_bitright.c
new file mode 100644
index 0000000..8c08e44
--- /dev/null
+++ b/src/mtx_bitright.c
@@ -0,0 +1,23 @@
+/*
+ * iemmatrix
+ *
+ * objects fand manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+
+/* name of the object and the classes */
+#define MTXBIN_GENERIC__NAME mtx_bitright
+/* operator; also used for abbreviation of object */
+#define MTXBIN_GENERIC__OPERATOR >>
+
+/* the operator operates on integers instead of floats */
+#define MTXBIN_GENERIC__INTEGEROP
+
+#include "mtx_binop_generic.h"
diff --git a/src/mtx_cos.c b/src/mtx_cos.c
new file mode 100644
index 0000000..da112ab
--- /dev/null
+++ b/src/mtx_cos.c
@@ -0,0 +1,84 @@
+/*
+ * iemmatrix
+ *
+ * objects for manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+#include "iemmatrix.h"
+
+/* mtx_cos: B=cos(A); */
+
+static t_class *mtx_cos_class;
+
+static void mtx_cos_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int row=atom_getfloat(argv++);
+ int col=atom_getfloat(argv++);
+ t_atom *m;
+ int n = argc-2;
+
+ if (argc<2){ post("mtx_cos: crippled matrix"); return; }
+ if ((col<1)||(row<1)) { post("mtx_cos: invalid dimensions"); return; }
+ if (col*row>argc-2){ post("sparse matrix not yet supported : use \"mtx_check\""); return; }
+
+ adjustsize(&x->m, row, col);
+ m = x->m.atombuffer+2;
+
+ while(n--){
+ t_float f = (t_float)cos(atom_getfloat(argv++));
+ SETFLOAT(m, f);
+ m++;
+ }
+
+ outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
+}
+
+static void mtx_cos_list(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int n=argc;
+ t_atom *m;
+ t_float factor = x->f;
+
+ adjustsize(&x->m, 1, argc);
+ m = x->m.atombuffer;
+
+ while(n--){
+ m->a_type = A_FLOAT;
+ (m++)->a_w.w_float = (t_float)cos(atom_getfloat(argv++));
+ }
+
+ outlet_list(x->x_obj.ob_outlet, gensym("list"), argc, x->m.atombuffer);
+}
+
+static void *mtx_cos_new(t_symbol *s)
+{
+ /* element cos */
+ t_matrix *x = (t_matrix *)pd_new(mtx_cos_class);
+ outlet_new(&x->x_obj, 0);
+ x->col = x->row = 0;
+ x->atombuffer = 0;
+ return(x);
+}
+
+void mtx_cos_setup(void)
+{
+ mtx_cos_class = class_new(gensym("mtx_cos"), (t_newmethod)mtx_cos_new, (t_method)mtx_binmtx_free,
+ sizeof(t_mtx_binmtx), 0, A_GIMME, 0);
+ class_addmethod(mtx_cos_class, (t_method)mtx_cos_matrix, gensym("matrix"), A_GIMME, 0);
+ class_addlist (mtx_cos_class, mtx_cos_list);
+ class_addbang (mtx_cos_class, mtx_binmtx_bang);
+
+ class_sethelpsymbol(mtx_cos_class, gensym("iemmatrix/mtx_cos"));
+}
+
+void iemtx_cos_setup(void)
+{
+ mtx_cos_setup();
+}
diff --git a/src/mtx_eq.c b/src/mtx_eq.c
new file mode 100644
index 0000000..194540f
--- /dev/null
+++ b/src/mtx_eq.c
@@ -0,0 +1,23 @@
+/*
+ * iemmatrix
+ *
+ * objects fand manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+
+/* name of the object and the classes */
+#define MTXBIN_GENERIC__NAME mtx_eq
+/* operator; also used for abbreviation of object */
+#define MTXBIN_GENERIC__OPERATOR ==
+
+/* the operator operates on integers instead of floats */
+//#define MTXBIN_GENERIC__INTEGEROP
+
+#include "mtx_binop_generic.h"
diff --git a/src/mtx_ge.c b/src/mtx_ge.c
new file mode 100644
index 0000000..4d4403f
--- /dev/null
+++ b/src/mtx_ge.c
@@ -0,0 +1,23 @@
+/*
+ * iemmatrix
+ *
+ * objects fand manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+
+/* name of the object and the classes */
+#define MTXBIN_GENERIC__NAME mtx_ge
+/* operator; also used for abbreviation of object */
+#define MTXBIN_GENERIC__OPERATOR >=
+
+/* the operator operates on integers instead of floats */
+//#define MTXBIN_GENERIC__INTEGEROP
+
+#include "mtx_binop_generic.h"
diff --git a/src/mtx_gt.c b/src/mtx_gt.c
new file mode 100644
index 0000000..42ec3e1
--- /dev/null
+++ b/src/mtx_gt.c
@@ -0,0 +1,23 @@
+/*
+ * iemmatrix
+ *
+ * objects fand manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+
+/* name of the object and the classes */
+#define MTXBIN_GENERIC__NAME mtx_gt
+/* operator; also used for abbreviation of object */
+#define MTXBIN_GENERIC__OPERATOR >
+
+/* the operator operates on integers instead of floats */
+//#define MTXBIN_GENERIC__INTEGEROP
+
+#include "mtx_binop_generic.h"
diff --git a/src/mtx_int.c b/src/mtx_int.c
new file mode 100644
index 0000000..38b2796
--- /dev/null
+++ b/src/mtx_int.c
@@ -0,0 +1,84 @@
+/*
+ * iemmatrix
+ *
+ * objects for manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+#include "iemmatrix.h"
+
+/* mtx_int: B=int(A); */
+
+static t_class *mtx_int_class;
+
+static void mtx_int_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int row=atom_getfloat(argv++);
+ int col=atom_getfloat(argv++);
+ t_atom *m;
+ int n = argc-2;
+
+ if (argc<2){ post("mtx_int: crippled matrix"); return; }
+ if ((col<1)||(row<1)) { post("mtx_int: invalid dimensions"); return; }
+ if (col*row>argc-2){ post("sparse matrix not yet supported : use \"mtx_check\""); return; }
+
+ adjustsize(&x->m, row, col);
+ m = x->m.atombuffer+2;
+
+ while(n--){
+ t_float f = (t_float)atom_getint(argv++);
+ SETFLOAT(m, f);
+ m++;
+ }
+
+ outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
+}
+
+static void mtx_int_list(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int n=argc;
+ t_atom *m;
+ t_float factor = x->f;
+
+ adjustsize(&x->m, 1, argc);
+ m = x->m.atombuffer;
+
+ while(n--){
+ m->a_type = A_FLOAT;
+ (m++)->a_w.w_float = (t_float)atom_getint(argv++);
+ }
+
+ outlet_list(x->x_obj.ob_outlet, gensym("list"), argc, x->m.atombuffer);
+}
+
+static void *mtx_int_new(t_symbol *s)
+{
+ /* element int */
+ t_matrix *x = (t_matrix *)pd_new(mtx_int_class);
+ outlet_new(&x->x_obj, 0);
+ x->col = x->row = 0;
+ x->atombuffer = 0;
+ return(x);
+}
+
+void mtx_int_setup(void)
+{
+ mtx_int_class = class_new(gensym("mtx_int"), (t_newmethod)mtx_int_new, (t_method)mtx_binmtx_free,
+ sizeof(t_mtx_binmtx), 0, A_GIMME, 0);
+ class_addmethod(mtx_int_class, (t_method)mtx_int_matrix, gensym("matrix"), A_GIMME, 0);
+ class_addlist (mtx_int_class, mtx_int_list);
+ class_addbang (mtx_int_class, mtx_binmtx_bang);
+
+ class_sethelpsymbol(mtx_int_class, gensym("iemmatrix/mtx_int"));
+}
+
+void iemtx_int_setup(void)
+{
+ mtx_int_setup();
+}
diff --git a/src/mtx_le.c b/src/mtx_le.c
new file mode 100644
index 0000000..50bc456
--- /dev/null
+++ b/src/mtx_le.c
@@ -0,0 +1,23 @@
+/*
+ * iemmatrix
+ *
+ * objects fand manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+
+/* name of the object and the classes */
+#define MTXBIN_GENERIC__NAME mtx_le
+/* operator; also used for abbreviation of object */
+#define MTXBIN_GENERIC__OPERATOR <=
+
+/* the operator operates on integers instead of floats */
+//#define MTXBIN_GENERIC__INTEGEROP
+
+#include "mtx_binop_generic.h"
diff --git a/src/mtx_lt.c b/src/mtx_lt.c
new file mode 100644
index 0000000..2b610d4
--- /dev/null
+++ b/src/mtx_lt.c
@@ -0,0 +1,23 @@
+/*
+ * iemmatrix
+ *
+ * objects fand manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+
+/* name of the object and the classes */
+#define MTXBIN_GENERIC__NAME mtx_lt
+/* operator; also used for abbreviation of object */
+#define MTXBIN_GENERIC__OPERATOR <
+
+/* the operator operates on integers instead of floats */
+//#define MTXBIN_GENERIC__INTEGEROP
+
+#include "mtx_binop_generic.h"
diff --git a/src/mtx_neq.c b/src/mtx_neq.c
new file mode 100644
index 0000000..b439104
--- /dev/null
+++ b/src/mtx_neq.c
@@ -0,0 +1,23 @@
+/*
+ * iemmatrix
+ *
+ * objects fand manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+
+/* name of the object and the classes */
+#define MTXBIN_GENERIC__NAME mtx_neq
+/* operator; also used for abbreviation of object */
+#define MTXBIN_GENERIC__OPERATOR !=
+
+/* the operator operates on integers instead of floats */
+//#define MTXBIN_GENERIC__INTEGEROP
+
+#include "mtx_binop_generic.h"
diff --git a/src/mtx_or.c b/src/mtx_or.c
new file mode 100644
index 0000000..b15f722
--- /dev/null
+++ b/src/mtx_or.c
@@ -0,0 +1,23 @@
+/*
+ * iemmatrix
+ *
+ * objects fand manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+
+/* name of the object and the classes */
+#define MTXBIN_GENERIC__NAME mtx_or
+/* operator; also used for abbreviation of object */
+#define MTXBIN_GENERIC__OPERATOR ||
+
+/* the operator operates on integers instead of floats */
+#define MTXBIN_GENERIC__INTEGEROP
+
+#include "mtx_binop_generic.h"
diff --git a/src/mtx_sin.c b/src/mtx_sin.c
new file mode 100644
index 0000000..290338c
--- /dev/null
+++ b/src/mtx_sin.c
@@ -0,0 +1,84 @@
+/*
+ * iemmatrix
+ *
+ * objects for manipulating simple matrices
+ * mostly refering to matlab/octave matrix functions
+ *
+ * Copyright (c) IOhannes m zmölnig, forum::für::umläute
+ * IEM, Graz, Austria
+ *
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+ *
+ */
+#include "iemmatrix.h"
+
+/* mtx_sin: B=sin(A); */
+
+static t_class *mtx_sin_class;
+
+static void mtx_sin_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int row=atom_getfloat(argv++);
+ int col=atom_getfloat(argv++);
+ t_atom *m;
+ int n = argc-2;
+
+ if (argc<2){ post("mtx_sin: crippled matrix"); return; }
+ if ((col<1)||(row<1)) { post("mtx_sin: invalid dimensions"); return; }
+ if (col*row>argc-2){ post("sparse matrix not yet supported : use \"mtx_check\""); return; }
+
+ adjustsize(&x->m, row, col);
+ m = x->m.atombuffer+2;
+
+ while(n--){
+ t_float f = (t_float)sin(atom_getfloat(argv++));
+ SETFLOAT(m, f);
+ m++;
+ }
+
+ outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
+}
+
+static void mtx_sin_list(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int n=argc;
+ t_atom *m;
+ t_float factor = x->f;
+
+ adjustsize(&x->m, 1, argc);
+ m = x->m.atombuffer;
+
+ while(n--){
+ m->a_type = A_FLOAT;
+ (m++)->a_w.w_float = (t_float)sin(atom_getfloat(argv++));
+ }
+
+ outlet_list(x->x_obj.ob_outlet, gensym("list"), argc, x->m.atombuffer);
+}
+
+static void *mtx_sin_new(t_symbol *s)
+{
+ /* element sin */
+ t_matrix *x = (t_matrix *)pd_new(mtx_sin_class);
+ outlet_new(&x->x_obj, 0);
+ x->col = x->row = 0;
+ x->atombuffer = 0;
+ return(x);
+}
+
+void mtx_sin_setup(void)
+{
+ mtx_sin_class = class_new(gensym("mtx_sin"), (t_newmethod)mtx_sin_new, (t_method)mtx_binmtx_free,
+ sizeof(t_mtx_binmtx), 0, A_GIMME, 0);
+ class_addmethod(mtx_sin_class, (t_method)mtx_sin_matrix, gensym("matrix"), A_GIMME, 0);
+ class_addlist (mtx_sin_class, mtx_sin_list);
+ class_addbang (mtx_sin_class, mtx_binmtx_bang);
+
+ class_sethelpsymbol(mtx_sin_class, gensym("iemmatrix/mtx_sin"));
+}
+
+void iemtx_sin_setup(void)
+{
+ mtx_sin_setup();
+}