A NumPy-like multi-dimensional array library for Swift with support for complex numbers and image processing.
Matft is a Swift library that implements NumPy-like multi-dimensional array operations, providing ndarray, matrix, and vector functionality. It solves the need for high-performance numerical computing and data manipulation in Swift, similar to what NumPy offers in Python. The library includes support for complex numbers, advanced indexing, image processing, and mathematical operations like linear algebra and statistics.
Swift developers working on scientific computing, machine learning, data analysis, or image processing projects who need NumPy-like array manipulation capabilities within the Swift ecosystem.
Developers choose Matft because it brings the familiar and powerful NumPy API to Swift, enabling efficient array operations with Accelerate framework integration. Its unique selling point is providing comprehensive multi-dimensional array support with complex number handling and image processing tools, all with a syntax closely mirroring NumPy.
Numpy-like library in swift. (Multi-dimensional Array, ndarray, matrix and vector library)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Matft closely mirrors NumPy's API, with familiar functions like `arange`, `reshape`, and `astype`, making it easy for Python developers to transition to Swift for array operations.
Leverages Apple's Accelerate for fast mathematical operations; benchmarks in the README show Matft's sine calculations are faster than NumPy (2.14ms vs 14.7ms).
Includes comprehensive complex array operations like arithmetic, conjugation, and angle calculation, essential for scientific computing, though it's labeled as beta with some features incomplete.
Provides direct conversion functions between MfArray and UIImage/CGImage, simplifying pixel-level manipulation in iOS/macOS apps without external dependencies.
Offers a wide range of functions from creation to linear algebra and FFT, matching many NumPy operations, as detailed in the extensive function list.
Boolean indexing and comparison operations are much slower than NumPy; the README admits Matft takes 7ms vs NumPy's 1ms for boolean indexing, and boolean tests show similar lags.
Complex number support is in beta with missing functionalities like boolean indexing setter, and the README notes that some parts are not fully implemented, potentially causing bugs.
1D arrays return MfArray instead of scalars when subscripted, requiring the unintuitive use of `.item` method as a workaround, which can lead to confusion and extra code.
Carthage and CocoaPods support is marked as outdated in badges, with only Swift Package Manager recommended, potentially causing installation issues for projects using other managers.