Showing posts with label C. Show all posts
Showing posts with label C. Show all posts

Wednesday, 20 December 2017

Matrix Construction in C++ using Armadillo

Matrix Construction in C++ using Armadillo

As a follow-through of vector, we go on matrix construction. Starting from the definition, matrix is a rectangular array of numbers, symbols, or expressions, arranged in rows and columns. The individual items in an matrix often denoted by or so-called elements, where is row index and is column index.

Because of there is no container for matrix in C/C++ standard library, let’s make our way construction matrix. In C we could use pointer of array or pointer of pointer as follows :

int m = 4, n = 3, i;

// Using pointer of array
int *B[m];
for (i = 0; i < m; i++) {
    A[i] = (int *) calloc(n, sizeof(int));
}

// Using pointer of pointer
int **B = (int **) calloc(m, sizeof(int *));
for (i = 0; i < m; i++) {
    B[i] = (int *) calloc(n, sizeof(int)); 
}

Vector Construction in C++ using Armadillo

Vector Construction in C++ using Armadillo

A collection of data in a row (or column) which may be summed together, multiplied by number, and having the same type (for instance real number, integer, complex number, float) is called vector. In programming, we tend to be familiar with array. Either in mathematics or programming, vector is accessed using index. For example, assume we have a vector that comprise , , , and so forth. Alternatively,

Monday, 14 August 2017

FFTW3 : C++ Implementation on MATLAB/OCTAVE Perspective

FFTW3 : C++ Implementaion on MATLAB/OCTAVE Perspective

I used to code using MATLAB and OCTAVE for my signal processing research. But, when it comes to real implementation and performance, I always stop and wonder how to make my concept coded in C/C++. Moreover, my MATLAB license is expired. All I need is Fourier Transform because it is the basic operation for signal processing. Then I made research on how Fourier Transform could be done in C/C++. I ended up on Fast Fourier Transform in the West (FFTW). It is considered the best and fastest FFT implementation in C/C++.

In this article, I would like to demonstrate basic forward and inverse transform of monotone signal. Because of we use audo signal in assumption, so this is 1D FFT problem. Well I think this simple example could be an entrance gate for MATLAB and OCTAVE programmers to implement their concepts on C/C++. I hope this article can be helpful for us.