Latest 1.0.4
Homepage https://github.com/dboyliao/NumSwift
License MIT
Platforms ios 8.0, requires ARC
Frameworks Accelerate
Authors

Numeric Operations for Swift

This project is just a simple practice on Swift and Accelerate framework.
The swift files contain some basic function used in numeric computation. The main functionality is build upon Accelearate framework which leaverages SIMD of the CPU, which make the codes run faster than native Swift code.

I am a big fan of python. In this project, you can find many of the functions mimic the API from numpy which is a popular package for scientific computation.

I hope you enjoy this package. Cheers.

Dependency

  • Accelerate framework
  • Foundation framework

Testing

First, change working directory to NumSwift.

Setup Testing Environment

We use numpy (python package for numeric computation) as reference. Please setup the python environment by following steps:

  • Instll python and virtualenv.
    • See this guide for detail of virtualenv
  • Activate a testing virtual environment.
    “`{bash}
    virtualenv venv_test
    source venv_test/bin/activate

  • Install required python packages
    • run pip install -r requirements.txt

You are ready to go!

Running Tests for Swift

  • Run make test-osx on Mac OSX.

Build

Importable Module

  • change working directory to NumSwift
  • Run make module
  • You will see a directory named NumSwiftModule
    • There are three files in that directory: NumSwift.swiftmodule, NumSwift.swiftdoc and libNumSwift.dylib
  • Include files generated in NumSwiftModule in you XCode Project.
    • If you hate XCode just like me, you can use swiftc instead with flags -I and -L
    • ex: Suppose you have a main.swift and import NumSwift in it, you can run xcrun -sdk macosx swiftc -I /path/to/NumSwiftModule -L /path/to/NumSwiftModule -lNumSwift -o main.

Importable Framework

  • Open NumSwift.xcodeproj under NumSwift/NumSwift/ directory.
  • Press Build.
  • You should be able to see NumSwift.framework under NumSwift/NumSwift/. Drag the framework file to any project you’d like to use it.
  • You should be able to import NumSwift in your project.

References

Accelerate Framework

Fourier Transform

  • DFT v.s FFT
  • vDSP Guide – DFT
    • That is why we use vDSP_DFT_XXX rather than vDSP_fft_XXX.
    • The header file which states you should prefer DFT over fft is located in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/vecLib on my computer. Go see it for yourself.

Licence

MIT

Latest podspec

{
    "name": "NumSwift",
    "version": "1.0.4",
    "summary": "Numeric Operations for Swift",
    "description": "This project is just a simple practice on Swift and Accelerate framework. The swift files contain some basic function used in numeric computation. The main functionality is build upon Accelearate framework which leaverages SIMD of the CPU, which make the codes run faster than native Swift code.nnI am a big fan of python. In this project, you can find many of the functions mimic the API from numpy which is a popular package for scientific computation.nnI hope you enjoy this package. Cheers.",
    "homepage": "https://github.com/dboyliao/NumSwift",
    "license": "MIT",
    "authors": {
        "Dboy Liao": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/dboyliao/NumSwift.git",
        "tag": "1.0.4"
    },
    "source_files": [
        "NumSwift/Source/*.swift",
        "NumSwift/Source/Signal/*.swift"
    ],
    "frameworks": "Accelerate",
    "requires_arc": true
}

Pin It on Pinterest

Share This