source:
tests/src/test-fmat.c
@
986131d
Last change on this file since 986131d was 986131d, checked in by , 7 years ago | |
---|---|
|
|
File size: 789 bytes |
Rev | Line | |
---|---|---|
[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] | 7 | int main (void) |
[7e35b37] | 8 | { |
[986131d] | 9 | aubio_init(); |
10 | ||
[7e35b37] | 11 | uint_t height = 3, length = 9, i, j; |
12 | // create fmat_t object | |
[4ed0ed1] | 13 | fmat_t * mat = new_fmat (height, length); |
[7e35b37] | 14 | for ( i = 0; i < mat->height; i++ ) { |
15 | for ( j = 0; j < mat->length; j++ ) { | |
16 | // all elements are already initialized to 0. | |
17 | assert(mat->data[i][j] == 0); | |
18 | // setting element of row i, column j | |
19 | mat->data[i][j] = i * 1. + j *.1; | |
20 | } | |
21 | } | |
[3cd9fdd] | 22 | fvec_t channel_onstack; |
23 | fvec_t *channel = &channel_onstack; | |
24 | fmat_get_channel(mat, 1, channel); | |
25 | fvec_print (channel); | |
[7e35b37] | 26 | // print out matrix |
27 | fmat_print(mat); | |
28 | // destroy it | |
29 | del_fmat(mat); | |
[986131d] | 30 | |
31 | aubio_cleanup(); | |
32 | ||
[7e35b37] | 33 | return 0; |
[cd60b5c] | 34 | } |
35 |
Note: See TracBrowser
for help on using the repository browser.