[PD-cvs] externals/iem/iemmatrix/src mtx_abs.c, NONE, 1.1 mtx_and.c, NONE, 1.1 mtx_bitand.c, NONE, 1.1 mtx_bitleft.c, NONE, 1.1 mtx_bitor.c, NONE, 1.1 mtx_bitright.c, NONE, 1.1 mtx_cos.c, NONE, 1.1 mtx_eq.c, NONE, 1.1 mtx_ge.c, NONE, 1.1 mtx_gt.c, NONE, 1.1 mtx_int.c, NONE, 1.1 mtx_le.c, NONE, 1.1 mtx_lt.c, NONE, 1.1 mtx_neq.c, NONE, 1.1 mtx_or.c, NONE, 1.1 mtx_sin.c, NONE, 1.1

IOhannes m zmölnig zmoelnig at users.sourceforge.net
Mon Sep 19 14:51:29 CEST 2005


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

Added Files:
	mtx_abs.c mtx_and.c mtx_bitand.c mtx_bitleft.c mtx_bitor.c 
	mtx_bitright.c mtx_cos.c mtx_eq.c mtx_ge.c mtx_gt.c mtx_int.c 
	mtx_le.c mtx_lt.c mtx_neq.c mtx_or.c mtx_sin.c 
Log Message:
new objects


--- NEW FILE: mtx_and.c ---
/*
 *  iemmatrix
 *
 *  objects fand manipulating simple matrices
 *  mostly refering to matlab/octave matrix functions
 *
 * Copyright (c) IOhannes m zmölnig, forum::für::umläute
 * IEM, Graz, Austria
 *
 * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 *
 */

/* name of the object and the classes */
#define MTXBIN_GENERIC__NAME mtx_and
/* operator; also used for abbreviation of object */
#define MTXBIN_GENERIC__OPERATOR &&

/* the operator operates on integers instead of floats */
#define MTXBIN_GENERIC__INTEGEROP

#include "mtx_binop_generic.h"

--- NEW FILE: mtx_le.c ---
/*
 *  iemmatrix
 *
 *  objects fand manipulating simple matrices
 *  mostly refering to matlab/octave matrix functions
 *
 * Copyright (c) IOhannes m zmölnig, forum::für::umläute
 * IEM, Graz, Austria
 *
 * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 *
 */

/* name of the object and the classes */
#define MTXBIN_GENERIC__NAME mtx_le
/* operator; also used for abbreviation of object */
#define MTXBIN_GENERIC__OPERATOR <=

/* the operator operates on integers instead of floats */
//#define MTXBIN_GENERIC__INTEGEROP

#include "mtx_binop_generic.h"

--- NEW FILE: mtx_bitright.c ---
/*
 *  iemmatrix
 *
 *  objects fand manipulating simple matrices
 *  mostly refering to matlab/octave matrix functions
 *
 * Copyright (c) IOhannes m zmölnig, forum::für::umläute
 * IEM, Graz, Austria
 *
 * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 *
 */

/* name of the object and the classes */
#define MTXBIN_GENERIC__NAME mtx_bitright
/* operator; also used for abbreviation of object */
#define MTXBIN_GENERIC__OPERATOR >>

/* the operator operates on integers instead of floats */
#define MTXBIN_GENERIC__INTEGEROP

#include "mtx_binop_generic.h"

--- NEW FILE: mtx_bitor.c ---
/*
 *  iemmatrix
 *
 *  objects fand manipulating simple matrices
 *  mostly refering to matlab/octave matrix functions
 *
 * Copyright (c) IOhannes m zmölnig, forum::für::umläute
 * IEM, Graz, Austria
 *
 * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 *
 */

/* name of the object and the classes */
#define MTXBIN_GENERIC__NAME mtx_bitor
/* operator; also used for abbreviation of object */
#define MTXBIN_GENERIC__OPERATOR |

/* the operator operates on integers instead of floats */
#define MTXBIN_GENERIC__INTEGEROP

#include "mtx_binop_generic.h"

--- NEW FILE: mtx_lt.c ---
/*
 *  iemmatrix
 *
 *  objects fand manipulating simple matrices
 *  mostly refering to matlab/octave matrix functions
 *
 * Copyright (c) IOhannes m zmölnig, forum::für::umläute
 * IEM, Graz, Austria
 *
 * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 *
 */

/* name of the object and the classes */
#define MTXBIN_GENERIC__NAME mtx_lt
/* operator; also used for abbreviation of object */
#define MTXBIN_GENERIC__OPERATOR <

/* the operator operates on integers instead of floats */
//#define MTXBIN_GENERIC__INTEGEROP

#include "mtx_binop_generic.h"

--- NEW FILE: mtx_gt.c ---
/*
 *  iemmatrix
 *
 *  objects fand manipulating simple matrices
 *  mostly refering to matlab/octave matrix functions
 *
 * Copyright (c) IOhannes m zmölnig, forum::für::umläute
 * IEM, Graz, Austria
 *
 * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 *
 */

/* name of the object and the classes */
#define MTXBIN_GENERIC__NAME mtx_gt
/* operator; also used for abbreviation of object */
#define MTXBIN_GENERIC__OPERATOR >

/* the operator operates on integers instead of floats */
//#define MTXBIN_GENERIC__INTEGEROP

#include "mtx_binop_generic.h"

--- NEW FILE: mtx_sin.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_sin: B=sin(A); */

static t_class *mtx_sin_class;

static void mtx_sin_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv)
{
  int row=atom_getfloat(argv++);
  int col=atom_getfloat(argv++);
  t_atom *m;
  int n = argc-2;

  if (argc<2){    post("mtx_sin: crippled matrix");    return;  }
  if ((col<1)||(row<1)) {    post("mtx_sin: invalid dimensions");    return;  }
  if (col*row>argc-2){    post("sparse matrix not yet supported : use \"mtx_check\"");    return;  }

  adjustsize(&x->m, row, col);
  m =  x->m.atombuffer+2;

  while(n--){
    t_float f = (t_float)sin(atom_getfloat(argv++));
    SETFLOAT(m, f);
    m++;
  }

  outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
}

static void mtx_sin_list(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
{
  int n=argc;
  t_atom *m;
  t_float factor = x->f;

  adjustsize(&x->m, 1, argc);
  m = x->m.atombuffer;

  while(n--){
    m->a_type = A_FLOAT;
    (m++)->a_w.w_float = (t_float)sin(atom_getfloat(argv++));
  }

  outlet_list(x->x_obj.ob_outlet, gensym("list"), argc, x->m.atombuffer);
}

static void *mtx_sin_new(t_symbol *s)
{
  /* element sin */
  t_matrix *x = (t_matrix *)pd_new(mtx_sin_class);
  outlet_new(&x->x_obj, 0);
  x->col = x->row = 0;
  x->atombuffer = 0;
  return(x);
}

void mtx_sin_setup(void)
{
  mtx_sin_class = class_new(gensym("mtx_sin"), (t_newmethod)mtx_sin_new, (t_method)mtx_binmtx_free,
				   sizeof(t_mtx_binmtx), 0, A_GIMME, 0);
  class_addmethod(mtx_sin_class, (t_method)mtx_sin_matrix, gensym("matrix"), A_GIMME, 0);
  class_addlist  (mtx_sin_class, mtx_sin_list);
  class_addbang  (mtx_sin_class, mtx_binmtx_bang);

  class_sethelpsymbol(mtx_sin_class, gensym("iemmatrix/mtx_sin"));
}

void iemtx_sin_setup(void)
{
  mtx_sin_setup();
}

--- NEW FILE: mtx_eq.c ---
/*
 *  iemmatrix
 *
 *  objects fand manipulating simple matrices
 *  mostly refering to matlab/octave matrix functions
 *
 * Copyright (c) IOhannes m zmölnig, forum::für::umläute
 * IEM, Graz, Austria
 *
 * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 *
 */

/* name of the object and the classes */
#define MTXBIN_GENERIC__NAME mtx_eq
/* operator; also used for abbreviation of object */
#define MTXBIN_GENERIC__OPERATOR ==

/* the operator operates on integers instead of floats */
//#define MTXBIN_GENERIC__INTEGEROP

#include "mtx_binop_generic.h"

--- NEW FILE: mtx_abs.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_abs: B=abs(A); */

static t_class *mtx_abs_class;

static void mtx_abs_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv)
{
  int row=atom_getfloat(argv++);
  int col=atom_getfloat(argv++);
  t_atom *m;
  int n = argc-2;

  if (argc<2){    post("mtx_abs: crippled matrix");    return;  }
  if ((col<1)||(row<1)) {    post("mtx_abs: invalid dimensions");    return;  }
  if (col*row>argc-2){    post("sparse matrix not yet supported : use \"mtx_check\"");    return;  }

  adjustsize(&x->m, row, col);
  m =  x->m.atombuffer+2;

  while(n--){
    t_float f = (t_float)abs(atom_getfloat(argv++));
    SETFLOAT(m, f);
    m++;
  }

  outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
}

static void mtx_abs_list(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
{
  int n=argc;
  t_atom *m;
  t_float factor = x->f;

  adjustsize(&x->m, 1, argc);
  m = x->m.atombuffer;

  while(n--){
    m->a_type = A_FLOAT;
    (m++)->a_w.w_float = (t_float)abs(atom_getfloat(argv++));
  }

  outlet_list(x->x_obj.ob_outlet, gensym("list"), argc, x->m.atombuffer);
}

static void *mtx_abs_new(t_symbol *s)
{
  /* element abs */
  t_matrix *x = (t_matrix *)pd_new(mtx_abs_class);
  outlet_new(&x->x_obj, 0);
  x->col = x->row = 0;
  x->atombuffer = 0;
  return(x);
}

void mtx_abs_setup(void)
{
  mtx_abs_class = class_new(gensym("mtx_abs"), (t_newmethod)mtx_abs_new, (t_method)mtx_binmtx_free,
				   sizeof(t_mtx_binmtx), 0, A_GIMME, 0);
  class_addmethod(mtx_abs_class, (t_method)mtx_abs_matrix, gensym("matrix"), A_GIMME, 0);
  class_addlist  (mtx_abs_class, mtx_abs_list);
  class_addbang  (mtx_abs_class, mtx_binmtx_bang);

  class_sethelpsymbol(mtx_abs_class, gensym("iemmatrix/mtx_abs"));
}

void iemtx_abs_setup(void)
{
  mtx_abs_setup();
}

--- NEW FILE: mtx_neq.c ---
/*
 *  iemmatrix
 *
 *  objects fand manipulating simple matrices
 *  mostly refering to matlab/octave matrix functions
 *
 * Copyright (c) IOhannes m zmölnig, forum::für::umläute
 * IEM, Graz, Austria
 *
 * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 *
 */

/* name of the object and the classes */
#define MTXBIN_GENERIC__NAME mtx_neq
/* operator; also used for abbreviation of object */
#define MTXBIN_GENERIC__OPERATOR !=

/* the operator operates on integers instead of floats */
//#define MTXBIN_GENERIC__INTEGEROP

#include "mtx_binop_generic.h"

--- NEW FILE: mtx_cos.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_cos: B=cos(A); */

static t_class *mtx_cos_class;

static void mtx_cos_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv)
{
  int row=atom_getfloat(argv++);
  int col=atom_getfloat(argv++);
  t_atom *m;
  int n = argc-2;

  if (argc<2){    post("mtx_cos: crippled matrix");    return;  }
  if ((col<1)||(row<1)) {    post("mtx_cos: invalid dimensions");    return;  }
  if (col*row>argc-2){    post("sparse matrix not yet supported : use \"mtx_check\"");    return;  }

  adjustsize(&x->m, row, col);
  m =  x->m.atombuffer+2;

  while(n--){
    t_float f = (t_float)cos(atom_getfloat(argv++));
    SETFLOAT(m, f);
    m++;
  }

  outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
}

static void mtx_cos_list(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
{
  int n=argc;
  t_atom *m;
  t_float factor = x->f;

  adjustsize(&x->m, 1, argc);
  m = x->m.atombuffer;

  while(n--){
    m->a_type = A_FLOAT;
    (m++)->a_w.w_float = (t_float)cos(atom_getfloat(argv++));
  }

  outlet_list(x->x_obj.ob_outlet, gensym("list"), argc, x->m.atombuffer);
}

static void *mtx_cos_new(t_symbol *s)
{
  /* element cos */
  t_matrix *x = (t_matrix *)pd_new(mtx_cos_class);
  outlet_new(&x->x_obj, 0);
  x->col = x->row = 0;
  x->atombuffer = 0;
  return(x);
}

void mtx_cos_setup(void)
{
  mtx_cos_class = class_new(gensym("mtx_cos"), (t_newmethod)mtx_cos_new, (t_method)mtx_binmtx_free,
				   sizeof(t_mtx_binmtx), 0, A_GIMME, 0);
  class_addmethod(mtx_cos_class, (t_method)mtx_cos_matrix, gensym("matrix"), A_GIMME, 0);
  class_addlist  (mtx_cos_class, mtx_cos_list);
  class_addbang  (mtx_cos_class, mtx_binmtx_bang);

  class_sethelpsymbol(mtx_cos_class, gensym("iemmatrix/mtx_cos"));
}

void iemtx_cos_setup(void)
{
  mtx_cos_setup();
}

--- NEW FILE: mtx_int.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_int: B=int(A); */

static t_class *mtx_int_class;

static void mtx_int_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv)
{
  int row=atom_getfloat(argv++);
  int col=atom_getfloat(argv++);
  t_atom *m;
  int n = argc-2;

  if (argc<2){    post("mtx_int: crippled matrix");    return;  }
  if ((col<1)||(row<1)) {    post("mtx_int: invalid dimensions");    return;  }
  if (col*row>argc-2){    post("sparse matrix not yet supported : use \"mtx_check\"");    return;  }

  adjustsize(&x->m, row, col);
  m =  x->m.atombuffer+2;

  while(n--){
    t_float f = (t_float)atom_getint(argv++);
    SETFLOAT(m, f);
    m++;
  }

  outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
}

static void mtx_int_list(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
{
  int n=argc;
  t_atom *m;
  t_float factor = x->f;

  adjustsize(&x->m, 1, argc);
  m = x->m.atombuffer;

  while(n--){
    m->a_type = A_FLOAT;
    (m++)->a_w.w_float = (t_float)atom_getint(argv++);
  }

  outlet_list(x->x_obj.ob_outlet, gensym("list"), argc, x->m.atombuffer);
}

static void *mtx_int_new(t_symbol *s)
{
  /* element int */
  t_matrix *x = (t_matrix *)pd_new(mtx_int_class);
  outlet_new(&x->x_obj, 0);
  x->col = x->row = 0;
  x->atombuffer = 0;
  return(x);
}

void mtx_int_setup(void)
{
  mtx_int_class = class_new(gensym("mtx_int"), (t_newmethod)mtx_int_new, (t_method)mtx_binmtx_free,
				   sizeof(t_mtx_binmtx), 0, A_GIMME, 0);
  class_addmethod(mtx_int_class, (t_method)mtx_int_matrix, gensym("matrix"), A_GIMME, 0);
  class_addlist  (mtx_int_class, mtx_int_list);
  class_addbang  (mtx_int_class, mtx_binmtx_bang);

  class_sethelpsymbol(mtx_int_class, gensym("iemmatrix/mtx_int"));
}

void iemtx_int_setup(void)
{
  mtx_int_setup();
}

--- NEW FILE: mtx_bitleft.c ---
/*
 *  iemmatrix
 *
 *  objects fand manipulating simple matrices
 *  mostly refering to matlab/octave matrix functions
 *
 * Copyright (c) IOhannes m zmölnig, forum::für::umläute
 * IEM, Graz, Austria
 *
 * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 *
 */

/* name of the object and the classes */
#define MTXBIN_GENERIC__NAME mtx_bitleft
/* operator; also used for abbreviation of object */
#define MTXBIN_GENERIC__OPERATOR <<

/* the operator operates on integers instead of floats */
#define MTXBIN_GENERIC__INTEGEROP

#include "mtx_binop_generic.h"

--- NEW FILE: mtx_bitand.c ---
/*
 *  iemmatrix
 *
 *  objects fand manipulating simple matrices
 *  mostly refering to matlab/octave matrix functions
 *
 * Copyright (c) IOhannes m zmölnig, forum::für::umläute
 * IEM, Graz, Austria
 *
 * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 *
 */

/* name of the object and the classes */
#define MTXBIN_GENERIC__NAME mtx_bitand
/* operator; also used for abbreviation of object */
#define MTXBIN_GENERIC__OPERATOR &

/* the operator operates on integers instead of floats */
#define MTXBIN_GENERIC__INTEGEROP

#include "mtx_binop_generic.h"

--- NEW FILE: mtx_or.c ---
/*
 *  iemmatrix
 *
 *  objects fand manipulating simple matrices
 *  mostly refering to matlab/octave matrix functions
 *
 * Copyright (c) IOhannes m zmölnig, forum::für::umläute
 * IEM, Graz, Austria
 *
 * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 *
 */

/* name of the object and the classes */
#define MTXBIN_GENERIC__NAME mtx_or
/* operator; also used for abbreviation of object */
#define MTXBIN_GENERIC__OPERATOR ||

/* the operator operates on integers instead of floats */
#define MTXBIN_GENERIC__INTEGEROP

#include "mtx_binop_generic.h"

--- NEW FILE: mtx_ge.c ---
/*
 *  iemmatrix
 *
 *  objects fand manipulating simple matrices
 *  mostly refering to matlab/octave matrix functions
 *
 * Copyright (c) IOhannes m zmölnig, forum::für::umläute
 * IEM, Graz, Austria
 *
 * Fand infandmation on usage and redistribution, and fand a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 *
 */

/* name of the object and the classes */
#define MTXBIN_GENERIC__NAME mtx_ge
/* operator; also used for abbreviation of object */
#define MTXBIN_GENERIC__OPERATOR >=

/* the operator operates on integers instead of floats */
//#define MTXBIN_GENERIC__INTEGEROP

#include "mtx_binop_generic.h"





More information about the Pd-cvs mailing list