source: tests/src/test-fmat.c @ cc3f129

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change on this file since cc3f129 was 332487b, checked in by Paul Brossier <piem@piem.org>, 11 years ago

tests/src: clean up includes

  • Property mode set to 100644
File size: 749 bytes
RevLine 
[332487b]1#include "aubio.h"
2#include "utils_tests.h"
[cd60b5c]3
[7e35b37]4// create a new matrix and fill it with i * 1. + j * .1, where i is the row,
5// and j the column.
6
[158e031]7int main (void)
[7e35b37]8{
9  uint_t height = 3, length = 9, i, j;
10  // create fmat_t object
[4ed0ed1]11  fmat_t * mat = new_fmat (height, length);
[7e35b37]12  for ( i = 0; i < mat->height; i++ ) {
13    for ( j = 0; j < mat->length; j++ ) {
14      // all elements are already initialized to 0.
15      assert(mat->data[i][j] == 0);
16      // setting element of row i, column j
17      mat->data[i][j] = i * 1. + j *.1;
18    }
19  }
[3cd9fdd]20  fvec_t channel_onstack;
21  fvec_t *channel = &channel_onstack;
22  fmat_get_channel(mat, 1, channel);
23  fvec_print (channel);
[7e35b37]24  // print out matrix
25  fmat_print(mat);
26  // destroy it
27  del_fmat(mat);
28  return 0;
[cd60b5c]29}
30
Note: See TracBrowser for help on using the repository browser.