52 cvec
out(2*x.length() - 1);
60 cvec
out(2*x.length() - 1);
68 cvec
out(2*x.length() - 1);
76 cvec
out(2*x.length() - 1);
99 M = std::max(x.size(), y.size());
103 N = std::max(x.size(), y.size());
111 it_assert(N <= std::max(x.size(), y.size()),
"max_lag cannot be as large as, or larger than, the maximum length of x and y.");
117 for (m = 0; m < N; m++) {
121 for (n = 0;n < M - m;n++) {
143 it_error(
"Incorrect scaleopt specified.");
158 int N = std::max(x.length(), y.length());
162 int fftsize =
pow2i(b);
164 int end = fftsize - 1;
203 out =
out /
static_cast<std::complex<double>
>(N);
221 it_warning(
"Unknow scaling option in XCORR, defaulting to <none> ");
228 int d =
X.cols(), n =
X.rows();
229 mat R(d, d),
m2(n, d);
236 for (
int i = 0;
i < d;
i++) {
242 for (
int i = 0;
i < d;
i++) {
243 for (
int j = 0;
j <=
i;
j++) {
244 for (
int k = 0; k < n; k++) {
253 for (
int i = 0;
i < d;
i++) {
254 for (
int j = 0;
j <=
i;
j++) {
255 for (
int k = 0; k < n; k++) {
256 R(
i,
j) +=
X(k,
i) *
X(k,
j);
270 "nfft must be a power of two in spectrum()!");
284 for (
int i = 0;
i < k;
i++) {
300 "The window size must be a power of two in spectrum()!");
313 for (
int i = 0;
i < k;
i++) {
328 s.set_size(
nfft / 2 + 1,
true);
335 s.set_size(
nfft / 2 + 1,
true);
int size() const
Returns the number of data elements in the array object.
void set_size(int n, bool copy=false)
Resizing an Array<T>.
Definitions of converters between different vector and matrix types.
Elementary mathematical functions - header file.
#define it_error(s)
Abort unconditionally.
#define it_warning(s)
Display a warning message.
#define it_assert_debug(t, s)
Abort if t is not true and NDEBUG is not defined.
#define it_assert(t, s)
Abort if t is not true.
ITPP_EXPORT void ifft(const cvec &in, cvec &out)
Inverse Fast Fourier Transform.
ITPP_EXPORT void fft(const cvec &in, cvec &out)
Fast Fourier Transform.
int pow2i(int x)
Calculate two to the power of x (2^x); x is integer.
vec log2(const vec &x)
log-2 of the elements
int levels2bits(int n)
Calculate the number of bits needed to represent n different values (levels).
T index_zero_pad(const Vec< T > &v, const int index)
Vec< T > zero_pad(const Vec< T > &v, int n)
Zero-pad a vector to size n.
T sum(const Vec< T > &v)
Sum of all elements in the vector.
vec real(const cvec &data)
Real part of complex values.
vec sqr(const cvec &data)
Absolute square of elements.
cvec conj(const cvec &x)
Conjugate of complex value.
vec filter_spectrum(const vec &a, int nfft)
Power spectrum calculation of a filter.
vec spectrum(const vec &v, int nfft, int noverlap)
Power spectrum calculation.
mat cov(const mat &X, bool is_zero_mean)
Covariance matrix calculation.
vec xcorr_old(const vec &x, const int max_lag, const std::string scaleopt)
Auto-correlation calculation.
vec xcorr(const vec &x, const int max_lag, const std::string scaleopt)
Auto-correlation calculation.
vec linspace(double from, double to, int points)
linspace (works in the same way as the MATLAB version)
double energy(const Vec< T > &v)
Calculate the energy: squared 2-norm. energy(v)=sum(abs(v).^2)
double mean(const vec &v)
The mean value.
vec hanning(int n)
Hanning window.
IT++ compatibility types and functions.
Various functions on vectors and matrices - header file.
Miscellaneous statistics functions and classes - header file.
cvec to_cvec(const Vec< T > &v)
Converts a Vec<T> to cvec.
const Array< T > concat(const Array< T > &a, const T &e)
Append element e to the end of the Array a.
int ceil_i(double x)
The nearest larger integer.
Mat< Num_T > elem_div(const Mat< Num_T > &m1, const Mat< Num_T > &m2)
Element wise division of two matrices.
Mat< Num_T > elem_mult(const Mat< Num_T > &m1, const Mat< Num_T > &m2)
Element wise multiplication of two matrices.
bin abs(const bin &inbin)
absolute value of bin
Definitions of signal processing functions.
Definitions of special vectors and matrices.
Definitions of window functions.