From c3a067dc355fc57a5759d4e9a97bcbcd878caf13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Thu, 3 Jan 2008 12:28:27 +0000 Subject: pedantic and C99 svn path=/trunk/externals/iem/iemmatrix/; revision=9114 --- src/iemmatrix.h | 10 +++++----- src/mtx_bspline.c | 10 ++++------ src/mtx_cholesky.c | 28 ++++++++++++++-------------- src/mtx_colon.c | 1 - src/mtx_concat.c | 6 +++--- src/mtx_conv.c | 8 ++------ src/mtx_cumsum.c | 10 +++++----- src/mtx_decay.c | 10 +++++----- src/mtx_diff.c | 10 +++++----- src/mtx_element.c | 2 +- src/mtx_eq.c | 2 +- src/mtx_fill.c | 10 +++++----- src/mtx_find.c | 9 ++------- src/mtx_gauss.c | 31 +++++++++++++++---------------- src/mtx_ge.c | 2 +- src/mtx_gt.c | 2 +- src/mtx_index.c | 6 +++--- src/mtx_le.c | 2 +- src/mtx_lt.c | 2 +- src/mtx_minmax.c | 6 +++--- src/mtx_mul~.c | 5 ++--- src/mtx_neq.c | 2 +- src/mtx_pivot.c | 14 +++++++------- src/mtx_prod.c | 1 - src/mtx_repmat.c | 11 +++++------ src/mtx_resize.c | 2 +- src/mtx_reverse.c | 9 ++++----- src/mtx_rowrfft.c | 7 +++---- src/mtx_rowrifft.c | 20 +++++++++----------- src/mtx_slice.c | 4 ++-- src/mtx_sort.c | 52 ++++++++++++++++++++++++---------------------------- src/mtx_sum.c | 1 - 32 files changed, 135 insertions(+), 160 deletions(-) (limited to 'src') diff --git a/src/iemmatrix.h b/src/iemmatrix.h index cf7b771..2e9eb13 100644 --- a/src/iemmatrix.h +++ b/src/iemmatrix.h @@ -73,7 +73,7 @@ # include # if defined (MAC_OS_X_VERSION_10_3) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 # else -//float intrinsics not in math.h, so we define them here +/* float intrinsics not in math.h, so we define them here */ # define sqrtf(v) (float)sqrt((double)(v)) # define cosf(v) (float)cos((double)(v)) # define sinf(v) (float)sin((double)(v)) @@ -108,16 +108,16 @@ typedef struct _mtx_binscalar { t_object x_obj; - t_matrix m; // the output matrix - t_float f; // the second input + t_matrix m; /* the output matrix */ + t_float f; /* the second input */ } t_mtx_binscalar; typedef struct _mtx_binmtx { t_object x_obj; - t_matrix m; // the output matrix - t_matrix m2; // the second input + t_matrix m; /* the output matrix */ + t_matrix m2; /* the second input */ } t_mtx_binmtx; diff --git a/src/mtx_bspline.c b/src/mtx_bspline.c index 9fec0a9..6bdd883 100644 --- a/src/mtx_bspline.c +++ b/src/mtx_bspline.c @@ -102,9 +102,7 @@ static void mtx_bspline_matrix2(t_mtx_spline *X, t_symbol *s, int argc, t_atom * mtx_bspline_resize(X, row, col); - //for(i=0; iatombuffer, cholesky); - // 4b destroy the buffers + /* 4b destroy the buffers */ freebytes(original, sizeof(t_matrixfloat)*row2); - // 4c output the atombuf; + /* 4c output the atombuf; */ matrix_bang(x); } diff --git a/src/mtx_colon.c b/src/mtx_colon.c index 4e36630..6d8f48c 100644 --- a/src/mtx_colon.c +++ b/src/mtx_colon.c @@ -72,7 +72,6 @@ static void mTXColonList (MTXColon *mtx_colon_obj, t_symbol *s, } size = (int)((stopval- startval + step) / step); - //post("startval %f stopval %f step %f, size %d",startval, stopval, step, size); if (size) { if (size!=mtx_colon_obj->size) { if (list_out) diff --git a/src/mtx_concat.c b/src/mtx_concat.c index 8e353e5..872e706 100644 --- a/src/mtx_concat.c +++ b/src/mtx_concat.c @@ -149,7 +149,7 @@ static void mTXConcatMatrix (MTXconcat *mtx_concat_obj, t_symbol *s, t_matrix *mtx_in2 = &mtx_concat_obj->mtx_in2; t_matrix *mtx_out = &mtx_concat_obj->mtx_out; - // size check + /* size check */ if (!size) { post("mtx_concat: invalid dimensions"); return; @@ -161,8 +161,8 @@ static void mTXConcatMatrix (MTXconcat *mtx_concat_obj, t_symbol *s, mtx_in1->row = rows; mtx_in1->col = columns; mtx_in1->atombuffer = argv; -// alternatively to the above: -// matrix_matrix2 (mtx_in1, s, argc, argv); + /* alternatively to the above: */ + /* matrix_matrix2 (mtx_in1, s, argc, argv); */ if (mtx_concat_obj->concat_mode == 0) { mTXConcatDoRowConcatenation(mtx_concat_obj, mtx_in1, mtx_in2, mtx_out); diff --git a/src/mtx_conv.c b/src/mtx_conv.c index b09b143..43655f4 100644 --- a/src/mtx_conv.c +++ b/src/mtx_conv.c @@ -221,7 +221,7 @@ static void mTXConvMatrix (MTXConv *mtx_conv_obj, t_symbol *s, int size_y = mtx_conv_obj->size_y; t_atom *list_ptr = mtx_conv_obj->list; - // fftsize check + /* fftsize check */ if (!size){ post("mtx_conv: invalid dimensions"); return; @@ -233,8 +233,6 @@ static void mTXConvMatrix (MTXConv *mtx_conv_obj, t_symbol *s, return; } - // post("1"); - if ((mtx_conv_obj->rows != rows)||(mtx_conv_obj->columns != columns)) { if (mtx_conv_obj->x) deleteTFloatMatrix (mtx_conv_obj->rows, mtx_conv_obj->columns, @@ -248,7 +246,6 @@ static void mTXConvMatrix (MTXConv *mtx_conv_obj, t_symbol *s, mtx_conv_obj->rows = rows; mtx_conv_obj->columns = columns; } - //post("2"); rows_y = rows+rows_k-1; columns_y = columns+columns_k-1; if ((mtx_conv_obj->rows_y != rows_y)||(mtx_conv_obj->columns_y != columns_y)) { @@ -277,7 +274,7 @@ static void mTXConvMatrix (MTXConv *mtx_conv_obj, t_symbol *s, } } - // main part + /* main part */ readMatrixFromList (rows, columns, argv, mtx_conv_obj->x); convolveMtx (rows, columns, rows_k, columns_k, @@ -289,7 +286,6 @@ static void mTXConvMatrix (MTXConv *mtx_conv_obj, t_symbol *s, SETFLOAT(&list_ptr[1], columns_y); outlet_anything(mtx_conv_obj->list_outlet, gensym("matrix"), size_y+2, list_ptr); - //post("7"); } void mtx_conv_setup (void) diff --git a/src/mtx_cumsum.c b/src/mtx_cumsum.c index 8e98052..dfc8640 100644 --- a/src/mtx_cumsum.c +++ b/src/mtx_cumsum.c @@ -157,7 +157,7 @@ static void mTXCumsumMatrix (MTXCumsum *mtx_cumsum_obj, t_symbol *s, t_float *y = mtx_cumsum_obj->y; int count; - // size check + /* size check */ if (!size) { post("mtx_cumsum: invalid dimensions"); return; @@ -192,8 +192,8 @@ static void mTXCumsumMatrix (MTXCumsum *mtx_cumsum_obj, t_symbol *s, mtx_cumsum_obj->x = x; mtx_cumsum_obj->y = y; - // main part - // reading matrix from inlet + /* main part */ + /* reading matrix from inlet */ if ((mtx_cumsum_obj->cumsum_mode == col_sym) || (mtx_cumsum_obj->cumsum_mode == col_sym2)) { readFloatFromListModulo (size, columns, list_ptr, x); @@ -203,7 +203,7 @@ static void mTXCumsumMatrix (MTXCumsum *mtx_cumsum_obj, t_symbol *s, else readFloatFromList (size, list_ptr, x); - // calculating cumsum + /* calculating cumsum */ if (mtx_cumsum_obj->cumsum_direction == -1) { if ((mtx_cumsum_obj->cumsum_mode == row_sym) || (mtx_cumsum_obj->cumsum_mode == col_sym) || @@ -231,7 +231,7 @@ static void mTXCumsumMatrix (MTXCumsum *mtx_cumsum_obj, t_symbol *s, x = mtx_cumsum_obj->x; y = mtx_cumsum_obj->y; - // writing matrix to outlet + /* writing matrix to outlet */ if ((mtx_cumsum_obj->cumsum_mode == col_sym) || (mtx_cumsum_obj->cumsum_mode == col_sym2)) { columns = mtx_cumsum_obj->columns; diff --git a/src/mtx_decay.c b/src/mtx_decay.c index f172231..16cd002 100644 --- a/src/mtx_decay.c +++ b/src/mtx_decay.c @@ -179,7 +179,7 @@ static void mTXDecayMatrix (MTXDecay *mtx_decay_obj, t_symbol *s, t_float *y = mtx_decay_obj->y; int count; - // size check + /* size check */ if (!size) { post("mtx_decay: invalid dimensions"); return; @@ -214,8 +214,8 @@ static void mTXDecayMatrix (MTXDecay *mtx_decay_obj, t_symbol *s, mtx_decay_obj->x = x; mtx_decay_obj->y = y; - // main part - // reading matrix from inlet + /* main part */ + /* reading matrix from inlet */ if ((mtx_decay_obj->decay_mode == col_sym) || (mtx_decay_obj->decay_mode == col_sym2)) { @@ -226,7 +226,7 @@ static void mTXDecayMatrix (MTXDecay *mtx_decay_obj, t_symbol *s, else readFloatFromList (size, list_ptr, x); - // calculating decay + /* calculating decay */ if (mtx_decay_obj->decay_direction == -1) { if ((mtx_decay_obj->decay_mode == col_sym) || (mtx_decay_obj->decay_mode == col_sym2) || @@ -254,7 +254,7 @@ static void mTXDecayMatrix (MTXDecay *mtx_decay_obj, t_symbol *s, x = mtx_decay_obj->x; y = mtx_decay_obj->y; - // writing matrix to outlet + /* writing matrix to outlet */ if ((mtx_decay_obj->decay_mode == col_sym) || (mtx_decay_obj->decay_mode == col_sym2)) { columns = mtx_decay_obj->columns; diff --git a/src/mtx_diff.c b/src/mtx_diff.c index cdc743c..96e59b1 100644 --- a/src/mtx_diff.c +++ b/src/mtx_diff.c @@ -150,7 +150,7 @@ static void mTXdiffMatrix (MTXdiff *mtx_diff_obj, t_symbol *s, t_float *y = mtx_diff_obj->y; int count; - // size check + /* size check */ if (!size) { post("mtx_diff: invalid dimensions"); return; @@ -185,8 +185,8 @@ static void mTXdiffMatrix (MTXdiff *mtx_diff_obj, t_symbol *s, mtx_diff_obj->x = x; mtx_diff_obj->y = y; - // main part - // reading matrix from inlet + /* main part */ + /* reading matrix from inlet */ if ((mtx_diff_obj->diff_mode == col_sym) || (mtx_diff_obj->diff_mode == col_sym2)) { readFloatFromListModulo (size, columns, list_ptr, x); @@ -196,7 +196,7 @@ static void mTXdiffMatrix (MTXdiff *mtx_diff_obj, t_symbol *s, else readFloatFromList (size, list_ptr, x); - // calculating diff + /* calculating diff */ if (mtx_diff_obj->diff_direction == -1) { if ((mtx_diff_obj->diff_mode == row_sym) || (mtx_diff_obj->diff_mode == col_sym) || @@ -223,7 +223,7 @@ static void mTXdiffMatrix (MTXdiff *mtx_diff_obj, t_symbol *s, x = mtx_diff_obj->x; y = mtx_diff_obj->y; - // writing matrix to outlet + /* writing matrix to outlet */ if ((mtx_diff_obj->diff_mode == col_sym) || (mtx_diff_obj->diff_mode == col_sym2)) { columns = mtx_diff_obj->columns; diff --git a/src/mtx_element.c b/src/mtx_element.c index 04a4f70..ddd5a6f 100644 --- a/src/mtx_element.c +++ b/src/mtx_element.c @@ -55,7 +55,7 @@ static void mtx_element_float(t_matrix *x, t_floatarg f) ap+=x->col*(x->current_row-1); count=x->col; while(count--)SETFLOAT(&ap[count], f); - } else { // x->current_row==0 + } else { ap+=x->current_col-1; count=x->row; while(count--)SETFLOAT(&ap[count*x->col], f); diff --git a/src/mtx_eq.c b/src/mtx_eq.c index 194540f..d3a0dcc 100644 --- a/src/mtx_eq.c +++ b/src/mtx_eq.c @@ -18,6 +18,6 @@ #define MTXBIN_GENERIC__OPERATOR == /* the operator operates on integers instead of floats */ -//#define MTXBIN_GENERIC__INTEGEROP +/* #define MTXBIN_GENERIC__INTEGEROP */ #include "mtx_binop_generic.h" diff --git a/src/mtx_fill.c b/src/mtx_fill.c index 901793f..0c2089f 100644 --- a/src/mtx_fill.c +++ b/src/mtx_fill.c @@ -103,7 +103,7 @@ static void mTXFillIndexMatrix (MTXfill *mtx_fill_obj, t_symbol *s, int list_size = argc - 2; int *idx = mtx_fill_obj->index; - // size check + /* size check */ if (!size) { mtx_fill_obj->fill_type = DONT_FILL_JUST_PASS; return; @@ -175,7 +175,7 @@ static void mTXBigMatrix (MTXfill *mtx_fill_obj, t_symbol *s, int list_size = argc - 2; t_atom *list_out = mtx_fill_obj->list_out; - // size check + /* size check */ if (!size) { post("mtx_fill: invalid dimensions"); return; @@ -236,7 +236,7 @@ static void mTXFillScalar (MTXfill *mtx_fill_obj, t_float f) post("mtx_fill: no matrix defined for filling"); return; } - // main part + /* main part */ writeFloatIndexedIntoMatrix (mtx_fill_obj->num_idcs_used, mtx_fill_obj->index, f,list_out+2); default: @@ -264,7 +264,7 @@ static void mTXFillMatrix (MTXfill *mtx_fill_obj, t_symbol *s, return; } - // size check + /* size check */ if (!list_size) { post("mtx_fill: invalid dimensions"); return; @@ -297,7 +297,7 @@ static void mTXFillMatrix (MTXfill *mtx_fill_obj, t_symbol *s, return; } - // main part + /* main part */ switch (mtx_fill_obj->fill_type) { case FILL_SUBMATRIX: list_out += columns * (mtx_fill_obj->fill_startrow-1) + diff --git a/src/mtx_find.c b/src/mtx_find.c index b3fe0fe..71bc84a 100644 --- a/src/mtx_find.c +++ b/src/mtx_find.c @@ -28,7 +28,6 @@ struct _MTXfind_ t_object x_obj; int size; int outsize; - //int find_dimension; t_symbol *find_mode; int find_direction; @@ -68,8 +67,6 @@ static void mTXSetFindMode (MTXfind *mtx_find_obj, t_symbol *c_dim) static void *newMTXFind (t_symbol *s, int argc, t_atom *argv) { MTXfind *mtx_find_obj = (MTXfind *) pd_new (mtx_find_class); -// int c_dim = 0; -// int c_dir = 1; mTXSetFindMode (mtx_find_obj, gensym(":")); mTXSetFindDirection (mtx_find_obj, 1); @@ -237,7 +234,7 @@ static void mTXFindMatrix (MTXfind *mtx_find_obj, t_symbol *s, int rows_out; int columns_out; - // size check + /* size check */ if (!size) { post("mtx_find: invalid dimensions"); return; @@ -259,9 +256,8 @@ static void mTXFindMatrix (MTXfind *mtx_find_obj, t_symbol *s, mtx_find_obj->size = size; mtx_find_obj->list_out = list_out; - // main part + /* main part */ list_out += 2; - //copyList (size, argv, list_out); rows_out = 1; if (mtx_find_obj->find_mode == row_sym) { if (mtx_find_obj->find_direction == -1) @@ -339,7 +335,6 @@ void mtx_find_setup (void) CLASS_DEFAULT, A_GIMME, 0); class_addbang (mtx_find_class, (t_method) mTXFindBang); class_addmethod (mtx_find_class, (t_method) mTXFindMatrix, gensym("matrix"), A_GIMME,0); -// class_addmethod (mtx_find_class, (t_method) mTXSetFindDimension, gensym("dimension"), A_DEFFLOAT,0); class_addmethod (mtx_find_class, (t_method) mTXSetFindMode, gensym("mode"), A_DEFSYMBOL,0); class_addmethod (mtx_find_class, (t_method) mTXSetFindDirection, gensym("direction"), A_DEFFLOAT,0); diff --git a/src/mtx_gauss.c b/src/mtx_gauss.c index 8d64cf6..139ea0f 100644 --- a/src/mtx_gauss.c +++ b/src/mtx_gauss.c @@ -45,7 +45,7 @@ static void mtx_gauss_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv) const t_matrixfloat singrange = 1.0e-10; t_matrixfloat *original; - t_matrixfloat *a1, *a2; // dummy pointers + t_matrixfloat *a1, *a2; /* dummy pointers */ if(row*col+2>argc){ @@ -57,11 +57,11 @@ static void mtx_gauss_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv) return; } - // reserve memory for outputting afterwards + /* reserve memory for outputting afterwards */ adjustsize(x, row, row); original=matrix2float(argv); - // Gauss elimination + /* Gauss elimination */ for(i=0; iatombuffer, original); - // 3c output the atombuf; + /* 3c output the atombuf; */ matrix_bang(x); } diff --git a/src/mtx_ge.c b/src/mtx_ge.c index 4d4403f..22354fb 100644 --- a/src/mtx_ge.c +++ b/src/mtx_ge.c @@ -18,6 +18,6 @@ #define MTXBIN_GENERIC__OPERATOR >= /* the operator operates on integers instead of floats */ -//#define MTXBIN_GENERIC__INTEGEROP +/* #define MTXBIN_GENERIC__INTEGEROP */ #include "mtx_binop_generic.h" diff --git a/src/mtx_gt.c b/src/mtx_gt.c index 42ec3e1..0be7d5a 100644 --- a/src/mtx_gt.c +++ b/src/mtx_gt.c @@ -18,6 +18,6 @@ #define MTXBIN_GENERIC__OPERATOR > /* the operator operates on integers instead of floats */ -//#define MTXBIN_GENERIC__INTEGEROP +/* #define MTXBIN_GENERIC__INTEGEROP */ #include "mtx_binop_generic.h" diff --git a/src/mtx_index.c b/src/mtx_index.c index a4ca156..cd993b0 100644 --- a/src/mtx_index.c +++ b/src/mtx_index.c @@ -118,7 +118,7 @@ static void mTXIndexRightMatrix (MTXindex *mtx_index_obj, t_symbol *s, int *index_in = mtx_index_obj->index_in; int max; - // size check + /* size check */ if (!size) { post("mtx_index: invalid dimensions"); return; @@ -167,7 +167,7 @@ static void mTXIndexMatrix (MTXindex *mtx_index_obj, t_symbol *s, int index_columns = mtx_index_obj->index_columns; int *indx = mtx_index_obj->index_in; - // size check + /* size check */ if (!size) { post("mtx_index: invalid dimensions"); return; @@ -185,7 +185,7 @@ static void mTXIndexMatrix (MTXindex *mtx_index_obj, t_symbol *s, post("mtx_index: index with what? no right matrix defined"); return; } - // main part + /* main part */ list_out += 2; setAtomListConstFloat (mtx_index_obj->index_size, list_out, mtx_index_obj->fill_value); writeIndexedValuesIntoList (mtx_index_obj->index_size, indx,list_in,list_out); diff --git a/src/mtx_le.c b/src/mtx_le.c index 50bc456..d4df459 100644 --- a/src/mtx_le.c +++ b/src/mtx_le.c @@ -18,6 +18,6 @@ #define MTXBIN_GENERIC__OPERATOR <= /* the operator operates on integers instead of floats */ -//#define MTXBIN_GENERIC__INTEGEROP +/* #define MTXBIN_GENERIC__INTEGEROP */ #include "mtx_binop_generic.h" diff --git a/src/mtx_lt.c b/src/mtx_lt.c index 2b610d4..d6a5ee8 100644 --- a/src/mtx_lt.c +++ b/src/mtx_lt.c @@ -18,6 +18,6 @@ #define MTXBIN_GENERIC__OPERATOR < /* the operator operates on integers instead of floats */ -//#define MTXBIN_GENERIC__INTEGEROP +/* #define MTXBIN_GENERIC__INTEGEROP */ #include "mtx_binop_generic.h" diff --git a/src/mtx_minmax.c b/src/mtx_minmax.c index f4345b9..c2d128e 100644 --- a/src/mtx_minmax.c +++ b/src/mtx_minmax.c @@ -27,7 +27,7 @@ struct _MTXminmax_ int size; int outsize; int mode; - int operator_minimum; // 1 if we are [mtx_min], 0 if we are [mtx_max] + int operator_minimum; /* 1 if we are [mtx_min], 0 if we are [mtx_max] */ t_outlet *min_outlet; t_outlet *max_outlet; @@ -142,7 +142,7 @@ static void mTXMinMaxMatrix (MTXminmax *mtx_minmax_obj, t_symbol *s, t_atom *minlist_out = mtx_minmax_obj->minlist_out; int elements_out; - // size check + /* size check */ if (!size) { post("mtx_minmax: invalid dimensions"); return; @@ -171,7 +171,7 @@ static void mTXMinMaxMatrix (MTXminmax *mtx_minmax_obj, t_symbol *s, mtx_minmax_obj->minlist_out = minlist_out; mtx_minmax_obj->maxlist_out = maxlist_out; - // main part + /* main part */ switch(mtx_minmax_obj->mode){ case 1: diff --git a/src/mtx_mul~.c b/src/mtx_mul~.c index 11306e8..b3d1130 100644 --- a/src/mtx_mul~.c +++ b/src/mtx_mul~.c @@ -103,7 +103,7 @@ static void matrix_multilde_matrix_set(t_matrix_multilde *x, int argc, t_atom *a length = col * row; if(transpose){ - // we need to transpose the matrix + /* we need to transpose the matrix */ for(i=0; ix_retarget = 0; - //post("time = %f ms, ticks = %d, inc = %f", x->x_time_ms, nticks, *inc); } if(x->x_remaining_ticks) diff --git a/src/mtx_neq.c b/src/mtx_neq.c index b439104..69a4c57 100644 --- a/src/mtx_neq.c +++ b/src/mtx_neq.c @@ -18,6 +18,6 @@ #define MTXBIN_GENERIC__OPERATOR != /* the operator operates on integers instead of floats */ -//#define MTXBIN_GENERIC__INTEGEROP +/* #define MTXBIN_GENERIC__INTEGEROP */ #include "mtx_binop_generic.h" diff --git a/src/mtx_pivot.c b/src/mtx_pivot.c index f03e289..21b91fb 100644 --- a/src/mtx_pivot.c +++ b/src/mtx_pivot.c @@ -21,9 +21,9 @@ typedef struct _mtx_pivot { t_object x_obj; - t_matrix m; // the output matrix - t_matrix m_pre; // the pre -multiply matrix - t_matrix m_post; // the post-multiply matrix + t_matrix m; /* the output matrix */ + t_matrix m_pre; /* the pre -multiply matrix */ + t_matrix m_post; /* the post-multiply matrix */ t_outlet *pivo, *pre, *post; @@ -79,7 +79,7 @@ static void mtx_pivot_matrix(t_mtx_pivot *x, t_symbol *s, int argc, t_atom *argv /* do the pivot thing */ for (k=0; klist_out; - // size check + /* size check */ if (!size) { post("mtx_repmat: invalid dimensions"); return; @@ -129,9 +129,8 @@ static void mTXRepmatMatrix (MTXrepmat *mtx_repmat_obj, t_symbol *s, list_out = (t_atom*) getbytes (sizeof(t_atom)*(size+2)); mtx_repmat_obj->list_out = list_out; mtx_repmat_obj->size = size; - //post("size %d, rows %d, columns %d", size, rows, columns); } - // main part + /* main part */ writeRepeatIntoMatrix (rep_rows, rep_cols, rows, columns, list_in, list_out+2); diff --git a/src/mtx_resize.c b/src/mtx_resize.c index 5c2323c..dfa182c 100644 --- a/src/mtx_resize.c +++ b/src/mtx_resize.c @@ -48,7 +48,7 @@ static void mtx_resize_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv) if (!r)r=row; if (!c)c=col; - if (r==row && c==col) { // no need to change + if (r==row && c==col) { /* no need to change */ outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, argv); return; } diff --git a/src/mtx_reverse.c b/src/mtx_reverse.c index 816bec6..8a040f8 100644 --- a/src/mtx_reverse.c +++ b/src/mtx_reverse.c @@ -23,7 +23,7 @@ struct _MTXreverse_ { t_object x_obj; int size; - int reverse_mode; // 0=col; 1=row + int reverse_mode; /* 0=col; 1=row */ t_outlet *list_outlet; t_atom *list_out; @@ -45,7 +45,7 @@ static void mTXSetReverseMode (MTXreverse *mtx_reverse_obj, t_symbol *c_mode) case 'r': case 'R': /* "row" */ mtx_reverse_obj->reverse_mode = 0; break; - case 'e': case 'E': case '.': // "element" just revert the whole matrix as if it was a list + case 'e': case 'E': case '.': /* "element" just revert the whole matrix as if it was a list */ mtx_reverse_obj->reverse_mode = -1; break; default: @@ -113,7 +113,7 @@ static void mTXreverseMatrix (MTXreverse *mtx_reverse_obj, t_symbol *s, t_atom *list_out = mtx_reverse_obj->list_out; int count; - // size check + /* size check */ if (!size) { error("mtx_reverse: invalid dimensions"); return; @@ -135,7 +135,7 @@ static void mTXreverseMatrix (MTXreverse *mtx_reverse_obj, t_symbol *s, mtx_reverse_obj->size = size; mtx_reverse_obj->list_out = list_out; - // main part + /* main part */ list_out += 2; copyList (size, argv, list_out); @@ -169,7 +169,6 @@ void mtx_reverse_setup (void) CLASS_DEFAULT, A_GIMME, 0); class_addbang (mtx_reverse_class, (t_method) mTXreverseBang); class_addmethod (mtx_reverse_class, (t_method) mTXreverseMatrix, gensym("matrix"), A_GIMME,0); -// class_addmethod (mtx_reverse_class, (t_method) mTXSetreverseDimension, gensym("dimension"), A_DEFFLOAT,0); class_addmethod (mtx_reverse_class, (t_method) mTXSetReverseMode, gensym("mode"), A_DEFSYMBOL,0); } diff --git a/src/mtx_rowrfft.c b/src/mtx_rowrfft.c index 7745f55..b3d0517 100644 --- a/src/mtx_rowrfft.c +++ b/src/mtx_rowrfft.c @@ -103,7 +103,6 @@ static void readFloatFromList (int n, t_atom *l, t_float *f) static void mTXrowrfftMatrix (MTXRowrfft *x, t_symbol *s, int argc, t_atom *argv) { - //mTXrowrfftList (x, s, argc-2, argv+2); int rows = atom_getint (argv++); int columns = atom_getint (argv++); int columns_re = (columns>>1)+1; /* N/2+1 samples needed for real part of realfft */ @@ -116,7 +115,7 @@ static void mTXrowrfftMatrix (MTXRowrfft *x, t_symbol *s, t_float *f_re = x->f_re; t_float *f_im = x->f_im; - // fftsize check + /* fftsize check */ if (!size) post("mtx_rowrfft: invalid dimensions"); else if (in_sizef_re = f_re; x->f_im = f_im; - // main part + /* main part */ readFloatFromList (size, argv, f_re); fft_count = rows; diff --git a/src/mtx_rowrifft.c b/src/mtx_rowrifft.c index d8d6530..a70e405 100644 --- a/src/mtx_rowrifft.c +++ b/src/mtx_rowrifft.c @@ -38,7 +38,7 @@ typedef struct _MTXRowrifft_ } MTXRowrifft; -// helper functions: these should really go into a separate file! +/* helper functions: these should really go into a separate file! */ static void zeroFloatArray (int n, t_float *f) @@ -58,7 +58,7 @@ static void readFloatFromList (int n, t_atom *l, t_float *f) *f++ = atom_getfloat (l++); } -//--------------inverse real fft +/*--------------inverse real fft */ static void multiplyVector (int n, t_float *f, t_float fac) { @@ -90,8 +90,7 @@ static void *newMTXRowrifft (t_symbol *s, int argc, t_atom *argv) static void mTXrowrifftMatrixCold (MTXRowrifft *x, t_symbol *s, int argc, t_atom *argv) { - //mTXrowrifftList (x, s, argc-2, argv+2); - int rows = atom_getint (argv++); + int rows = atom_getint (argv++); int columns_re = atom_getint (argv++); int in_size = argc-2; int columns = (columns_re-1)<<1; @@ -102,7 +101,7 @@ static void mTXrowrifftMatrixCold (MTXRowrifft *x, t_symbol *s, t_float *f_re = x->f_re; t_float *f_im = x->f_im; - // ifftsize check + /* ifftsize check */ if (columns_re < 3) post("mtx_rowrifft: matrix must have at least 3 columns"); else if (!size) @@ -113,7 +112,7 @@ static void mTXrowrifftMatrixCold (MTXRowrifft *x, t_symbol *s, post("mtx_rowrifft: too small matrices"); else if (columns == (1 << ilog2(columns))) { - // memory things + /* memory things */ f_re=(t_float*)realloc(f_re, sizeof(t_float)*size); f_im=(t_float*)realloc(f_im, sizeof(t_float)*size); list_re=(t_atom*)realloc(list_re, sizeof(t_atom)*(size+2)); @@ -127,7 +126,7 @@ static void mTXrowrifftMatrixCold (MTXRowrifft *x, t_symbol *s, x->f_re = f_re; x->f_im = f_im; - // main part: reading imaginary part + /* main part: reading imaginary part */ ifft_count = rows; x->renorm_fac = 1.0f / columns; while (ifft_count--) { @@ -135,7 +134,7 @@ static void mTXrowrifftMatrixCold (MTXRowrifft *x, t_symbol *s, argv += columns_re; f_im += columns; } - // do nothing else! + /* do nothing else! */ } else post("mtx_rowrifft: rowvector 2*(size+1) no power of 2!"); @@ -144,7 +143,6 @@ static void mTXrowrifftMatrixCold (MTXRowrifft *x, t_symbol *s, static void mTXrowrifftMatrixHot (MTXRowrifft *x, t_symbol *s, int argc, t_atom *argv) { - //mTXrowrifftList (x, s, argc-2, argv+2); int rows = atom_getint (argv++); int columns_re = atom_getint (argv++); int columns = x->columns; @@ -157,7 +155,7 @@ static void mTXrowrifftMatrixHot (MTXRowrifft *x, t_symbol *s, t_float *f_im = x->f_im; t_float renorm_fac = x->renorm_fac; - // ifftsize check + /* ifftsize check */ if ((rows != x->rows) || (columns_re != x->columns_re)) post("mtx_rowrifft: matrix dimensions do not match"); @@ -165,7 +163,7 @@ static void mTXrowrifftMatrixHot (MTXRowrifft *x, t_symbol *s, post("mtx_rowrifft: sparse matrix not yet supported: use \"mtx_check\""); else if (!x->size2) post("mtx_rowrifft: invalid right side matrix"); - else { // main part + else { /* main part */ ifft_count = rows; ptr_re += 2; while (ifft_count--){ diff --git a/src/mtx_slice.c b/src/mtx_slice.c index 3adfe5c..8f88404 100644 --- a/src/mtx_slice.c +++ b/src/mtx_slice.c @@ -142,7 +142,7 @@ static void mTXSliceMatrix (MTXslice *mtx_slice_obj, t_symbol *s, int startcol = mtx_slice_obj->slice_startcol; int slicecols, slicerows, slicesize; - // size check + /* size check */ if (!size) { post("mtx_slice: invalid dimensions"); return; @@ -172,7 +172,7 @@ static void mTXSliceMatrix (MTXslice *mtx_slice_obj, t_symbol *s, slicecols = stopcol-startcol+1; slicesize = slicerows*slicecols; - // main part + /* main part */ if (slicesize != mtx_slice_obj->slice_size) { if (!list_out) list_out = (t_atom *) getbytes (sizeof (t_atom) * (slicesize + 2)); diff --git a/src/mtx_sort.c b/src/mtx_sort.c index 10217e0..2bc04a4 100644 --- a/src/mtx_sort.c +++ b/src/mtx_sort.c @@ -36,7 +36,6 @@ struct _MTXSort_ t_atom *list_out2; t_atom *list_in; t_float *x; -// t_float *y; t_float *i; }; @@ -48,8 +47,10 @@ static void deleteMTXSort (MTXSort *mtx_sort_obj) freebytes (mtx_sort_obj->list_out2, sizeof(t_atom)*(mtx_sort_obj->size+2)); if (mtx_sort_obj->x) freebytes (mtx_sort_obj->x, sizeof(t_float)*(mtx_sort_obj->size)); - //if (mtx_sort_obj->y) - // freebytes (mtx_sort_obj->y, sizeof(t_float)*(mtx_sort_obj->size)); + /* + if (mtx_sort_obj->y) + freebytes (mtx_sort_obj->y, sizeof(t_float)*(mtx_sort_obj->size)); + */ if (mtx_sort_obj->i) freebytes (mtx_sort_obj->i, sizeof(t_float)*(mtx_sort_obj->size)); } @@ -69,7 +70,7 @@ static void *newMTXSort (t_symbol *s, int argc, t_atom *argv) { MTXSort *mtx_sort_obj = (MTXSort *) pd_new (mtx_sort_class); - // defaults: + /* defaults: */ mTXSetSortMode (mtx_sort_obj, gensym(":")); mTXSetSortDirection (mtx_sort_obj, 1.0f); if (argc>=1) { @@ -243,11 +244,10 @@ static void mTXSortMatrix (MTXSort *mtx_sort_obj, t_symbol *s, t_atom *list_out1 = mtx_sort_obj->list_out1; t_atom *list_out2 = mtx_sort_obj->list_out2; t_float *x = mtx_sort_obj->x; - //t_float *y = mtx_sort_obj->y; t_float *i = mtx_sort_obj->i; int count; - // size check + /* size check */ if (!size) { post("mtx_sort: invalid dimensions"); return; @@ -259,8 +259,9 @@ static void mTXSortMatrix (MTXSort *mtx_sort_obj, t_symbol *s, else if ((!x)||(!list_out1)||(!list_out2)/*||(!y)*/) { if (!x) x = (t_float *) getbytes (sizeof (t_float) * (size)); - //if (!y) - // y = (t_float *) getbytes (sizeof (t_float) * (size)); + /*if (!y) + * y = (t_float *) getbytes (sizeof (t_float) * (size)); + */ if (!i) i = (t_float *) getbytes (sizeof (t_float) * (size)); if (!list_out1) @@ -270,36 +271,32 @@ static void mTXSortMatrix (MTXSort *mtx_sort_obj, t_symbol *s, } else if (size != mtx_sort_obj->size) { x = (t_float *) resizebytes (x, - sizeof (t_float) * (mtx_sort_obj->size), - sizeof (t_float) * (size)); - //y = (t_float *) resizebytes (y, - // sizeof (t_float) * (mtx_sort_obj->size), - // sizeof (t_float) * (size)); + sizeof (t_float) * (mtx_sort_obj->size), + sizeof (t_float) * (size)); i = (t_float *) resizebytes (i, - sizeof (t_float) * (mtx_sort_obj->size), - sizeof (t_float) * (size)); + sizeof (t_float) * (mtx_sort_obj->size), + sizeof (t_float) * (size)); list_out1 = (t_atom *) resizebytes (list_out1, - sizeof (t_atom) * (mtx_sort_obj->size+2), - sizeof (t_atom) * (size + 2)); + sizeof (t_atom) * (mtx_sort_obj->size+2), + sizeof (t_atom) * (size + 2)); list_out2 = (t_atom *) resizebytes (list_out2, - sizeof (t_atom) * (mtx_sort_obj->size+2), - sizeof (t_atom) * (size + 2)); + sizeof (t_atom) * (mtx_sort_obj->size+2), + sizeof (t_atom) * (size + 2)); } mtx_sort_obj->list_out1 = list_out1; mtx_sort_obj->list_out2 = list_out2; mtx_sort_obj->x = x; - // mtx_sort_obj->y = y; mtx_sort_obj->i = i; mtx_sort_obj->size = size; mtx_sort_obj->rows = rows; mtx_sort_obj->columns = columns; - // generating indexing vector + /* generating indexing vector */ indexingVector (size, columns, mtx_sort_obj->sort_mode, i); - // main part - // reading matrix from inlet + /* main part */ + /* reading matrix from inlet */ if ((mtx_sort_obj->sort_mode == col_sym)|| (mtx_sort_obj->sort_mode == col_sym2)) { readFloatFromListModulo (size, columns, list_ptr, x); @@ -309,7 +306,7 @@ static void mTXSortMatrix (MTXSort *mtx_sort_obj, t_symbol *s, else readFloatFromList (size, list_ptr, x); - // calculating sort + /* calculating sort */ if ((mtx_sort_obj->sort_mode != col_sym) && (mtx_sort_obj->sort_mode != col_sym2) && (mtx_sort_obj->sort_mode != row_sym)) @@ -320,7 +317,7 @@ static void mTXSortMatrix (MTXSort *mtx_sort_obj, t_symbol *s, x = mtx_sort_obj->x; i = mtx_sort_obj->i; - // writing matrix to outlet + /* writing matrix to outlet */ if ((mtx_sort_obj->sort_mode == col_sym)|| (mtx_sort_obj->sort_mode == col_sym2)) { columns = mtx_sort_obj->columns; @@ -333,13 +330,13 @@ static void mTXSortMatrix (MTXSort *mtx_sort_obj, t_symbol *s, writeFloatIntoList (size, list_out2+2, i); } - // writing indices + /* writing indices */ SETSYMBOL(list_out2, gensym("matrix")); SETFLOAT(list_out2, rows); SETFLOAT(&list_out2[1], columns); outlet_anything(mtx_sort_obj->list_outlet2, gensym("matrix"), mtx_sort_obj->size+2, list_out2); - // writing sorted values + /* writing sorted values */ SETSYMBOL(list_out1, gensym("matrix")); SETFLOAT(list_out1, rows); SETFLOAT(&list_out1[1], columns); @@ -358,7 +355,6 @@ void mtx_sort_setup (void) class_addbang (mtx_sort_class, (t_method) mTXSortBang); class_addmethod (mtx_sort_class, (t_method) mTXSortMatrix, gensym("matrix"), A_GIMME,0); class_addmethod (mtx_sort_class, (t_method) mTXSetSortMode, gensym("mode"), A_DEFSYMBOL,0); -// class_addmethod (mtx_sort_class, (t_method) mTXSetSortDimension, gensym("dimension"), A_DEFFLOAT,0); class_addmethod (mtx_sort_class, (t_method) mTXSetSortDirection, gensym("direction"), A_DEFFLOAT,0); row_sym = gensym("row"); diff --git a/src/mtx_sum.c b/src/mtx_sum.c index fd20ab9..0286e2f 100644 --- a/src/mtx_sum.c +++ b/src/mtx_sum.c @@ -63,7 +63,6 @@ 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); } -- cgit v1.2.1