Skip to main content

Fast multiplications of quaternion-valued matrices.

Project description

qmatmul: Fast multiplication of quaternion-valued matrices - algorithm and its implementations for sequential and CUDA computations

We present an algorithm for fast multiplication of matrices whose elements are quaternions - hypercomplex numbers consisting of one real and three imaginary parts. The number of elementary floating-point multiplications involved in the algorithm is reduced twice with respect to the definition-based formula, regardless of the input matrices. This is owed to a suitable representation and decomposition into two products, one of which takes advantage of certain diagonal symmetry properties, the other of sparsity.

The qmatmul package is suitable for Python's ecosystem. Altogether, we provide 8 implementation variants of matrix-matrix multiplication for quaternion-valued inputs. The variants cover several approaches based on NumPy, thus supported by BLAS, but also several approaches employing Numba - a just-in-time compiler targeting both CPU and GPU (CUDA). Our design of CUDA computations for the proposed algorithm involves: 6 kernel functions with 11 invocations, tiling and shared memory, and few host-device memory transfers.

Installation

pip install qmatmul

For usage examples and more information see the repository at: https://github.com/pklesk/quaternions.

Documentation

Developer documentation of the project is accessible at: https://pklesk.github.io/quaternions.

License

This project is licensed under the MIT License.

Acknowledgments and credits

  • NumPy: the fundamental package for scientific computing with Python.
  • Numba: a high-performance just-in-time Python compiler.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qmatmul-1.0.4.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qmatmul-1.0.4-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file qmatmul-1.0.4.tar.gz.

File metadata

  • Download URL: qmatmul-1.0.4.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for qmatmul-1.0.4.tar.gz
Algorithm Hash digest
SHA256 8797987de1286f68b72860db23259c59b0f3696d27c279ec7bfba8aeedb99b9f
MD5 ff257819d74410f3bcfbf6d5217bd665
BLAKE2b-256 9f109cd078fb68639c40170e9086c634769c4606edfeba4c070148de4474c549

See more details on using hashes here.

File details

Details for the file qmatmul-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: qmatmul-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for qmatmul-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 173ea1ad9b107538aff9474a73592be4213e162284ad3ad48e52b931791958ea
MD5 8205f83f861279f43c416ca275bdde60
BLAKE2b-256 916a359e20b5ff95c21468768564d39935f510acdbc595c613c943c613880734

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page