Ignore:
Timestamp:
Mar 3, 2013, 8:09:48 PM (11 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
474a573
Parents:
abd326c
Message:

tests/src/: improve examples

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/src/test-fmat.c

    rabd326c r7e35b37  
    11#include <aubio.h>
     2#include <assert.h>
    23
    3 int main(){
    4         uint_t length = 1024;                     /* length */
    5         uint_t height = 1024;                     /* height */
    6         fmat_t * mat = new_fmat (length, height); /* input buffer */
    7         fmat_print(mat);
    8         del_fmat(mat);
    9         return 0;
     4// create a new matrix and fill it with i * 1. + j * .1, where i is the row,
     5// and j the column.
     6
     7int main ()
     8{
     9  uint_t height = 3, length = 9, i, j;
     10  // create fmat_t object
     11  fmat_t * mat = new_fmat (length, height);
     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  }
     20  // print out matrix
     21  fmat_print(mat);
     22  // destroy it
     23  del_fmat(mat);
     24  return 0;
    1025}
    1126
Note: See TracChangeset for help on using the changeset viewer.