[PD-cvs] externals/iem/iemmatrix/src mtx_sum.c, NONE, 1.1 iemmatrix.c, 1.5, 1.6 mtx_prod.c, 1.1, 1.2
IOhannes m zmölnig
zmoelnig at users.sourceforge.net
Tue May 10 14:16:59 CEST 2005
- Previous message: [PD-cvs] pd/src s_audio.c,1.5.4.11,1.5.4.12
- Next message: [PD-cvs] externals/iem/iemmatrix/abs mtx_matcher-help.pd, NONE, 1.1 mtx_spivot-help.pd, NONE, 1.1 mtx_symasym-help.pd, NONE, 1.1 mtx_matcher.pd, 1.1.1.1, 1.2 mtx_spivot.pd, 1.2, 1.3 mtx_symasym.pd, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/pure-data/externals/iem/iemmatrix/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24092
Modified Files:
iemmatrix.c mtx_prod.c
Added Files:
mtx_sum.c
Log Message:
added mtx_sum
--- NEW FILE: mtx_sum.c ---
/*
* 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_sum */
/* column-wise sum
*/
static t_class *mtx_sum_class;
static void mtx_sum_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
{
int row=atom_getfloat(argv++);
int col=atom_getfloat(argv++);
int n;
if(row*col>argc-2)post("mtx_sum: sparse matrices not yet supported : use \"mtx_check\"");
else {
t_atom *ap = (t_atom *)getbytes(col * sizeof(t_atom)), *dummy=ap;
for(n=0;n<col;n++, dummy++){
int i=row;
t_float f=0.f;
t_atom*ap2=argv+n;
while(i--){
f+=atom_getfloat(ap2+col*i);
}
SETFLOAT(dummy, f);
}
outlet_list(x->x_obj.ob_outlet, gensym("prod"), col, ap);
freebytes(ap, (col * sizeof(t_atom)));
}
}
static void mtx_sum_list(t_matrix *x, t_symbol *s, int argc, t_atom *argv){
t_float f=0.f;
while(argc--)f+=atom_getfloat(argv++);
outlet_float(x->x_obj.ob_outlet, f);
}
static void *mtx_sum_new()
{
t_matrix *x = (t_matrix *)pd_new(mtx_sum_class);
outlet_new(&x->x_obj, 0);
x->row = x->col = 0;
x->atombuffer = 0;
return (x);
}
void mtx_sum_setup(void)
{
mtx_sum_class = class_new(gensym("mtx_sum"), (t_newmethod)mtx_sum_new,
(t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
class_addlist (mtx_sum_class, mtx_sum_list);
// class_addbang (mtx_sum_class, matrix_bang);
class_addmethod(mtx_sum_class, (t_method)mtx_sum_matrix, gensym("matrix"), A_GIMME, 0);
class_sethelpsymbol(mtx_sum_class, gensym("iemmatrix/mtx_sum"));
}
void iemtx_sum_setup(void){
void mtx_sum_setup(void);
}
Index: mtx_prod.c
===================================================================
RCS file: /cvsroot/pure-data/externals/iem/iemmatrix/src/mtx_prod.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** mtx_prod.c 9 May 2005 16:27:23 -0000 1.1
--- mtx_prod.c 10 May 2005 12:16:49 -0000 1.2
***************
*** 15,19 ****
/* mtx_prod */
! /* prod(diag(A))
*/
static t_class *mtx_prod_class;
--- 15,19 ----
/* mtx_prod */
! /* column-wise product
*/
static t_class *mtx_prod_class;
Index: iemmatrix.c
===================================================================
RCS file: /cvsroot/pure-data/externals/iem/iemmatrix/src/iemmatrix.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** iemmatrix.c 10 May 2005 09:38:51 -0000 1.5
--- iemmatrix.c 10 May 2005 12:16:49 -0000 1.6
***************
*** 38,41 ****
--- 38,42 ----
void mtx_scroll_setup();
void mtx_size_setup();
+ void mtx_sum_setup();
void mtx_trace_setup();
void mtx_transpose_setup();
***************
*** 68,71 ****
--- 69,73 ----
mtx_scroll_setup();
mtx_size_setup();
+ mtx_sum_setup();
mtx_trace_setup();
mtx_transpose_setup();
- Previous message: [PD-cvs] pd/src s_audio.c,1.5.4.11,1.5.4.12
- Next message: [PD-cvs] externals/iem/iemmatrix/abs mtx_matcher-help.pd, NONE, 1.1 mtx_spivot-help.pd, NONE, 1.1 mtx_symasym-help.pd, NONE, 1.1 mtx_matcher.pd, 1.1.1.1, 1.2 mtx_spivot.pd, 1.2, 1.3 mtx_symasym.pd, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Pd-cvs
mailing list