[PD-cvs] externals/iem/iemmatrix/src mtx_inverse.c,1.4,1.5

IOhannes m zmölnig zmoelnig at users.sourceforge.net
Wed May 11 16:31:29 CEST 2005


Update of /cvsroot/pure-data/externals/iem/iemmatrix/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30546

Modified Files:
	mtx_inverse.c 
Log Message:
output a righthand bang if inversion fails


Index: mtx_inverse.c
===================================================================
RCS file: /cvsroot/pure-data/externals/iem/iemmatrix/src/mtx_inverse.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** mtx_inverse.c	11 May 2005 14:07:18 -0000	1.4
--- mtx_inverse.c	11 May 2005 14:31:27 -0000	1.5
***************
*** 90,93 ****
--- 90,95 ----
    int col=atom_getfloat(argv+1);
  
+   int error=0;
+ 
    t_matrixfloat *original, *inverted;
  
***************
*** 105,109 ****
    if (row==col){
      /* fine, the matrix is square */
!     inverted=mtx_doInvert(original, row, 0);
    } else {
      /* we'll have to do the pseudo-inverse:
--- 107,111 ----
    if (row==col){
      /* fine, the matrix is square */
!     inverted=mtx_doInvert(original, row, &error);
    } else {
      /* we'll have to do the pseudo-inverse:
***************
*** 117,125 ****
        inverteeCol=col;
        invertee  =mtx_doMultiply(col, transposed, row, original, col);
!       inverted  =mtx_doMultiply(col, mtx_doInvert(invertee, col, 0), col, transposed, row);
      } else {
        inverteeCol=row;
        invertee  =mtx_doMultiply(row, original, col, transposed, row);
!       inverted  =mtx_doMultiply(col, transposed, row, mtx_doInvert(invertee, row, 0), row);
      }
      freebytes(transposed, sizeof(t_matrixfloat)*col*row);
--- 119,127 ----
        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);
***************
*** 133,136 ****
--- 135,140 ----
    freebytes(original, sizeof(t_matrixfloat)*row*col);
  
+   if(error)outlet_bang(x->x_outlet);
+ 
    /* 3c output the atombuf; */
    matrix_bang(x);
***************
*** 143,146 ****
--- 147,151 ----
    x->col=x->row=0;
    x->atombuffer=0;
+   x->x_outlet=outlet_new(&x->x_obj, 0);
  
    return (x);





More information about the Pd-cvs mailing list