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.1.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.1-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qmatmul-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 6d5e244cc1860e1a2b42d15120fab9c552d290d9ae3046c85938b4aeab37d291
MD5 181dbc06070d638253483a74f7903a76
BLAKE2b-256 d8b1c615d6959ba43b743a250b0d00d8da453666458a2a01ec30a28f2ab990da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qmatmul-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0d7f91389efc7ce0b2e2a64611491e54a2d3e1789027f5044a029dc827f6fc4c
MD5 a41ce21b3782263b5804be57fe2fa872
BLAKE2b-256 8e5bd9cea0fc0ab8333aa44d4bfac79a07c0a12bf94100283d4dbb71694a1227

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