Update of /cvsroot/pure-data/externals/iem/iemmatrix/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4555
Modified Files: mtx_binop_generic.h Log Message: added methods for 1-row and 1-col right-side matrices
Index: mtx_binop_generic.h =================================================================== RCS file: /cvsroot/pure-data/externals/iem/iemmatrix/src/mtx_binop_generic.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mtx_binop_generic.h 18 Oct 2005 09:56:50 -0000 1.4 --- mtx_binop_generic.h 18 Oct 2005 11:01:16 -0000 1.5 *************** *** 108,111 **** --- 108,184 ---- }
+ 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");