kopia lustrzana https://github.com/Dsplib/libdspl-2.0
Changes to be committed:
modified: dspl/dox/doxyfile_en modified: dspl/dox/doxyfile_ru modified: dspl/dox/en/getting_started_compile_codeblocks_win.dox modified: dspl/dox/en/getting_started_compile_make_win.dox modified: dspl/dox/en/getting_started_toolchain.dox modified: dspl/dox/en/gnuplot.dox modified: dspl/dox/en/goertzel.dox new file: dspl/dox/en/img/Untitled (Recovered).bmp modified: dspl/dox/en/inout.dox modified: dspl/dox/header_ru.html modified: dspl/dox/ru/mainpage.dox modified: examples/src/dspl_info_test.cpull/6/merge
rodzic
adf9e6f06d
commit
74a71b63de
|
@ -967,8 +967,8 @@ EXAMPLE_RECURSIVE = YES
|
|||
# that contain images that are to be included in the documentation (see the
|
||||
# \image command).
|
||||
|
||||
IMAGE_PATH = ru/img \
|
||||
../../bin/img
|
||||
IMAGE_PATH = ../../bin/img \
|
||||
en/img
|
||||
|
||||
# The INPUT_FILTER tag can be used to specify a program that doxygen should
|
||||
# invoke to filter for each input file. Doxygen will invoke the filter program
|
||||
|
|
|
@ -1524,7 +1524,7 @@ ECLIPSE_DOC_ID = org.doxygen.Project
|
|||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
DISABLE_INDEX = YES
|
||||
DISABLE_INDEX = NO
|
||||
|
||||
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
|
||||
# structure should be generated to display hierarchical information. If the tag
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*! ****************************************************************************
|
||||
\page getting_started_codeblocks Компиляция libdspl-2.0 в CodeBlocks
|
||||
\page getting_started_codeblocks Build libdspl-2.0 by CodeBlocks IDE
|
||||
|
||||
\section sec_codeblocks Компиляция libdspl-2.0 в CodeBlocks
|
||||
\section sec_codeblocks Build libdspl-2.0 by CodeBlocks IDE
|
||||
|
||||
Предварительно необходимо установить все необходимые утилиты.
|
||||
Если этот шаг не сделан, то смотри раздел:
|
||||
You must first install all the necessary utilities.
|
||||
If this step is not done, see section:
|
||||
\n
|
||||
\ref getting_started_toolchain
|
||||
\n
|
||||
|
@ -13,22 +13,25 @@
|
|||
|
||||
|
||||
|
||||
\subsection sec_codeblocks_download Скачиваем исходные коды libdspl-2.0
|
||||
Скачиваем
|
||||
\subsection sec_codeblocks_download Download libdspl-2.0 source code
|
||||
Download libdspl-2.0 source code from
|
||||
<a href="https://github.com/Dsplib/libdspl-2.0">
|
||||
с сайта Github.com
|
||||
Github.com:
|
||||
</a>
|
||||
исходные коды DSPL:
|
||||
|
||||
\n
|
||||
\n
|
||||
\image html dspl_github.png
|
||||
\n
|
||||
\n
|
||||
You can clone project by Git or just download zip-archive.
|
||||
|
||||
Разархивируем в рабочий каталог.
|
||||
Unzip or clone project to the folder.
|
||||
|
||||
Вы можете разархивировать в любой каталог, `libdspl-2.0` будет
|
||||
обозначать каталог, в который разархивированы исходные коды.
|
||||
You can unzip to any directory, here `libdspl-2.0` will be
|
||||
indicate the directory in which the source codes are unzipped.
|
||||
|
||||
В качестве примера, исходные коды были разархивированы в
|
||||
каталог `J:\libdspl-2.0`. \n
|
||||
As an example, the source codes were unzipped to
|
||||
directory `J:\libdspl-2.0`.
|
||||
|
||||
|
||||
|
||||
|
@ -36,103 +39,102 @@
|
|||
|
||||
|
||||
|
||||
\subsection sec_codeblocks_start Запуск и настройка CodeBlocks
|
||||
Запускаем IDE CodeBlocks и в меню `File` выбираем меню `Open`:
|
||||
\subsection sec_codeblocks_start Run CodeBlocks IDE and settings
|
||||
Run CodeBlocks IDE and select menu`File -> Open`:
|
||||
\n
|
||||
\n
|
||||
\image html codeblocks_1.png
|
||||
\n
|
||||
\n
|
||||
В открывшемся диалоговом окне переходим в каталог
|
||||
`\libdspl-2.0\ide\codeblocks`,
|
||||
где `libdspl-2.0` - каталог, в который была разархивирован проект DSPL.
|
||||
Open `\libdspl-2.0\ide\codeblocks`,
|
||||
here `libdspl-2.0` - directory into which the project was unzipped or cloned.
|
||||
\n
|
||||
\n
|
||||
\image html codeblocks_2.png
|
||||
\n
|
||||
\n
|
||||
Открываем `dspl.workspace` и находим внутри проект
|
||||
Open `dspl.workspace` and select
|
||||
`examples -> src -> dspl_info_test.c`.
|
||||
В окне редактора увидим короткий исходный код программы, которая загружает
|
||||
библиотеку, вызывает функцию `dspl_info` и выгружает библиотеку.
|
||||
Test program source code we can see in editor.
|
||||
Test program links `libdspl.dll` and run `dspl_info` function.
|
||||
\n
|
||||
\n
|
||||
\image html codeblocks_3.png
|
||||
\n
|
||||
\n
|
||||
Теперь важный шаг перед первой сборкой проектов: необходимо настроить
|
||||
среду CodeBlocks для работы с компилятором GCC и отладчиком.
|
||||
Для этого открываем меню `Settings->Compiler`:
|
||||
Before the first build of projects: you need to configure
|
||||
CodeBlocks environment for working with the GCC compiler and debugger. \n
|
||||
Open menu `Settings->Compiler`:
|
||||
\n
|
||||
\n
|
||||
\image html codeblocks_4.png
|
||||
\n
|
||||
\n
|
||||
В открывшемся окне настроек выбираем `Global compiler settings` и переходим
|
||||
на вкладку`Toolchain executables`. Все поля данного окна должны быть
|
||||
заполнены как на картинке:
|
||||
Select `Global compiler settings` and `Toolchain executables`.
|
||||
All fields of this window needs to fill as follow:
|
||||
\n
|
||||
\n
|
||||
\image html codeblocks_5.png
|
||||
\n
|
||||
\n
|
||||
Нажимает `OK` и окно закроется.
|
||||
Press `OK` window will be closed.
|
||||
|
||||
Теперь настраиваем отладчик. Для этого открываем меню `Settings->Debugger`:
|
||||
Next step is debugger configuration. Open menu `Settings->Debugger`:
|
||||
\n
|
||||
\n
|
||||
\image html codeblocks_6.png
|
||||
\n
|
||||
\n
|
||||
В открывшемся окне выбираем `GDB/CDB debugger -> Default` и заполняем поля
|
||||
формы и проставляем галочки как показано на картинке:
|
||||
Select `GDB/CDB debugger -> Default` and all fields of this window
|
||||
needs to fill as follow:
|
||||
\n
|
||||
\n
|
||||
\image html codeblocks_7.png
|
||||
\n
|
||||
\n
|
||||
Нажимаем `OK` и теперь все готово для сборки проекта.
|
||||
Press `OK` and CodeBlocks is ready to working.
|
||||
|
||||
|
||||
|
||||
|
||||
\subsection sec_codeblocks_compile Сборка и выполнение тестовой программы
|
||||
Выбираем меню `Build -> Rebuild workspace`:
|
||||
\subsection sec_codeblocks_compile Build librray and run test program
|
||||
Run menu `Build -> Rebuild workspace`:
|
||||
\n
|
||||
\n
|
||||
\image html codeblocks_8.png
|
||||
\n
|
||||
\n
|
||||
Если окроектся диалог с вопросом, то соглашаемся:
|
||||
If the dialogue with the question is opened, then we press `Yes`:
|
||||
\n
|
||||
\n
|
||||
\image html codeblocks_9.png
|
||||
\n
|
||||
\n
|
||||
В результате начнется первая сборка проекта, которая может занять
|
||||
несколько минут, потому что необходимо первый раз скомпилировать
|
||||
библиотеки BLAS и LAPACK. Последующие сборки будут быстрее,
|
||||
потому что перекомпилировать надо будет только измененные файлы.
|
||||
As a result, the first compilation of the project will begin, which may take
|
||||
few minutes because you need to compile for the first time
|
||||
BLAS and LAPACK libraries. Subsequent builds will be faster
|
||||
because only modified files will need to be recompiled.
|
||||
|
||||
По завершению сборки в поле `Build log` появится сообщение как на картинке:
|
||||
Upon completion of the compilation, a message will appear
|
||||
in the `Build log` field as in the picture:
|
||||
\n
|
||||
\n
|
||||
\image html codeblocks_10.png
|
||||
\n
|
||||
\n
|
||||
Проект собрался и нам осталось лишь выполнить приложение:
|
||||
The project is ready and we just have to run the application:
|
||||
\n
|
||||
\n
|
||||
\image html codeblocks_11.png
|
||||
\n
|
||||
\n
|
||||
В результате появится консольное окно в который функция `dspl_info`
|
||||
выведет информацию о библиотеке DSPL 2.0:
|
||||
As a result, a console window will appear in which the function `dspl_info`
|
||||
will display information about the libdspl library:
|
||||
\n
|
||||
\n
|
||||
\image html codeblocks_12.png
|
||||
\n
|
||||
\n
|
||||
Таким образом, настройка CodeBlocks и компиляция проекта закончена успешно.
|
||||
CodeBlocks configuration and project compilation completed successfully.
|
||||
\n
|
||||
***************************************************************************** */
|
|
@ -1,73 +1,75 @@
|
|||
/*! ****************************************************************************
|
||||
\page getting_started_make Компиляция libdspl-2.0 утилитой make
|
||||
\page getting_started_make Build libdspl-2.0 by make program
|
||||
|
||||
\section sec_getting_started_make Компиляция libdspl-2.0 утилитой make
|
||||
\section sec_getting_started_make Build libdspl-2.0 by make program
|
||||
|
||||
Предварительно необходимо установить все необходимые утилиты.
|
||||
Если этот шаг не сделан, то смотри раздел: \n
|
||||
You must first install all the necessary utilities.
|
||||
If this step is not done, see section: \n
|
||||
\ref getting_started_toolchain
|
||||
\n
|
||||
|
||||
|
||||
\subsection sec_make_download Скачиваем исходные коды libdspl-2.0
|
||||
Скачиваем
|
||||
\subsection sec_make_download Download libdspl-2.0 source code
|
||||
|
||||
Download libdspl-2.0 source code from
|
||||
<a href="https://github.com/Dsplib/libdspl-2.0">
|
||||
с сайта Github.com
|
||||
Github.com:
|
||||
</a>
|
||||
исходные коды DSPL:
|
||||
\n
|
||||
\n
|
||||
\image html dspl_github.png
|
||||
\n
|
||||
\n
|
||||
Разархивируем в рабочий каталог.
|
||||
You can clone project by Git or just download zip-archive.
|
||||
|
||||
Вы можете разархивировать в любой каталог, `libdspl-2.0` будет
|
||||
обозначать каталог, в который разархивированы исходные коды.
|
||||
Unzip or clone project to the folder.
|
||||
|
||||
В качестве примера, исходные коды были разархивированы в
|
||||
каталог `J:\libdspl-2.0`.
|
||||
You can unzip to any directory, here `libdspl-2.0` will be
|
||||
indicate the directory in which the source codes are unzipped.
|
||||
|
||||
As an example, the source codes were unzipped to
|
||||
directory `J:\libdspl-2.0`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\subsection sec_make_compile Сборка проекта и выполнение тестовой программы
|
||||
Переходим в указанный каталог:
|
||||
\subsection sec_make_compile Build libdspl-2.0 and run test program
|
||||
Open the `libdspl-2.0` directory:
|
||||
\n
|
||||
\n
|
||||
\image html libdspl_dir.png
|
||||
\n
|
||||
\n
|
||||
Выделяем в строку адреса и вводим туда `cmd`:
|
||||
Select address line and type `cmd`:
|
||||
\n
|
||||
\n
|
||||
\image html libdspl_cmd.png
|
||||
\n
|
||||
\n
|
||||
В результате откроется консоль Windows в которую можно вводить команды. \n
|
||||
Вводим команду `ming32-make`:\n
|
||||
The Windows console opens and we can write command `ming32-make`:\n
|
||||
\n
|
||||
\n
|
||||
\image html winconsole_1.png
|
||||
\n
|
||||
\n
|
||||
После нажатия `[Enter]` начнется сборка всех компонент библиотеки.
|
||||
Press`[Enter]` and library compilation will begin.
|
||||
\note
|
||||
Время первой сборки зависит от производительности компьютера и может
|
||||
занимать несколько минут. Последующие сборки будут значительно
|
||||
быстрее, потому что при первой сборке компилируются библиотеки BLAS и
|
||||
LAPACK, которые линкуются в дальнейшем из готовых объектных файлов.
|
||||
First build time depends on computer performance and may
|
||||
take a few minutes. Subsequent builds will be significantly
|
||||
faster because the BLA and LAPACK libraries are compiled during the
|
||||
first build and are later linked from ready-made object files. \n
|
||||
|
||||
После сборки проекта можно перейти в каталог `bin` в котором сохранены
|
||||
программы примеры. Также в данном каталоге можно найти готовую библиотеку
|
||||
|
||||
After building the project, you can go to the `bin` directory in which keeps
|
||||
program examples. Also in this directory you can find a ready-made library
|
||||
`libdspl.dll`:
|
||||
\n
|
||||
\n
|
||||
\image html libdspl_bin.png
|
||||
\n
|
||||
\n
|
||||
На этом установка всех компонент и сборка проекта окончена. \n
|
||||
`libdspl.dll` building completes \n
|
||||
|
||||
Смотри также: \ref getting_started_codeblocks \n
|
||||
See also: \ref getting_started_codeblocks \n
|
||||
***************************************************************************** */
|
|
@ -1,26 +1,28 @@
|
|||
/*! ****************************************************************************
|
||||
|
||||
\page getting_started_toolchain Установка DSPLIB toolchain в Windows
|
||||
\page getting_started_toolchain Install DSPLIB toolchain on Windows
|
||||
|
||||
\section dec_getting_started_toolchain Установка DSPLIB toolchain в Windows
|
||||
\section dec_getting_started_toolchain Install DSPLIB toolchain on Windows
|
||||
|
||||
|
||||
\subsection download_toolchain_windows Загрузка установщика
|
||||
Запуск DSPL в системе Windows требует установки компилятора, Unix-утилит, и
|
||||
пакета построения графиков GNUPlot. Также желательно установить консольный
|
||||
файловый менеджер Far и IDE для разработки и отладки программ. \n
|
||||
Для установки всего необходимого софта предлагается скачать и установить
|
||||
DSPLIB toolchain - полный набор утилит необходимых для работы с библиотекой.
|
||||
\subsection download_toolchain_windows DSPLIB toolchain installer
|
||||
Building libdspl-2.0 on a Windows system requires installation
|
||||
of a compiler, Unix utilities, and Gnuplot package.
|
||||
It is also advisable to install the console file manager Far
|
||||
and IDE for developing and debugging programs. \n
|
||||
|
||||
DSPLIB toolchain is complete set of utilities necessary
|
||||
for working with libdspl-2.0 on a Windows system.
|
||||
\n
|
||||
\n
|
||||
<a href = "http://ru.dsplib.org/dsplib_toolchain_20_04_win_x64.exe">
|
||||
<b>Скачать установщик dsplib_toolchain_20_04_win_x64.exe</b>
|
||||
</a>(~219 МБ).
|
||||
<b>Download dsplib_toolchain_20_04_win_x64.exe</b>
|
||||
</a>(~219 MB).
|
||||
\n
|
||||
\n
|
||||
<b>Cостав dsplib toolchain 20.04:</b> \n
|
||||
<b>DSPLIB toolchain 20.04 contains:</b> \n
|
||||
<a href = "https://sourceforge.net/projects/mingw-w64/files/mingw-w64/">
|
||||
MinGW-W64-builds-4.3.5 (версия GCC компилятора 8.1.0)
|
||||
MinGW-W64-builds-4.3.5 (GCC compiler v. 8.1.0)
|
||||
</a>
|
||||
\n
|
||||
<a href = "http://www.codeblocks.org">
|
||||
|
@ -45,37 +47,37 @@ Native Win32 ports of some GNU utilities
|
|||
|
||||
|
||||
|
||||
\subsection install_gcc Установка DSPLIB toolchain в системе Windows
|
||||
Запускаем установщик и выбираем директорию в которую будет произведена установка
|
||||
всех компонент.
|
||||
\subsection install_gcc Install DSPLIB toolchain on Windows
|
||||
Run the installer and select the path directory.
|
||||
\n
|
||||
\n
|
||||
\image html toolchain_1.png
|
||||
\n
|
||||
\n
|
||||
По умолчанию установка производится по адресу `C:\dsplib`.
|
||||
Default path is `C:\dsplib`.
|
||||
|
||||
\note
|
||||
Настоятельно рекомендуется устанавливать все компоненты в каталог
|
||||
`C:\dsplib`, потому что IDE CodeBlocks и другие программы настроены на
|
||||
работу именно из этого каталога.
|
||||
It is highly recommended that all components be installed in a directory.
|
||||
`C:\dsplib` because IDE CodeBlocks and other programs are configured to
|
||||
work from this directory.
|
||||
|
||||
После нажатия кнопки `[Установить]` начнется процесс копирования пакетов в
|
||||
указанный каталог.
|
||||
Press `[Install]` button and the process will copy packages to
|
||||
specified directory.
|
||||
\n
|
||||
\n
|
||||
\image html toolchain_2.png
|
||||
\n
|
||||
\n
|
||||
По завершению копирования файлов указанные пути будут прописаны в переменной
|
||||
PATH, а на рабочем столе будут созданы иконки FarManager и IDE CodeBlocks. \n
|
||||
Для завершения установки необходимо нажать `[Завершить]`.
|
||||
Upon completion of file copying, the specified paths will be written
|
||||
in the `PATH` variable, and the FarManager and IDE CodeBlocks icons will
|
||||
be created on the desktop. \n
|
||||
To complete the installation, click `[Close]`.
|
||||
\n
|
||||
\n
|
||||
\image html toolchain_3.png
|
||||
\n
|
||||
\n
|
||||
Перейдя в каталог `C:\dsplib` можно увидеть следующие установленные пакеты:
|
||||
In the `C:\dsplib` directory we can see follow packages:
|
||||
\n
|
||||
\n
|
||||
\image html toolchain_4.png
|
||||
|
@ -83,23 +85,21 @@ PATH, а на рабочем столе будут созданы иконки F
|
|||
\n
|
||||
`codeblocks` --- IDE CodeBlocks \n
|
||||
|
||||
`farmanager` --- Консольный файловый менеджер. Очень удобен для запуска
|
||||
консольных приложений \n
|
||||
`farmanager` --- Console file manager. \n
|
||||
|
||||
`gnuplot` --- Многофункциональный пакет построения графиков. \n
|
||||
`gnuplot` --- Portable command-line driven graphing utility. \n
|
||||
|
||||
`mingw64` --- Набор компиляторов gcc для языков C, C++ и FORTRAN
|
||||
(для BLAS и LAPACK). \n
|
||||
`mingw64` --- GCC comliler for C, C++ and FORTRAN
|
||||
(needs for BLAS and LAPACK). \n
|
||||
|
||||
`UnxUtils` --- Windows интерфейс для Unix утилит.
|
||||
Необходимо для поддержки кроссплатформенной
|
||||
компиляции проекта. \n
|
||||
`UnxUtils` --- Windows interface for Unix utilities. \n
|
||||
|
||||
`Uninstall.exe` --- Деинсталлятор, способный удалить все
|
||||
компоненты и переменные `PATH`.
|
||||
`Uninstall.exe` --- Uninstaller that can remove everything
|
||||
components and `PATH` variables.
|
||||
|
||||
После того как полный набор утилит и программ установлен можно переходить к
|
||||
сборке библиотеки DSPL: \n
|
||||
|
||||
After the full set of utilities and programs is installed, you can compile and
|
||||
run libdspl-2.0. \n
|
||||
|
||||
\ref getting_started_make \n
|
||||
\ref getting_started_codeblocks \n
|
||||
|
|
|
@ -5,79 +5,77 @@
|
|||
void** hplot)
|
||||
|
||||
\brief
|
||||
Создать график GNUPLOT.
|
||||
Create GNUPLOT chart.
|
||||
|
||||
Данная функция открывает пакет GNUPLOT в зависимости от передаваемых в программу
|
||||
параметров `argv`. После вызова данной функции по адресу `hplot` будет записан
|
||||
handle графика и появляется возможность посылать GNUPLOT команды для отображения
|
||||
графиков.
|
||||
This function opens the GNUPLOT package depending on the `argv` parameters
|
||||
passed to the program. After calling this function, the handle of the graph
|
||||
will be written to the address `hplot` and it becomes possible to send GNUPLOT
|
||||
commands to display the graphs.
|
||||
|
||||
\note С точки зрения системы, `hplot` является указателем на открытый файл,
|
||||
в который можно записывать команды для исполнения пакетом GNUPLOT.
|
||||
\note From a system point of view, `hplot` is a pointer to an open file
|
||||
in which you can write commands for execution by the GNUPLOT package.
|
||||
|
||||
|
||||
|
||||
\param[in] argc
|
||||
Количество аргументов вызова программы. \n
|
||||
(количество переменных `argv`). \n
|
||||
Данное значение не должно быть меньше единицы, потому что `argv[0]`
|
||||
хранит имя исполняемого файла программы. \n
|
||||
The number of arguments to invoke the program. \n
|
||||
(number of `argv` variables). \n
|
||||
This value cannot be less than one, because `argv [0]`
|
||||
keeps the program executable file name. \n
|
||||
\n
|
||||
|
||||
\param[in] argv
|
||||
Указатель на массив строк параметров исполняемого файла. \n
|
||||
Размер массива `argc` строк. \n
|
||||
`argv[0]` хранит имя исполняемого файла программы. \n
|
||||
`argv[1]` задает формат отображения графика: \n
|
||||
Pointer to a strings array of the executable file parameters . \n
|
||||
The size of the array is `argc`. \n
|
||||
`argv [0]` keeps the executable file name. \n
|
||||
`argv [1]` sets the graph display format: \n
|
||||
\verbatim
|
||||
|
||||
--plotwin отображать график в отдельном окне
|
||||
(данный параметр используется по умолчанию);
|
||||
--plotwin display the graph in a individual window
|
||||
(this parameter is used by default);
|
||||
|
||||
--plotpng сохранить график в png-файл, заданный именем fn_png;
|
||||
--plotpng save the plot to a `fn_png` png file;
|
||||
|
||||
--noplot график не создавать, игнорировать все команды GNUPLOT.
|
||||
--noplot plot not to create, ignore all GNUPLOT commands.
|
||||
\endverbatim
|
||||
\n
|
||||
|
||||
\param[in] w
|
||||
Ширина окна графика или png-файла в пикселях. \n
|
||||
The width of the graph window or png file in pixels. \n
|
||||
\n
|
||||
|
||||
\param[in] h
|
||||
Высота окна графика или png-файла в пикселях. \n
|
||||
The height of the graph window or png file in pixels. \n
|
||||
\n
|
||||
|
||||
\param[in] fn_png
|
||||
Имя png-файла, в который будет сохранен график. \n
|
||||
Путь сохранения графика совпадает с путем исполняемого файла программы. \n
|
||||
Plot png-file name. \n
|
||||
|
||||
\param[in, out] hplot
|
||||
Указатель на адрес хэндла пакета GNUPLOT. \n
|
||||
По данному адресу будет записан указатель на текщий график. Данный указатель
|
||||
необходим для посылки команд GNUPLOT для построения графика. \n
|
||||
Pointer to the handle address of the GNUPLOT package. \n
|
||||
A pointer to the current graph will be recorded at this address. This pointer
|
||||
is required to send GNUPLOT commands. \n
|
||||
\n
|
||||
|
||||
\return
|
||||
`RES_OK` --- функция выполнена успешно. \n
|
||||
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
|
||||
При возникновении ошибки по адресу `hplot` будет записан `NULL`. \n
|
||||
`RES_OK` if function is calculated successfully. \n
|
||||
Else \ref ERROR_CODE_GROUP "code error".
|
||||
The `hplot` pointer sets in `NULL` if function returns error. \n
|
||||
\note
|
||||
Если в `argv[1]` задан параметр `--noplot`, то функция вернет `RES_OK`,
|
||||
но по адресу `hplot` также будет записан `NULL`. \n
|
||||
If `argv[1]` parameter equals `--noplot`, then function returns `RES_OK`, but
|
||||
`hplot` will be set as `NULL`. \n
|
||||
|
||||
После построения графиков необходимо закрыть хэндл GNUPLOT функцией
|
||||
\ref gnuplot_close. \n
|
||||
GNUPLOT handle must be closed by \ref gnuplot_close after plotting.\n
|
||||
|
||||
Пример построения графиков синуса и косинуса привден в следующем листинге:
|
||||
An example of plotting sine and cosine is given in the following listing:
|
||||
|
||||
\include gnuplot_script_test.c
|
||||
|
||||
Данная программа рассчитвает значения функций синуса и косинуса,
|
||||
а также сохрянет текстовые файлы `dat/cosine.txt` и `dat/sine.txt`. \n
|
||||
This program calculates the values of the sine and cosine functions,
|
||||
and also saves the text files `dat / cosine.txt` and` dat / sine.txt`. \n
|
||||
|
||||
Сохраненные данные отображаются на трех графиках (с данными синуса, косинуса
|
||||
и обоими данными):
|
||||
The saved data is displayed on three graphs
|
||||
(with sine, cosine data by both data):
|
||||
|
||||
\image html gnuplot_script_sin.png
|
||||
|
||||
|
@ -86,9 +84,7 @@ handle графика и появляется возможность посыл
|
|||
\image html gnuplot_script_sincos.png
|
||||
|
||||
|
||||
\author
|
||||
Бахурин Сергей
|
||||
www.dsplib.org
|
||||
\author Sergey Bakhurin www.dsplib.org
|
||||
**************************************************************************** */
|
||||
|
||||
|
||||
|
@ -100,28 +96,27 @@ www.dsplib.org
|
|||
\fn void gnuplot_close(void* h)
|
||||
|
||||
\brief
|
||||
Закрыть хэндл GNUPLOT.
|
||||
Close GNUPLOT handle.
|
||||
|
||||
Данная функция закрывает открытый ранее хэндл GNUPLOT после передачи всех
|
||||
команд построения графиков.
|
||||
This function closes the previously opened GNUPLOT handle after transferring all
|
||||
commands.
|
||||
|
||||
\note
|
||||
С точки зрения системы, `h` является указателем на открытый файл, в который
|
||||
можно записывать команды для исполнения пакетом GNUPLOT.
|
||||
Данная функция закрывает этот файл. \n
|
||||
Важно отметить, что закрытие хэндла не означает закрытия окна графика.
|
||||
После закрытия хэндла пакета, пользователь не может посылать команды построения
|
||||
графика, но окно графика остается открытым, так как обрабатывается пакетом
|
||||
GNUPLOT независимо.
|
||||
From a system point of view, `h` is a pointer to an open file in which
|
||||
You can write commands for execution by the GNUPLOT package.
|
||||
This function closes this file. \n
|
||||
It is important to note that closing the handle does not mean closing the
|
||||
plot window.
|
||||
After closing the package handle, the user cannot send build commands,
|
||||
but the plot window remains open, as it is processed by the package
|
||||
GNUPLOT regardless.
|
||||
|
||||
|
||||
\param[in] h
|
||||
Хэндл графика GNUPLOT, который будет закрыт. \n
|
||||
GNUPLOT handle which will be closed. \n
|
||||
\n
|
||||
|
||||
|
||||
\author Бахурин Сергей
|
||||
www.dsplib.org
|
||||
\author Sergey Bakhurin www.dsplib.org
|
||||
**************************************************************************** */
|
||||
|
||||
|
||||
|
@ -137,34 +132,29 @@ www.dsplib.org
|
|||
\fn void gnuplot_cmd(void* h, char* cmd)
|
||||
|
||||
\brief
|
||||
Функция посылает команду `cmd` пакету GNUPLOT, для построения
|
||||
или оформления графика, соответсвующего хэндлу `h`.
|
||||
Function sends `cmd` command to GNUPLOT corresponds to `h` handle.
|
||||
|
||||
Данная функция закрывает открытый ранее хэндл GNUPLOT после передачи всех
|
||||
команд построения графиков.
|
||||
|
||||
\note С точки зрения системы, `h` является указателем на открытый файл,
|
||||
в который можно записывать команды для исполнения пакетом GNUPLOT. Данная
|
||||
функция записывает в данный файл строку `cmd`. \n
|
||||
\note From a system point of view, `h` is a pointer to an open file,
|
||||
into which you can write commands for execution by the GNUPLOT package. This
|
||||
function writes the string `cmd` to the given file. \n
|
||||
\n
|
||||
С точки зрения пользователя, вызов функции `gnuplot_cmd` равносильно выполнению
|
||||
одной строки скрипта GNUPLOT. \n
|
||||
From the user's point of view, calling the `gnuplot_cmd` function is
|
||||
GNUPLOT script one line executing. \n
|
||||
\n
|
||||
Исчерпывающее описание возможностей построения графиков пакетом GNUPLOT,
|
||||
с примерами команд можно найти на
|
||||
<a href = "http://gnuplot.sourceforge.net/demo_5.2/">сайте проекта GNUPLOT</a>.
|
||||
A comprehensive description of the graphing capabilities of the GNUPLOT package,
|
||||
with examples of commands can be found on
|
||||
<a href = "http://gnuplot.sourceforge.net/demo_5.2/"> GNUPLOT project </a>.
|
||||
|
||||
\param[in] h
|
||||
Хэндл графика GNUPLOT. \n
|
||||
GNUPLOT handle. \n
|
||||
\n
|
||||
|
||||
|
||||
\param[in] cmd
|
||||
Тектовая строка команды построения или оформления графика. \n
|
||||
GNUPLOT command string. \n
|
||||
\n
|
||||
|
||||
|
||||
\author
|
||||
Бахурин Сергей
|
||||
www.dsplib.org
|
||||
\author Sergey Bakhurin www.dsplib.org
|
||||
**************************************************************************** */
|
||||
|
|
|
@ -3,60 +3,58 @@
|
|||
\ingroup DFT_GROUP
|
||||
\fn int goertzel(double *x, int n, int *ind, int k, complex_t *y)
|
||||
\brief
|
||||
<a href = "http://ru.dsplib.org/content/goertzel/goertzel.html">
|
||||
Алгоритм Гёрцеля
|
||||
<a href = "http://en.dsplib.org/content/goertzel/goertzel.html">
|
||||
Goertzel algorithmf
|
||||
</a>
|
||||
для расчета отдельных спектральных отсчетов дискретного
|
||||
преобразования Фурье вещественного сигнала `x`.
|
||||
Данный алгоритм позволяет рассчитать `k` спектральных отсчетов
|
||||
`n`-точечного ДПФ, заданных вектором индексов `ind`.
|
||||
individual DFT samples calculation for the real input vector `x`.
|
||||
|
||||
Goertzel algorithm calculates `k` samples of `n`-point DFT, according to
|
||||
`ind` indexes vector.
|
||||
|
||||
|
||||
|
||||
\param[in] x
|
||||
Указатель на вектор вещественного входного сигнала. \n
|
||||
Размер вектора `[n x 1]`. \n
|
||||
Pointer to the real input vector `x` \n
|
||||
Vector size is `[n x 1]`. \n
|
||||
\n
|
||||
|
||||
\param[in] n
|
||||
Размер вектора входного сигнала. \n
|
||||
Size of vector `x`. \n
|
||||
\n
|
||||
|
||||
\param[in] ind
|
||||
Указатель на вектор индексов спектральных отсчетов для расчета которых
|
||||
будет использоваться алгоритм Герцеля. \n
|
||||
Размер вектора `[k x 1]`. \n
|
||||
Pointer to the DFT samples indexes which need
|
||||
to calculate by Goertzel algorithm. \n
|
||||
Vector size is `[k x 1]`. \n
|
||||
\n
|
||||
|
||||
\param[in] k
|
||||
Размер вектора индексов спектральных отсчетов `ind`. \n
|
||||
Size of vector `ind`. \n
|
||||
\n
|
||||
|
||||
\param[out] y
|
||||
Указатель на вектор спектральных отсчетов, соответствующих номерам `ind`. \n
|
||||
Размер вектора `[k x 1]`. \n
|
||||
Память должна быть выделена. \n
|
||||
Pointer to the DFT samples vector corresponds to indexes `ind`. \n
|
||||
Vector size is `[k x 1]`. \n
|
||||
Memory must be allocated. \n
|
||||
\n
|
||||
|
||||
\return
|
||||
`RES_OK` --- расчёт выполнен успешно. \n
|
||||
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
|
||||
`RES_OK` if function is calculated successfully. \n
|
||||
Else \ref ERROR_CODE_GROUP "code error".
|
||||
|
||||
\note
|
||||
Алгоритм Гёрцеля эффективен когда необходимо рассчитать несколько
|
||||
спектральных отсчетов сигнала большой длительности. \n
|
||||
Однако, размер `k` вектора индексов `ind` может быть произвольным,
|
||||
в том числе больше длины сигнала `n`.
|
||||
В этом случае некоторые спектральные отсчеты будут повторяться, но это
|
||||
не повлечет за собой ошибки выполнения. \n
|
||||
Значения индексов спектральных отсчетов `ind` также могут быть
|
||||
произвольными целыми, в том числе и отрицательными.
|
||||
В этом случае будут рассчитаны спектральные отсчеты
|
||||
с индексами по модулю `n`. \n
|
||||
Goertzel's algorithm is effective when it is necessary to calculate
|
||||
several DFT samples of a signal of long duration. \n
|
||||
However, the size `k` of the vector of indices` ind` can be arbitrary,
|
||||
including more than the length of the signal `n`.
|
||||
In this case, some DFT samples will be repeated, but this will not entail
|
||||
a runtime error. \n
|
||||
The values of the indices of the DFT spectral samples `ind`
|
||||
can also be arbitrary integers, including negative ones.
|
||||
In this case, the DFT samples will be calculated.
|
||||
with indices modulo `n`. \n
|
||||
|
||||
\author
|
||||
Бахурин Сергей
|
||||
www.dsplib.org
|
||||
\author Sergey Bakhurin www.dsplib.org
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
@ -66,63 +64,57 @@ www.dsplib.org
|
|||
/*! ****************************************************************************
|
||||
\ingroup DFT_GROUP
|
||||
\fn int goertzel_cmplx(complex_t *x, int n, int *ind, int k, complex_t *y)
|
||||
\brief
|
||||
<a href = "http://ru.dsplib.org/content/goertzel/goertzel.html">
|
||||
Алгоритм Гёрцеля
|
||||
\brief
|
||||
<a href = "http://en.dsplib.org/content/goertzel/goertzel.html">
|
||||
Goertzel algorithmf
|
||||
</a>
|
||||
для расчета отдельных спектральных отсчетов дискретного
|
||||
преобразования Фурье комплексного сигнала `x`.
|
||||
Данный алгоритм позволяет рассчитать `k` спектральных отсчетов
|
||||
`n`-точечного ДПФ, заданных вектором индексов `ind`.
|
||||
individual DFT samples calculation for the complex input vector `x`.
|
||||
|
||||
Goertzel algorithm calculates `k` samples of `n`-point DFT, according to
|
||||
`ind` indexes vector.
|
||||
|
||||
|
||||
Данный алгоритм позволяет рассчитать `k` спектральных отсчетов
|
||||
`n`-точечного ДПФ, заданных вектором индексов `ind`.
|
||||
|
||||
\param[in] x
|
||||
Указатель на вектор комплексного входного сигнала. \n
|
||||
Размер вектора `[n x 1]`. \n
|
||||
Pointer to the complex input vector `x` \n
|
||||
Vector size is `[n x 1]`. \n
|
||||
\n
|
||||
|
||||
\param[in] n
|
||||
Размер вектора входного сигнала. \n
|
||||
Size of vector `x`. \n
|
||||
\n
|
||||
|
||||
\param[in] ind
|
||||
Указатель на вектор индексов спектральных отсчетов для расчета которых
|
||||
будет использоваться алгоритм Герцеля. \n
|
||||
Размер вектора `[k x 1]`. \n
|
||||
Pointer to the DFT samples indexes which need
|
||||
to calculate by Goertzel algorithm. \n
|
||||
Vector size is `[k x 1]`. \n
|
||||
\n
|
||||
|
||||
\param[in] k
|
||||
Размер вектора индексов спектральных отсчетов `ind`. \n
|
||||
Size of vector `ind`. \n
|
||||
\n
|
||||
|
||||
|
||||
\param[out] y
|
||||
Указатель на вектор спектральных отсчетов, соответствующих номерам `ind`. \n
|
||||
Размер вектора `[k x 1]`. \n
|
||||
Память должна быть выделена. \n
|
||||
Pointer to the DFT samples vector corresponds to indexes `ind`. \n
|
||||
Vector size is `[k x 1]`. \n
|
||||
Memory must be allocated. \n
|
||||
\n
|
||||
|
||||
\return
|
||||
`RES_OK` --- функция выполнена успешно. \n
|
||||
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
|
||||
`RES_OK` if function is calculated successfully. \n
|
||||
Else \ref ERROR_CODE_GROUP "code error".
|
||||
|
||||
\note
|
||||
Алгоритм Герцеля эффективен когда необходимо рассчитать несколько
|
||||
спектральных отсчетов сигнала большой длительности. \n
|
||||
Однако, размер `k` вектора индексов `ind` может быть произвольным,
|
||||
в том числе больше длины сигнала `n`.
|
||||
В этом случае некоторые спектральные отсчеты
|
||||
будут повторяться, но это не повлечет за собой ошибки выполнения. \n
|
||||
Значения индексов спектральных отсчетов `ind` также могут быть
|
||||
произвольными целыми, в том числе и отрицательными.
|
||||
В этом случае будут рассчитаны спектральные отсчеты с индексами
|
||||
по модулю `n`. \n
|
||||
\n
|
||||
Goertzel's algorithm is effective when it is necessary to calculate
|
||||
several DFT samples of a signal of long duration. \n
|
||||
However, the size `k` of the vector of indices` ind` can be arbitrary,
|
||||
including more than the length of the signal `n`.
|
||||
In this case, some DFT samples will be repeated, but this will not entail
|
||||
a runtime error. \n
|
||||
The values of the indices of the DFT spectral samples `ind`
|
||||
can also be arbitrary integers, including negative ones.
|
||||
In this case, the DFT samples will be calculated.
|
||||
with indices modulo `n`. \n
|
||||
|
||||
|
||||
\author
|
||||
Бахурин Сергей
|
||||
www.dsplib.org
|
||||
\author Sergey Bakhurin www.dsplib.org
|
||||
***************************************************************************** */
|
||||
|
|
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 407 KiB |
|
@ -3,68 +3,63 @@
|
|||
\fn int writebin(void* x, int n, int dtype, char* fn)
|
||||
|
||||
\brief
|
||||
Сохранить данные в бинарный файл
|
||||
Save 1D vector to the binary file
|
||||
|
||||
Функция сохраняет реальный или комплексный вектор данных
|
||||
размера `[n x 1]` в бинарный файл `fn`. \n \n
|
||||
Function saves real or complex 1D vector size `n` to the binary file `fn`.
|
||||
\n \n
|
||||
|
||||
File format supports 1D and 2D arrays and has follow format: \n\n
|
||||
|
||||
Файл является универсальным для хранения как одномерных,
|
||||
так и двумерных массивов и имеет следующий формат: \n \n
|
||||
\verbatim
|
||||
|
||||
type 4 байта типа int.
|
||||
Может принимать значение:
|
||||
DAT_DOUBLE, если x указатель на вектор вещественных чисел;
|
||||
DAT_COMPLEX, если x указатель на вектор комплексных чисел.
|
||||
type 4 bytes type int.
|
||||
Can take on value:
|
||||
DAT_DOUBLE, if x pointer to the real vector;
|
||||
DAT_COMPLEX, if x pointer to the complex vector;
|
||||
|
||||
n 4 байта типа int.
|
||||
Количество строк данных.
|
||||
n 4 bytes type int.
|
||||
Number of array rows.
|
||||
|
||||
m 4 байта типа int.
|
||||
Количество столбцов данных.
|
||||
При сохранении вектора всегда равно 1.
|
||||
m 4 bytes type int.
|
||||
Number of array columns.
|
||||
This parameter equals 1 because this function saves 1D vector.
|
||||
|
||||
data Данные в бинарном виде.
|
||||
Размер данных:
|
||||
n * sizeof(double), если dtype==DAT_DOUBLE;
|
||||
n * sizeof(complex_t), если dtype==DAT_COMPLEX.
|
||||
data Data in binary raw.
|
||||
Data size is:
|
||||
n * sizeof(double), if dtype==DAT_DOUBLE;
|
||||
n * sizeof(complex_t), if dtype==DAT_COMPLEX.
|
||||
\endverbatim
|
||||
|
||||
Файл может быть использован для верификации алгоритмов сторонними пакетами,
|
||||
такими как GNU Octave, Matlab, Python и т.д. \n \n
|
||||
Binary file can be used for algorithms verification by external packages like
|
||||
GNU Octave, Matlab, Python because the function writes to a file
|
||||
without loss of accuracy. \n \n
|
||||
|
||||
\param[in] x
|
||||
Указатель на массив данных. \n
|
||||
Размер вектора `[n x 1]`. \n
|
||||
Pointer to the input vector. \n
|
||||
Vector size is `[n x 1]`. \n
|
||||
\n
|
||||
|
||||
\param[in] n
|
||||
Размер вектора данных. \n
|
||||
Size of input vector. \n
|
||||
\n
|
||||
|
||||
\param[in] dtype
|
||||
Тип данных. \n
|
||||
Type of data. \n
|
||||
|
||||
Может принимать значения: \n
|
||||
`DAT_DOUBLE` -- вещественные данные; \n
|
||||
`DAT_COMPLEX` -- комплексные данные. \n
|
||||
Can be one of follow: \n
|
||||
`DAT_DOUBLE` -- real data; \n
|
||||
`DAT_COMPLEX` -- complex data. \n
|
||||
\n
|
||||
|
||||
\param[in] fn
|
||||
Имя файла. \n
|
||||
File name. \n
|
||||
\n
|
||||
|
||||
\return
|
||||
`RES_OK` --- файл сохранен успешно. \n
|
||||
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
|
||||
`RES_OK` if file is saved successfully. \n
|
||||
Else \ref ERROR_CODE_GROUP "code error".
|
||||
|
||||
\note
|
||||
Данная функция производит запись в файл без потери точности,
|
||||
поэтому рекомендуется использовать ее для верификации данных DSPL. \n
|
||||
\n
|
||||
|
||||
|
||||
Функция для чтения бинарного файла в GNU Octave и Matlab:
|
||||
Reading saved binary file from GNU Octave or Matlab:
|
||||
\code{.m}
|
||||
function [dat, n, m] = readbin(fn)
|
||||
fid = fopen(fn);
|
||||
|
@ -90,9 +85,7 @@ function [dat, n, m] = readbin(fn)
|
|||
end
|
||||
\endcode
|
||||
|
||||
\author
|
||||
Бахурин Сергей
|
||||
www.dsplib.org
|
||||
\author Sergey Bakhurin www.dsplib.org
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
@ -106,11 +99,9 @@ www.dsplib.org
|
|||
\fn int writetxt(double* x, double* y, int n, char* fn)
|
||||
|
||||
\brief
|
||||
Сохранить вещественные данные в текстовый файл
|
||||
Save real data \f$y(x)\f$ to the text file `fn`. \n
|
||||
|
||||
Функция сохраняет вещественные данные в текстовый файл `fn`. \n
|
||||
|
||||
Файл имеет следующий формат: \n
|
||||
File format
|
||||
|
||||
\verbatim
|
||||
x[0] y[0]
|
||||
|
@ -119,42 +110,39 @@ x[1] y[1]
|
|||
x[n-1] y[n-1]
|
||||
\endverbatim
|
||||
|
||||
Файл может быть использован для построения графика сторонней программой,
|
||||
например пакетом GNUPLOT (см. раздел \ref PLOT_GROUP). \n
|
||||
Text file can be used to plotting data with a third-party program
|
||||
for example, the GNUPLOT package (see \ref PLOT_GROUP). \n
|
||||
|
||||
\param[in] x
|
||||
Указатель на первый вектор. \n
|
||||
Размер вектора `[n x 1]`. \n
|
||||
Pointer to the vector `x`. \n
|
||||
Vector size is `[n x 1]`. \n
|
||||
\n
|
||||
|
||||
\param[in] y
|
||||
Указатель на второй вектор. \n
|
||||
Размер вектора `[n x 1]`. \n
|
||||
Может быть `NULL`. \n
|
||||
Файл будет содержать только один столбец соответствующий
|
||||
вектору `x` если `y == NULL`. \n
|
||||
Pointer to the vector `y`. \n
|
||||
Vector size is `[n x 1]`. \n
|
||||
This pointer can be `NULL`.
|
||||
File will have only one column corresponds to `x` vector in this case. \n
|
||||
\n
|
||||
|
||||
\param[in] n
|
||||
Размер входных векторов. \n
|
||||
Size of vectors `x` and `y`. \n
|
||||
\n
|
||||
|
||||
\param[in] fn
|
||||
Имя файла. \n
|
||||
File name. \n
|
||||
\n
|
||||
|
||||
|
||||
\return
|
||||
`RES_OK` --- файл сохранен успешно. \n
|
||||
В противном случае \ref ERROR_CODE_GROUP "код ошибки": \n
|
||||
`RES_OK` if file is saved successfully. \n
|
||||
Else \ref ERROR_CODE_GROUP "code error".
|
||||
|
||||
\note
|
||||
Данная функция производит округление данных при записи в файл.
|
||||
Поэтому не рекомендуется использовать ее для верификации данных DSPL.
|
||||
This function rounds data when writing to a file.
|
||||
So, it is not recommended to use it to verify algorithms.
|
||||
|
||||
\author
|
||||
Бахурин Сергей
|
||||
www.dsplib.org
|
||||
\author Sergey Bakhurin www.dsplib.org
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
@ -166,19 +154,17 @@ www.dsplib.org
|
|||
\fn int writetxt_3d(double* x, int nx, double* y, int ny, double* z, char* fn)
|
||||
|
||||
\brief
|
||||
Сохранить данные для построения 3D графика
|
||||
Save data \f$ z(x,y)\f$ to the text file `fn` for 3D surface plotting.
|
||||
|
||||
Функция сохраняет вещественные данные в текстовый файл `fn`
|
||||
для построения 3D поверхности. \n
|
||||
|
||||
Функция \f$ z(x,y)\f$ описывается матрицей значений `z[x[n], y[n]]`
|
||||
как это показано на рисунке
|
||||
Function \f$ z(x,y)\f$ describes as matrix `z[x[n], y[n]]` as it showed on the
|
||||
follow figure:
|
||||
|
||||
\image html writetxt_3d_matrix.png
|
||||
|
||||
Матрица `z` хранится в памяти по столбцам, как это показано красной стрелкой. \n
|
||||
Matrix `z` writen in the memory by columns as it it showed on the figure by
|
||||
red arrow. \n
|
||||
|
||||
Файл имеет следующий формат: \n
|
||||
Text file fas follow format: \n
|
||||
|
||||
\verbatim
|
||||
x[0] y[0] z[0, 0]
|
||||
|
@ -203,66 +189,64 @@ x[2] y[ny-1] z[2, ny-1]
|
|||
... ... ...
|
||||
x[nx-1] y[ny-1] z[nx-1, ny-1]
|
||||
\endverbatim
|
||||
Таким образом, каждое значение матрицы `z` записано отдельной строкой со
|
||||
соответствующими значениями `x` и `y`. Столбцы матрицы отделены пустой строкой.
|
||||
Each `z` matrix value is writen on individual line corresponds to `x`
|
||||
and `y` values. Matrix columns are separated from each other by an empty line.
|
||||
|
||||
Файл может быть использован для построения графика сторонней программой,
|
||||
например пакетом GNUPLOT (см. раздел \ref PLOT_GROUP). Также данный формат
|
||||
поддерживается пакетами pgfplot3d издательской системы Latex. \n
|
||||
The file can be used to build a 3D surface with a third-party program
|
||||
for example, the GNUPLOT package (see \ref PLOT_GROUP). Also this format
|
||||
supported by pgfplot3d packages of the Latex system. \n
|
||||
|
||||
\param[in] x
|
||||
Указатель на вектор значений оси `x`. \n
|
||||
Размер вектора `[nx x 1]`. \n
|
||||
Pointer to the vector `x`. \n
|
||||
Vector size is `[nx x 1]`. \n
|
||||
\n
|
||||
|
||||
\param[in] nx
|
||||
Размер вектора оси `x`. \n
|
||||
Size of vector `x`. \n
|
||||
\n
|
||||
|
||||
|
||||
\param[in] y
|
||||
Указатель на второй вектор значений оси `y`. \n
|
||||
Размер вектора `[ny x 1]`. \n
|
||||
Pointer to the vector `y`. \n
|
||||
Vector size is `[ny x 1]`. \n
|
||||
\n
|
||||
|
||||
\param[in] ny
|
||||
Размер вектора оси `y`. \n
|
||||
Size of vector `y`. \n
|
||||
\n
|
||||
|
||||
\param[in] z
|
||||
Указатель на матрицу значений функции `z(x, y)`. \n
|
||||
Pointer to the matrix `z(x, y)`. \n
|
||||
Size of matrix is `[nx x ny]`.
|
||||
\n
|
||||
|
||||
\param[in] fn
|
||||
Имя файла. \n
|
||||
3D data file name. \n
|
||||
\n
|
||||
|
||||
|
||||
\return
|
||||
`RES_OK` --- файл сохранен успешно. \n
|
||||
В противном случае \ref ERROR_CODE_GROUP "код ошибки": \n
|
||||
`RES_OK` if file is saved successfully. \n
|
||||
Else \ref ERROR_CODE_GROUP "code error".
|
||||
|
||||
Пример использования функции и посторения 3D поверхности приведен
|
||||
в следующем листинге:
|
||||
Example of 3D surface plotting:
|
||||
|
||||
\include writetxt_3d_test.c
|
||||
|
||||
Данная программа рассчитывает и строит поверхность функции
|
||||
Program calcultes function
|
||||
|
||||
\f[
|
||||
z(x,y) = x \exp(-x^2 -y^2)
|
||||
\f]
|
||||
|
||||
В каталоге `dat` будет создан файл `data3d.txt`.\n
|
||||
Кроме того программа GNUPLOT произведет построение 3D поверхности
|
||||
по сохраненным в файл данным:
|
||||
and save data to the `dat/data3d.txt` file.\n
|
||||
In addition, GNUPLOT built a 3D surface by data
|
||||
saved to the `dat/data3d.txt` file:
|
||||
|
||||
\image html writetxt_3d.png
|
||||
|
||||
|
||||
\author
|
||||
Бахурин Сергей
|
||||
www.dsplib.org
|
||||
\author Sergey Bakhurin www.dsplib.org
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
@ -274,11 +258,9 @@ www.dsplib.org
|
|||
\fn int writetxt_int(int* x, int* y, int n, char* fn)
|
||||
|
||||
\brief
|
||||
Сохранить целочисленные данные в текстовый файл
|
||||
Save interger data \f$y(x)\f$ to the text file `fn`. \n
|
||||
|
||||
Функция сохраняет целочисленные данные в текстовый файл `fn`. \n
|
||||
|
||||
Файл имеет следующий формат: \n
|
||||
File format
|
||||
|
||||
\verbatim
|
||||
x[0] y[0]
|
||||
|
@ -287,35 +269,33 @@ x[1] y[1]
|
|||
x[n-1] y[n-1]
|
||||
\endverbatim
|
||||
|
||||
Файл может быть использован для построения графика сторонней программой,
|
||||
например пакетом GNUPLOT (см. раздел \ref PLOT_GROUP). \n
|
||||
Text file can be used to plotting data with a third-party program
|
||||
for example, the GNUPLOT package (see \ref PLOT_GROUP). \n
|
||||
|
||||
\param[in] x
|
||||
Указатель на первый вектор. \n
|
||||
Размер вектора `[n x 1]`. \n
|
||||
Pointer to the interger vector `x`. \n
|
||||
Vector size is `[n x 1]`. \n
|
||||
\n
|
||||
|
||||
\param[in] y
|
||||
Указатель на второй вектор. \n
|
||||
Размер вектора `[n x 1]`. \n
|
||||
Может быть `NULL`. \n
|
||||
Файл будет содержать только один столбец соответствующий
|
||||
вектору `x` если `y == NULL`. \n
|
||||
Pointer to the interger vector `y`. \n
|
||||
Vector size is `[n x 1]`. \n
|
||||
This pointer can be `NULL`.
|
||||
File will have only one column corresponds to `x` vector in this case. \n
|
||||
\n
|
||||
|
||||
\param[in] n
|
||||
Размер входных векторов. \n
|
||||
Size of vectors `x` and `y`. \n
|
||||
\n
|
||||
|
||||
\param[in] fn
|
||||
Имя файла. \n
|
||||
File name. \n
|
||||
\n
|
||||
|
||||
\return
|
||||
`RES_OK` --- файл сохранен успешно. \n
|
||||
В противном случае \ref ERROR_CODE_GROUP "код ошибки": \n
|
||||
|
||||
\author
|
||||
Бахурин Сергей
|
||||
www.dsplib.org
|
||||
\return
|
||||
`RES_OK` if file is saved successfully. \n
|
||||
Else \ref ERROR_CODE_GROUP "code error".
|
||||
|
||||
\author Sergey Bakhurin www.dsplib.org
|
||||
***************************************************************************** */
|
||||
|
|
|
@ -128,9 +128,6 @@ screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
|
||||
<!--BEGIN TITLEAREA-->
|
||||
|
@ -166,4 +163,4 @@ screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+
|
|||
</table>
|
||||
</div>
|
||||
<!--END TITLEAREA-->
|
||||
<!-- end header part -->
|
||||
<!-- end header part -->
|
|
@ -28,42 +28,42 @@ DSPL-2.0 --- свободная библиотека алгоритмов циф
|
|||
среда разработки и отладки CodeBlocks, а также файловый менеджер Far и
|
||||
коллекция портированных Unix утилит.
|
||||
|
||||
\ref getting_started_toolchain \n
|
||||
\ref getting_started_make \n
|
||||
\ref getting_started_codeblocks \n
|
||||
\ref SYS_LOADING_GROUP \n
|
||||
- \ref getting_started_toolchain \n
|
||||
- \ref getting_started_make \n
|
||||
- \ref getting_started_codeblocks \n
|
||||
- \ref SYS_LOADING_GROUP \n
|
||||
|
||||
\subsection sec_doc_content Разделы документации
|
||||
<b>Математические функции:</b> \n
|
||||
\ref SPEC_MATH_COMMON_GROUP \n
|
||||
\ref SPEC_MATH_TRIG_GROUP \n
|
||||
\ref SPEC_MATH_TRANSCEND \n
|
||||
\ref SPEC_MATH_ELLIP_GROUP \n
|
||||
\ref SPEC_MATH_RAND_GEN_GROUP \n
|
||||
\ref SPEC_MATH_STAT_GROUP \n
|
||||
\ref SPEC_MATH_LINALG_GROUP \n
|
||||
- \ref SPEC_MATH_COMMON_GROUP \n
|
||||
- \ref SPEC_MATH_TRIG_GROUP \n
|
||||
- \ref SPEC_MATH_TRANSCEND \n
|
||||
- \ref SPEC_MATH_ELLIP_GROUP \n
|
||||
- \ref SPEC_MATH_RAND_GEN_GROUP \n
|
||||
- \ref SPEC_MATH_STAT_GROUP \n
|
||||
- \ref SPEC_MATH_LINALG_GROUP \n
|
||||
\n
|
||||
|
||||
<b>Алгоритмы спектрального анализа: </b> \n
|
||||
\ref DFT_GROUP \n
|
||||
\ref WIN_GROUP \n
|
||||
\ref HILBERT_GROUP \n
|
||||
- \ref DFT_GROUP \n
|
||||
- \ref WIN_GROUP \n
|
||||
- \ref HILBERT_GROUP \n
|
||||
\n
|
||||
|
||||
<b>Расчет и анализ аналоговых и цифровых фильтров:</b>\n
|
||||
\ref FILTER_CONV_GROUP \n
|
||||
\ref IIR_FILTER_DESIGN_GROUP \n
|
||||
\ref FIR_FILTER_DESIGN_GROUP \n
|
||||
\ref FILTER_ANALYSIS_GROUP \n
|
||||
- \ref FILTER_CONV_GROUP \n
|
||||
- \ref IIR_FILTER_DESIGN_GROUP \n
|
||||
- \ref FIR_FILTER_DESIGN_GROUP \n
|
||||
- \ref FILTER_ANALYSIS_GROUP \n
|
||||
\n
|
||||
|
||||
<b>Прочие алгоритмы:</b> \n
|
||||
\ref RESAMPLING_GROUP \n
|
||||
\ref IN_OUT_GROUP \n
|
||||
\ref PLOT_GROUP \n
|
||||
- \ref RESAMPLING_GROUP \n
|
||||
- \ref IN_OUT_GROUP \n
|
||||
- \ref PLOT_GROUP \n
|
||||
\n
|
||||
|
||||
<b>Приложения</b>\n
|
||||
\ref TYPES_GROUP \n
|
||||
\ref ERROR_CODE_GROUP \n
|
||||
- \ref TYPES_GROUP \n
|
||||
- \ref ERROR_CODE_GROUP \n
|
||||
***************************************************************************** */
|
||||
|
|
|
@ -1,130 +1,29 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "dspl.h"
|
||||
|
||||
#define N 10000
|
||||
#define L 1E-3
|
||||
|
||||
|
||||
int randu_accuracy(double* x, double* y, int n, double acc, random_t* prnd)
|
||||
{
|
||||
double z[512];
|
||||
int err, cnt, i;
|
||||
if(!x || !y)
|
||||
return ERROR_PTR;
|
||||
if(n < 1)
|
||||
return ERROR_SIZE;
|
||||
if(acc < 0)
|
||||
return ERROR_NEGATIVE;
|
||||
|
||||
|
||||
cnt = 0;
|
||||
while(cnt < n)
|
||||
{
|
||||
randu(z, 512, prnd);
|
||||
|
||||
for(i = 0; i < 512; i++)
|
||||
{
|
||||
if(z[i] < acc)
|
||||
{
|
||||
x[cnt] = z[i];
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cnt = 0;
|
||||
while(cnt < n)
|
||||
{
|
||||
randu(z, 512, prnd);
|
||||
for(i = 0; i < 512; i++)
|
||||
{
|
||||
if(z[i] < acc)
|
||||
{
|
||||
y[cnt] = z[i];
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
void* hdspl; /* DSPL handle */
|
||||
void* hplot; /* GNUPLOT handles */
|
||||
random_t rnd = {0}; /* random structure */
|
||||
hdspl = dspl_load(); /* Load DSPL function */
|
||||
/* libdspl handle */
|
||||
void* hdspl;
|
||||
|
||||
/* Load libdspl functions */
|
||||
hdspl = dspl_load();
|
||||
|
||||
/* Check libdspl handle. */
|
||||
/* If hdspl == NULL means problem with libdspl loading */
|
||||
if(!hdspl)
|
||||
{
|
||||
printf("libdspl loading error!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
double *x = NULL;
|
||||
double *y = NULL;
|
||||
/* Print libdspl info */
|
||||
dspl_info();
|
||||
|
||||
|
||||
x = (double*) malloc(N * sizeof(double));
|
||||
y = (double*) malloc(N * sizeof(double));
|
||||
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* MRG32K3A random numbers generator */
|
||||
/***************************************************************************/
|
||||
double seed_mrg32k3a = 1234.0;
|
||||
|
||||
random_init(&rnd, RAND_TYPE_MRG32K3A, (void*)(&seed_mrg32k3a));
|
||||
randu_accuracy(x, y, N, L, &rnd);
|
||||
|
||||
writetxt(x, y, N, "dat/randu_acc_mrg32k3a.txt");
|
||||
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* MT19937 random numbers generator */
|
||||
/***************************************************************************/
|
||||
unsigned long long seed_mt19937 = 1234353456;
|
||||
|
||||
random_init(&rnd, RAND_TYPE_MT19937, (void*)(&seed_mt19937));
|
||||
randu_accuracy(x, y, N, L, &rnd);
|
||||
writetxt(x, y, N, "dat/randu_acc_mt19937.txt");
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* Standard C random numbers generator */
|
||||
/***************************************************************************/
|
||||
randu_accuracy(x, y, N, L, NULL);
|
||||
/* Save to files "dat/randu_std.txt" */
|
||||
writetxt(x, y, N, "dat/randu_acc_std.txt");
|
||||
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* plotting by GNUPLOT */
|
||||
/***************************************************************************/
|
||||
/* Create window plot
|
||||
gnuplot_create(argc, argv, 920, 320,
|
||||
"img/randu_accuracy_test.png", &hplot);
|
||||
//gnuplot_cmd(hplot, "set grid");
|
||||
gnuplot_cmd(hplot, "set multiplot layout 1,3 rowsfirst");
|
||||
gnuplot_cmd(hplot, "set xlabel 'x'");
|
||||
gnuplot_cmd(hplot, "set ylabel 'y'");
|
||||
gnuplot_cmd(hplot, "unset key");
|
||||
gnuplot_cmd(hplot, "set title 'MRG32K3A'");
|
||||
gnuplot_cmd(hplot, "plot 'dat/randu_acc_mrg32k3a.txt' with points pointtype 0");
|
||||
gnuplot_cmd(hplot, "set title 'MT19937'");
|
||||
gnuplot_cmd(hplot, "plot 'dat/randu_acc_mt19937.txt' with points pointtype 0");
|
||||
gnuplot_cmd(hplot, "set title 'Standard C'");
|
||||
gnuplot_cmd(hplot, "plot 'dat/randu_acc_std.txt' with points pointtype 0");
|
||||
gnuplot_close(hplot);
|
||||
*/
|
||||
if(x)
|
||||
free(x);
|
||||
if(y)
|
||||
free(y);
|
||||
|
||||
|
||||
/* free dspl handle */
|
||||
/* free dspl handle */
|
||||
dspl_free(hdspl);
|
||||
return 0;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue