Changeset 7e35b37 for tests/src/test-cvec.c
- Timestamp:
- Mar 3, 2013, 8:09:48 PM (12 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/applefworks, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 474a573
- Parents:
- abd326c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/src/test-cvec.c
rabd326c r7e35b37 1 1 #include <aubio.h> 2 #include "utils_tests.h" 2 3 3 int main(){ 4 /* allocate some memory */ 5 uint_t win_s = 1024; /* window size */ 6 cvec_t * sp = new_cvec (win_s); /* input buffer */ 7 del_cvec(sp); 4 int main () 5 { 6 uint_t i, window_size = 16; // window size 7 utils_init_random(); 8 cvec_t * complex_vector = new_cvec (window_size); // input buffer 9 uint_t rand_times = 4; 8 10 9 return 0; 11 while (rand_times -- ) { 12 // fill with random phas and norm 13 for ( i = 0; i < complex_vector->length; i++ ) { 14 complex_vector->norm[i] = ( 2. / RAND_MAX * random() - 1. ); 15 complex_vector->phas[i] = ( 2. / RAND_MAX * random() - 1. ) * M_PI; 16 } 17 // print the vector 18 cvec_print(complex_vector); 19 } 20 21 // set all vector elements to `0` 22 cvec_zeros(complex_vector); 23 for ( i = 0; i < complex_vector->length; i++ ) { 24 assert( complex_vector->norm[i] == 0. ); 25 // assert( complex_vector->phas[i] == 0 ); 26 } 27 cvec_print(complex_vector); 28 29 // set all vector elements to `1` 30 cvec_ones(complex_vector); 31 for ( i = 0; i < complex_vector->length; i++ ) { 32 assert( complex_vector->norm[i] == 1. ); 33 // assert( complex_vector->phas[i] == 0 ); 34 } 35 cvec_print(complex_vector); 36 // destroy it 37 del_cvec(complex_vector); 38 return 0; 10 39 } 11
Note: See TracChangeset
for help on using the changeset viewer.