Blog

  • Template-Cool-Admin

    CoolAdmin Bootstrap 4.1 Admin Dashboard Template

    CoolAdmin is a responsive Bootstrap 4.1 admin template. It provides you with a collection of ready to use code snippets and utilities, custom pages, loads of charts, 4 different dashboard variations, a collection of applications and some useful widgets. Preview of this awesome admin template available here: https://colorlib.com/polygon/cooladmin/index.html

    Preview

    Screenshot

    CoolAdmin admin dashboard template preview

    CoolAdmin admin dashboard template preview

    Demo Site: [Here]

    TOC

    Built With

    Changelog

    V 1.0.0

    Initial Release ### Authors Colorlib

    More info

    License

    CoolAdmin is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the final products. But you always need to state that Colorlib is the original author of this template.

    Visit original content creator repository https://github.com/Hicham-O-Sfh/Template-Cool-Admin
  • Batatabit-Jesus-Monge

    Batata-Project

    Landing page.
    About the project:

    Context: We have seen the rise of interest in crypto currencies here, in the Latin America region. Many new crypto brokers are starting operations and new coins being offered in the region. However, to have information, even for basic operations, is very painful. For example, if I want to buy 100 ETH, where is the cheapest place to buy in Mexico? Or which brokers have the lower fees? Only in Brazil we have more than 40 brokers, and most of them only let you see the full information after creating an account.

    • Since the crypto world is presented as a dangerous activity (or related to virtual crimes) in many news, the very first value we want to show to our potential user is Trust and Confidence, in order to create authority.
    • Our platform will gather information from many places in only one. So our users will have an intelligence platform that will allow them to spend less time, have the right information at the right moment, and as a consequence, make wise decisions to make more money.

    Visit original content creator repository
    https://github.com/jesusmongedev/Batatabit-Jesus-Monge

  • rubiks-cube-sim

    rubiks-cube-sim

    Rubik’s Cube Simulator using just python

    Cube 3x3

    Installation

    Dependencies

    Recommended python version: 3.8

    • numpy
    • quaternion
    • pyglet

    Use pip to install these packages (python3 -m pip install <package_name>)

    Setup

    Clone this repository using following command
    git clone https://github.com/VismayVakharia/rubiks-cube-sim

    Usage

    Run main.py to start the cube simulation

    Parameters

    Parameter Default value Explanation
    WIN_W 640 Width of the GUI window
    WIN_H 640 Height of the GUI window
    CUBE_SIZE 3 Rubik’s cube size: NxNxN
    COMMANDS [] List of moves (see below)
    PAUSED False Whether to start the simulation paused
    RECORDING False Whether to record the simulation

    Commands Example

    COMMANDS = ["R", "U", "R'", "U'"]

    Supported commands:

    • 1×1
      • Cube rotations: X Y Z
    • 2×2
      • Face turns: F R U B L D
      • Cube rotations: X Y Z
    • 3×3
      • Face turns: F R U B L D
      • Dual-layer turns: f r u b l d
      • Slice turns: M E S
      • Cube rotations: X Y Z
    • Higher NxN
      • Face turns: F R U B L D
      • Tier turns: T<num_layers><face_rotation>
        • T3R is three layers deep starting from R-layer rotated as R
        • T1R <=> R (where R could be any face turn)
      • Numbered layer turns: N<layer_number><face_rotation>
        • N3R is third layer starting from R-layer rotated as R
        • N1R <=> R
      • Numbered range of layers turns: N<start_layer>-<end_layer><face_rotation>
        • N2-4R is second to fourth layers starting from R-layer rotated as R
        • N1-nR <=> TnR | N2-2L <=> N2L
      • Cube rotations: X Y Z
    • Any command C (including dual-layer, tier & numbered-layer) can be followed by
      • ' (apostrophe) as in C': Same turn as C, only counter-clockwise
      • 2 as in C2: 180 deg C turn

    For detailed explanation on higher order notation, refer this website

    GUI Control

    Command Action
    F | R | U | B | L | D Respective face turns
    M | E | S Respective slice turns
    X | Y | Z Respective whole-cube rotations
    Space Pause/Unpause simulation
    Backspace Reset the cube orientation
    Click & Drag Rotate the orientation of the cube
    Mouse Scroll Zoom in/out

    Note: Uppercase letters rotate clockwise and lowercase do counter-clockwise.

    Recording

    If the RECORDING flag is set True, animation frames will be saved to frames/ directory.

    To convert these frame to:

    • gif:
      cd frames/
      convert -delay 5 -loop 0 `ls -v` output.gif
    • mp4:
      cd frames/
      ffmpeg -framerate 25 -i %d.png -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p output.mp4
    Visit original content creator repository https://github.com/VismayVakharia/rubiks-cube-sim
  • webman-annotations

    webman 框架 注解路由插件

    使用了 doctrine/annotations 包来对代码内的注解进行解析。

    您可以直接在控制器类或类方法定义注解,实现路由定义。

    webman框架插件地址:https://www.workerman.net/plugin/115

    站在巨人的肩膀可以看到更远,感谢 https://www.workerman.net/plugin/52 的启发。

    安装

    composer require shayvmo/webman-annotations

    使用

    配置文件

    <?php
    // config/plugin/shayvmo/webman-annotations/annotation.php
    return [
        // 注解扫描路径, 只扫描应用目录下已定义的文件夹,例如: app/admin/controller 及其下级目录
        'include_paths' => [
            'admin'
        ],
        // requestMapping 允许的请求method
        'allow_methods' => ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'HEAD', 'PATCH'],
        // 忽略解析的注解名称,适用于 php7 使用 doctrine/annotations 解析
        'ignored' => [
            "after", "afterClass", "backupGlobals", "backupStaticAttributes", "before", "beforeClass", "codeCoverageIgnore*",
            "covers", "coversDefaultClass", "coversNothing", "dataProvider", "depends", "doesNotPerformAssertions",
            "expectedException", "expectedExceptionCode", "expectedExceptionMessage", "expectedExceptionMessageRegExp", "group",
            "large", "medium", "preserveGlobalState", "requires", "runTestsInSeparateProcesses", "runInSeparateProcess", "small",
            "test", "testdox", "testWith", "ticket", "uses" , "datetime",
        ]
    ];

    一、中间件注解

    注:方法会继承类定义的中间件。

    类和方法通用,参数中间件类名,单个中间件传入字符串,多个中间件传入字符串数组。

    use Shayvmo\WebmanAnnotations\Annotations\Middleware;
    use App\third\middleware\SignatureCheckA;
    
    // php74
    /**
     * @Middleware(
     *     \App\third\middleware\SignatureCheck::class,
     * )
     */
     
    /**
     * @Middleware({
     *   SignatureCheckA::class,
     *   \App\third\middleware\SignatureCheck::class,
     * })
     */
    
    // php8注解
    // 单个中间件
    #[Middleware(LimitTrafficMiddleware::class)]
    // 多个
    #[Middleware([LimitTrafficMiddleware::class, \App\third\middleware\SignatureCheck::class])]
    
    
    // 忽略中间件校验注解
    use Shayvmo\WebmanAnnotations\Annotations\MiddlewareIgnore;
    
    // php74
    /**
     * @MiddlewareIgnore(
     *     \App\third\middleware\SignatureCheck::class,
     * )
     */
     
    /**
     * @MiddlewareIgnore({
     *   SignatureCheckA::class,
     *   \App\third\middleware\SignatureCheck::class,
     * })
     */
    
    // php8注解
    // 单个中间件
    #[MiddlewareIgnore(LimitTrafficMiddleware::class)]
    // 多个
    #[MiddlewareIgnore([LimitTrafficMiddleware::class, \App\third\middleware\SignatureCheck::class])]
    
    
    

    二、类注解

    类注解有控制器注解@RestController和资源路由@ResourceMapping
    资源路由和webman框架原有的资源路由一致。参考:webman路由

    控制器注解

    use Shayvmo\WebmanAnnotations\Annotations\RestController;
    

    @RestController控制器注解,只有一个参数prefix,表示整个控制器的路由路径前缀,方法路由路径都会拼接该前缀。
    传参可以省略键名。

    • @RestController("/a")
    • @RestController(prefix="/a")

    php8注解

    • #[RestController("/test1")]
    • #[RestController(path: "/test2")]

    资源路由注解

    use Shayvmo\WebmanAnnotations\Annotations\ResourceMapping;
    

    @ResourceMapping资源路由注解,有pathallow_methods两个参数
    path表示资源路由的路径,allow_methods为指定的资源方法数组,不传指定资源方法时,使用全部资源方法
    path传参可以省略键名。

    • @ResourceMapping(path="/dddd", allow_methods={"index", "show"})
    • @ResourceMapping("/dddd", allow_methods={"index", "show"})

    php8注解

    • #[ResourceMapping("/test", allow_methods: ["index", "show"])]
    • #[ResourceMapping(path: "/test2", allow_methods: ["index", "show"])]

    注:如果定义了资源路由,会自动忽略类同名方法的方法注解。

    附:资源路由方法对照

    请求方法 路径 类方法
    GET /test index
    GET /test/create create
    POST /test store
    GET /test/{id} show
    GET /test/{id}/edit edit
    PUT /test/{id} update
    DELETE /test/{id} destroy
    PUT /test/{id}/recovery recovery

    三、方法注解

    方法注解主要是@RequestMapping 以及 @GetMapping@PostMapping@PutMapping@DeleteMapping 四个便捷注解。
    定义路由路径 path 和请求方法methods。两个参数均可以传入字符串或数组。
    例如path传入数组时,表示多个请求路由路径。methods传入数组时,表示多个请求方法。

    注:便捷注解传入路由路径path即可,可以省略键名path,无需传入methods

    • @RequestMapping(path={"/dddd", "/dddd1"}, methods={"get", "post"})
    • @GetMapping(path={"/get","/get1"})
    • @GetMapping({"/get","/get1"})
    • @PostMapping(path="/post")
    • @PutMapping(path="/put")
    • @DeleteMapping(path="/delete")

    php8注解

    • #[RequestMapping("/test1", methods: "get")]
    • #[RequestMapping(["/test1","/test11"], methods: ["get", "post"])]
    • #[GetMapping(["/get", "/get1"])]
    • #[PostMapping(path: "/post")]
    • #[PutMapping(path: "/put")]
    • #[DeleteMapping("/delete")]

    // 方法注解
    use Shayvmo\WebmanAnnotations\Annotations\RequestMapping;
    use Shayvmo\WebmanAnnotations\Annotations\GetMapping;
    use Shayvmo\WebmanAnnotations\Annotations\PostMapping;
    use Shayvmo\WebmanAnnotations\Annotations\PutMapping;
    use Shayvmo\WebmanAnnotations\Annotations\DeleteMapping;
    

    四、示例

    <?php
    
    declare (strict_types=1);
    
    namespace App\third\controller;
    
    use Shayvmo\WebmanAnnotations\Annotations\RestController;
    use Shayvmo\WebmanAnnotations\Annotations\DeleteMapping;
    use Shayvmo\WebmanAnnotations\Annotations\GetMapping;
    use Shayvmo\WebmanAnnotations\Annotations\Middleware;
    use Shayvmo\WebmanAnnotations\Annotations\PostMapping;
    use Shayvmo\WebmanAnnotations\Annotations\PutMapping;
    use Shayvmo\WebmanAnnotations\Annotations\RequestMapping;
    use Shayvmo\WebmanAnnotations\Annotations\ResourceMapping;
    
    use App\third\middleware\SignatureCheck;
    
    use support\Request;
    use Tinywan\LimitTraffic\Middleware\LimitTrafficMiddleware;
    
    /**
     * @RestController("/test")
     * @ResourceMapping("/dddd", allow_methods={"index", "show"})
     * @Middleware(SignatureCheck::class)
     */
    class ATest
    {
        public function index()
        {
            // 
            return 'Test/index';
        }
    
        public function show(Request $request, $id)
        {
            return "Test/show $id";
        }
    
        /**
         * @GetMapping("/test")
         * @Middleware(SignatureCheck::class)
         */
        public function get()
        {
            return 'Test/get';
        }
    
        /**
         * @RequestMapping(methods={"get", "post"}, path="/test1")
         * @Middleware({
         *     LimitTrafficMiddleware::class,
         * })
         */
        public function test()
        {
            return 'Test/test';
        }
    
        /**
         * @PostMapping("/post")
         */
        public function post()
        {
            return 'Test/post';
        }
    
        /**
         * @PutMapping("/put")
         */
        public function put()
        {
            return 'Test/put';
        }
    
        /**
         * @DeleteMapping("/delete")
         */
        public function delete()
        {
            return 'Test/delete';
        }
    }

    五、更新日志

    • v1.2.0

      2024-05-23,增加中间件忽略注解MiddlewareIgnore

    • v1.1.1

      2023-04-11,修复发现的RequestMapping解析allow_methods问题

    • v1.1.0

      2023-03-30,增加php8原生注解支持

    • v1.0.1

      2023-03-27,修复发现的bug

    • v1.0.0

      2023-03-27,发布1.0.0版本

    Visit original content creator repository
    https://github.com/shayvmo/webman-annotations

  • NLP-CleanText

    NLP: Clean raw and messy text with regular expressions

    Background

    This code is part of a larger NLP Machine Learning project. To train/finetune a Machine Learning model or to make predictions with it,
    the input text first needs to be cleaned before it can be tokenized and used.

    General Info

    The code can be used to clean and preprocess raw, unprocessed and messy text and mostly uses regular
    expressions (Python re package, Python 3.11) to do that.
    In “main.py“, there is a messy sample text to be cleaned. The methods in the class CleanText in “funcs/clean.py” transform
    those parts of the text that are found by the compiled re objects/patterns defined in “funcs/re_patterns.py“.
    These patterns and functions can be adjusted to specific needs.
    In addition to the Python re package, some other Python string functions (such as “maketrans”, etc) are used.

    Setup

    The main.py script contains sample text in the variable “messy_text“.

    1. Go to main.py and paste the text you want to be cleaned into the variable “messy_text“. Then run it. The cleaned text will be printed.
    2. Adjust the class methods in “funcs/clean.py” and the regular expressions in “funcs/re_patterns.py” according to your needs.

    Visit original content creator repository
    https://github.com/rainergo/NLP-CleanText

  • smseourl

    PrestaShop SEO Friendly URL Module

    This is Prestashop SEO Friendly URL Module. This module is compatiable with prestashop 1.6.X.X to prestashop 1.7.X.X version.

    No Core Change ( without any override )

    This module has not use any override system. This module don’t change any core prestashop files That why its very easy to use.

    Installation / Usage

    Prestashop default modules installation system.

    Support

    If you fetch any issue please feel free to create a issue on github. I will help you to solve the issue.

    Contribution

    Found a bug or have an idea? Use GitHub’s tickets system.
    If you want to help and add a feature or fix a bug, you need to make a pull request:

    • Create a fork of this repo
    • Create a new branch like “feature-xxxxxx”
    • Commit your changes on the dev branch
    • Create your pull request on GitHub

    License

    PrestaShop SEO Friendly URL Module is licensed under the GNU licence

    Hire Us:

    If you want to make a Online E-Commerce Store Using Prestashop, WordPress, Opencart, Laravel, Django. Please email Us : kamrulbd36@gmail.com

    Thank you for downloading and using the PrestaShop SEO Friendly URL Module!

    Visit original content creator repository
    https://github.com/softwaremistri/smseourl

  • tilt-relay

    tilt-relay

    A ESP32-based [Tilt Hydrometer](Tilt Relay to Brewfather

    graph LR
        A[Tilt<br/>Hydrometer] --->|Bluetooth LE<br/>iBeacon<br>gravity / temperature| B
        B[ESP32<br/>microcontroller] --->|WiFi<br/>http POST<br/>json| C[brewfather.app]
    



    Loading


    Support

    Why ?

    The bluetooth signal from the Tilt Hydrometer is not strong enough to get
    throught stainless fermenters (e.g. kegs) inside a metalic fermentation
    chamber (e.g. a freezer). This means the default brewfather integration
    for the Tilts might now work properly without additional hardware.

    Several solutions exists but the cheapest one is to use a microcontroller
    inside the fermentation chamber (e.g. freezer) to listen to the bluetooth
    signal and then relay it, using more powerful WiFi, to the brewfather app.

    How To Build

    Hardware

    • A ESP32 microcontroller

    I used a M5StickC.
    It’s main advantage is that it comes pre-installed inside it’s own case.
    It also has a small screen (not really needed for this project) and comes
    with a short USB cable (more useful to develop than for a permanent
    installation). Sadly it’s now EOL and any supplies are likely be limited.

    There is a newer M5StickC Plus
    model with a larger screen. However it’s pricier, does not come with
    a USB cable and provide no additional/useful features for this project.

    A cheaper option is the screen-less Atom Lite
    but, from other projects, I found it’s WiFi antenna is less powerful and
    you might have issues (from inside a freezer) to connect it to your WiFi
    network. YMMV.

    Software

    • Install VSCode
    • From VSCode install the PlatformIO extension
    • Clone this repository
    • Include your own private.h file with your WiFi credentials and your BrewFather Custom Stream URL

    Example

    #ifndef __PRIVATE_H__
    #define __PRIVATE_H__
    
    #define DEFAULT_SSID        "wifi-ssid"
    #define DEFAULT_PASSWORD    "wifi-password"
    #define BREWFATHER_URL      "/stream?id=XXXXXXXXXX"
    #endif
    • Build the project
    • Deploy to your ESP32 microcontroller

    See Also

    Visit original content creator repository
    https://github.com/spouliot/tilt-relay

  • release-notes-generator

    Build & Test GitHub license Version

    RNG


    This project was born to automate the communication between developers and final users.

    A complete markdown file will be created using your pull request descriptions.

    How Release Notes are done
    1. Parse every PR in latest RELEASE.

    2. Filter Pull Requests by label.

    3. Add PR title and description to RELEASE-NOTE.md.

    4. Mark Release note section as feature, bug, refactor, etc.

    5. If you set publish: true

      • All changes will be commited to your repo.
      • Tag pull requests with in-release-note label.
    6. Execute plugins, like TEAMS webhooks

    Supported Repos
  • GITHUB via @octokit.

  • TEAMS via Webhooks.


  • Documentation


    Install

    npm i -D "@adrian.insua/relase-notes-generator"

    CI Configuration

    RNG uses TOKEN to authorize process repository access in CI.

    If you want to push changes to a protected_branch you’ll need to use an access token with enough permissions.

    1. Create a personal access token with enough permissions.
    2. Add it as a secret in your project configuration.
    3. Update your workflow to use it as auth token for rng
      run: npm run rng
      env:
        GITHUB_TOKEN: ${ secrets.ADMIN_TOKEN }

    Preview in pull request

    You can see how RELEASE NOTES will look like using preview and issue attribute

    Github Actions

    Workflow

    name: Preview Release Notes in PR
    
    on:
      workflow_dispatch:
      pull_request:
        branches:
          - develop
    
    jobs:
      build:
        name: Release notes preview
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
            with:
              persist-credentials: false
          - uses: actions/setup-node@v2
            with:
              node-version: 16
          - run: npm ci
          - run: npm run build
          - run: npm run preview -- ${{ github.event.number }}
            env:
              GITHUB_TOKEN: ${{ secrets.ADMIN_TOKEN }}
    { 
      "scripts": {
        "preview": "rng gen -v --snapshot -f '' --issue"
      }
    }

    Workflow steps:

    • Pass issue to preview script.
    • Set snapshot flag to parse pull requests since latest release.
    Custom configuration file

    You can use a custom config file for this process

    { 
      "scripts": {
        "preview": "rng gen -v -c .releasenotes-preview.yml --issue"
      }
    }
    # releasenote-preview
    snapshot: true
    filter: ''
    decoration:
      type/feature: '## :sparkles: '
      type/bug: '## :bug: '

    Example

    # releasenotesrc.yml
    
    message: "chore: update RELEASE-NOTES [skip ci]"
    token: TOKEN
    repo: RELEASE_NOTES_TEST
    split: true
    out: '.'
    ignored-labels:
      - in-release-note
      - released
    assets:
      - CHANGELOG.md
      - package.json
    decoration:
      type/feature: '## :zap: '
      type/bug: '## :bug: '
    // .env
    
    TOKEN=<your-repo-token>
    RELEASE_NOTES_TEST=adrianiy/release-notes-generator
    

    Output

    # RELEASE NOTES
    
    # :rocket: Mock testing issue 
    ###### 2021-10-13
    
    ## :zap: Test Issue
    
    This issue is used by release-notes-generator for test purposes

    Check out our RELEASE NOTES

    Visit original content creator repository https://github.com/adrianiy/release-notes-generator
  • MoGliFC-Flight-Controller

    MoGliFC – flight controller and generic CAN-FD interface

    powered by

    GLIWA.com

    WORK IN PROGRESS

    Tapeout expected: 09/2024

    Work based on:

    Overview

    MoGliFC is an STM32H743-based flight controller for quadcopters (‘drones’) as well as aircraft with wings. Winged aircraft typically require servos to be connected to the flight controller while copters typically have no such requirement.

    Quadcopter and Wing

    MoGliFC addresses both use-cases by providing a scored extension board for the servo connectors which also holds the BEC for the servos. When removed, the signal outputs remain on the flight controller and are available e.g. as GPIOs, UARTs or PWM outputs. To enable a “Full Stack” solution for drones incorporating also a dedicated ESC daughter board, the design goal of MoGliFC is such that off-the-shelf ESC boards can be used. (outlook: custom ESC board for MoGliFC with advanced features)

    CAN-FD and Debug

    The second extension option is a larger frame which allows the MoGliFC to be placed in a BOPLA ALUBOS housing with the USB interface as well es the CAN/CAN-FD externally available turning the MogliFC into a general purpose CAN-FD interface. This second extension also holds a SWD (single wire debug) interface for easy debugging.

    PCB mechanical concept

    edit online with draw.io

    Features

    Main

    • MCU: STM32H743 @480MHz

    • GYROscope: BMI270 (Bosch)

    • MAGnetometer: HMC5883 (Honeywell)

    • BAROmeter: DPS310 (Infineon)

    • OnScreenDisplay: AT7456E

    • BLACKBOX Recorder: 128MB

    • expressLRS 3.x true diversity receiver (Gemini compatible)

    I/O

    • 7x UARTs
    • 8x PWM outputs (Wing only)
    • 4 ADCs (Vbat, Current, RSSI, AirSpeed)
    • I2C, SPI, CAN
    • USB-C

    Power

    • 8-25V (3~6S) DC-input
    • BEC 5V 2A cont., 3A peak (FC) (Wing/Debug only)
    • BEC 10V 2A cont., 3A peak (VTX/camera) (Wing/Debug only)
    • BEC Vx 8A cont., 10A peak (servos, 5V with 6/7.4V option) (Wing/Debug only)
    • LDO 3.3V 500mA (external)

    Power concept

    edit online with draw.io

    Other

    • 3x status LEDs
    • Beeper support
    • WS2812 LED support
    • Dual Camera Inputs switch
    • Current Sensor (50A continuous, 160A peak) (Wing/Debug only)
    • Battery Voltage Sensor: 1K:10K (INAV Scale 1100)

    Mechanics

    • Mounting: 30.5 x 30.5mm, Φ4mm with grommets Φ3mm
    • Dimension: 54 x 36 x 13 mm (wing); 36 x 36 x 13 mm (quad)
    • Weight: XXg (Quad: XXg, Wing: YYg)

    Documentation

    Setup, installation

    Hardware

    Software

    Tools

    Contributing

    Contributions are welcome and encouraged. You can contribute in many ways:

    • Documentation updates and corrections.
    • How-To guides – received help? help others!
    • Bug fixes.
    • New features.
    • Telling us your ideas and suggestions.
    • Buying your hardware from this

    Github issue tracker is a good place to search for existing issues or report a new bug/feature request: Before creating new issues please check to see if there is an existing one!

    Developers

    Main developers are:

    Targets

    • set up github space
    • set up development environment
    • develop and prototype board
    • develop inav branch
    • final prototype testing
    • ingest MoGliFC as supported INAV and Betaflight target
    • series production
    Visit original content creator repository https://github.com/MomoRC-tech/MoGliFC-Flight-Controller
  • minfft

    minfft

    A minimalist Fast Fourier Transform library.

    It achieves high performance by simple means.

    Overview

    The library routines compute:

    • Forward and inverse complex DFT,
    • Forward and inverse DFT of real data,
    • Cosine and sine transforms of types 2, 3, 4

    of any dimensionality and power-of-two lengths.

    The library provides C and Fortran interfaces.

    Contents

    Interface

    All transform routines take three arguments:

    • input data pointer x,
    • output data pointer y,
    • auxiliary data pointer a.

    The transform routines are capable of both in-place and out-of-place operation. In the latter case the input is left intact.

    Auxiliary data contain chains of precomputed constants and temporary memory buffers, required for a transform routine to do its job. Once prepared, the auxiliary data can be reused as many times as needed. Also, the same auxiliary data fit for both forward and inverse transforms of the same kind.

    These examples in C and Fortran show how the library functions are used:

    	#include "minfft.h"
    	minfft_cmpl x[N],y[N]; // input and output buffers
    	minfft_aux *a; // aux data
    	// prepare aux data
    	a=minfft_mkaux_dft_1d(N);
    	// do transforms
    	minfft_dft(x,y,a);
    	minfft_invdft(y,x,a);
    	// free aux data
    	minfft_free_aux(a);
    	use minfft
    	complex(minfft_cmpl),dimension(n) :: x,y ! input and output buffers
    	type(minfft_aux) :: a ! aux data
    	! prepare aux data
    	a=minfft_mkaux_dft_1d(n)
    	! do transforms
    	call minfft_dft(x,y,a)
    	call minfft_invdft(y,x,a)
    	! free aux data
    	call minfft_free_aux(a)

    Data types

    The library defines its own types for real and complex numbers, and for auxiliary data:

    C Fortran
    minfft_real real(minfft_real)
    minfft_cmpl complex(minfft_cmpl)
    minfft_aux type(minfft_aux)

    By default, minfft_real is double. If C99 native complex is available, then minfft_cmpl is double complex. Otherwise, minfft_cmpl is an array of two minfft_reals. It is binary-compatible with other known complex number types, such as MSVC _Dcomplex or C++ complex<double>.

    To build a single precision version, define the MINFFT_SINGLE macro.

    Transforms

    Below is a list of transforms with their definitions, auxiliary data makers, and transform routines.

    For convenience, we provide aux data makers for one-, two- and three-dimensional transforms, along with a generic any-dimensional one. The dimensions are passed to aux maker routines in the C order (most rapidly varying index is the last). So, when calling from Fortran, array dimensions must be passed in the reverse order:

    	complex(minfft_cmpl),dimension(n1,n2,n3) :: z
    	a=minfft_mkaux_dft_3d(n3,n2,n1)

    Auxiliary data makers return NULL if an error occured.

    Our definitions of transforms, and formats of input and output data, are fully compatible with FFTW.

    Complex DFT

    minfft_aux* minfft_mkaux_dft_1d (int N);
    minfft_aux* minfft_mkaux_dft_2d (int N1, int N2);
    minfft_aux* minfft_mkaux_dft_3d (int N1, int N2, int N3);
    minfft_aux* minfft_mkaux_dft (int d, int *Ns);
    void minfft_dft (minfft_cmpl *x, minfft_cmpl *y, const minfft_aux *a);

    Inverse complex DFT

    minfft_aux* minfft_mkaux_dft_1d (int N);
    minfft_aux* minfft_mkaux_dft_2d (int N1, int N2);
    minfft_aux* minfft_mkaux_dft_3d (int N1, int N2, int N3);
    minfft_aux* minfft_mkaux_dft (int d, int *Ns);
    void minfft_invdft (minfft_cmpl *x, minfft_cmpl *y, const minfft_aux *a);

    Real DFT

    This transform returns mostly non-redundant part of the complex DFT of real data.

    For a real array of dimensions

    it produces a complex array of dimensions

    Note that output takes a little more space than input. For in-place operation, make sure the data buffer is big enough to contain output.

    minfft_aux* minfft_mkaux_realdft_1d (int N);
    minfft_aux* minfft_mkaux_realdft_2d (int N1, int N2);
    minfft_aux* minfft_mkaux_realdft_3d (int N1, int N2, int N3);
    minfft_aux* minfft_mkaux_realdft (int d, int *Ns);
    void minfft_realdft (minfft_real *x, minfft_cmpl *z, const minfft_aux *a);

    Inverse real DFT

    This is the inversion of the real DFT.

    It takes a complex array of dimensions

    and returns a real array of dimensions

    NB: Multidimensional inverse real DFT does not preserve input.

    minfft_aux* minfft_mkaux_realdft_1d (int N);
    minfft_aux* minfft_mkaux_realdft_2d (int N1, int N2);
    minfft_aux* minfft_mkaux_realdft_3d (int N1, int N2, int N3);
    minfft_aux* minfft_mkaux_realdft (int d, int *Ns);
    void minfft_invrealdft (minfft_cmpl *z, minfft_real *y, const minfft_aux *a);

    DCT-2

    minfft_aux* minfft_mkaux_t2t3_1d (int N);
    minfft_aux* minfft_mkaux_t2t3_2d (int N1, int N2);
    minfft_aux* minfft_mkaux_t2t3_3d (int N1, int N2, int N3);
    minfft_aux* minfft_mkaux_t2t3 (int d, int *Ns);
    void minfft_dct2 (minfft_real *x, minfft_real *y, const minfft_aux *a);

    DST-2

    minfft_aux* minfft_mkaux_t2t3_1d (int N);
    minfft_aux* minfft_mkaux_t2t3_2d (int N1, int N2);
    minfft_aux* minfft_mkaux_t2t3_3d (int N1, int N2, int N3);
    minfft_aux* minfft_mkaux_t2t3 (int d, int *Ns);
    void minfft_dst2 (minfft_real *x, minfft_real *y, const minfft_aux *a);

    DCT-3

    minfft_aux* minfft_mkaux_t2t3_1d (int N);
    minfft_aux* minfft_mkaux_t2t3_2d (int N1, int N2);
    minfft_aux* minfft_mkaux_t2t3_3d (int N1, int N2, int N3);
    minfft_aux* minfft_mkaux_t2t3 (int d, int *Ns);
    void minfft_dct3 (minfft_real *x, minfft_real *y, const minfft_aux *a);

    DST-3

    minfft_aux* minfft_mkaux_t2t3_1d (int N);
    minfft_aux* minfft_mkaux_t2t3_2d (int N1, int N2);
    minfft_aux* minfft_mkaux_t2t3_3d (int N1, int N2, int N3);
    minfft_aux* minfft_mkaux_t2t3 (int d, int *Ns);
    void minfft_dst3 (minfft_real *x, minfft_real *y, const minfft_aux *a);

    DCT-4

    minfft_aux* minfft_mkaux_t4_1d (int N);
    minfft_aux* minfft_mkaux_t4_2d (int N1, int N2);
    minfft_aux* minfft_mkaux_t4_3d (int N1, int N2, int N3);
    minfft_aux* minfft_mkaux_t4 (int d, int *Ns);
    void minfft_dct4 (minfft_real *x, minfft_real *y, const minfft_aux *a);

    DST-4

    minfft_aux* minfft_mkaux_t4_1d (int N);
    minfft_aux* minfft_mkaux_t4_2d (int N1, int N2);
    minfft_aux* minfft_mkaux_t4_3d (int N1, int N2, int N3);
    minfft_aux* minfft_mkaux_t4 (int d, int *Ns);
    void minfft_dst4 (minfft_real *x, minfft_real *y, const minfft_aux *a);

    Freeing auxiliary data

    If not needed anymore, the memory consumed by the auxiliary data can be freed by the minfft_free_aux() routine:

    void minfft_free_aux (minfft_aux *a);

    Memory requirements

    Our library does not try to save memory, and allocates temporary buffers wherever it benefits performance.

    The amounts of memory allocated for the auxiliary data of the one-dimensional transforms are given below:

    Transform Auxiliary data size
    Complex DFT of length N 2N complex numbers
    Real DFT of length N 3.5N real numbers
    Type-2 or Type-3 transform of length N 5.5N real numbers
    Type-4 transform of length N 6N real numbers

    Multi-dimensional transforms use a temporary buffer of the same size as the input data. This value is the dominant term in their auxiliary data size.

    Implementation details

    The complex DFT is computed by a split-radix (2/4), decimation in frequency, explicitly recursive fast Fourier transform. This method achieves a remarkable balance between performance and simplicity, and it behaves particularly cache-friendly, since it refers mostly to adjacent memory locations.

    The real transforms are reduced eventually to a half-length complex transform.

    For each transform, we first implement its one-dimensional, out-of-place, input-preserving, sequential input, strided output routine. This allows us to compute a multi-dimensional transform by repeated application of its one-dimensional routine along each dimension.

    Performance

    Below are the plots of speed and accuracy of our library, compared with the libraries of similar design — KissFFT and PocketFFT. Performance of a highly optimized machine-specific version of the FFTW library is also shown for reference.

    Standards

    C89, Fortran 2003.

    License

    MIT.

    Visit original content creator repository https://github.com/aimukhin/minfft