diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..4f72e51 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: c + +install: + - make install + +script: make \ No newline at end of file diff --git a/README.md b/README.md index 9dc8d91..38853e1 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ libdspl-2.0 includes follow algorithms sets: * Mathematical sections includes trigonometric, hyperbolic, elliptic functions of real and complex variables. * Pseudorandom numbers generation algorithms. * Statistic functions. -* Linear algebra BLAS and LAPACK packages are used under the hood. +* Linear algebra [BLAS](http://www.netlib.org/blas/) and [LAPACK](http://www.netlib.org/lapack/) packages are used under the hood. * Digital resampling algorithms. diff --git a/dspl/doc/en/latex/Makefile b/dspl/doc/en/latex/Makefile new file mode 100644 index 0000000..877c9cc --- /dev/null +++ b/dspl/doc/en/latex/Makefile @@ -0,0 +1,23 @@ +LATEX_CMD=pdflatex + +all: refman.pdf + +pdf: refman.pdf + +refman.pdf: clean refman.tex + $(LATEX_CMD) refman + makeindex refman.idx + $(LATEX_CMD) refman + latex_count=8 ; \ + while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\ + do \ + echo "Rerunning latex...." ;\ + $(LATEX_CMD) refman ;\ + latex_count=`expr $$latex_count - 1` ;\ + done + makeindex refman.idx + $(LATEX_CMD) refman + + +clean: + rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl refman.pdf diff --git a/dspl/dox/en/dft.dox b/dspl/dox/en/dft.dox index 736efa1..3498ec6 100644 --- a/dspl/dox/en/dft.dox +++ b/dspl/dox/en/dft.dox @@ -2,139 +2,141 @@ /*! **************************************************************************** \ingroup DFT_GROUP \fn int dft(double* x, int n, complex_t* y) -\brief Дискретное преобразование Фурье вещественного сигнала. +\brief Discrete Fourier transform of a real signal. -Функция рассчитывает \f$ n \f$-точечное дискретное преобразование Фурье -вещественного сигнала \f$ x(m) \f$, \f$ m = 0 \ldots n-1 \f$. \n +The function calculates the \f$ n \f$ -point discrete Fourier transform +real signal \f$ x (m) \f$, \f$ m = 0 \ldots n-1 \f$. \n \f[ - Y(k) = \sum_{m = 0}^{n-1} x(m) - \exp \left( -j \frac{2\pi}{n} m k \right), + Y (k) = \sum_ {m = 0} ^ {n-1} x (m) + \exp \left (-j \frac {2 \pi} {n} m k \right), \f] -где \f$ k = 0 \ldots n-1 \f$. +where \f$ k = 0 \ldots n-1 \f$. -\param[in] x -Указатель на вектор вещественного входного сигнала \f$x(m)\f$, -\f$ m = 0 \ldots n-1 \f$. \n -Размер вектора `[n x 1]`. \n \n +\param [in] x +Pointer to the vector of the real input signal \f$ x (m) \f$, +\f$ m = 0 \ldots n-1 \f$. \n +The size of the vector is `[n x 1]`. \n \n -\param[in] n -Размер ДПФ \f$n\f$ (размер векторов входного сигнала и результата ДПФ). \n \n +\param [in] n +The size of the DFT \f$ n \f$ +(the size of the vectors of the input signal and the result of the DFT). \n \n -\param[out] y -Указатель на комплексный вектор результата ДПФ \f$Y(k)\f$, -\f$ k = 0 \ldots n-1 \f$. -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n +\param [out] y +Pointer to the complex vector of the DFT result \f$ Y (k) \f$, +\f$ k = 0 \ldots n-1 \f$. +The size of the vector is `[n x 1]`. \n +Memory must be allocated. \n \n \return -`RES_OK` если ДПФ рассчитана успешно. \n -В противном случае \ref ERROR_CODE_GROUP "код ошибки". +`RES_OK` if the DFT is calculated successfully. \n +Otherwise, \ref ERROR_CODE_GROUP "error code". -Пример использования функции `dft`: +An example of using the `dft` function: \include dft_test.c -Результат работы программы: +The result of the program: \verbatim -y[ 0] = 120.000 0.000 -y[ 1] = -8.000 40.219 -y[ 2] = -8.000 19.314 -y[ 3] = -8.000 11.973 -y[ 4] = -8.000 8.000 -y[ 5] = -8.000 5.345 -y[ 6] = -8.000 3.314 -y[ 7] = -8.000 1.591 -y[ 8] = -8.000 0.000 -y[ 9] = -8.000 -1.591 -y[10] = -8.000 -3.314 -y[11] = -8.000 -5.345 -y[12] = -8.000 -8.000 -y[13] = -8.000 -11.973 -y[14] = -8.000 -19.314 -y[15] = -8.000 -40.219 +y [0] = 120.000 0.000 +y [1] = -8.000 40.219 +y [2] = -8.000 19.314 +y [3] = -8.000 11.973 +y [4] = -8.000 8.000 +y [5] = -8.000 5.345 +y [6] = -8.000 3.314 +y [7] = -8.000 1.591 +y [8] = -8.000 0.000 +y [9] = -8.000 -1.591 +y [10] = -8.000 -3.314 +y [11] = -8.000 -5.345 +y [12] = -8.000 -8.000 +y [13] = -8.000 -11.973 +y [14] = -8.000 -19.314 +y [15] = -8.000 -40.219 \endverbatim \note -Данная функция выполняет расчет ДПФ наивным методом и требует \f$ n^2 \f$ -комплексных умножений. \n -Для увеличения скорости расчета рекомендуется использовать -алгоритмы быстрого преобразования Фурье. +This function performs the DFT calculation using the naive method and requires \f$ n ^ 2 \f$ +complex multiplications. \n +To increase the calculation speed, it is recommended to use +fast Fourier transform algorithms. \author -Бахурин Сергей -www.dsplib.org -***************************************************************************** */ +Bakhurin Sergey +www.dsplib.org +**************************************************************************** */ /*! **************************************************************************** \ingroup DFT_GROUP \fn int dft_cmplx(complex_t* x, int n, complex_t* y) -\brief Дискретное преобразование Фурье комплексного сигнала. +\brief Discrete Fourier transform of a complex signal. -Функция рассчитывает \f$ n \f$-точечное дискретное преобразование Фурье -комплексного сигнала \f$ x(m) \f$, \f$ m = 0 \ldots n-1 \f$. \n +The function calculates the \f$ n \f$ -point discrete Fourier transform +complex signal \f$ x (m) \f$, \f$ m = 0 \ldots n-1 \f$. \n \f[ - Y(k) = \sum_{m = 0}^{n-1} x(m) - \exp \left( -j \frac{2\pi}{n} m k \right), + Y (k) = \sum_ {m = 0} ^ {n-1} x (m) + \exp \left (-j \frac {2 \pi} {n} m k \right), \f] -где \f$ k = 0 \ldots n-1 \f$. +where \f$ k = 0 \ldots n-1 \f$. -\param[in] x -Указатель на вектор комплексного -входного сигнала \f$x(m)\f$, \f$ m = 0 \ldots n-1 \f$. \n -Размер вектора `[n x 1]`. \n \n +\param [in] x +Pointer to a vector of complex +input signal \f$ x (m) \f$, \f$ m = 0 \ldots n-1 \f$. \n +The size of the vector is `[n x 1]`. \n \n -\param[in] n -Размер ДПФ \f$n\f$ (размер векторов входного сигнала и результата ДПФ). \n \n +\param [in] n +The size of the DFT \f$ n \f$ +(the size of the vectors of the input signal and the result of the DFT). \n \n -\param[out] y -Указатель на комплексный вектор -результата ДПФ \f$Y(k)\f$, \f$ k = 0 \ldots n-1 \f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n +\param [out] y +Integrated Vector Pointer +DFT result \f$ Y (k) \f$, \f$ k = 0 \ldots n-1 \f$. \n +The size of the vector is `[n x 1]`. \n +Memory must be allocated. \n \n \return -`RES_OK` если ДПФ рассчитана успешно. \n -В противном случае \ref ERROR_CODE_GROUP "код ошибки". +`RES_OK` if the DFT is calculated successfully. \n +Otherwise, \ref ERROR_CODE_GROUP "error code". -Пример использования функции `dft_cmplx`: +An example of using the `dft_cmplx` function: \include dft_cmplx_test.c -Результат работы программы: +The result of the program: \verbatim -y[ 0] = 120.000 0.000 -y[ 1] = -8.000 40.219 -y[ 2] = -8.000 19.314 -y[ 3] = -8.000 11.973 -y[ 4] = -8.000 8.000 -y[ 5] = -8.000 5.345 -y[ 6] = -8.000 3.314 -y[ 7] = -8.000 1.591 -y[ 8] = -8.000 0.000 -y[ 9] = -8.000 -1.591 -y[10] = -8.000 -3.314 -y[11] = -8.000 -5.345 -y[12] = -8.000 -8.000 -y[13] = -8.000 -11.973 -y[14] = -8.000 -19.314 -y[15] = -8.000 -40.219 +y [0] = 120.000 0.000 +y [1] = -8.000 40.219 +y [2] = -8.000 19.314 +y [3] = -8.000 11.973 +y [4] = -8.000 8.000 +y [5] = -8.000 5.345 +y [6] = -8.000 3.314 +y [7] = -8.000 1.591 +y [8] = -8.000 0.000 +y [9] = -8.000 -1.591 +y [10] = -8.000 -3.314 +y [11] = -8.000 -5.345 +y [12] = -8.000 -8.000 +y [13] = -8.000 -11.973 +y [14] = -8.000 -19.314 +y [15] = -8.000 -40.219 \endverbatim \note -Данная функция выполняет расчет ДПФ наивным методом -и требует \f$ n^2 \f$ комплексных умножений. \n -Для увеличения скорости расчета рекомендуется -использовать алгоритмы быстрого преобразования Фурье. +This function performs the calculation of the DFT by the naive method +and requires \f$ n ^ 2 \f$ complex multiplications. \n +To increase the calculation speed, it is recommended +use fast Fourier transform algorithms. \author -Бахурин Сергей -www.dsplib.org +Bakhurin Sergey +www.dsplib.org ***************************************************************************** */ @@ -143,69 +145,70 @@ www.dsplib.org /*! **************************************************************************** \ingroup DFT_GROUP \fn int idft_cmplx(complex_t* x, int n, complex_t* y) -\brief Обратное дискретное преобразование Фурье комплексного спектра. +\brief Inverse discrete Fourier transform of the complex spectrum. -Функция рассчитывает \f$ n \f$-точечное обратное дискретное преобразование -Фурье комплексного спектра \f$ x(m) \f$, \f$ m = 0 \ldots n-1 \f$. \n +The function calculates the \f$ n \f$ -point inverse discrete transform +Fourier complex spectrum \f$ x (m) \f$, \f$ m = 0 \ldots n-1 \f$. \n \f[ - y(k) = \sum_{m = 0}^{n-1} x(m) - \exp \left( j \frac{2\pi}{n} m k \right), + y (k) = \sum_ {m = 0} ^ {n-1} x (m) + \exp \left (j \frac {2 \pi} {n} m k \right), \f] -где \f$ k = 0 \ldots n-1 \f$. +where \f$ k = 0 \ldots n-1 \f$. -\param[in] x -Указатель на вектор входного комплексного спектра сигнала \f$x(m)\f$, -\f$ m = 0 \ldots n-1 \f$. \n -Размер вектора `[n x 1]`. \n \n +\param [in] x +Pointer to the vector of the input complex signal spectrum \f$ x (m) \f$, +\f$ m = 0 \ldots n-1 \f$. \n +The size of the vector is `[n x 1]`. \n \n -\param[in] n -Размер ОДПФ \f$n\f$ (размер векторов входного спектра и результата ОДПФ). \n \n +\param [in] n +The size of the ODPF \f$ n \f$ +(the size of the vectors of the input spectrum and the result of the ODPF). \n \n -\param[out] y -Указатель на комплексный вектор результата ОДПФ \f$y(k)\f$, -\f$ k = 0 \ldots n-1 \f$. -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n +\param [out] y +Pointer to the complex vector of the ODPF result \f$ y (k) \f$, +\f$ k = 0 \ldots n-1 \f$. +The size of the vector is `[n x 1]`. \n +Memory must be allocated. \n \n \return -`RES_OK` если ОДПФ рассчитана успешно. \n -В противном случае \ref ERROR_CODE_GROUP "код ошибки". +`RES_OK` if the ODPF is calculated successfully. \n +Otherwise, \ref ERROR_CODE_GROUP "error code". -Пример использования функции `dft_cmplx`: +An example of using the `dft_cmplx` function: \include idft_cmplx_test.c -Результат работы программы: +The result of the program: \verbatim -x[ 0] = 0.000 +0.000j, z[ 0] = 0.000 -0.000 -x[ 1] = 1.000 +0.000j, z[ 1] = 1.000 -0.000 -x[ 2] = 2.000 +0.000j, z[ 2] = 2.000 -0.000 -x[ 3] = 3.000 +0.000j, z[ 3] = 3.000 -0.000 -x[ 4] = 4.000 +0.000j, z[ 4] = 4.000 -0.000 -x[ 5] = 5.000 +0.000j, z[ 5] = 5.000 -0.000 -x[ 6] = 6.000 +0.000j, z[ 6] = 6.000 -0.000 -x[ 7] = 7.000 +0.000j, z[ 7] = 7.000 -0.000 -x[ 8] = 8.000 +0.000j, z[ 8] = 8.000 -0.000 -x[ 9] = 9.000 +0.000j, z[ 9] = 9.000 -0.000 -x[10] = 10.000 +0.000j, z[10] = 10.000 -0.000 -x[11] = 11.000 +0.000j, z[11] = 11.000 +0.000 -x[12] = 12.000 +0.000j, z[12] = 12.000 +0.000 -x[13] = 13.000 +0.000j, z[13] = 13.000 +0.000 -x[14] = 14.000 +0.000j, z[14] = 14.000 +0.000 -x[15] = 15.000 +0.000j, z[15] = 15.000 -0.000 +x [0] = 0.000 + 0.000j, z [0] = 0.000 -0.000 +x [1] = 1.000 + 0.000j, z [1] = 1.000 -0.000 +x [2] = 2.000 + 0.000j, z [2] = 2.000 -0.000 +x [3] = 3.000 + 0.000j, z [3] = 3.000 -0.000 +x [4] = 4.000 + 0.000j, z [4] = 4.000 -0.000 +x [5] = 5.000 + 0.000j, z [5] = 5.000 -0.000 +x [6] = 6.000 + 0.000j, z [6] = 6.000 -0.000 +x [7] = 7.000 + 0.000j, z [7] = 7.000 -0.000 +x [8] = 8.000 + 0.000j, z [8] = 8.000 -0.000 +x [9] = 9.000 + 0.000j, z [9] = 9.000 -0.000 +x [10] = 10.000 + 0.000j, z [10] = 10.000 -0.000 +x [11] = 11.000 + 0.000j, z [11] = 11.000 +0.000 +x [12] = 12.000 + 0.000j, z [12] = 12.000 +0.000 +x [13] = 13.000 + 0.000j, z [13] = 13.000 +0.000 +x [14] = 14.000 + 0.000j, z [14] = 14.000 +0.000 +x [15] = 15.000 + 0.000j, z [15] = 15.000 -0.000 \endverbatim \note -Данная функция выполняет расчет ОДПФ наивным методом -и требует \f$ n^2 \f$ комплексных умножений. \n -Для увеличения скорости расчета рекомендуется -использовать алгоритмы быстрого преобразования Фурье. +This function performs the calculation of the DFT using the naive method. +and requires \f$ n ^ 2 \f$ complex multiplications. \n +To increase the calculation speed, it is recommended +use fast Fourier transform algorithms. \author -Бахурин Сергей -www.dsplib.org +Bakhurin Sergey +www.dsplib.org ***************************************************************************** */ diff --git a/dspl/dox/en/dspl_load.dox b/dspl/dox/en/dspl_load.dox index 5a547b0..8b4cb60 100644 --- a/dspl/dox/en/dspl_load.dox +++ b/dspl/dox/en/dspl_load.dox @@ -1,54 +1,53 @@ /*! **************************************************************************** \ingroup SYS_LOADING_GROUP \fn void* dspl_load() -\brief -Произвести динамическую линковку и загрузить функции DSPL-2.0. +\brief +Perform dynamic linking and load DSPL-2.0 functions. -Данная функция производит попытку связывания с библиотекой `libdspl.dll` в -системе Windows и с библиотекой `libdspl.so` в системе Linux. -Предполагается, что библиотека находится в одной директории с приложением -пользователя, или путь к библиотеке прописан в переменных пути операционной -системы. +This function attempts to link to the library `libdspl.dll` in +Windows system and the `libdspl.so` library on the Linux system. +The library is assumed to be in the same directory as the application. +user, or the path to the library is registered in the operating path variables +system. -При удачном связывании и загрузке функций библиотеки возвращается хэндл -библиотеки, а также в адресном пространстве приложения появляются -указатели на функции DSPL-2.0. +Upon successful binding and loading of library functions, the handle is returned +libraries, as well as in the address space of the application appear +pointers to DSPL-2.0 functions. \note -Возвращаемый хэндл имеет тип `void*`, который в ОС Windows может быть приведен -к типу `HINSTANCE`. На практике необходимости в этом, нет, потому что данный -тип приводится к `HINSTANCE` автоматически, если выставлен флаг компилятора, -указывающий, что сборка приложения производится в ОС Windows. +The returned handle is of type `void *`, which can be cast on Windows +to type `HINSTANCE`. In practice, this is not necessary, because this +the type is cast to `HINSTANCE` automatically if the compiler flag is set, +indicating that the application is being built on Windows. -Пример простейшей программы реализующей динамическое связывание с DSPL-2.0. +An example of a simple program that implements dynamic binding with DSPL-2.0. \code #include #include #include "dspl.h" - -int main(int argc, char* argv[]) +int main (int argc, char* argv[]) { - void* hdspl; /* DSPL хэндл */ - hdspl = dspl_load(); /* Динамическая линковка */ + void * hdspl; /* DSPL handle */ + hdspl = dspl_load (); /* Dynamic linking */ - /* Проверяем указатель. Если `NULLL`, то линковка прошла неудачно */ - if(!hdspl) + /* Check the pointer. If `NULL`, then the link failed */ + if (! hdspl) { - printf("libdspl loading error!\n"); + printf ("libdspl loading error! \n"); return -1; } /* - Линковка прошла успешно можно вызывать функции DSPL-2.0 + The link was successful, you can call the functions of DSPL-2.0 */ - /* - Перед корректным завершением приложения необходимо разлинковать - библиотеку и очистить память. + /* + Before correctly terminating the application, you must unlink + library and clear memory. */ - dspl_free(hdspl); + dspl_free (hdspl); return 0; } @@ -58,7 +57,7 @@ int main(int argc, char* argv[]) \author -Бахурин Сергей +Bakhurin Sergey www.dsplib.org **************************************************************************** */ @@ -68,19 +67,19 @@ www.dsplib.org /*! **************************************************************************** \ingroup SYS_LOADING_GROUP \fn void dspl_free(void* handle) -\brief -Очищает связанную ранее динамическую библиотеку DSPL-2.0. +\brief +Cleans up the previously linked DSPL-2.0 dynamic library. -Данная кроссплатформенная функция производит очистку библиотеки `libdspl.dll` в -системе Windows и с библиотеки `libdspl.so` в системе Linux. -После очистки библиотеки все функции станут недоступны. +This cross-platform function clears the library `libdspl.dll` in +Windows system and from the library `libdspl.so` on the Linux system. +After cleaning the library, all functions will become unavailable. -\param[in] handle -Хэндл прилинкованной ранее библиотеки DSPL-2.0. \n -Данный указатель может быть `NULL`, в этом случае никакие действия не -производятся. +\param [in] handle +Handle of the previously linked DSPL-2.0 library. \n +This pointer can be `NULL`, in this case no action +are being produced. \author -Бахурин Сергей +Bakhurin Sergey www.dsplib.org **************************************************************************** */ diff --git a/dspl/dox/en/ellipj.dox b/dspl/dox/en/ellipj.dox index 5857408..c3f7b5a 100644 --- a/dspl/dox/en/ellipj.dox +++ b/dspl/dox/en/ellipj.dox @@ -1,45 +1,41 @@ + /*! **************************************************************************** \ingroup SPEC_MATH_ELLIP_GROUP \fn int ellip_acd(double* w, int n, double k, double* u) -\brief Обратная эллиптическая функция Якоби - \f$ u = \textrm{cd}^{-1}(w, k)\f$ вещественного аргумента +\brief Inverse Jacobi elliptic function \f$ u = \textrm{cd}^{-1}(w, k)\f$ +of the real vector argument -Функция рассчитывает значения обратной эллиптической функции -\f$ u = \textrm{cd}^{-1}(w, k)\f$ для вещественного вектора `w`. \n +Function calculates inverse Jacobi elliptic function +\f$ u = \textrm{cd}^{-1}(w, k)\f$ of the real vector `w`. \n -Для расчета используется итерационный алгоритм на основе преобразования -Ландена. \n - \param[in] w -Указатель на массив вектора переменной \f$ w \f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n +Pointer to the argument vector \f$ w \f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n \param[in] n -Размер вектора `w`. \n +Size of vector `w`. \n -\param[in] k Значение эллиптического модуля \f$ k \f$. -Эллиптический модуль -- вещественный параметр, -принимающий значения от 0 до 1. \n \n - +\param[in] k +Elliptical modulus \f$ k \f$. \n +Elliptical modulus is real parameter, +which values can be from 0 to 1. \n \n + \param[out] u -Указатель на вектор значений обратной эллиптической -функции \f$ u = \textrm{cd}^{-1}(w, k)\f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n +Pointer to the vector of inverse Jacobi elliptic function +\f$ u = \textrm{cd}^{-1}(w, k)\f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n \return -`RES_OK` Расчет произведен успешно. \n -В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n +`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n -\author -Бахурин Сергей -www.dsplib.org -***************************************************************************** */ +\author Sergey Bakhurin www.dsplib.org +***************************************************************************** */ @@ -49,42 +45,38 @@ www.dsplib.org /*! **************************************************************************** \ingroup SPEC_MATH_ELLIP_GROUP -\fn int ellip_acd_cmplx(complex_t* w, int n, double k, complex_t* u) -\brief Обратная эллиптическая функция Якоби - \f$ u = \textrm{cd}^{-1}(w, k)\f$ комплексного аргумента +\fn int ellip_acd_cmplx(complex_t* w, int n, double k, complex_t* u) +\brief Inverse Jacobi elliptic function \f$ u = \textrm{cd}^{-1}(w, k)\f$ +of complex vector argument -Функция рассчитывает занчения значения обратной эллиптической функции -\f$ u = \textrm{cd}^{-1}(w, k)\f$ для комплексного вектора `w`. \n - -Для расчета используется итерационный алгоритм на основе преобразования -Ландена. \n +Function calculates inverse Jacobi elliptic function +\f$ u = \textrm{cd}^{-1}(w, k)\f$ of complex vector `w`. \n \param[in] w -Указатель на массив вектора переменной \f$ w \f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n - +Pointer to the argument vector \f$ w \f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n + \param[in] n -Размер вектора `w`. \n \n - +Size of vector `w`. \n + \param[in] k -Значение эллиптического модуля \f$ k \f$. \n -Эллиптический модуль -- вещественный параметр, -принимающий значения от 0 до 1. \n \n +Elliptical modulus \f$ k \f$. \n +Elliptical modulus is real parameter, +which values can be from 0 to 1. \n \n + \param[out] u -Указатель на вектор значений обратной эллиптической -функции \f$ u = \textrm{cd}^{-1}(w, k)\f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n +Pointer to the vector of inverse Jacobi elliptic function +\f$ u = \textrm{cd}^{-1}(w, k)\f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n + \return -`RES_OK` Расчет произведен успешно. \n -В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n +`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n -\author -Бахурин Сергей -www.dsplib.org +\author Sergey Bakhurin www.dsplib.org ***************************************************************************** */ @@ -96,41 +88,37 @@ www.dsplib.org /*! **************************************************************************** \ingroup SPEC_MATH_ELLIP_GROUP \fn int ellip_asn(double* w, int n, double k, double* u) -\brief Обратная эллиптическая функция Якоби - \f$ u = \textrm{sn}^{-1}(w, k)\f$ вещественного аргумента +\brief Inverse Jacobi elliptic function \f$ u = \textrm{sn}^{-1}(w, k)\f$ +of real vector argument -Функция рассчитывает занчения значения обратной эллиптической функции -\f$ u = \textrm{sn}^{-1}(w, k)\f$ для вещественного вектора `w`. \n - -Для расчета используется итерационный алгоритм на основе преобразования -Ландена. \n +Function calculates inverse Jacobi elliptic function +\f$ u = \textrm{sn}^{-1}(w, k)\f$ of real vector `w`. \n \param[in] w -Указатель на массив вектора переменной \f$ w \f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n - +Pointer to the argument vector \f$ w \f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n + \param[in] n -Размер вектора `w`. \n \n - +Size of vector `w`. \n + \param[in] k -Значение эллиптического модуля \f$ k \f$. \n -Эллиптический модуль -- вещественный параметр, -принимающий значения от 0 до 1. \n \n +Elliptical modulus \f$ k \f$. \n +Elliptical modulus is real parameter, +which values can be from 0 to 1. \n \n + \param[out] u -Указатель на вектор значений обратной эллиптической -функции \f$ u = \textrm{sn}^{-1}(w, k)\f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n +Pointer to the vector of inverse Jacobi elliptic function +\f$ u = \textrm{sn}^{-1}(w, k)\f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n + \return -`RES_OK` Расчет произведен успешно. \n -В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n +`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n -\author -Бахурин Сергей -www.dsplib.org +\author Sergey Bakhurin www.dsplib.org ***************************************************************************** */ @@ -141,44 +129,38 @@ www.dsplib.org /*! **************************************************************************** \ingroup SPEC_MATH_ELLIP_GROUP -\fn int ellip_asn_cmplx(complex_t* w, int n, double k, complex_t* u) -\brief Обратная эллиптическая функция Якоби - \f$ u = \textrm{sn}^{-1}(w, k)\f$ комплексного аргумента +\fn int ellip_asn_cmplx(complex_t* w, int n, double k, complex_t* u) +\brief Inverse Jacobi elliptic function \f$ u = \textrm{sn}^{-1}(w, k)\f$ +of complex vector argument -Функция рассчитывает занчения значения обратной эллиптической функции -\f$ u = \textrm{sn}^{-1}(w, k)\f$ для комплексного вектора `w`. \n - -Для расчета используется итерационный алгоритм на основе преобразования -Ландена. \n - +Function calculates inverse Jacobi elliptic function +\f$ u = \textrm{sn}^{-1}(w, k)\f$ of complex vector `w`. \n \param[in] w -Указатель на массив вектора переменной \f$ w \f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n - +Pointer to the argument vector \f$ w \f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n + \param[in] n -Размер вектора `w`. \n \n +Size of vector `w`. \n \param[in] k -Значение эллиптического модуля \f$ k \f$. \n -Эллиптический модуль -- вещественный параметр, -принимающий значения от 0 до 1. \n \n +Elliptical modulus \f$ k \f$. \n +Elliptical modulus is real parameter, +which values can be from 0 to 1. \n \n + \param[out] u -Указатель на вектор значений обратной эллиптической -функции \f$ u = \textrm{sn}^{-1}(w, k)\f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n +Pointer to the vector of inverse Jacobi elliptic function +\f$ u = \textrm{sn}^{-1}(w, k)\f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n \return -`RES_OK`Расчет произведен успешно. \n -В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n +`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n -\author -Бахурин Сергей -www.dsplib.org +\author Sergey Bakhurin www.dsplib.org ***************************************************************************** */ @@ -189,46 +171,41 @@ www.dsplib.org /*! **************************************************************************** \ingroup SPEC_MATH_ELLIP_GROUP -\fn int ellip_cd(double* u, int n, double k, double* y) -\brief Эллиптическая функция Якоби -\f$ y = \textrm{cd}(u K(k), k)\f$ вещественного аргумента +\fn int ellip_cd(double* u, int n, double k, double* y) +\brief Jacobi elliptic function \f$ y = \textrm{cd}(u K(k), k)\f$ +of real vector argument -Функция рассчитывает занчения значения эллиптической функции -\f$ y = \textrm{cd}(u K(k), k)\f$ для вещественного вектора `u` и -эллиптического модуля `k`. \n - -Для расчета используется итерационный алгоритм на основе преобразования -Ландена. \n - +Function calculates Jacobi elliptic function +\f$ y = \textrm{cd}(u K(k), k)\f$ of real vector `u` and +elliptical modulus `k`. \n \param[in] u -Указатель на массив вектора переменной \f$ u \f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n - +Pointer to the argument vector \f$ u \f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n + \param[in] n -Размер вектора `u`. \n \n - +Size of vector `u`. \n + \param[in] k -Значение эллиптического модуля \f$ k \f$. \n -Эллиптический модуль -- вещественный параметр, -принимающий значения от 0 до 1. \n \n +Elliptical modulus \f$ k \f$. \n +Elliptical modulus is real parameter, +which values can be from 0 to 1. \n \n + \param[out] y -Указатель на вектор значений эллиптической -функции \f$ y = \textrm{cd}(u K(k), k)\f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n +Pointer to the vector of Jacobi elliptic function +\f$ y = \textrm{cd}(u K(k), k)\f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n \return -`RES_OK` Расчет произведен успешно. \n -В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n +`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n + +\author Sergey Bakhurin www.dsplib.org +***************************************************************************** */ -\author -Бахурин Сергей -www.dsplib.org -***************************************************************************** */ @@ -238,46 +215,39 @@ www.dsplib.org /*! **************************************************************************** \ingroup SPEC_MATH_ELLIP_GROUP -\fn int ellip_cd_cmplx(complex_t* u, int n, double k, complex_t* y) -\brief Эллиптическая функция Якоби - \f$ y = \textrm{cd}(u K(k), k)\f$ комплексного аргумента +\fn int ellip_cd_cmplx(complex_t* u, int n, double k, complex_t* y) +\brief Jacobi elliptic function \f$ y = \textrm{cd}(u K(k), k)\f$ +of complex vector argument -Функция рассчитывает занчения значения эллиптической функции -\f$ y = \textrm{cd}(u K(k), k)\f$ для комплексного вектора `u` и -эллиптического модуля `k`. \n - -Для расчета используется итерационный алгоритм на основе преобразования -Ландена. \n - +Function calculates Jacobi elliptic function +\f$ y = \textrm{cd}(u K(k), k)\f$ of complex vector `u` and +elliptical modulus `k`. \n \param[in] u -Указатель на массив вектора переменной \f$ u \f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n +Pointer to the argument vector \f$ u \f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n \param[in] n -Размер вектора `u`. \n \n +Size of vector `u`. \n \param[in] k -Значение эллиптического модуля \f$ k \f$. \n -Эллиптический модуль -- вещественный параметр, -принимающий значения от 0 до 1. \n \n +Elliptical modulus \f$ k \f$. \n +Elliptical modulus is real parameter, +which values can be from 0 to 1. \n \n \param[out] y -Указатель на вектор значений эллиптической -функции \f$ y = \textrm{cd}(u K(k), k)\f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n +Pointer to the vector of Jacobi elliptic function +\f$ y = \textrm{cd}(u K(k), k)\f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n \return -`RES_OK` Расчет произведен успешно. \n -В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n +`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n -\author -Бахурин Сергей -www.dsplib.org +\author Sergey Bakhurin www.dsplib.org ***************************************************************************** */ @@ -288,15 +258,17 @@ www.dsplib.org /*! **************************************************************************** \ingroup SPEC_MATH_ELLIP_GROUP \fn int ellip_landen(double k, int n, double* y) -\brief Расчет коэффициентов \f$ k_i \f$ ряда полного эллиптического интеграла. +\brief Function calculates complete elliptical integral +coefficients \f$ k_i \f$ -Полный эллиптический интеграл \f$ K(k) \f$ может быть представлен рядом: +Complete elliptical integral \f$ K(k) \f$ can be described as: \f[ K(k) = \frac{\pi}{2} \prod_{i = 1}^{\infty}(1+k_i), \f] -где \f$ k_i \f$ вычисляется итерационно при начальных условиях \f$ k_0 = k\f$: +here \f$ k_i \f$ -- coefficients which calculated +iterative from \f$ k_0 = k\f$: \f[ k_i = @@ -308,31 +280,34 @@ k_i = \right)^2 \f] -Данная функция рассчитывает ряд первых `n` значений \f$ k_i \f$, которые в -дальнейшем могут быть использованы для расчета эллиптического интеграла и -эллиптических функций. +This function calculates `n` fist coefficients \f$ k_i \f$, which can +be used for Complete elliptical integral. + \param[in] k -Эллиптический модуль \f$ k \f$. \n +Elliptical modulus \f$ k \f$. \n +Elliptical modulus is real parameter, which values can be from 0 to 1. \n \n + \param[in] n -Размер вектора `y` соответсвующих коэффициентам \f$ k_i \f$. \n \n +Number of \f$ k_i \f$ which need to calculate. \n +Parameter `n` is size of output vector `y`. \n + \param[out] y -Указатель на вектор значений коэффициентов \f$ k_i \f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n +pointer to the real vector which keep \f$ k_i \f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n \return -`RES_OK` Расчет произведен успешно. \n -В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n + `RES_OK` -- successful exit, else \ref ERROR_CODE_GROUP "error code". \n -Пример использования функции `ellip_landen`: +Example: \include ellip_landen_test.c -Результат работы программы: +Result: \verbatim i k[i] @@ -352,111 +327,90 @@ k_i = 13 0.000e+00 \endverbatim -\note -Ряд полного эллиптического интеграла сходится при значениях -эллиптического модуля \f$ k<1 \f$. При этом сходимость ряда достаточно -быстрая и для практический приложений достаточно от 10 до 20 значений -\f$ k_i \f$ для обеспечения погрешности при расчете полного -эллиптического интеграла в пределах машинной точности. +\note Complete elliptical integral converges enough fast + if modulus \f$ k<1 \f$. There are 10 to 20 coefficients \f$ k_i \f$ ​​ + are sufficient for practical applications + to ensure complete elliptic integral precision within EPS. -\author -Бахурин Сергей -www.dsplib.org +\author Sergey Bakhurin www.dsplib.org ***************************************************************************** */ - - /*! **************************************************************************** \ingroup SPEC_MATH_ELLIP_GROUP -\fn int ellip_sn(double* u, int n, double k, double* y) -\brief Эллиптическая функция Якоби -\f$ y = \textrm{sn}(u K(k), k)\f$ вещественного аргумента +\fn int ellip_sn(double* u, int n, double k, double* y) +\brief Jacobi elliptic function \f$ y = \textrm{sn}(u K(k), k)\f$ +of real vector argument -Функция рассчитывает занчения значения эллиптической функции -\f$ y = \textrm{sn}(u K(k), k)\f$ для вещественного вектора `u` и -эллиптического модуля `k`. \n +Function calculates Jacobi elliptic function +\f$ y = \textrm{sn}(u K(k), k)\f$ of real vector `u` and +elliptical modulus `k`. \n -Для расчета используется итерационный алгоритм на основе преобразования -Ландена. \n +\param[in] u +Pointer to the argument vector \f$ u \f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n + +\param[in] n +Size of vector `u`. \n - -\param[in] u -Указатель на массив вектора переменной \f$ u \f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n - -\param[in] n -Размер вектора `u`. \n \n - \param[in] k -Значение эллиптического модуля \f$ k \f$. \n -Эллиптический модуль -- вещественный параметр, -принимающий значения от 0 до 1. \n \n +Elliptical modulus \f$ k \f$. \n +Elliptical modulus is real parameter, +which values can be from 0 to 1. \n \n + \param[out] y -Указатель на вектор значений эллиптической -функции \f$ y = \textrm{sn}(u K(k), k)\f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n +Pointer to the vector of Jacobi elliptic function +\f$ y = \textrm{sn}(u K(k), k)\f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n \return -`RES_OK` Расчет произведен успешно. \n -В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n - -\author -Бахурин Сергей -www.dsplib.org -***************************************************************************** */ - - - +`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n +\author Sergey Bakhurin www.dsplib.org + ***************************************************************************** */ /*! **************************************************************************** \ingroup SPEC_MATH_ELLIP_GROUP -\fn int ellip_sn_cmplx(complex_t* u, int n, double k, complex_t* y) -\brief Эллиптическая функция Якоби -\f$ y = \textrm{sn}(u K(k), k)\f$ комплексного аргумента +\fn int ellip_sn_cmplx(complex_t* u, int n, double k, complex_t* y) +\brief Jacobi elliptic function \f$ y = \textrm{sn}(u K(k), k)\f$ of complex vector argument -Функция рассчитывает занчения значения эллиптической функции -\f$ y = \textrm{sn}(u K(k), k)\f$ для комплексного вектора `u` и -эллиптического модуля `k`. \n - -Для расчета используется итерационный алгоритм на основе преобразования -Ландена. \n +Function calculates Jacobi elliptic function +\f$ y = \textrm{sn}(u K(k), k)\f$ of complex vector `u` and +elliptical modulus `k`. \n \param[in] u -Указатель на массив вектора переменной \f$ u \f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n - +Pointer to the argument vector \f$ u \f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n + \param[in] n -Размер вектора `u`. \n \n - +Size of vector `u`. \n + \param[in] k -Значение эллиптического модуля \f$ k \f$. \n -Эллиптический модуль -- вещественный параметр, -принимающий значения от 0 до 1. \n \n +Elliptical modulus \f$ k \f$. \n +Elliptical modulus is real parameter, +which values can be from 0 to 1. \n \n + \param[out] y -Указатель на вектор значений эллиптической -функции \f$ y = \textrm{sn}(u K(k), k)\f$. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена. \n \n +Pointer to the vector of Jacobi elliptic function +\f$ y = \textrm{sn}(u K(k), k)\f$. \n +Vector size is `[n x 1]`. \n +Memory must be allocated. \n \n + \return -`RES_OK` Расчет произведен успешно. \n -В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n +`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n -\author -Бахурин Сергей -www.dsplib.org +\author Sergey Bakhurin www.dsplib.org ***************************************************************************** */ diff --git a/dspl/dox/en/error_list.dox b/dspl/dox/en/error_list.dox index 098f9b5..87b8db2 100644 --- a/dspl/dox/en/error_list.dox +++ b/dspl/dox/en/error_list.dox @@ -2,45 +2,45 @@ /*! \ingroup ERROR_CODE_GROUP \def RES_OK -\brief Функция завершилась корректно. Ошибки отсутствуют. +\brief The function completed correctly. No errors. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_ARG_PARAM -\brief Неверный параметр вызова программы. -Данная ошибка возникает, когда производится вызов программы с неверным -количеством параметров `argc` и указателем `argv` -на массив параметров вызова программы. +\brief Invalid program call parameter. +This error occurs when a program is called with an invalid +the number of arguments `argc` and the pointer` argv` +to an array of program call parameters. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_DAT_TYPE -\brief Неверный тип данных. -Данная ошибка возникает при сохранении данных в бинарный файл, когда параметр, -задающий тип данных в памяти (вещественные или комплексные) задан неверно. +\brief Invalid data type. +This error occurs when saving data to a binary file, when the parameter +the defining data type in memory (real or complex) is set incorrectly. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_DIV_ZERO -\brief Ошибка деления на ноль. -Функция возвращает данную ошибку, если в вычислительном алгоритме возникло -деление на ноль. +\brief Division by zero error. +The function returns this error if a computational algorithm occurs +division by zero. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_ELLIP_MODULE -\brief Модуль эллиптического интеграла Якоби должен быть от 0 до 1. -Данная ошибка возникает при расчете эллиптических функций Якоби -при неверном задании параметра эллиптического модуля. -Функция завершает работу и возвращает данный код ошибки. +\brief The modulus of the Jacobi elliptic integral must be from 0 to 1. +This error occurs when calculating Jacobi elliptic functions +if the parameter of the elliptic module is incorrectly set. +The function exits and returns the given error code. */ @@ -48,30 +48,30 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FFT_SIZE -\brief Неверно задан размер БПФ. -Размер БПФ может быть составным вида -\f$n = n_0 \times n_1 \times n_2 \ldots \times n_p \times m\f$, -где \f$n_i = 2,3,5,7\f$, а \f$m \f$ -- -произвольный простой множитель не превосходящий 46340. -Ошибка возникает, когда множитель \f$m \f$ превосходит 46340. +\brief The FFT size is not set correctly. +FFT size can be composite +\f$ n = n_0 \times n_1 \times n_2 \ldots \times n_p \times m \f$, +where \f$ n_i = 2,3,5,7 \f$, and \f$ m \f$ -- +an arbitrary prime factor not exceeding 46340. +An error occurs when the factor \f$ m \f$ exceeds 46340 . */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FILTER_A0 -\brief Параметр \f$a_0\f$ передаточной характеристики \f$H(z)\f$ цифрового -БИХ-фильтра не может быть равен нулю. +\brief Parameter \f$ a_0 \f$ cannot be zero digital for +IIR filter transfer characteristic \f$ H (z)\f$. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FILTER_APPROX -\brief Неизвестный тип аппроксимации цифрового или аналогового фильтра. -Данная ошибка возникает при неверном задании масок типа цифрового БИХ-фильтра. -Библиотека поддерживает следущие аппроксимации: Баттерворта, Чебышева первого -рода, Чебышева второго рода и эллиптические. +\brief Unknown approximation type of digital or analog filter. +This error occurs when masks such as a digital IIR filter are incorrectly set. +The library supports the following approximations: Butterworth, +Chebyshev of the first kind, Chebyshev of the second kind and elliptic. */ @@ -79,26 +79,24 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FILTER_FT -\brief Неверно заданы частоты преобразования ФНЧ-ПФ и ФНЧ-РФ. -Частотные маски полосовых и режекторных фильтров имеют две частоты среза -или частоты заграждения. При реализации частотных преобразований фильтров -необходимо задавать правую частоту среза меньше левой. +\brief The conversion frequencies of the low-pass filter and low-pass filter are incorrect. +Frequency masks for bandpass and bandstop filters have two cutoff frequencies or barrage frequencies. +When implementing frequency filter conversions, it is necessary to set the left cutoff frequency less than the right. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FILTER_ORD -\brief Порядок фильтра задан неверно. -Порядок фильтра должен быть задан положительным целым значением. +\brief The filter order is incorrect. +The order of the filter must be specified by a positive integer value. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FILTER_ORD_BP -\brief Порядок полосового или режекторного фильтра задан неверно. -Порядок полосового и режекторного фильтра должен быть задан -чётным положительным значением. +\brief The order of the bandpass or notch filter is not set correctly. +The order of the bandpass and notch filter must be given an even positive value. */ @@ -106,8 +104,8 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FILTER_RP -\brief Параметр неравномерности фильтра в полосе пропускания задан неверно. -Данный параметр задается в дБ и должен быть положительным числом. +\brief The filter non-uniformity parameter in the passband is set incorrectly. +This parameter is specified in dB and must be a positive number. */ @@ -115,17 +113,16 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FILTER_RS -\brief Параметр подавления фильтра в полосе заграждения задан неверно. -Данный параметр задается в дБ и должен быть положительным числом. +\brief The filter suppression parameter in the boom bar is not set correctly. +This parameter is specified in dB and must be a positive number. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FILTER_TYPE -\brief Неизвестный тип фильтра. -Библиотека поддерживает следущие типы фильтров: ФНЧ, ФВЧ, полосовой и -режекторный. +\brief Unknown filter type. +The library supports the following filter types: lowpass, highpass, bandpass and bandstop. */ @@ -133,16 +130,15 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FILTER_WP -\brief Параметр частоты среза фильтра задан неверно. -Частота среза фильтра должна быть положительной от 0 до 1 для -цифрового КИХ-фильтра. +\brief The filter cutoff frequency parameter is set incorrectly. +The cutoff frequency of the filter must be positive from 0 to 1 for the digital FIR filter. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FILTER_WS -\brief Параметр частоты заграждения фильтра задан неверно. -Частота заграждения должна быть положительным числом от 0 до 1. +\brief The filter frequency parameter is set incorrectly. +The frequency must be a positive from 0 to 1. */ @@ -151,7 +147,7 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FNAME -\brief Ошибка в имени файла. Необходимо задать корректное имя файла. +\brief Error in file name. You must specify the correct file name. */ @@ -160,26 +156,24 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FOPEN -\brief Ошибка открытия файла. -Файл с заданным именем не может быть открыт для записи и (или) чтения. +\brief Error opening file. +A file with the specified name cannot be opened for writing or reading. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FREAD_SIZE -\brief Ошибка чтения блока данных из бинарного файла. -Ошибка возникает, если при чтении блока данных из файла размер считанного блока -не соответствует требуемому значению. +\brief Error reading data block from binary file. +An error occurs if size of the read block does not match the required value. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_FWRITE_SIZE -\brief Ошибка записи блока данных в бинарный файла. -Ошибка возникает, если при записи блока данных в файл, размер записанного блока -не соответствует требуемому значению. +\brief Error writing data to binary file. +An error occurs if, the size of the recorded block does not match the required value. */ @@ -192,19 +186,19 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_GNUPLOT_CREATE -\brief Невозможно подключиться к пакету GNUPLOT. -Пожалуйста проверьте, что пакет доступен. +\brief Unable to connect to the GNUPLOT package. +Please check that the package is available. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_GNUPLOT_TERM -\brief Неизвестный параметра вызова программы, задающий терминал GNUPLOT.\n -Данный параметр может принимать одно из следюущих значений:\n -`--noplot` построение графика не производиться;\n -`--plotwin` построение графиков производиться в отельном окне (окнах);\n -`--plotpng` построение графиков производиться в png - файл.\n +\brief Unknown program call parameter specifying the GNUPLOT terminal. \n +This parameter can be one of the following values: \n +`--noplot` no plotting; \ n +`--plotwin` plot in the new window; \n +`--plotpng` plot in png file. \n */ @@ -212,42 +206,41 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_LAPACK -\brief Встроенная функция пакета LAPACK вернула код ошибки. -Данная ошибка возвращается функцией, если она использует одну из встроенных -функций LAPACK, которая завершилась с ошибкой. +\brief The built-in LAPACK function returned an error code. +This error is returned by the function if it uses one of the built-in LAPACK functions that failed. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_MALLOC -\brief Ошибка динамического выделения памяти. -Данная ошибка означает, что при динамическом выделении памяти произошла ошбика. -В результате функция `malloc` в теле вызваемой функции вернула `NULL` указатель. -Дальнейшая обработка функцией невозможна. +\brief Dynamic memory allocation error. +This error means that an error occurred while dynamically allocating memory. +As a result, the `malloc` function in the body of the called function returned a` NULL` pointer. +Further processing by the function is not possible. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_MATRIX_SIZE -\brief Неверный размер матрицы. +\brief Matrix size error. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_MIN_MAX -\brief Минимальное значение (нижняя граница) больше максимального. +\brief The minimum value (lower bound) is greater than the maximum. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_NEGATIVE -\brief Отрицательный параметр. -Функция возвращает данный код ошибки, когда принимает отрицательный параметр -в переменную, которая не может быть отрицательной. +\brief Negative parameter. +The function returns the given error code when it takes a negative parameter. +into a variable that cannot be negative. */ @@ -255,10 +248,10 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_POLY_AN -\brief Неверно задан старший коэффициент полинома. -Например при вычислении кореней полинома степени \f$N\f$ -\f[ P_N(x) = a_0 + a_1 x + a_2 x^2 + \ldots a_N x^N \f] -старший коэффициентом \f$a_N\f$ не может быть равным нулю. +\brief The senior coefficient of the polynomial is incorrectly set. +For example, when calculating the roots of a polynomial of degree \f$ N \f$ +\f[P_N (x) = a_0 + a_1 x + a_2 x ^ 2 + \ ldots a_N x ^ N \f] +the leading coefficient \f$ a_N \f$ cannot be equal to zero. */ @@ -266,8 +259,8 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_POLY_ORD -\brief Неверно задан порядок полинома. -Порядок полинома должен быть положительным целым числом. +\brief The polynomial order is incorrect. +The order of the polynomial must be a positive integer. */ @@ -275,11 +268,11 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_PTR -\brief Ошибка указателя. -Данная ошибка означает, что один из обязательных указателей -(память под который должна быть выделена) передан как `NULL`. -При возникновении данной ошибки, функция завершает работу -и возвращает данный код ошибки. +\brief Pointer error. +This error means that one of the required pointers +(memory to be allocated for) is transferred as `NULL`. +When this error occurs, the function exits +and returns the given error code. */ @@ -287,10 +280,10 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_RAND_SIGMA -\brief Неверно задано среднеквадратическое отклонение -нормального распределения случайной величины. -Среднеквадратическое отклонение должно быть -неотрицательным вещественным числом. +\brief The standard deviation is incorrect +normal distribution of a random variable. +The standard deviation should be +non-negative real number. */ @@ -298,19 +291,19 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_RAND_TYPE -\brief Неизвестный датчик псевдослучайных чисел. -В библиотеке используются следующие датчики: -\li MRG32K3A -- 32 битный датчик MRG32K3A разработан Пьером Лекуэром. -\li MT19937-64 -- 64-битный датчик Вихрь Мерсенна. +\brief Unknown pseudorandom number genration algorithm. +The following algorithms are used in the library: +\li MRG32K3A -- 32 bit algortithm MRG32K3A was developed by Pierre Lecuer. +\li MT19937-64 -- 64-bit Mersenne Twister algorithm. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_RESAMPLE_RATIO -\brief Коэффициент передискретизации задан неверно. -Коэффициент передискретизации задается отношением \f$\frac{P}{Q}\f$, где -\f$P\f$ и \f$Q\f$ вещественные положительные числа. +\brief The resampling factor is set incorrectly. +The resampling factor is given by the relation \f$ \frac{P}{Q} \f$, where +\f$ P \f$ and \f$Q\f$ are real positive numbers. */ @@ -318,9 +311,9 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_RESAMPLE_FRAC_DELAY -\brief Неверное значение дробной задержки. -Дробная задержка может принимать значения от -1 до 1, где 1 соответствует -одному интервалу дискретизации \f$1/F_{\textrm{s}}\f$. +\brief Invalid fractional delay value. +The fractional delay can take values from -1 to 1, where 1 corresponds to +one sampling interval \f$ 1 / F_{\textrm{s}} \f$. */ @@ -329,12 +322,12 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_SIZE -\brief Ошибка при передаче размера массива. -Данная ошибка возникает когда помимо указателя -на массив входных или выходных данных передается неверный -размер массива (меньше или равный нулю). -При возникновении данной ошибки, -функция завершает работу и возвращает данный код ошибки. +\brief Error array size. +This error occurs when in addition to the pointer +the wrong input is passed to the input or output array + size (less than or equal to zero). +If this error occurs, +the function exits and returns the given error code. */ @@ -342,8 +335,8 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_SYM_TYPE -\brief Ошибка параметра типа заполнения массивов в линейном или логарифмическом -масштабе. Допустимые типы заполнения: симметричный и периодический. +\brief Parameter error of type of filling arrays in linear or logarithmic scale. +Valid fill types are symmetric and periodic. */ @@ -351,29 +344,28 @@ /*! \ingroup ERROR_CODE_GROUP \def ERROR_UNWRAP -\brief Ошибка параметров функции раскрытия периодичности. -Параметр периода и отступа должны быть положительными числами. +\brief Error in unwrap function. +The phase period and indent parameter must be positive numbers */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_WIN_PARAM -\brief Ошибка значения параметра оконной функции. -Для каждой параметрической оконной функции существуют допустимые значения -параметра. +\brief window function parameter error. +Valid parameter values exist for each parametric window function. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_WIN_SYM -\brief Симметричность или периодичность заданного окна не поддерживается. +\brief Symmetry or periodicity of a given window is not supported. */ /*! \ingroup ERROR_CODE_GROUP \def ERROR_WIN_TYPE -\brief Неизвестный тип оконной функции. +\brief Unknown window function type. */ diff --git a/dspl/dox/en/fft.dox b/dspl/dox/en/fft.dox index b2fb671..330c0d3 100644 --- a/dspl/dox/en/fft.dox +++ b/dspl/dox/en/fft.dox @@ -6,80 +6,67 @@ /*! **************************************************************************** \ingroup DFT_GROUP \struct fft_t -\brief Структура данных объекта быстрого преобразования Фурье +\brief Fast Fourier Transform Object Data Structure -Структура хранит указатели на массивы поворотных коэффициентов -и массивы промежуточных данных алгоритма быстрого преобразования Фурье. +The structure stores pointers to twiddle factors and arrays of intermediate data of the fast Fourier transform algorithm. -Библиотека DSPL использует для БПФ алгоритм для составной длины +The DSPL library uses an FFT algorithm for composite size. \param n -Размер вектора БПФ, для которого выделена память в массивах структуры. \n -Парметр `n` должен быть равен целой степени двойки. \n \n +The size of the FFT vector for which memory is allocated in the structure arrays. \n +The parameter `n` must be equal to an integer power of two (radix 2). \n \n \param w -Указатель на вектор поворотных коэффициентов алгоритма БПФ. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена и массив поворотных коэффициентов -должен быть заполнен функцией \ref fft_create. \n \n +Pointer to the vector of twiddle factors. \n +The size of the vector is `[n x 1]`. \n +The memory must be allocated and an array of twiddle factors +must be filled with the \ref fft_create function. \n\n \param t0 -Указатель на вектор промежуточных вычислений алгоритма БПФ. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена функцией \ref fft_create. \n \n +Pointer to the vector of intermediate results of the FFT algorithm. \n +The size of the vector is `[n x 1]`. \n +Memory must be allocated by \ref fft_create function. \n\n \param t1 -Указатель на вектор промежуточных вычислений алгоритма БПФ. \n -Размер вектора `[n x 1]`. \n -Память должна быть выделена функцией \ref fft_create. \n \n -Структура заполняется функцией \ref fft_create один раз -до использования алгоритма БПФ. \n -Указатель на объект данной структуры может быть -многократно использован при вызове функций БПФ. \n -Перед выходом из программы выделенную память под поворотные -коэффициенты и массивы промежуточных данных -необходимо очистить функцией \ref fft_free. Например: +Pointer to the vector of intermediate results. \n +The size of the vector is `[n x 1]`. \n +The memory must be allocated with the \ref fft_create function. \n\n +The structure is populated with the \ref fft_create function once +before using the FFT algorithm. \n +A pointer to an object of this structure may be +reused when calling FFT functions. \n +Before exiting the program, dedicated memory for twiddle factors and arrays of intermediate data +must be cleared by the \ref fft_free function. For example: \code -fft_t pfft; /* объявляем объект fft_t */ -int n = 64; /* Размер БПФ */ - -/* -обнуляем все поля и указатели. -Данные шаг рекомендуется ввиду того, что некоторые -при создании переменной не инициализируют ее нулем. -*/ - -memset(&pfft, 0, sizeof(fft_t)); +fft_t pfft = {0}; /* Structure fft_t and clear all fields */ +int n = 64; /* FFT size */ int err; -/* создаем объект для 64-точечного БПФ */ +/* Create and fill FFT structure for 64-points FFT */ err = fft_create(&pfft, n); -/* Вызов БПФ функции*/ -/* Еще раз вызов БПФ функции */ +/* FFT calculation here */ +/* FFT calculation here one more */ /* ... */ -/* очистить память объекта БПФ */ +/* Clear fft structure */ fft_free(&pfft); \endcode \note -Важно отметить, что если объект `fft_t` был создан для размера БПФ равного `n`, -то он может быть использован только для БПФ размера `n`. \n\n -Также необходимо заметить, что функции БПФ самостоятельно контролируют размер, -и самостоятельно выделяют память объекта БПФ при необходимости. -Так если вызвать любую функцию использующую структуру `fft_t` с заполненными -данными для длины БПФ `k` для расчета БПФ длины `n`, -то массивы структуры будут автоматически пересозданы для длины `n`. +It is important to note that if the object `fft_t` was created for the FFT size equal to` n`, +it can only be used for FFT of size `n`. \n \n +It’s also worth noting that the FFT functions independently control the size, and independently allocate the memory of the FFT object, if necessary. +So if you call any function using the `fft_t` structure with filled +data for the FFT length `k` for calculating the FFT of length`n`, +then the structure arrays will be automatically recreated for the length `n`. -\author -Бахурин Сергей. -www.dsplib.org +\author Sergey Bakhurin www.dsplib.org ***************************************************************************** */ diff --git a/dspl/dox/en/groups_define.dox b/dspl/dox/en/groups_define.dox index 86402ab..85ea3d5 100644 --- a/dspl/dox/en/groups_define.dox +++ b/dspl/dox/en/groups_define.dox @@ -36,7 +36,7 @@ groupdelay, impulse response and other. \defgroup SPEC_MATH_TRANSCEND Transcendent math functions -\defgroup SPEC_MATH_ELLIP_GROUP Elliptic Jacoby functions of the real and complex arguments. +\defgroup SPEC_MATH_ELLIP_GROUP Elliptic Jacobi functions of the real and complex arguments. \defgroup SPEC_MATH_RAND_GEN_GROUP Pseudo-random numbers generation This group describes the functions of the pseudo-random numbers generation diff --git a/dspl/dox/en/mainpage.dox b/dspl/dox/en/mainpage.dox index 5c4a3fd..5ec9d2d 100644 --- a/dspl/dox/en/mainpage.dox +++ b/dspl/dox/en/mainpage.dox @@ -1,10 +1,8 @@ /*! **************************************************************************** \mainpage DSPL-2.0 - Digital Signal Processing Algorithm Library -. \section sec_main_page DSPL-2.0 --- free DSP algorithm library - DSPL-2.0 --- opensource cross-platform digital signal processing algorithm library, written in C language. \n diff --git a/dspl/dox/ru/error_list.dox b/dspl/dox/ru/error_list.dox index 098f9b5..8de438b 100644 --- a/dspl/dox/ru/error_list.dox +++ b/dspl/dox/ru/error_list.dox @@ -82,7 +82,7 @@ \brief Неверно заданы частоты преобразования ФНЧ-ПФ и ФНЧ-РФ. Частотные маски полосовых и режекторных фильтров имеют две частоты среза или частоты заграждения. При реализации частотных преобразований фильтров -необходимо задавать правую частоту среза меньше левой. +необходимо задавать левую частоту среза меньше правой. */ /*! diff --git a/dspl/src/conv.c b/dspl/src/conv.c index e24a7ab..9aa6369 100644 --- a/dspl/src/conv.c +++ b/dspl/src/conv.c @@ -25,61 +25,9 @@ /******************************************************************************* -\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`. /n - Vector size is `[na x 1]`. /n /n - -\param[in] na Size of the first vector `a`. /n /n - -\param[in] b Pointer to the second vector `b`. /n - Vector size is `[nb x 1]`. /n /n - -\param[in] nb Size of the second vector `b`. /n /n - -\param[out] c Pointer to the convolution output vector \f$ c = a * b\f$. /n - Vector size is `[na + nb - 1 x 1]`. /n - Memory must be allocated. /n /n - -\return `RES_OK` if convolution is calculated successfully. /n -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 - /n - -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 +Real vectors linear convolution. +-------------------------------------------------------------------------------- +Documented: RU, EN *******************************************************************************/ int DSPL_API conv(double* a, int na, double* b, int nb, double* c) { @@ -122,61 +70,9 @@ int DSPL_API conv(double* a, int na, double* b, int nb, double* c) /****************************************************************************** -\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`. /n - Vector size is `[na x 1]`. /n /n - -\param[in] na Size of the first vector `a`. /n /n - -\param[in] b Pointer to the second vector `b`. /n - Vector size is `[nb x 1]`. /n /n - -\param[in] nb Size of the second vector `b`. /n /n - -\param[out] c Pointer to the convolution output vector \f$ c = a * b\f$. /n - Vector size is `[na + nb - 1 x 1]`. /n - Memory must be allocated. /n /n - -\return `RES_OK` if convolution is calculated successfully. /n -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 - /n - -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 + Complex vectors linear convolution. +-------------------------------------------------------------------------------- +Documented: RU, EN *******************************************************************************/ int DSPL_API conv_cmplx(complex_t* a, int na, complex_t* b, int nb, complex_t* c) @@ -224,75 +120,9 @@ int DSPL_API conv_cmplx(complex_t* a, int na, complex_t* b, /****************************************************************************** -\ingroup FILTER_CONV_GROUP -\fn int conv_fft(double* a, int na, double* b, int nb, - fft_t* pfft, int nfft, double* c) -\brief Real vectors fast linear convolution by using fast Fourier -transform algorithms - -Function convolves two real vectors \f$ c = a * b\f$ length `na` and `nb` -in the frequency domain by using FFT algorithms. This approach provide -high-performance convolution which increases with `na` and `nb` increasing. -The output convolution is a vector `c` with length equal to `na + nb - 1`. - -\param[in] a Pointer to the first vector `a`. /n - Vector size is `[na x 1]`. /n /n - -\param[in] na Size of the first vector `a`. /n /n - -\param[in] b Pointer to the second vector `b`. /n - Vector size is `[nb x 1]`. /n /n - -\param[in] nb Size of the second vector `b`. /n /n - -\param[in] pfft Pointer to the structure `fft_t`. /n - Function changes `fft_t` structure fields so `fft_t` must - be clear before program returns. /n /n - -\param[in] nfft FFT size. /n - This parameter set which FFT size will be used - for overlapped frequency domain convolution. /n - FFT size must be more of minimal `na` and `nb` value. - For example if `na = 10`, `nb = 4` then `nfft` parameter must - be more than 4. /n - -\param[out] c Pointer to the convolution output vector \f$ c = a * b\f$. /n - Vector size is `[na + nb - 1 x 1]`. /n - Memory must be allocated. /n /n - -\return `RES_OK` if convolution is calculated successfully. /n -Else \ref ERROR_CODE_GROUP "code error". /n /n - -Example: -\include conv_fft_test.c - -Program output: - -\verbatim -conv_fft error: 0x00000000 -conv error: 0x00000000 -c[ 0] = -0.00 d[ 0] = 0.00 -c[ 1] = -0.00 d[ 1] = 0.00 -c[ 2] = 1.00 d[ 2] = 1.00 -c[ 3] = 4.00 d[ 3] = 4.00 -c[ 4] = 10.00 d[ 4] = 10.00 -c[ 5] = 20.00 d[ 5] = 20.00 -c[ 6] = 35.00 d[ 6] = 35.00 -c[ 7] = 56.00 d[ 7] = 56.00 -c[ 8] = 77.00 d[ 8] = 77.00 -c[ 9] = 98.00 d[ 9] = 98.00 -c[ 10] = 119.00 d[ 10] = 119.00 -c[ 11] = 140.00 d[ 11] = 140.00 -c[ 12] = 161.00 d[ 12] = 161.00 -c[ 13] = 182.00 d[ 13] = 182.00 -c[ 14] = 190.00 d[ 14] = 190.00 -c[ 15] = 184.00 d[ 15] = 184.00 -c[ 16] = 163.00 d[ 16] = 163.00 -c[ 17] = 126.00 d[ 17] = 126.00 -c[ 18] = 72.00 d[ 18] = 72.00 -\endverbatim - -\author Sergey Bakhurin www.dsplib.org +Real vectors fast linear convolution by using fast Fourier transform +-------------------------------------------------------------------------------- +Documented: RU, EN *******************************************************************************/ int DSPL_API conv_fft(double* a, int na, double* b, int nb, fft_t* pfft, int nfft, double* c) diff --git a/dspl/src/dft.c b/dspl/src/dft.c index c9c8144..128d205 100644 --- a/dspl/src/dft.c +++ b/dspl/src/dft.c @@ -26,65 +26,9 @@ /****************************************************************************** -\ingroup DFT_GROUP -\fn int dft(double* x, int n, complex_t* y) -\brief `n`-points discrete Fourier transform of the real vector `x`. - -Function calculates \f$ n \f$-points discrete Fourier transform of -the real vector \f$ x(m) \f$, \f$ m = 0 \ldots n-1 \f$. \n -\f[ - Y(k) = \sum_{m = 0}^{n-1} x(m) - \exp \left( -j \frac{2\pi}{n} m k \right), -\f] -here \f$ k = 0 \ldots n-1 \f$. - -\param[in] x Pointer to the real input - signal vector \f$x(m)\f$, - \f$ m = 0 \ldots n-1 \f$. \n - Vector size is `[n x 1]`. \n \n - -\param[in] n DFT size \f$n\f$ (size of input and output vectors). \n \n - -\param[out] y Pointer to the complex DFT output vector \f$Y(k)\f$, - \f$ k = 0 \ldots n-1 \f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - - -\return `RES_OK` if DFT is calculated successfully. \n -Else \ref ERROR_CODE_GROUP "code error". - -Example: - -\include dft_test.c - -Program output: - -\verbatim - y[ 0] = 120.000 0.000 - y[ 1] = -8.000 40.219 - y[ 2] = -8.000 19.314 - y[ 3] = -8.000 11.973 - y[ 4] = -8.000 8.000 - y[ 5] = -8.000 5.345 - y[ 6] = -8.000 3.314 - y[ 7] = -8.000 1.591 - y[ 8] = -8.000 0.000 - y[ 9] = -8.000 -1.591 - y[10] = -8.000 -3.314 - y[11] = -8.000 -5.345 - y[12] = -8.000 -8.000 - y[13] = -8.000 -11.973 - y[14] = -8.000 -19.314 - y[15] = -8.000 -40.219 -\endverbatim - -\note -This function uses naive DFT algorithm and requires \f$ n^2 \f$ -operations. You can use fast Fourier transform algorithms -for DFT performance improvement. - -\author Sergey Bakhurin www.dsplib.org +`n`-points discrete Fourier transform of the real vector `x`. +-------------------------------------------------------------------------------- +Documented: RU, EN *******************************************************************************/ int DSPL_API dft(double* x, int n, complex_t* y) { @@ -118,65 +62,9 @@ int DSPL_API dft(double* x, int n, complex_t* y) /****************************************************************************** -\ingroup DFT_GROUP -\fn int dft_cmplx(complex_t* x, int n, complex_t* y) -\brief `n`-points discrete Fourier transform of the complex vector `x`. - -Function calculates \f$ n \f$-points discrete Fourier transform of -the complex vector \f$ x(m) \f$, \f$ m = 0 \ldots n-1 \f$. \n -\f[ - Y(k) = \sum_{m = 0}^{n-1} x(m) - \exp \left( -j \frac{2\pi}{n} m k \right), -\f] -here \f$ k = 0 \ldots n-1 \f$. - -\param[in] x Pointer to the complex input - signal vector \f$x(m)\f$, - \f$ m = 0 \ldots n-1 \f$. \n - Vector size is `[n x 1]`. \n \n - -\param[in] n DFT size \f$n\f$ (size of input and output vectors). \n \n - -\param[out] y Pointer to the complex DFT output vector \f$Y(k)\f$, - \f$ k = 0 \ldots n-1 \f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - - -\return `RES_OK` if DFT is calculated successfully. \n -Else \ref ERROR_CODE_GROUP "code error". - -Example: - -\include dft_cmplx_test.c - -Program output: - -\verbatim - y[ 0] = 120.000 0.000 - y[ 1] = -8.000 40.219 - y[ 2] = -8.000 19.314 - y[ 3] = -8.000 11.973 - y[ 4] = -8.000 8.000 - y[ 5] = -8.000 5.345 - y[ 6] = -8.000 3.314 - y[ 7] = -8.000 1.591 - y[ 8] = -8.000 0.000 - y[ 9] = -8.000 -1.591 - y[10] = -8.000 -3.314 - y[11] = -8.000 -5.345 - y[12] = -8.000 -8.000 - y[13] = -8.000 -11.973 - y[14] = -8.000 -19.314 - y[15] = -8.000 -40.219 -\endverbatim - -\note -This function uses naive DFT algorithm and requires \f$ n^2 \f$ -operations. You can use fast Fourier transform algorithms -for DFT performance improvement. - -\author Sergey Bakhurin www.dsplib.org +`n`-points discrete Fourier transform of the complex vector `x`. +-------------------------------------------------------------------------------- +Documented: RU, EN *******************************************************************************/ int DSPL_API dft_cmplx(complex_t* x, int n, complex_t* y) { @@ -214,65 +102,9 @@ int DSPL_API dft_cmplx(complex_t* x, int n, complex_t* y) /****************************************************************************** -\ingroup DFT_GROUP -\fn int idft_cmplx(complex_t* x, int n, complex_t* y) -\brief `n`-points inverse discrete Fourier transform of the complex vector `x`. - -Function calculates \f$ n \f$-points inverse discrete Fourier transform of -the complex vector \f$ x(m) \f$, \f$ m = 0 \ldots n-1 \f$. \n -\f[ - y(k) = \sum_{m = 0}^{n-1} x(m) - \exp \left( j \frac{2\pi}{n} m k \right), -\f] -here \f$ k = 0 \ldots n-1 \f$. - -\param[in] x Pointer to the complex input - vector \f$x(m)\f$, - \f$ m = 0 \ldots n-1 \f$. \n - Vector size is `[n x 1]`. \n \n - -\param[in] n IDFT size \f$n\f$ (size of input and output vectors). \n \n - -\param[out] y Pointer to the complex IDFT output vector \f$y(k)\f$, - \f$ k = 0 \ldots n-1 \f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - - -\return `RES_OK` if IDFT is calculated successfully. \n -Else \ref ERROR_CODE_GROUP "code error". - -Example: - -\include idft_cmplx_test.c - -Program output: - -\verbatim -x[ 0] = 0.000 +0.000j, z[ 0] = 0.000 -0.000 -x[ 1] = 1.000 +0.000j, z[ 1] = 1.000 -0.000 -x[ 2] = 2.000 +0.000j, z[ 2] = 2.000 -0.000 -x[ 3] = 3.000 +0.000j, z[ 3] = 3.000 -0.000 -x[ 4] = 4.000 +0.000j, z[ 4] = 4.000 -0.000 -x[ 5] = 5.000 +0.000j, z[ 5] = 5.000 -0.000 -x[ 6] = 6.000 +0.000j, z[ 6] = 6.000 -0.000 -x[ 7] = 7.000 +0.000j, z[ 7] = 7.000 -0.000 -x[ 8] = 8.000 +0.000j, z[ 8] = 8.000 -0.000 -x[ 9] = 9.000 +0.000j, z[ 9] = 9.000 -0.000 -x[10] = 10.000 +0.000j, z[10] = 10.000 -0.000 -x[11] = 11.000 +0.000j, z[11] = 11.000 +0.000 -x[12] = 12.000 +0.000j, z[12] = 12.000 +0.000 -x[13] = 13.000 +0.000j, z[13] = 13.000 +0.000 -x[14] = 14.000 +0.000j, z[14] = 14.000 +0.000 -x[15] = 15.000 +0.000j, z[15] = 15.000 -0.000 -\endverbatim - -\note -This function uses naive IDFT algorithm and requires \f$ n^2 \f$ -operations. You can use fast Fourier transform algorithms -for DFT performance improvement. - -\author Sergey Bakhurin www.dsplib.org +`n`-points inverse discrete Fourier transform of the complex vector `x`. +-------------------------------------------------------------------------------- +Documented: RU, EN *******************************************************************************/ int DSPL_API idft_cmplx(complex_t* x, int n, complex_t* y) { diff --git a/dspl/src/ellipj.c b/dspl/src/ellipj.c index 7c3f47d..e6ff0b2 100644 --- a/dspl/src/ellipj.c +++ b/dspl/src/ellipj.c @@ -26,37 +26,12 @@ #include "dspl.h" + /***************************************************************************** -\ingroup SPEC_MATH_ELLIP_GROUP -\fn int ellip_acd(double* w, int n, double k, double* u) -\brief Inverse Jacobi elliptic function -\f$ u = \textrm{cd}^{-1}(w, k)\f$ of real vector argument - -Function calculates inverse Jacobi elliptic function -\f$ u = \textrm{cd}^{-1}(w, k)\f$ of real vector `w`. \n - -\param[in] w Pointer to the argument vector \f$ w \f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - -\param[in] n Size of vector `w`. \n - -\param[in] k Elliptical modulus \f$ k \f$. \n - Elliptical modulus is real parameter, - which values can be from 0 to 1. \n \n - - -\param[out] u Pointer to the vector of inverse Jacobi elliptic function - \f$ u = \textrm{cd}^{-1}(w, k)\f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - - -\return -`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n - -\author Sergey Bakhurin www.dsplib.org - ******************************************************************************/ +Inverse Jacobi elliptic function cd^-1(w, k) for the real argument +-------------------------------------------------------------------------------- +Documented: RU, EN +*******************************************************************************/ int DSPL_API ellip_acd(double* w, int n, double k, double* u) { double lnd[ELLIP_ITER], t; @@ -91,37 +66,12 @@ int DSPL_API ellip_acd(double* w, int n, double k, double* u) + /***************************************************************************** -\ingroup SPEC_MATH_ELLIP_GROUP -\fn int ellip_acd_cmplx(complex_t* w, int n, double k, complex_t* u) -\brief Inverse Jacobi elliptic function -\f$ u = \textrm{cd}^{-1}(w, k)\f$ of complex vector argument - -Function calculates inverse Jacobi elliptic function -\f$ u = \textrm{cd}^{-1}(w, k)\f$ of complex vector `w`. \n - -\param[in] w Pointer to the argument vector \f$ w \f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - -\param[in] n Size of vector `w`. \n - -\param[in] k Elliptical modulus \f$ k \f$. \n - Elliptical modulus is real parameter, - which values can be from 0 to 1. \n \n - - -\param[out] u Pointer to the vector of inverse Jacobi elliptic function - \f$ u = \textrm{cd}^{-1}(w, k)\f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - - -\return -`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n - -\author Sergey Bakhurin www.dsplib.org - ******************************************************************************/ +Inverse Jacobi elliptic function cd^-1(w, k) for the complex argument +-------------------------------------------------------------------------------- +Documented: RU, EN +*******************************************************************************/ int DSPL_API ellip_acd_cmplx(complex_t* w, int n, double k, complex_t* u) { double lnd[ELLIP_ITER], t; @@ -177,36 +127,10 @@ int DSPL_API ellip_acd_cmplx(complex_t* w, int n, double k, complex_t* u) /***************************************************************************** -\ingroup SPEC_MATH_ELLIP_GROUP -\fn int ellip_asn(double* w, int n, double k, double* u) -\brief Inverse Jacobi elliptic function -\f$ u = \textrm{sn}^{-1}(w, k)\f$ of real vector argument - -Function calculates inverse Jacobi elliptic function -\f$ u = \textrm{sn}^{-1}(w, k)\f$ of real vector `w`. \n - -\param[in] w Pointer to the argument vector \f$ w \f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - -\param[in] n Size of vector `w`. \n - -\param[in] k Elliptical modulus \f$ k \f$. \n - Elliptical modulus is real parameter, - which values can be from 0 to 1. \n \n - - -\param[out] u Pointer to the vector of inverse Jacobi elliptic function - \f$ u = \textrm{sn}^{-1}(w, k)\f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - - -\return -`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n - -\author Sergey Bakhurin www.dsplib.org - ******************************************************************************/ +Inverse Jacobi elliptic function sn^-1(w, k) for the real argument +-------------------------------------------------------------------------------- +Documented: RU, EN +*******************************************************************************/ int DSPL_API ellip_asn(double* w, int n, double k, double* u) { double lnd[ELLIP_ITER], t; @@ -242,36 +166,10 @@ int DSPL_API ellip_asn(double* w, int n, double k, double* u) /***************************************************************************** -\ingroup SPEC_MATH_ELLIP_GROUP -\fn int ellip_asn_cmplx(complex_t* w, int n, double k, complex_t* u) -\brief Inverse Jacobi elliptic function -\f$ u = \textrm{sn}^{-1}(w, k)\f$ of complex vector argument - -Function calculates inverse Jacobi elliptic function -\f$ u = \textrm{sn}^{-1}(w, k)\f$ of complex vector `w`. \n - -\param[in] w Pointer to the argument vector \f$ w \f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - -\param[in] n Size of vector `w`. \n - -\param[in] k Elliptical modulus \f$ k \f$. \n - Elliptical modulus is real parameter, - which values can be from 0 to 1. \n \n - - -\param[out] u Pointer to the vector of inverse Jacobi elliptic function - \f$ u = \textrm{sn}^{-1}(w, k)\f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - - -\return -`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n - -\author Sergey Bakhurin www.dsplib.org - ******************************************************************************/ +Inverse Jacobi elliptic function sn^-1(w, k) for the complex argument +-------------------------------------------------------------------------------- +Documented: RU, EN +*******************************************************************************/ int DSPL_API ellip_asn_cmplx(complex_t* w, int n, double k, complex_t* u) { double lnd[ELLIP_ITER], t; @@ -326,37 +224,10 @@ int DSPL_API ellip_asn_cmplx(complex_t* w, int n, double k, complex_t* u) /***************************************************************************** -\ingroup SPEC_MATH_ELLIP_GROUP -int ellip_cd(double* u, int n, double k, double* y) -\brief Jacobi elliptic function -\f$ y = \textrm{cd}(u K(k), k)\f$ of real vector argument - -Function calculates Jacobi elliptic function -\f$ y = \textrm{cd}(u K(k), k)\f$ of real vector `u` and -elliptical modulus `k`. \n - -\param[in] u Pointer to the argument vector \f$ u \f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - -\param[in] n Size of vector `u`. \n - -\param[in] k Elliptical modulus \f$ k \f$. \n - Elliptical modulus is real parameter, - which values can be from 0 to 1. \n \n - - -\param[out] y Pointer to the vector of Jacobi elliptic function - \f$ y = \textrm{cd}(u K(k), k)\f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - - -\return -`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n - -\author Sergey Bakhurin www.dsplib.org - ******************************************************************************/ +Jacobi elliptic function cd(u*K(k), k) for the real argument +-------------------------------------------------------------------------------- +Documented: RU, EN +*******************************************************************************/ int DSPL_API ellip_cd(double* u, int n, double k, double* y) { double lnd[ELLIP_ITER]; @@ -390,37 +261,10 @@ int DSPL_API ellip_cd(double* u, int n, double k, double* y) /***************************************************************************** -\ingroup SPEC_MATH_ELLIP_GROUP -int ellip_cd_cmplx(complex_t* u, int n, double k, complex_t* y) -\brief Jacobi elliptic function -\f$ y = \textrm{cd}(u K(k), k)\f$ of complex vector argument - -Function calculates Jacobi elliptic function -\f$ y = \textrm{cd}(u K(k), k)\f$ of complex vector `u` and -elliptical modulus `k`. \n - -\param[in] u Pointer to the argument vector \f$ u \f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - -\param[in] n Size of vector `u`. \n - -\param[in] k Elliptical modulus \f$ k \f$. \n - Elliptical modulus is real parameter, - which values can be from 0 to 1. \n \n - - -\param[out] y Pointer to the vector of Jacobi elliptic function - \f$ y = \textrm{cd}(u K(k), k)\f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - - -\return -`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n - -\author Sergey Bakhurin www.dsplib.org - ******************************************************************************/ +Jacobi elliptic function cd(u*K(k), k) for the complex argument +-------------------------------------------------------------------------------- +Documented: RU, EN +*******************************************************************************/ int DSPL_API ellip_cd_cmplx(complex_t* u, int n, double k, complex_t* y) { double lnd[ELLIP_ITER], t; @@ -467,81 +311,11 @@ int DSPL_API ellip_cd_cmplx(complex_t* u, int n, double k, complex_t* y) /***************************************************************************** -\ingroup SPEC_MATH_ELLIP_GROUP -\fn int ellip_landen(double k, int n, double* y) -\brief Function calculates complete elliptical integral -coefficients \f$ k_i \f$ - -Complete elliptical integral \f$ K(k) \f$ can be described as: - -\f[ -K(k) = \frac{\pi}{2} \prod_{i = 1}^{\infty}(1+k_i), -\f] - -here \f$ k_i \f$ -- coefficients which calculated -iterative from \f$ k_0 = k\f$: - -\f[ -k_i = -\left( -\frac{k_{i-1}} -{ -1+\sqrt{1-k_{i-1}^2} -} -\right)^2 -\f] - -This function calculates `n` fist coefficients \f$ k_i \f$, which can -be used for Complete elliptical integral. - - -\param[in] k Elliptical modulus \f$ k \f$. \n - Elliptical modulus is real parameter, - which values can be from 0 to 1. \n \n - - -\param[in] n Number of \f$ k_i \f$ which need to calculate.\n - Parameter `n` is size of output vector `y`.\n - -\param[out] y pointer to the real vector which keep \f$ k_i \f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - - -\return - `RES_OK` -- successful exit, else \ref ERROR_CODE_GROUP "error code". \n - -Example: - -\include ellip_landen_test.c - -Result: - -\verbatim - i k[i] - - 1 4.625e-01 - 2 6.009e-02 - 3 9.042e-04 - 4 2.044e-07 - 5 1.044e-14 - 6 2.727e-29 - 7 1.859e-58 - 8 8.640e-117 - 9 1.866e-233 -10 0.000e+00 -11 0.000e+00 -12 0.000e+00 -13 0.000e+00 -\endverbatim - -\note Complete elliptical integral converges enough fast - if modulus \f$ k<1 \f$. There are 10 to 20 coefficients \f$ k_i \f$ ​​ - are sufficient for practical applications - to ensure complete elliptic integral precision within EPS. - -\author Sergey Bakhurin www.dsplib.org - ******************************************************************************/ + Function calculates complete elliptical integral coefficients \f$ k_i \f$ + by Landen transform +-------------------------------------------------------------------------------- +Documented: RU, EN +*******************************************************************************/ int DSPL_API ellip_landen(double k, int n, double* y) { int i; @@ -568,8 +342,10 @@ int DSPL_API ellip_landen(double k, int n, double* y) /***************************************************************************** - * Elliptic modular equation - ******************************************************************************/ + Elliptic modular equation + -------------------------------------------------------------------------------- +Documented: NO, NO +*******************************************************************************/ int DSPL_API ellip_modulareq(double rp, double rs, int ord, double *k) { double ep, es, ke, kp, t, sn = 0.0; @@ -614,8 +390,11 @@ int DSPL_API ellip_modulareq(double rp, double rs, int ord, double *k) /***************************************************************************** - * Elliptic rational function - ******************************************************************************/ +Elliptic rational function +-------------------------------------------------------------------------------- +Documented: NO, NO +*******************************************************************************/ + int DSPL_API ellip_rat(double* w, int n, int ord, double k, double* u) { double t, xi, w2, xi2, k2; @@ -663,37 +442,10 @@ int DSPL_API ellip_rat(double* w, int n, int ord, double k, double* u) /***************************************************************************** -\ingroup SPEC_MATH_ELLIP_GROUP -int ellip_sn(double* u, int n, double k, double* y) -\brief Jacobi elliptic function -\f$ y = \textrm{sn}(u K(k), k)\f$ of real vector argument - -Function calculates Jacobi elliptic function -\f$ y = \textrm{sn}(u K(k), k)\f$ of real vector `u` and -elliptical modulus `k`. \n - -\param[in] u Pointer to the argument vector \f$ u \f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - -\param[in] n Size of vector `u`. \n - -\param[in] k Elliptical modulus \f$ k \f$. \n - Elliptical modulus is real parameter, - which values can be from 0 to 1. \n \n - - -\param[out] y Pointer to the vector of Jacobi elliptic function - \f$ y = \textrm{sn}(u K(k), k)\f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - - -\return -`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n - -\author Sergey Bakhurin www.dsplib.org - ******************************************************************************/ +Jacobi elliptic function sn(u*K(k), k) for the real vector argument +-------------------------------------------------------------------------------- +Documented: RU, EN +*******************************************************************************/ int DSPL_API ellip_sn(double* u, int n, double k, double* y) { double lnd[ELLIP_ITER]; @@ -724,37 +476,10 @@ int DSPL_API ellip_sn(double* u, int n, double k, double* y) /***************************************************************************** -\ingroup SPEC_MATH_ELLIP_GROUP -int ellip_sn_cmplx(complex_t* u, int n, double k, complex_t* y) -\brief Jacobi elliptic function -\f$ y = \textrm{sn}(u K(k), k)\f$ of complex vector argument - -Function calculates Jacobi elliptic function -\f$ y = \textrm{sn}(u K(k), k)\f$ of complex vector `u` and -elliptical modulus `k`. \n - -\param[in] u Pointer to the argument vector \f$ u \f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - -\param[in] n Size of vector `u`. \n - -\param[in] k Elliptical modulus \f$ k \f$. \n - Elliptical modulus is real parameter, - which values can be from 0 to 1. \n \n - - -\param[out] y Pointer to the vector of Jacobi elliptic function - \f$ y = \textrm{sn}(u K(k), k)\f$. \n - Vector size is `[n x 1]`. \n - Memory must be allocated. \n \n - - -\return -`RES_OK` successful exit, else \ref ERROR_CODE_GROUP "error code". \n - -\author Sergey Bakhurin www.dsplib.org - ******************************************************************************/ +Jacobi elliptic function sn(u*K(k), k) for the complex vector argument +-------------------------------------------------------------------------------- +Documented: RU, EN +*******************************************************************************/ int DSPL_API ellip_sn_cmplx(complex_t* u, int n, double k, complex_t* y) { double lnd[ELLIP_ITER], t;