diff --git a/README.md b/README.md
index 70a665b..d109692 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,6 @@
-# libdspl-2.0
+# libdspl-2.0 Digital signal processing library
+
+
+
+libdspl-2.0 is free cross-platform library of digital signal processing algorithms.
+libdspl-2.0 includes the following groups of algorithms:
diff --git a/dox/ru/mainpage.dox b/dox/ru/mainpage.dox
index 8d6d8df..418553b 100644
--- a/dox/ru/mainpage.dox
+++ b/dox/ru/mainpage.dox
@@ -21,7 +21,7 @@ DSPL-2.0 - свободная библиотека алгоритмов цифр
Библиотека поддерживает работу с вещественными и
комплексными типами входных данных.
-Описание испльзуемых типов:
+Описание используемых типов:
\ref TYPES_GROUP
diff --git a/dspl/dox/ru/complex.dox b/dspl/dox/ru/complex.dox
index 1ec4933..903ac80 100644
--- a/dspl/dox/ru/complex.dox
+++ b/dspl/dox/ru/complex.dox
@@ -358,6 +358,65 @@ cos_cmplx(5.0+6.0j) = 57.219 +193.428j
+/*! ****************************************************************************
+\ingroup SPEC_MATH_COMMON_GROUP
+\fn int log_cmplx(complex_t* x, int n, complex_t *y)
+\brief Натуральный логарифм комплексного аргумента `x`
+
+Функция рассчитывает значения натурального логарифма комплексного аргумента,
+заданного вектором `x` длины `n`:
+\f[
+\textrm{Ln}(x) = j \varphi + \ln(|x|),
+\f]
+где \f$\varphi\f$ - фаза комплексного числа.
+
+\param[in] x Указатель на комплексный вектор аргумента логарифма.
+ Размер вектора `[n x 1]`.
+
+\param[in] n Размер входного и выходного векторов `x` и `y`.
+
+
+\param[out] y Указатель на вектор значений комплексного логарифма,
+ соответствующего входному вектору `x`.
+ Размер массива `[n x 1]`.
+ Память должна быть выделена.
+
+\return
+`RES_OK` если значение функции рассчитано успешно.
+В противном случае \ref ERROR_CODE_GROUP "код ошибки":
+
+Например при выполнении следующего кода
+\code{.cpp}
+ complex_t x[3] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}};
+ complex_t y[3];
+ int k;
+
+ log_cmplx(x, 3, y);
+
+ for(k = 0; k < 3; k++)
+ printf("log_cmplx(%.1f%+.1fj) = %.3f%+.3fj\n",
+ RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));
+
+ \endcode
+
+
+Результатом работы будет
+
+\verbatim
+log_cmplx(1.0+2.0j) = 0.805+1.107j
+log_cmplx(3.0+4.0j) = 1.609+0.927j
+log_cmplx(5.0+6.0j) = 2.055+0.876j
+\endverbatim
+
+\author
+Бахурин Сергей www.dsplib.org
+***************************************************************************** */
+
+
+
+
+
+
@@ -370,7 +429,7 @@ cos_cmplx(5.0+6.0j) = 57.219 +193.428j
исходного вещественного массива `x`.
-\param[in] x Указатель на массв вещественных данных.
+\param[in] x Указатель на массив вещественных данных.
Размер массива `[n x 1]`.
\param[in] n Размер массивов входных и выходных данных.
@@ -403,7 +462,120 @@ cos_cmplx(5.0+6.0j) = 57.219 +193.428j
\endverbatim
\author
-Бахурин Сергей.
-www.dsplib.org
+Бахурин Сергей. www.dsplib.org
***************************************************************************** */
+
+
+
+
+/*! ****************************************************************************
+\ingroup SPEC_MATH_TRIG_GROUP
+\fn int sin_cmplx(complex_t* x, int n, complex_t *y)
+\brief Синус комплексного аргумента `x`
+
+Функция рассчитывает значения синуса комплексного аргумента,
+заданного вектором `x` длины `n`:
+\f[
+\textrm{sin}(x) = \frac{\exp(jx) - \exp(-jx)}{2j}
+\f]
+
+
+\param[in] x Указатель на вектор аргумента комплексного синуса.
+ Размер вектора `[n x 1]`.
+
+\param[in] n Размер входного и выходного векторов `x` и `y`.
+
+
+\param[out] y Указатель на вектор значений комплексного синуса,
+ соответствующего входному вектору `x`.
+ Размер массива `[n x 1]`.
+ Память должна быть выделена.
+
+\return
+`RES_OK` если значение функции рассчитано успешно .
+В противном случае \ref ERROR_CODE_GROUP "код ошибки":
+
+Например при выполнении следующего кода
+\code{.cpp}
+ complex_t x[3] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}};
+ complex_t y[3];
+ int k;
+
+ sin_cmplx(x, 3, y);
+
+ for(k = 0; k < 3; k++)
+ printf("sin_cmplx(%.1f%+.1fj) = %9.3f%+9.3fj\n",
+ RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));
+
+ \endcode
+
+
+Результатом работы будет
+
+\verbatim
+sin_cmplx(1.0+2.0j) = 3.166 +1.960j
+sin_cmplx(3.0+4.0j) = 3.854 -27.017j
+sin_cmplx(5.0+6.0j) = -193.430 +57.218j
+\endverbatim
+
+\author
+Бахурин Сергей www.dsplib.org
+***************************************************************************** */
+
+
+
+
+/*! ****************************************************************************
+\ingroup SPEC_MATH_COMMON_GROUP
+\fn int sqrt_cmplx(complex_t* x, int n, complex_t *y)
+\brief Квадратный корень из комплексного вектора `x` (поэлементный).
+
+Функция рассчитывает значения квадратного корня комплексного аргумента,
+заданного вектором `x` длины `n`:
+\f[
+y(k) = \sqrt{x(k)}, \qquad k = 0 \ldots n-1.
+\f]
+
+
+\param[in] x Указатель на вектор аргумента квадратного корня.
+ Размер вектора `[n x 1]`.
+
+\param[in] n Размер входного и выходного векторов `x` и `y`.
+
+
+\param[out] y Указатель на вектор значений комплексного корня,
+ соответствующего входному вектору `x`.
+ Размер массива `[n x 1]`.
+ Память должна быть выделена.
+
+\return
+`RES_OK` если значение функции рассчитано успешно .
+В противном случае \ref ERROR_CODE_GROUP "код ошибки":
+
+Например при выполнении следующего кода
+\code{.cpp}
+ complex_t x[3] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}};
+ complex_t y[3];
+ int k;
+
+ sqrt_cmplx(x, 3, y);
+
+ for(k = 0; k < 3; k++)
+ printf("sqrt_cmplx(%.1f%+.1fj) = %.3f%+.3fj\n",
+ RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));
+
+ \endcode
+
+
+Результатом работы будет
+
+\verbatim
+sqrt_cmplx(1.0+2.0j) = 1.272+0.786j
+sqrt_cmplx(3.0+4.0j) = 2.000+1.000j
+sqrt_cmplx(5.0+6.0j) = 2.531+1.185j
+\endverbatim
+
+\author
+Бахурин Сергей www.dsplib.org
+***************************************************************************** */
diff --git a/dspl/dox/ru/conv.dox b/dspl/dox/ru/conv.dox
index 21a9a34..ae267f1 100644
--- a/dspl/dox/ru/conv.dox
+++ b/dspl/dox/ru/conv.dox
@@ -21,12 +21,41 @@
Память должна быть выделена.
\return
-`RES_OK` если свертка расчитана успешно.
+`RES_OK` если свертка расчитана успешно.
В противном случае \ref ERROR_CODE_GROUP "код ошибки".
-\author
-Бахурин Сергей
-www.dsplib.org
+\note Если вектора `a` и `b` представляют собой коэффициенты двух полиномов,
+то результат линейной свертки представляет собой коэффициенты произведения
+исходных полиномов.
+
+Пример использования функции:
+
+\code{.cpp}
+ double ar[3] = {1.0, 2.0, 3.0};
+ double br[4] = {3.0, -1.0, 2.0, 4.0};
+ double cr[6];
+
+ int n;
+
+ conv(ar, 3, br, 4, cr);
+
+ for(n = 0; n < 6; n++)
+ printf("cr[%d] = %5.1f\n", n, cr[n]);
+
+\endcode
+
+
+Результат работы:
+\verbatim
+cr[0] = 3.0
+cr[1] = 5.0
+cr[2] = 9.0
+cr[3] = 5.0
+cr[4] = 14.0
+cr[5] = 12.0
+\endverbatim
+
+\author Бахурин Сергей www.dsplib.org
**************************************************************************** */
@@ -62,9 +91,39 @@ www.dsplib.org
`RES_OK` если свертка расчитана успешно.
В противном случае \ref ERROR_CODE_GROUP "код ошибки".
-\author
-Бахурин Сергей
-www.dsplib.org
+
+\note Если вектора `a` и `b` представляют собой коэффициенты двух полиномов,
+то результат линейной свертки представляет собой коэффициенты произведения
+исходных полиномов.
+
+Пример использования функции:
+
+\code{.cpp}
+ complex_t ac[3] = {{0.0, 1.0}, {1.0, 1.0}, {2.0, 2.0}};
+ complex_t bc[4] = {{3.0, 3.0}, {4.0, 4.0}, {5.0, 5.0}, {6.0, 6.0}};
+ complex_t cc[6];
+
+ int n;
+
+ conv_cmplx(ac, 3, bc, 4, cc);
+
+ for(n = 0; n < 6; n++)
+ printf("cc[%d] = %5.1f%+5.1fj\n", n, RE(cc[n]),IM(cc[n]));
+
+\endcode
+
+
+Результат работы:
+\verbatim
+cc[0] = -3.0 +3.0j
+cc[1] = -4.0+10.0j
+cc[2] = -5.0+25.0j
+cc[3] = -6.0+32.0j
+cc[4] = 0.0+32.0j
+cc[5] = 0.0+24.0j
+\endverbatim
+
+\author Бахурин Сергей www.dsplib.org
***************************************************************************** */
diff --git a/dspl/src/complex.c b/dspl/src/complex.c
index 3118e33..2e13496 100644
--- a/dspl/src/complex.c
+++ b/dspl/src/complex.c
@@ -321,7 +321,55 @@ int DSPL_API cos_cmplx(complex_t* x, int n, complex_t *y)
/******************************************************************************
-Logarithm complex
+\ingroup SPEC_MATH_COMMON_GROUP
+\fn int log_cmplx(complex_t* x, int n, complex_t *y)
+\brief The logarithm function the complex vector argument `x`
+
+Function calculates the logarithm function as:
+
+\f[
+\textrm{Ln}(x) = j \varphi + \ln(|x|),
+\f]
+here \f$\varphi\f$ - the complex number phase.
+
+\param[in] x Pointer to the argument vector `x`.
+ Vector size is `[n x 1]`.
+
+\param[in] n Input vector `x` and the logarithm vector `y` size.
+
+
+\param[out] y Pointer to the output complex vector `y`,
+ corresponds to the input vector `x`.
+ Vector size is `[n x 1]`.
+ Memory must be allocated.
+
+\return
+`RES_OK` if function calculated successfully.
+Else \ref ERROR_CODE_GROUP "code error".
+
+Example:
+\code{.cpp}
+ complex_t x[3] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}};
+ complex_t y[3];
+ int k;
+
+ log_cmplx(x, 3, y);
+
+ for(k = 0; k < 3; k++)
+ printf("log_cmplx(%.1f%+.1fj) = %.3f%+.3fj\n",
+ RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));
+\endcode
+
+
+Output is:
+\verbatim
+log_cmplx(1.0+2.0j) = 0.805+1.107j
+log_cmplx(3.0+4.0j) = 1.609+0.927j
+log_cmplx(5.0+6.0j) = 2.055+0.876j
+\endverbatim
+
+\author
+Sergey Bakhurin www.dsplib.org
*******************************************************************************/
int DSPL_API log_cmplx(complex_t* x, int n, complex_t *y)
{
@@ -346,7 +394,49 @@ int DSPL_API log_cmplx(complex_t* x, int n, complex_t *y)
/******************************************************************************
-convert double array to a complex array
+\ingroup TYPES_GROUP
+\fn int re2cmplx(double* x, int n, complex_t *y)
+\brief Convert real array to the complex array.
+
+Function copies the vector `x` to the real part of vector `y`.
+Image part of the vector `y` sets as zero.
+So complex vector contains data:
+`y[i] = x[i] + j0, here i = 0,1,2 ... n-1`
+
+
+\param[in] x Pointer to the real vector `x`.
+ Vector size is `[n x 1]`.
+
+\param[in] n Size of the real vector `x` and complex vector `y`.
+
+\param[out] y Pointer to the complex vector `y`.
+ Vector size is `[n x 1]`.
+ Memory must be allocated.
+
+
+\return
+`RES_OK` if function returns successfully.
+Else \ref ERROR_CODE_GROUP "code error":
+
+
+
+Например при выполнении следующего кода
+\code{.cpp}
+ double x[3] = {1.0, 2.0, 3.0};
+ complex_t y[3];
+
+ re2cmplx(x, 3, y);
+\endcode
+
+Vector `y` will keep:
+
+\verbatim
+ y[0] = 1+0j;
+ y[1] = 2+0j;
+ y[2] = 3+0j.
+\endverbatim
+
+\author Sergey Bakhurin. www.dsplib.org
*******************************************************************************/
int DSPL_API re2cmplx(double* x, int n, complex_t* y)
{
@@ -369,7 +459,56 @@ int DSPL_API re2cmplx(double* x, int n, complex_t* y)
/******************************************************************************
-Complex cosine
+\ingroup SPEC_MATH_TRIG_GROUP
+\fn int sin_cmplx(complex_t* x, int n, complex_t *y)
+\brief The sine function the complex vector argument `x`
+
+Function calculates the sine function as:
+
+\f[
+\textrm{cos}(x) = \frac{\exp(jx) - \exp(-jx)}{2j}
+\f]
+
+
+\param[in] x Pointer to the argument vector `x`.
+ Vector size is `[n x 1]`.
+
+\param[in] n Input vector `x` and the sine vector `y` size.
+
+
+\param[out] y Pointer to the output complex vector `y`,
+ corresponds to the input vector `x`.
+ Vector size is `[n x 1]`.
+ Memory must be allocated.
+
+\return
+`RES_OK` if function calculated successfully.
+Else \ref ERROR_CODE_GROUP "code error".
+
+Example:
+\code{.cpp}
+ complex_t x[3] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}};
+ complex_t y[3];
+ int k;
+
+ sin_cmplx(x, 3, y);
+
+ for(k = 0; k < 3; k++)
+ printf("sin_cmplx(%.1f%+.1fj) = %9.3f%+9.3fj\n",
+ RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));
+
+\endcode
+
+
+Output is:
+\verbatim
+sin_cmplx(1.0+2.0j) = 3.166 +1.960j
+sin_cmplx(3.0+4.0j) = 3.854 -27.017j
+sin_cmplx(5.0+6.0j) = -193.430 +57.218j
+\endverbatim
+
+\author
+Sergey Bakhurin www.dsplib.org
*******************************************************************************/
int DSPL_API sin_cmplx(complex_t* x, int n, complex_t *y)
{
@@ -398,7 +537,53 @@ int DSPL_API sin_cmplx(complex_t* x, int n, complex_t *y)
/******************************************************************************
-SQRT complex
+\ingroup SPEC_MATH_COMMON_GROUP
+\fn int sqrt_cmplx(complex_t* x, int n, complex_t *y)
+\brief Square root of the complex vector argguument `x`.
+
+Function calculates square root value of vector `x` length `n`:
+\f[
+y(k) = \sqrt{x(k)}, \qquad k = 0 \ldots n-1.
+\f]
+
+
+\param[in] x Pointer to the input complex vector `x`.
+ Vector size is `[n x 1]`.
+
+\param[in] n Size of input and output vectors `x` and `y`.
+
+
+\param[out] y Pointer to the square root vector `y`.
+ Vector size is `[n x 1]`.
+ Memory must be allocated.
+
+\return `RES_OK` if function is calculated successfully.
+Else \ref ERROR_CODE_GROUP "code error".
+
+Example
+\code{.cpp}
+ complex_t x[3] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}};
+ complex_t y[3]
+ int k;
+
+ sqrt_cmplx(x, 3, y);
+
+ for(k = 0; k < 3; k++)
+ printf("sqrt_cmplx(%.1f%+.1fj) = %.3f%+.3fj\n",
+ RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));
+
+ \endcode
+
+
+Результатом работы будет
+
+\verbatim
+sqrt_cmplx(1.0+2.0j) = 1.272+0.786j
+sqrt_cmplx(3.0+4.0j) = 2.000+1.000j
+sqrt_cmplx(5.0+6.0j) = 2.531+1.185j
+\endverbatim
+
+\author Sergey Bakhurin www.dsplib.org
*******************************************************************************/
int DSPL_API sqrt_cmplx(complex_t* x, int n, complex_t *y)
{
diff --git a/dspl/src/conv.c b/dspl/src/conv.c
index 911d7e2..c3585ab 100644
--- a/dspl/src/conv.c
+++ b/dspl/src/conv.c
@@ -27,7 +27,61 @@
/*******************************************************************************
-Real vectors linear convolution
+\ingroup FILTER_CONV_GROUP
+\fn int conv(double* a, int na, double* b, int nb, double* c)
+\brief Real vectors linear convolution.
+
+Function convolves two real vectors \f$ c = a * b\f$ length `na` and `nb`.
+The output convolution is a vector `c` with length equal to `na + nb - 1`.
+
+\param[in] a Pointer to the first vector `a`.
+ Vector size is `[na x 1]`.
+
+\param[in] na Size of the first vector `a`.
+
+\param[in] b Pointer to the second vector `b`.
+ Vector size is `[nb x 1]`.
+
+\param[in] nb Size of the second vector `b`.
+
+\param[out] c Pointer to the convolution output vector \f$ c = a * b\f$.
+ Vector size is `[na + nb - 1 x 1]`.
+ Memory must be allocated.
+
+\return `RES_OK` if convolution is calculated successfully.
+Else \ref ERROR_CODE_GROUP "code error".
+
+\note If vectors `a` and `b` are coefficients of two polynomials,
+then convolution of the vectors `a` and `b` returns polynomial product
+coefficients.
+
+Example:
+\code{.cpp}
+ double ar[3] = {1.0, 2.0, 3.0};
+ double br[4] = {3.0, -1.0, 2.0, 4.0};
+ double cr[6];
+
+ int n;
+
+ conv(ar, 3, br, 4, cr);
+
+ for(n = 0; n < 6; n++)
+ printf("cr[%d] = %5.1f\n", n, cr[n]);
+
+\endcode
+
+
+Output:
+\verbatim
+cr[0] = 3.0
+cr[1] = 5.0
+cr[2] = 9.0
+cr[3] = 5.0
+cr[4] = 14.0
+cr[5] = 12.0
+\endverbatim
+
+\author Sergey Bakhurin www.dsplib.org
*******************************************************************************/
int DSPL_API conv(double* a, int na, double* b, int nb, double* c)
{
@@ -70,7 +124,61 @@ int DSPL_API conv(double* a, int na, double* b, int nb, double* c)
/******************************************************************************
-Complex vectors linear convolution
+\ingroup FILTER_CONV_GROUP
+\fn int conv_cmplx(complex_t* a, int na, complex_t* b, int nb, complex_t* c)
+\brief Complex vectors linear convolution.
+
+Function convolves two complex vectors \f$ c = a * b\f$ length `na` and `nb`.
+The output convolution is a vector `c` with length equal to `na + nb - 1`.
+
+\param[in] a Pointer to the first vector `a`.
+ Vector size is `[na x 1]`.
+
+\param[in] na Size of the first vector `a`.
+
+\param[in] b Pointer to the second vector `b`.
+ Vector size is `[nb x 1]`.
+
+\param[in] nb Size of the second vector `b`.
+
+\param[out] c Pointer to the convolution output vector \f$ c = a * b\f$.
+ Vector size is `[na + nb - 1 x 1]`.
+ Memory must be allocated.
+
+\return `RES_OK` if convolution is calculated successfully.
+Else \ref ERROR_CODE_GROUP "code error".
+
+\note If vectors `a` and `b` are coefficients of two polynomials,
+then convolution of the vectors `a` and `b` returns polynomial product
+coefficients.
+
+Example:
+\code{.cpp}
+ complex_t ac[3] = {{0.0, 1.0}, {1.0, 1.0}, {2.0, 2.0}};
+ complex_t bc[4] = {{3.0, 3.0}, {4.0, 4.0}, {5.0, 5.0}, {6.0, 6.0}};
+ complex_t cc[6];
+
+ int n;
+
+ conv_cmplx(ac, 3, bc, 4, cc);
+
+ for(n = 0; n < 6; n++)
+ printf("cc[%d] = %5.1f%+5.1fj\n", n, RE(cc[n]),IM(cc[n]));
+
+\endcode
+
+
+Output:
+\verbatim
+cc[0] = -3.0 +3.0j
+cc[1] = -4.0+10.0j
+cc[2] = -5.0+25.0j
+cc[3] = -6.0+32.0j
+cc[4] = 0.0+32.0j
+cc[5] = 0.0+24.0j
+\endverbatim
+
+\author Sergey Bakhurin www.dsplib.org
*******************************************************************************/
int DSPL_API conv_cmplx(complex_t* a, int na, complex_t* b,
int nb, complex_t* c)
@@ -296,7 +404,7 @@ int DSPL_API filter_iir(double* b, double* a, int ord,
double* an = NULL;
double u;
int k;
- int m;
+ int m;
int count;
if(!b || !x || !y)
diff --git a/examples/src/complex_test.c b/examples/src/complex_test.c
index 6deb21e..7c6925e 100644
--- a/examples/src/complex_test.c
+++ b/examples/src/complex_test.c
@@ -30,7 +30,26 @@ int main()
printf("cos_cmplx(%.1f%+.1fj) = %9.3f%+9.3fj\n",
RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));
+ printf("\n\nlog_cmplx\n---------------------------------\n");
+ log_cmplx(x, 3, y);
+ for(k = 0; k < 3; k++)
+ printf("log_cmplx(%.1f%+.1fj) = %.3f%+.3fj\n",
+ RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));
+ printf("\n\nsin_cmplx\n---------------------------------\n");
+ sin_cmplx(x, 3, y);
+ for(k = 0; k < 3; k++)
+ printf("sin_cmplx(%.1f%+.1fj) = %9.3f%+9.3fj\n",
+ RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));
+
+ printf("\n\nsqrt_cmplx\n---------------------------------\n");
+ sqrt_cmplx(x, 3, y);
+ for(k = 0; k < 3; k++)
+ printf("sqrt_cmplx(%.1f%+.1fj) = %.3f%+.3fj\n",
+ RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));
+
+
+
dspl_free(handle); // free dspl handle
return 0;
diff --git a/examples/src/conv_fft_cmplx_test.c b/examples/src/conv_fft_cmplx_test.c
index b123faa..e1c9ec7 100644
--- a/examples/src/conv_fft_cmplx_test.c
+++ b/examples/src/conv_fft_cmplx_test.c
@@ -7,24 +7,27 @@
#define M 5
int main()
{
- void* handle; // DSPL handle
- handle = dspl_load(); // Load DSPL function
- complex_t a[N], b[M], c[N+M-1];
- fft_t pfft;
- int n;
-
- linspace(0, 2*N, 2*N, DSPL_PERIODIC, (double*)a);
- linspace(0, 2*M, 2*M, DSPL_PERIODIC, (double*)b);
- memset(&pfft, 0, sizeof(fft_t));
-
- conv_fft_cmplx(a, N, b, M, &pfft, c);
-
- for(n = 0; n < N+M-1; n++)
- printf("c[%3d] = %9.2f%+9.2fj\n", n, RE(c[n]), IM(c[n]));
-
- fft_free(&pfft);
- dspl_free(handle); // free dspl handle
- return 0;
+ void* handle; // DSPL handle
+ handle = dspl_load(); // Load DSPL function
+ complex_t a[N], b[M], c[N+M-1], d[N+M-1];
+ fft_t pfft;
+ int n;
+
+ linspace(0, 2*N, 2*N, DSPL_PERIODIC, (double*)a);
+ linspace(0, 2*M, 2*M, DSPL_PERIODIC, (double*)b);
+ memset(&pfft, 0, sizeof(fft_t));
+
+ conv_fft_cmplx(a, N, b, M, &pfft, c);
+ conv_cmplx(a, N, b, M, d);
+
+ for(n = 0; n < N+M-1; n++)
+ {
+ printf("c[%3d] = %9.2f%+9.2fj ", n, RE(c[n]), IM(c[n]));
+ printf("d[%3d] = %9.2f%+9.2fj \n", n, RE(d[n]), IM(d[n]));
+ }
+ fft_free(&pfft);
+ dspl_free(handle); // free dspl handle
+ return 0;
}
diff --git a/examples/src/conv_test.c b/examples/src/conv_test.c
new file mode 100644
index 0000000..fb3b2ae
--- /dev/null
+++ b/examples/src/conv_test.c
@@ -0,0 +1,41 @@
+#include
+#include
+#include
+#include "dspl.h"
+
+
+int main()
+{
+ void* handle; // DSPL handle
+ handle = dspl_load(); // Load DSPL function
+ complex_t ac[3] = {{0.0, 1.0}, {1.0, 1.0}, {2.0, 2.0}};
+ complex_t bc[4] = {{3.0, 3.0}, {4.0, 4.0}, {5.0, 5.0}, {6.0, 6.0}};
+ complex_t cc[6];
+
+ double ar[3] = {1.0, 2.0, 3.0};
+ double br[4] = {3.0, -1.0, 2.0, 4.0};
+ double cr[6];
+
+ int n;
+
+ printf("\nconv\n--------------------------------\n");
+ conv(ar, 3, br, 4, cr);
+ for(n = 0; n < 6; n++)
+ printf("cr[%d] = %5.1f\n", n, cr[n]);
+
+ printf("\nconv_cmplx\n--------------------------------\n");
+ conv_cmplx(ac, 3, bc, 4, cc);
+ for(n = 0; n < 6; n++)
+ printf("cc[%d] = %5.1f%+5.1fj\n", n, RE(cc[n]),IM(cc[n]));
+
+
+
+
+ dspl_free(handle); // free dspl handle
+ return 0;
+}
+
+
+
+
+