Update of /cvsroot/pure-data/externals/iem/iemmatrix/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5642
Modified Files:
mtx_distance2.c mtx_fill.c mtx_inverse.c mtx_prod.c
Log Message:
reduced compiler warnings by properly declaring functions and avoiding variable shadowing
Index: mtx_fill.c
===================================================================
RCS file: /cvsroot/pure-data/externals/iem/iemmatrix/src/mtx_fill.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** mtx_fill.c 14 Aug 2006 12:43:53 -0000 1.9
--- mtx_fill.c 12 Nov 2006 12:56:06 -0000 1.10
***************
*** 82,96 ****
}
! static void writeIndexedValuesIntoMatrix (int n, int *index, t_atom *x, t_atom *y)
{
! for (;n--;index++,x++)
! if (*index)
! y[*index-1] = *x;
}
! static void writeFloatIndexedIntoMatrix (int n, int *index, t_float f, t_atom *y)
{
! for (;n--;index++)
! if (*index)
! SETFLOAT(&y[*index-1], f);
}
--- 82,96 ----
}
! static void writeIndexedValuesIntoMatrix (int n, int *idx, t_atom *x, t_atom *y)
{
! for (;n--;idx++,x++)
! if (*idx)
! y[*idx-1] = *x;
}
! static void writeFloatIndexedIntoMatrix (int n, int *idx, t_float f, t_atom *y)
{
! for (;n--;idx++)
! if (*idx)
! SETFLOAT(&y[*idx-1], f);
}
***************
*** 102,106 ****
int size = rows * columns;
int list_size = argc - 2;
! int *index = mtx_fill_obj->index;
// size check
--- 102,106 ----
int size = rows * columns;
int list_size = argc - 2;
! int *idx = mtx_fill_obj->index;
// size check
***************
*** 126,140 ****
else {
if (size > mtx_fill_obj->index_size) {
! if (!index)
! index = (int *) getbytes (sizeof (int) * (size + 2));
else
! index = (int *) resizebytes (index,
sizeof (int) * (mtx_fill_obj->index_size+2),
sizeof (t_atom) * (size + 2));
mtx_fill_obj->index_size = size;
! mtx_fill_obj->index = index;
}
mtx_fill_obj->max_index =
! copyNonZeroAtomsToIntegerArrayMax (&size, argv++, index);
mtx_fill_obj->num_idcs_used = size;
if (!size)
--- 126,140 ----
else {
if (size > mtx_fill_obj->index_size) {
! if (!idx)
! idx = (int *) getbytes (sizeof (int) * (size + 2));
else
! idx = (int *) resizebytes (idx,
sizeof (int) * (mtx_fill_obj->index_size+2),
sizeof (t_atom) * (size + 2));
mtx_fill_obj->index_size = size;
! mtx_fill_obj->index = idx;
}
mtx_fill_obj->max_index =
! copyNonZeroAtomsToIntegerArrayMax (&size, argv++, idx);
mtx_fill_obj->num_idcs_used = size;
if (!size)
Index: mtx_inverse.c
===================================================================
RCS file: /cvsroot/pure-data/externals/iem/iemmatrix/src/mtx_inverse.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** mtx_inverse.c 29 Mar 2006 12:07:52 -0000 1.7
--- mtx_inverse.c 12 Nov 2006 12:56:06 -0000 1.8
***************
*** 18,22 ****
! t_matrixfloat* mtx_doInvert(t_matrixfloat*input, int rowcol, int*error){
/*
* row==col==rowclo
--- 18,22 ----
! t_matrixfloat* mtx_doInvert(t_matrixfloat*input, int rowcol, int*err){
/*
* row==col==rowclo
***************
*** 78,82 ****
}
}
! if(error!=0)*error=ok;
return inverted;
--- 78,82 ----
}
}
! if(err!=0)*err=ok;
return inverted;
***************
*** 89,93 ****
int col=atom_getfloat(argv+1);
! int error=0;
t_matrixfloat *original, *inverted;
--- 89,93 ----
int col=atom_getfloat(argv+1);
! int err=0;
t_matrixfloat *original, *inverted;
***************
*** 106,110 ****
if (row==col){
/* fine, the matrix is square */
! inverted=mtx_doInvert(original, row, &error);
} else {
/* we'll have to do the pseudo-inverse:
--- 106,110 ----
if (row==col){
/* fine, the matrix is square */
! inverted=mtx_doInvert(original, row, &err);
} else {
/* we'll have to do the pseudo-inverse:
***************
*** 118,126 ****
inverteeCol=col;
invertee =mtx_doMultiply(col, transposed, row, original, col);
! inverted =mtx_doMultiply(col, mtx_doInvert(invertee, col, &error), col, transposed, row);
} else {
inverteeCol=row;
invertee =mtx_doMultiply(row, original, col, transposed, row);
! inverted =mtx_doMultiply(col, transposed, row, mtx_doInvert(invertee, row, &error), row);
}
freebytes(transposed, sizeof(t_matrixfloat)*col*row);
--- 118,126 ----
inverteeCol=col;
invertee =mtx_doMultiply(col, transposed, row, original, col);
! inverted =mtx_doMultiply(col, mtx_doInvert(invertee, col, &err), col, transposed, row);
} else {
inverteeCol=row;
invertee =mtx_doMultiply(row, original, col, transposed, row);
! inverted =mtx_doMultiply(col, transposed, row, mtx_doInvert(invertee, row, &err), row);
}
freebytes(transposed, sizeof(t_matrixfloat)*col*row);
***************
*** 134,140 ****
freebytes(original, sizeof(t_matrixfloat)*row*col);
! if(error){
outlet_bang(x->x_outlet);
! pd_error(x, "mtx_inverse: couldn't really invert the matrix !!! %d error%c", error, (error-1)?'s':0);
}
--- 134,140 ----
freebytes(original, sizeof(t_matrixfloat)*row*col);
! if(err){
outlet_bang(x->x_outlet);
! pd_error(x, "mtx_inverse: couldn't really invert the matrix !!! %d error%c", err, (err-1)?'s':0);
}
Index: mtx_prod.c
===================================================================
RCS file: /cvsroot/pure-data/externals/iem/iemmatrix/src/mtx_prod.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** mtx_prod.c 29 Mar 2006 12:07:52 -0000 1.4
--- mtx_prod.c 12 Nov 2006 12:56:06 -0000 1.5
***************
*** 50,54 ****
! static void *mtx_prod_new()
{
t_matrix *x = (t_matrix *)pd_new(mtx_prod_class);
--- 50,54 ----
! static void *mtx_prod_new(void)
{
t_matrix *x = (t_matrix *)pd_new(mtx_prod_class);
Index: mtx_distance2.c
===================================================================
RCS file: /cvsroot/pure-data/externals/iem/iemmatrix/src/mtx_distance2.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** mtx_distance2.c 29 Mar 2006 12:07:52 -0000 1.3
--- mtx_distance2.c 12 Nov 2006 12:56:06 -0000 1.4
***************
*** 71,76 ****
int n;
for(n=0; n<col; n++){
! t_float x=atom_getfloat(&m1[c1+n])-atom_getfloat(&m2[c2+n]);
! f+=x*x;
}
SETFLOAT(m,f);
--- 71,76 ----
int n;
for(n=0; n<col; n++){
! t_float val=atom_getfloat(&m1[c1+n])-atom_getfloat(&m2[c2+n]);
! f+=val*val;
}
SETFLOAT(m,f);