diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2005-10-18 11:01:16 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2005-10-18 11:01:16 +0000 |
commit | a01bbba5e2e73bd6006307d60ab6063ee8b9c7cc (patch) | |
tree | 03aec0dce90221f3a095f5b75f3124bc38937b26 | |
parent | 3517975bac0925848e75bfab0ea13bd6b525c808 (diff) |
added methods for 1-row and 1-col right-side matrices
svn path=/trunk/externals/iem/iemmatrix/; revision=3730
-rw-r--r-- | src/mtx_binop_generic.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/mtx_binop_generic.h b/src/mtx_binop_generic.h index 6d60ba3..b059f6b 100644 --- a/src/mtx_binop_generic.h +++ b/src/mtx_binop_generic.h @@ -107,6 +107,79 @@ static void mtxbin_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv) return; } + if(x->m2.col==1&&x->m2.row==1) + { + adjustsize(&x->m, row, col); + m = x->m.atombuffer+2; + +#ifdef MTXBIN_GENERIC__INTEGEROP + t_int offset=atom_getint(m2); +#else + t_float offset=atom_getfloat(m2); +#endif + while(n--){ +#ifdef MTXBIN_GENERIC__INTEGEROP + t_float f = (t_float)(atom_getint(m1) MTXBIN_GENERIC__OPERATOR offset); +#else + t_float f = atom_getfloat(m1) MTXBIN_GENERIC__OPERATOR offset; +#endif + SETFLOAT(m, f); + m++; m1++; + } + outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer); + return; + } + if(x->m2.row==1) + { + int c, r; + adjustsize(&x->m, row, col); + m = x->m.atombuffer+2; + for(r=0; r<row; r++){ + m2 = x->m2.atombuffer+2; + for(c=0; c<col; c++){ +#ifdef MTXBIN_GENERIC__INTEGEROP + t_float f = (t_float)(atom_getint(m1) MTXBIN_GENERIC__OPERATOR atom_getint(m2)); +#else + t_float f = atom_getfloat(m1) MTXBIN_GENERIC__OPERATOR atom_getfloat(m2); +#endif + m1++; m2++; + SETFLOAT(m, f); + m++; + } + } + outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer); + return; + } + if(x->m2.col==1) + { + int c, r; + adjustsize(&x->m, row, col); + m = x->m.atombuffer+2; + + for(r=0; r<row; r++){ +#ifdef MTXBIN_GENERIC__INTEGEROP + t_int offset = atom_getint(m2); +#else + t_float offset = atom_getfloat(m2); +#endif + + for(c=0; c<col; c++){ +#ifdef MTXBIN_GENERIC__INTEGEROP + t_float f = (t_float)(atom_getint(m1) MTXBIN_GENERIC__OPERATOR offset); +#else + t_float f = atom_getfloat(m1) MTXBIN_GENERIC__OPERATOR offset; +#endif + SETFLOAT(m, f); + m++; m1++; + } + m2++; + } + + outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer); + return; + } + + if ((col!=x->m2.col)||(row!=x->m2.row)){ post( MTXBIN_SHORTNAME ": matrix dimensions do not match"); /* LATER SOLVE THIS */ |