source: tests/src/test-cvec.c @ b65230a

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change on this file since b65230a was 986131d, checked in by Eduard Müller <mueller.eduard@googlemail.com>, 7 years ago

Intel IPP support for aubio

See emuell/aubio/ intel_ipp2 for details please

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[332487b]1#include "aubio.h"
[7e35b37]2#include "utils_tests.h"
[4e9101e]3
[158e031]4int main (void)
[7e35b37]5{
[986131d]6  aubio_init();
7
[7e35b37]8  uint_t i, window_size = 16; // window size
9  cvec_t * complex_vector = new_cvec (window_size); // input buffer
10  uint_t rand_times = 4;
[4e9101e]11
[491e6ea]12  utils_init_random();
13
[7e35b37]14  while (rand_times -- ) {
15    // fill with random phas and norm
16    for ( i = 0; i < complex_vector->length; i++ ) {
17      complex_vector->norm[i] = ( 2. / RAND_MAX * random() - 1. );
18      complex_vector->phas[i] = ( 2. / RAND_MAX * random() - 1. ) * M_PI;
19    }
20    // print the vector
21    cvec_print(complex_vector);
22  }
23
24  // set all vector elements to `0`
[5d10ac1]25  cvec_norm_zeros(complex_vector);
[7e35b37]26  for ( i = 0; i < complex_vector->length; i++ ) {
27    assert( complex_vector->norm[i] == 0. );
28    // assert( complex_vector->phas[i] == 0 );
29  }
30  cvec_print(complex_vector);
[4e9101e]31
[7e35b37]32  // set all vector elements to `1`
[5d10ac1]33  cvec_norm_ones(complex_vector);
[7e35b37]34  for ( i = 0; i < complex_vector->length; i++ ) {
35    assert( complex_vector->norm[i] == 1. );
36    // assert( complex_vector->phas[i] == 0 );
37  }
38  cvec_print(complex_vector);
[39a7b26]39
40  cvec_zeros(complex_vector);
[5d10ac1]41  cvec_phas_zeros(complex_vector);
42  cvec_norm_zeros(complex_vector);
43  cvec_norm_ones(complex_vector);
44  cvec_phas_ones(complex_vector);
[39a7b26]45  cvec_copy(complex_vector, complex_vector);
46
[7e35b37]47  // destroy it
48  del_cvec(complex_vector);
[986131d]49
50  aubio_cleanup();
51
[7e35b37]52  return 0;
53}
Note: See TracBrowser for help on using the repository browser.