libdspl-2.0
Digital Signal Processing Algorithm Library
dspl.c
1/*
2* Copyright (c) 2015-2022 Sergey Bakhurin
3* Digital Signal Processing Library [http://dsplib.org]
4*
5* This file is part of libdspl-2.0.
6*
7* is free software: you can redistribute it and/or modify
8* it under the terms of the GNU Lesser General Public License as published by
9* the Free Software Foundation, either version 3 of the License, or
10* (at your option) any later version.
11*
12* DSPL is distributed in the hope that it will be useful,
13* but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15* GNU General Public License for more details.
16*
17* You should have received a copy of the GNU Lesser General Public License
18* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21
22
23#ifdef WIN_OS
24#include <windows.h>
25#endif /* WIN_OS */
26
27#ifdef LINUX_OS
28#include <dlfcn.h>
29#endif /* LINUX_OS */
30
31
32#include <stdio.h>
33#include "dspl.h"
34
35
36#ifndef BUILD_LIB
37
38p_acos_cmplx acos_cmplx ;
39p_addlog addlog ;
40p_array_scale_lin array_scale_lin ;
41p_asin_cmplx asin_cmplx ;
42
43p_butter_ap butter_ap ;
44p_bessel_i0 bessel_i0 ;
45p_bilinear bilinear ;
46p_butter_ap_zp butter_ap_zp ;
47
48p_cheby_poly1 cheby_poly1 ;
49p_cheby_poly2 cheby_poly2 ;
50p_cheby1_ap cheby1_ap ;
51p_cheby1_ap_zp cheby1_ap_zp ;
52p_cheby2_ap cheby2_ap ;
53p_cheby2_ap_wp1 cheby2_ap_wp1 ;
54p_cheby2_ap_zp cheby2_ap_zp ;
55p_cmplx2re cmplx2re ;
56p_concat concat ;
57p_conv conv ;
58p_conv_cmplx conv_cmplx ;
59p_conv_fft conv_fft ;
60p_conv_fft_cmplx conv_fft_cmplx ;
61p_cos_cmplx cos_cmplx ;
62
63p_decimate decimate ;
64p_decimate_cmplx decimate_cmplx ;
65p_dft dft ;
66p_dft_cmplx dft_cmplx ;
67p_dmod dmod ;
68p_dspl_info dspl_info ;
69
70p_ellip_acd ellip_acd ;
71p_ellip_acd_cmplx ellip_acd_cmplx ;
72p_ellip_ap ellip_ap ;
73p_ellip_ap_zp ellip_ap_zp ;
74p_ellip_asn ellip_asn ;
75p_ellip_asn_cmplx ellip_asn_cmplx ;
76p_ellip_cd ellip_cd ;
77p_ellip_cd_cmplx ellip_cd_cmplx ;
78p_ellip_landen ellip_landen ;
79p_ellip_modulareq ellip_modulareq ;
80p_ellip_rat ellip_rat ;
81p_ellip_sn ellip_sn ;
82p_ellip_sn_cmplx ellip_sn_cmplx ;
83
84p_farrow_lagrange farrow_lagrange ;
85p_farrow_spline farrow_spline ;
86p_fft fft ;
87p_fft_abs fft_abs ;
88p_fft_abs_cmplx fft_abs_cmplx ;
89p_fft_cmplx fft_cmplx ;
90p_fft_create fft_create ;
91p_fft_free fft_free ;
92p_fft_mag fft_mag ;
93p_fft_mag_cmplx fft_mag_cmplx ;
94p_fft_shift fft_shift ;
95p_fft_shift_cmplx fft_shift_cmplx ;
96p_filter_freq_resp filter_freq_resp ;
97p_filter_iir filter_iir ;
98p_filter_ws1 filter_ws1 ;
99p_filter_zp2ab filter_zp2ab ;
100p_find_max_abs find_max_abs ;
101p_find_nearest find_nearest ;
102p_fir_linphase fir_linphase ;
103p_flipip flipip ;
104p_flipip_cmplx flipip_cmplx ;
105p_fourier_integral_cmplx fourier_integral_cmplx ;
106p_fourier_series_dec fourier_series_dec ;
107p_fourier_series_dec_cmplx fourier_series_dec_cmplx ;
108p_fourier_series_rec fourier_series_rec ;
109p_freqs freqs ;
110p_freqs_cmplx freqs_cmplx ;
111p_freqs2time freqs2time ;
112p_freqz freqz ;
113
114p_gnuplot_close gnuplot_close ;
115p_gnuplot_cmd gnuplot_cmd ;
116p_gnuplot_create gnuplot_create ;
117p_gnuplot_open gnuplot_open ;
118p_goertzel goertzel ;
119p_goertzel_cmplx goertzel_cmplx ;
120p_group_delay group_delay ;
121
122p_histogram histogram ;
123p_histogram_norm histogram_norm ;
124
125p_idft_cmplx idft_cmplx ;
126p_ifft_cmplx ifft_cmplx ;
127p_iir iir ;
128
129p_linspace linspace ;
130p_log_cmplx log_cmplx ;
131p_logspace logspace ;
132p_low2bp low2bp ;
133p_low2bs low2bs ;
134p_low2high low2high ;
135p_low2low low2low ;
136
137p_matrix_eig_cmplx matrix_eig_cmplx ;
138p_matrix_eye matrix_eye ;
139p_matrix_eye_cmplx matrix_eye_cmplx ;
140p_matrix_mul matrix_mul ;
141p_matrix_pinv matrix_pinv ;
142p_matrix_print matrix_print ;
143p_matrix_print_cmplx matrix_print_cmplx ;
144p_matrix_svd matrix_svd ;
145p_matrix_transpose matrix_transpose ;
146p_matrix_transpose_cmplx matrix_transpose_cmplx ;
147p_matrix_transpose_hermite matrix_transpose_hermite ;
148p_mean mean ;
149p_mean_cmplx mean_cmplx ;
150p_minmax minmax ;
151
152p_ones ones ;
153
154p_phase_delay phase_delay ;
155p_poly_z2a_cmplx poly_z2a_cmplx ;
156p_polyroots polyroots ;
157p_polyval polyval ;
158p_polyval_cmplx polyval_cmplx ;
159p_psd_bartlett psd_bartlett ;
160p_psd_bartlett_cmplx psd_bartlett_cmplx ;
161p_psd_periodogram psd_periodogram ;
162p_psd_periodogram_cmplx psd_periodogram_cmplx ;
163p_psd_welch psd_welch ;
164p_psd_welch_cmplx psd_welch_cmplx ;
165
166p_randb randb ;
167p_randb2 randb2 ;
168p_randi randi ;
169p_randn randn ;
170p_randn_cmplx randn_cmplx ;
171p_random_init random_init ;
172p_randu randu ;
173p_ratcompos ratcompos ;
174p_re2cmplx re2cmplx ;
175p_readbin readbin ;
176
177p_signal_pimp signal_pimp ;
178p_signal_saw signal_saw ;
179p_sin_cmplx sin_cmplx ;
180p_sinc sinc ;
181p_sine_int sine_int ;
182p_sqrt_cmplx sqrt_cmplx ;
183p_stat_std stat_std ;
184p_stat_std_cmplx stat_std_cmplx ;
185p_sum sum ;
186p_sum_sqr sum_sqr ;
187
188p_trapint trapint ;
189p_trapint_cmplx trapint_cmplx ;
190
191p_unwrap unwrap ;
192
193p_vector_dot vector_dot ;
194p_verif verif ;
195p_verif_data_gen verif_data_gen ;
196p_verif_cmplx verif_cmplx ;
197p_verif_str verif_str ;
198p_verif_str_cmplx verif_str_cmplx ;
199
200p_window window ;
201p_writebin writebin ;
202p_writetxt writetxt ;
203p_writetxt_3d writetxt_3d ;
204p_writetxt_3dline writetxt_3dline ;
205p_writetxt_cmplx writetxt_cmplx ;
206p_writetxt_cmplx_im writetxt_cmplx_im ;
207p_writetxt_cmplx_re writetxt_cmplx_re ;
208p_writetxt_int writetxt_int ;
209
210p_xcorr xcorr ;
211p_xcorr_cmplx xcorr_cmplx ;
212
213
214#ifdef WIN_OS
215#define LOAD_FUNC(fn) \
216 fname = #fn;\
217 fn = (p_##fn)GetProcAddress(handle, fname);\
218 if(! fn) goto exit_label;
219#endif
220
221
222
223#ifdef LINUX_OS
224#define LOAD_FUNC(fn) \
225 fname = #fn;\
226 fn = (p_##fn)dlsym(handle, fname);\
227 if ((error = dlerror()) != NULL) goto exit_label
228#endif
229
230
231void* dspl_load()
232{
233 char* fname;
234 #ifdef WIN_OS
235 HINSTANCE handle;
236 handle = LoadLibrary(TEXT("libdspl.dll"));
237 if (!handle)
238 {
239 printf("libdspl.dll loading ERROR!\n");
240 return NULL;
241 }
242 #endif /* WIN_OS */
243
244
245 #ifdef LINUX_OS
246 char* error;
247 void *handle;
248 /* open the *.so */
249 handle = dlopen ("./libdspl.so", RTLD_LAZY);
250 if (!handle)
251 {
252 printf("libdspl.so loading ERROR!\n");
253 return NULL;
254 }
255 #endif /* LINUX_OS */
256
257 LOAD_FUNC(acos_cmplx);
258 LOAD_FUNC(addlog);
259 LOAD_FUNC(array_scale_lin);
260 LOAD_FUNC(asin_cmplx);
261
262 LOAD_FUNC(bessel_i0);
263 LOAD_FUNC(bilinear);
264 LOAD_FUNC(butter_ap);
265 LOAD_FUNC(butter_ap_zp);
266
267 LOAD_FUNC(cheby_poly1);
268 LOAD_FUNC(cheby_poly2);
269 LOAD_FUNC(cheby1_ap);
270 LOAD_FUNC(cheby1_ap_zp);
271 LOAD_FUNC(cheby2_ap);
272 LOAD_FUNC(cheby2_ap_wp1);
273 LOAD_FUNC(cheby2_ap_zp);
274 LOAD_FUNC(cmplx2re);
275 LOAD_FUNC(concat);
276 LOAD_FUNC(conv);
277 LOAD_FUNC(conv_cmplx);
278 LOAD_FUNC(conv_fft);
279 LOAD_FUNC(conv_fft_cmplx);
280 LOAD_FUNC(cos_cmplx);
281
282 LOAD_FUNC(decimate);
283 LOAD_FUNC(decimate_cmplx);
284 LOAD_FUNC(dft);
285 LOAD_FUNC(dft_cmplx);
286 LOAD_FUNC(dmod);
287 LOAD_FUNC(dspl_info);
288
289 LOAD_FUNC(ellip_acd);
290 LOAD_FUNC(ellip_acd_cmplx);
291 LOAD_FUNC(ellip_ap);
292 LOAD_FUNC(ellip_ap_zp);
293 LOAD_FUNC(ellip_asn);
294 LOAD_FUNC(ellip_asn_cmplx);
295 LOAD_FUNC(ellip_cd);
296 LOAD_FUNC(ellip_cd_cmplx);
297 LOAD_FUNC(ellip_landen);
298 LOAD_FUNC(ellip_modulareq);
299 LOAD_FUNC(ellip_rat);
300 LOAD_FUNC(ellip_sn);
301 LOAD_FUNC(ellip_sn_cmplx);
302
303 LOAD_FUNC(farrow_lagrange);
304 LOAD_FUNC(farrow_spline);
305 LOAD_FUNC(fft);
306 LOAD_FUNC(fft_cmplx);
307 LOAD_FUNC(fft_create);
308 LOAD_FUNC(fft_free);
309 LOAD_FUNC(fft_mag);
310 LOAD_FUNC(fft_mag_cmplx);
311 LOAD_FUNC(fft_shift);
312 LOAD_FUNC(fft_shift_cmplx);
313 LOAD_FUNC(filter_freq_resp);
314 LOAD_FUNC(filter_iir);
315 LOAD_FUNC(filter_ws1);
316 LOAD_FUNC(filter_zp2ab);
317 LOAD_FUNC(find_max_abs);
318 LOAD_FUNC(find_nearest);
319 LOAD_FUNC(fir_linphase);
320 LOAD_FUNC(flipip);
321 LOAD_FUNC(flipip_cmplx);
322 LOAD_FUNC(fourier_integral_cmplx);
323 LOAD_FUNC(fourier_series_dec);
324 LOAD_FUNC(fourier_series_dec_cmplx);
325 LOAD_FUNC(fourier_series_rec);
326 LOAD_FUNC(freqz);
327 LOAD_FUNC(freqs);
328 LOAD_FUNC(freqs_cmplx);
329 LOAD_FUNC(freqs2time);
330
331 LOAD_FUNC(gnuplot_close);
332 LOAD_FUNC(gnuplot_cmd);
333 LOAD_FUNC(gnuplot_create);
334 LOAD_FUNC(gnuplot_open);
335 LOAD_FUNC(goertzel);
336 LOAD_FUNC(goertzel_cmplx);
337 LOAD_FUNC(group_delay);
338
339 LOAD_FUNC(histogram);
340 LOAD_FUNC(histogram_norm);
341
342 LOAD_FUNC(idft_cmplx);
343 LOAD_FUNC(ifft_cmplx);
344 LOAD_FUNC(iir);
345
346 LOAD_FUNC(linspace);
347 LOAD_FUNC(log_cmplx);
348 LOAD_FUNC(logspace);
349 LOAD_FUNC(low2bp);
350 LOAD_FUNC(low2bs);
351 LOAD_FUNC(low2high);
352 LOAD_FUNC(low2low);
353
354 LOAD_FUNC(matrix_eig_cmplx);
355 LOAD_FUNC(matrix_eye);
356 LOAD_FUNC(matrix_eye_cmplx);
357 LOAD_FUNC(matrix_mul);
358 LOAD_FUNC(matrix_pinv);
359 LOAD_FUNC(matrix_print);
360 LOAD_FUNC(matrix_print_cmplx);
361 LOAD_FUNC(matrix_svd);
362 LOAD_FUNC(matrix_transpose);
363 LOAD_FUNC(matrix_transpose_cmplx);
364 LOAD_FUNC(matrix_transpose_hermite);
365 LOAD_FUNC(mean);
366 LOAD_FUNC(mean_cmplx);
367 LOAD_FUNC(minmax);
368
369 LOAD_FUNC(ones);
370
371 LOAD_FUNC(phase_delay);
372 LOAD_FUNC(poly_z2a_cmplx);
373 LOAD_FUNC(polyroots);
374 LOAD_FUNC(polyval);
375 LOAD_FUNC(polyval_cmplx);
376 LOAD_FUNC(psd_bartlett);
377 LOAD_FUNC(psd_bartlett_cmplx);
378 LOAD_FUNC(psd_periodogram);
379 LOAD_FUNC(psd_periodogram_cmplx);
380 LOAD_FUNC(psd_welch);
381 LOAD_FUNC(psd_welch_cmplx);
382
383 LOAD_FUNC(randi);
384 LOAD_FUNC(randb);
385 LOAD_FUNC(randb2);
386 LOAD_FUNC(randn);
387 LOAD_FUNC(randn_cmplx);
388 LOAD_FUNC(random_init);
389 LOAD_FUNC(randu);
390 LOAD_FUNC(ratcompos);
391 LOAD_FUNC(re2cmplx);
392 LOAD_FUNC(readbin);
393
394 LOAD_FUNC(signal_pimp);
395 LOAD_FUNC(signal_saw);
396 LOAD_FUNC(sin_cmplx);
397 LOAD_FUNC(sinc);
398 LOAD_FUNC(sine_int);
399 LOAD_FUNC(sqrt_cmplx);
400 LOAD_FUNC(stat_std);
401 LOAD_FUNC(stat_std_cmplx);
402 LOAD_FUNC(sum);
403 LOAD_FUNC(sum_sqr);
404
405 LOAD_FUNC(trapint);
406 LOAD_FUNC(trapint_cmplx);
407
408 LOAD_FUNC(unwrap);
409
410 LOAD_FUNC(vector_dot);
411 LOAD_FUNC(verif);
412 LOAD_FUNC(verif_data_gen);
413 LOAD_FUNC(verif_cmplx);
414 LOAD_FUNC(verif_str);
415 LOAD_FUNC(verif_str_cmplx);
416
417 LOAD_FUNC(window);
418 LOAD_FUNC(writebin);
419 LOAD_FUNC(writetxt);
420 LOAD_FUNC(writetxt_3d);
421 LOAD_FUNC(writetxt_3dline);
422 LOAD_FUNC(writetxt_cmplx);
423 LOAD_FUNC(writetxt_cmplx_im);
424 LOAD_FUNC(writetxt_cmplx_re);
425 LOAD_FUNC(writetxt_int);
426
427 LOAD_FUNC(xcorr);
428 LOAD_FUNC(xcorr_cmplx);
429
430
431 #ifdef WIN_OS
432 return (void*)handle;
433 exit_label:
434 printf("function %s loading ERROR!\n", fname);
435 if(handle)
436 FreeLibrary(handle);
437 return NULL;
438 #endif /* WIN_OS */
439
440
441 #ifdef LINUX_OS
442 return handle;
443 exit_label:
444 printf("function %s loading ERROR!\n", fname);
445 if(handle)
446 dlclose(handle);
447 return NULL;
448 #endif /* LINUX_OS */
449}
450
451
452
453void dspl_free(void* handle)
454{
455 #ifdef WIN_OS
456 FreeLibrary((HINSTANCE)handle);
457 #endif /* WIN_OS */
458
459 #ifdef LINUX_OS
460 dlclose(handle);
461 #endif /* LINUX_OS */
462}
463
464#endif /* BUILD_LIB */
int DSPL_API decimate_cmplx(complex_t *x, int n, int d, complex_t *y, int *cnt)
Complex vector decimation.
int DSPL_API linspace(double x0, double x1, int n, int type, double *x)
Function fills a vector with n linearly spaced elements between x0 and x1.
Definition: linspace.c:169
int DSPL_API concat(void *a, size_t na, void *b, size_t nb, void *c)
Concatenate arrays a and b
Definition: concat.c:146
int DSPL_API verif(double *x, double *y, size_t n, double eps, double *err)
Real arrays verification.
Definition: verif.c:130
int DSPL_API ones(double *x, int n)
Function fills all real vector x by ones values.
Definition: ones.c:103
int DSPL_API verif_cmplx(complex_t *x, complex_t *y, size_t n, double eps, double *err)
Complex arrays verification.
Definition: verif_cmplx.c:141
int DSPL_API decimate(double *x, int n, int d, double *y, int *cnt)
Real vector decimation.
Definition: decimate.c:140
int DSPL_API flipip_cmplx(complex_t *x, int n)
Flip complex vector x in place.
Definition: flipip_cmplx.c:132
int DSPL_API array_scale_lin(double *x, int n, double xmin, double xmax, double dx, double h, double *y)
Vector x linear transformation.
int DSPL_API logspace(double x0, double x1, int n, int type, double *x)
Function fills a vector with n logarithmically spaced elements between and .
Definition: logspace.c:178
int DSPL_API sum(double *x, int n, double *s)
Definition: sum.c:43
int DSPL_API flipip(double *x, int n)
Flip real vector x in place.
Definition: flipip.c:133
int DSPL_API fourier_series_dec(double *t, double *s, int nt, double period, int nw, double *w, complex_t *y)
Fourier series coefficient calculation for periodic signal.
int DSPL_API idft_cmplx(complex_t *x, int n, complex_t *y)
Inverse discrete Fourier transform of the complex spectrum.
Definition: idft_cmplx.c:163
void DSPL_API fft_free(fft_t *pfft)
Free fft_t structure.
Definition: fft_free.c:63
int DSPL_API fft_cmplx(complex_t *x, int n, fft_t *pfft, complex_t *y)
Fast Fourier transform for the complex vector.
Definition: fft_cmplx.c:179
int DSPL_API fft_create(fft_t *pfft, int n)
Function creates and fill fft_t structure.
Definition: fft_create.c:161
int DSPL_API ifft_cmplx(complex_t *x, int n, fft_t *pfft, complex_t *y)
Inverse fast Fourier transform.
Definition: ifft_cmplx.c:179
int DSPL_API fft_shift(double *x, int n, double *y)
Perform a shift of the vector x, for use with the fft and ifft functions, in order to move the freque...
Definition: fft_shift.c:95
int DSPL_API fft(double *x, int n, fft_t *pfft, complex_t *y)
Fast Fourier transform for the real vector.
Definition: fft.c:173
int DSPL_API dft(double *x, int n, complex_t *y)
Discrete Fourier transform of a real signal.
Definition: dft.c:163
int DSPL_API goertzel(double *x, int n, int *ind, int k, complex_t *y)
Goertzel algorithm individual DFT samples calculation for the real input vector x.
Definition: goertzel.c:125
int DSPL_API fourier_series_rec(double *w, complex_t *s, int nw, double *t, int nt, complex_t *y)
Time signal reconstruction from Fourier series coefficients.
int DSPL_API dft_cmplx(complex_t *x, int n, complex_t *y)
Discrete Fourier transform of a complex signal.
Definition: dft_cmplx.c:163
int DSPL_API goertzel_cmplx(complex_t *x, int n, int *ind, int k, complex_t *y)
Goertzel algorithm individual DFT samples calculation for the complex input vector x.
int DSPL_API phase_delay(double *b, double *a, int ord, int flag, double *w, int n, double *tau)
Phase delay calculation for digital or analog filter corresponds to , or transfer function.
Definition: phase_delay.c:165
int DSPL_API group_delay(double *pb, double *pa, int ord, int flag, double *w, int n, double *tau)
Group delay calculation for digital or analog filter corresponds to , or transfer function.
Definition: group_delay.c:164
int DSPL_API freqs(double *b, double *a, int ord, double *w, int n, complex_t *h)
Analog filter frequency response calculation.
Definition: freqs.c:143
int DSPL_API freqz(double *b, double *a, int ord, double *w, int n, complex_t *h)
Function calculates the digital filter frequency response corresponds to transfer function .
Definition: freqz.c:157
int DSPL_API filter_freq_resp(double *b, double *a, int ord, double *w, int n, int flag, double *mag, double *phi, double *tau)
Magnitude, phase response and group delay vectors calculation for digital or analog filter correspond...
int DSPL_API filter_iir(double *b, double *a, int ord, double *x, int n, double *y)
Real IIR filtration.
Definition: filter_iir.c:167
int DSPL_API conv_cmplx(complex_t *a, int na, complex_t *b, int nb, complex_t *c)
Complex vectors linear convolution.
Definition: conv_cmplx.c:160
int DSPL_API conv(double *a, int na, double *b, int nb, double *c)
Real vectors linear convolution.
Definition: conv.c:159
int DSPL_API conv_fft_cmplx(complex_t *a, int na, complex_t *b, int nb, fft_t *pfft, int nfft, complex_t *c)
Complex vectors fast linear convolution by using fast Fourier transform algorithms.
int DSPL_API conv_fft(double *a, int na, double *b, int nb, fft_t *pfft, int nfft, double *c)
Real vectors fast linear convolution by using fast Fourier transform algorithms.
Definition: conv_fft.c:202
int DSPL_API fir_linphase(int ord, double w0, double w1, int filter_type, int win_type, double win_param, double *h)
Function calculates linear-phase FIR filter coefficients by window method.
Definition: fir_linphase.c:323
int DSPL_API bilinear(double *bs, double *as, int ord, double *bz, double *az)
Transform a s-plane analog filter transfer function to the digital filter transfer function .
Definition: bilinear.c:210
int DSPL_API iir(double rp, double rs, int ord, double w0, double w1, int type, double *b, double *a)
Digital IIR filter design.
Definition: iir.c:244
int DSPL_API cheby2_ap_zp(int ord, double rs, complex_t *z, int *nz, complex_t *p, int *np)
Function calculates arrays of zeros and poles for analog normlized lowpass Chebyshev type 2 filter tr...
Definition: cheby2_ap_zp.c:220
int DSPL_API low2high(double *b, double *a, int ord, double w0, double w1, double *beta, double *alpha)
Lowpass to highpass filter frequency transform.
Definition: low2high.c:148
int DSPL_API cheby1_ap(double rp, int ord, double *b, double *a)
Function calculates the transfer function coefficients of analog normalized lowpass Chebyshev type 1...
Definition: cheby1_ap.c:181
int DSPL_API butter_ap(double rp, int ord, double *b, double *a)
Function calculates the transfer function coefficients of analog normalized lowpass Butterworth filt...
Definition: butter_ap.c:173
int DSPL_API ellip_ap_zp(int ord, double rp, double rs, complex_t *z, int *nz, complex_t *p, int *np)
Function calculates arrays of zeros and poles for analog normlized lowpass elliptic filter transfer f...
Definition: ellip_ap_zp.c:220
int DSPL_API cheby1_ap_zp(int ord, double rp, complex_t *z, int *nz, complex_t *p, int *np)
Function calculates arrays of zeros and poles for analog normlized lowpass Chebyshev type 1 filter tr...
Definition: cheby1_ap_zp.c:205
int DSPL_API low2low(double *b, double *a, int ord, double w0, double w1, double *beta, double *alpha)
Definition: low2low.c:149
int DSPL_API ratcompos(double *b, double *a, int n, double *c, double *d, int p, double *beta, double *alpha)
Rational composition.
Definition: ratcompos.c:184
int DSPL_API butter_ap_zp(int ord, double rp, complex_t *z, int *nz, complex_t *p, int *np)
Function calculates arrays of zeros and poles for analog normlized lowpass Batterworth filter transfe...
Definition: butter_ap_zp.c:211
int DSPL_API ellip_ap(double rp, double rs, int ord, double *b, double *a)
Function calculates the transfer function coefficients of analog normalized lowpass elliptic filter ...
Definition: ellip_ap.c:193
int DSPL_API cheby2_ap(double rs, int ord, double *b, double *a)
Function calculates the transfer function coefficients of analog normalized lowpass Chebyshev type 2...
Definition: cheby2_ap.c:184
int DSPL_API writebin(void *x, int n, int m, int dtype, char *fn)
Save 1D vector to the binary file.
Definition: writebin.c:217
int DSPL_API writetxt_3d(double *x, int nx, double *y, int ny, double *z, char *fn)
Save data to the text file fn for 3D surface plotting.
Definition: writetxt_3d.c:214
int DSPL_API readbin(char *fn, void **x, int *pn, int *pm, int *dtype)
Read array from the bin-file.
Definition: readbin.c:314
int DSPL_API writetxt_int(int *x, int *y, int n, char *fn)
Save interger data to the text file fn. .
Definition: writetxt_int.c:115
int DSPL_API writetxt(double *x, double *y, int n, char *fn)
Save real data to the text file fn. .
Definition: writetxt.c:122
int DSPL_API gnuplot_open(void **hplot)
Open GNUPLOT program.
Definition: gnuplot_open.c:103
void DSPL_API gnuplot_close(void *h)
Close GNUPLOT handle.
Definition: gnuplot_close.c:80
int DSPL_API gnuplot_create(int argc, char *argv[], int w, int h, char *fn_png, void **hplot)
Create GNUPLOT chart.
void DSPL_API gnuplot_cmd(void *h, char *cmd)
Function sends cmd command to GNUPLOT corresponds to h handle.
Definition: gnuplot_cmd.c:82
int DSPL_API sinc(double *x, int n, double a, double *y)
Function for the real vector x.
Definition: sinc.c:88
int DSPL_API sqrt_cmplx(complex_t *x, int n, complex_t *y)
Square root of the complex vector argguument x.
Definition: sqrt_cmplx.c:136
int DSPL_API log_cmplx(complex_t *x, int n, complex_t *y)
The logarithm function the complex vector argument x.
Definition: log_cmplx.c:139
int DSPL_API ellip_sn_cmplx(complex_t *u, int n, double k, complex_t *y)
Jacobi elliptic function of complex vector argument.
int DSPL_API ellip_cd_cmplx(complex_t *u, int n, double k, complex_t *y)
Jacobi elliptic function of complex vector argument.
int DSPL_API ellip_asn(double *w, int n, double k, double *u)
Inverse Jacobi elliptic function of real vector argument.
Definition: ellip_asn.c:106
int DSPL_API ellip_acd_cmplx(complex_t *w, int n, double k, complex_t *u)
Inverse Jacobi elliptic function of complex vector argument.
int DSPL_API ellip_cd(double *u, int n, double k, double *y)
Jacobi elliptic function of real vector argument.
Definition: ellip_cd.c:125
int DSPL_API ellip_asn_cmplx(complex_t *w, int n, double k, complex_t *u)
Inverse Jacobi elliptic function of complex vector argument.
int DSPL_API ellip_sn(double *u, int n, double k, double *y)
Jacobi elliptic function of real vector argument.
Definition: ellip_sn.c:127
int DSPL_API ellip_landen(double k, int n, double *y)
Function calculates complete elliptical integral coefficients .
Definition: ellip_landen.c:175
int DSPL_API ellip_acd(double *w, int n, double k, double *u)
Inverse Jacobi elliptic function of the real vector argument.
Definition: ellip_acd.c:102
int DSPL_API matrix_eye_cmplx(complex_t *a, int n, int m)
The complex identity matrix size n x m generation.
int DSPL_API matrix_eye(double *a, int n, int m)
The real identity matrix size n x m generation.
Definition: matrix_eye.c:80
int DSPL_API matrix_mul(double *a, int na, int ma, double *b, int nb, int mb, double *c)
Matrix multiplication.
Definition: matrix_mul.c:191
int DSPL_API matrix_eig_cmplx(complex_t *a, int n, complex_t *v, int *info)
Eigenvalues calculation of the complex square matrix a.
int DSPL_API cheby_poly1(double *x, int n, int ord, double *y)
Chebyshev polynomial of the first kind order ord
Definition: cheby_poly1.c:136
int DSPL_API cheby_poly2(double *x, int n, int ord, double *y)
Chebyshev polynomial of the second kind order ord
Definition: cheby_poly2.c:133
int DSPL_API polyroots(double *a, int ord, complex_t *r, int *info)
Function calculates real polynomial roots.
Definition: polyroots.c:157
int DSPL_API randb2(double *x, int n, random_t *prnd)
Binary bipolar [-1, 1] pseudorandom vector.
Definition: randb2.c:116
int DSPL_API random_init(random_t *prnd, int type, void *seed)
Pseudorandom numbers generators initialization.
Definition: random_init.c:120
int DSPL_API randb(double *x, int n, random_t *prnd)
Binary unipolar [0, 1] pseudorandom vector.
Definition: randb.c:118
int DSPL_API xcorr_cmplx(complex_t *x, int nx, complex_t *y, int ny, int flag, int nr, complex_t *r, double *t)
Estimates the cross-correlation vector for complex discrete-time sequences x and y.
Definition: xcorr.c:449
int DSPL_API mean_cmplx(complex_t *x, int n, complex_t *m)
Calculates the mean of the complex input vector x
Definition: mean_cmplx.c:108
int DSPL_API mean(double *x, int n, double *m)
Calculates the mean of the input vector x
Definition: mean.c:105
int DSPL_API find_max_abs(double *a, int n, double *m, int *ind)
Find maximum absolute value from the real vector a
Definition: find_max_abs.c:121
int DSPL_API stat_std_cmplx(complex_t *x, int n, double *s)
Calculates the standard deviation of the complex input vector x
int DSPL_API stat_std(double *x, int n, double *s)
Calculates the standard deviation of the input vector x
Definition: stat_std.c:116
int DSPL_API xcorr(double *x, int nx, double *y, int ny, int flag, int nr, double *r, double *t)
Estimates the cross-correlation vector for real discrete-time sequences x and y.
Definition: xcorr.c:214
int DSPL_API bessel_i0(double *x, int n, double *y)
Modified Bessel Function of the First Kind – [1].
Definition: bessel_i0.c:116
int DSPL_API sine_int(double *x, int n, double *si)
Sine integral function for the real vector x.
Definition: sine_int.c:114
int DSPL_API cos_cmplx(complex_t *x, int n, complex_t *y)
The cosine function the complex vector argument x.
Definition: cos_cmplx.c:136
int DSPL_API acos_cmplx(complex_t *x, int n, complex_t *y)
The inverse of the cosine function the complex vector argument x.
Definition: acos_cmplx.c:141
int DSPL_API sin_cmplx(complex_t *x, int n, complex_t *y)
The sine function the complex vector argument x.
Definition: sin_cmplx.c:136
int DSPL_API asin_cmplx(complex_t *x, int n, complex_t *y)
The inverse of the sine function the complex vector argument x.
Definition: asin_cmplx.c:138
void * dspl_load()
Perform dynamic linking and load libdspl-2.0 functions.
void dspl_free(void *handle)
Cleans up the previously linked DSPL-2.0 dynamic library.
int DSPL_API cmplx2re(complex_t *x, int n, double *re, double *im)
Separate complex vector to the real and image vectors.
Definition: cmplx2re.c:130
int DSPL_API re2cmplx(double *x, int n, complex_t *y)
Convert real array to the complex array.
Definition: re2cmplx.c:120
int DSPL_API window(double *w, int n, int win_type, double param)
Window function calculation.
Definition: win.c:329