示例#1
0
static PyObject *
Py_alpha_norm (PyObject * self, PyObject * args)
{
  PyObject *input;
  fvec_t vec;
  smpl_t alpha;
  PyObject *result;

  if (!PyArg_ParseTuple (args, "O" AUBIO_NPY_SMPL_CHR ":alpha_norm", &input, &alpha)) {
    return NULL;
  }

  if (input == NULL) {
    return NULL;
  }

  if (!PyAubio_ArrayToCFvec(input, &vec)) {
    return NULL;
  }

  // compute the function
  result = Py_BuildValue (AUBIO_NPY_SMPL_CHR, fvec_alpha_norm (&vec, alpha));
  if (result == NULL) {
    return NULL;
  }

  return result;
}
示例#2
0
static PyObject *
Py_alpha_norm (PyObject * self, PyObject * args)
{
  PyObject *input;
  fvec_t *vec;
  smpl_t alpha;
  PyObject *result;

  if (!PyArg_ParseTuple (args, "Of:alpha_norm", &input, &alpha)) {
    return NULL;
  }

  if (input == NULL) {
    return NULL;
  }

  vec = PyAubio_ArrayToCFvec (input);

  if (vec == NULL) {
    return NULL;
  }

  // compute the function
  result = Py_BuildValue ("f", fvec_alpha_norm (vec, alpha));
  if (result == NULL) {
    return NULL;
  }

  return result;
}
示例#3
0
文件: mathutils.c 项目: EQ4/aubio-mod
void
fvec_alpha_normalise (fvec_t * o, smpl_t alpha)
{
  uint_t j;
  smpl_t norm = fvec_alpha_norm (o, alpha);
  for (j = 0; j < o->length; j++) {
    o->data[j] /= norm;
  }
}