Skip to main content

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.

Release files for qmatmul 1.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qmatmul 1.0.6
File Size Uploaded
qmatmul-1.0.6.tar.gz 15.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qmatmul 1.0.6
File Interpreter ABI Platform
qmatmul-1.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 27.8 kB

Release files / qmatmul-1.0.6.tar.gz

Download URL qmatmul-1.0.6.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9297de80fba0d4416dd29643ac82fb249f4d7f60e95b25034c07498f172f0833
BLAKE2b-256 checksum
How to use checksums
0320679ed286d5f8375abfd167ac6706f38a5ecc56f49ef93cde635b85169373
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / qmatmul-1.0.6-py3-none-any.whl

Download URL qmatmul-1.0.6-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6feaefd55fb9e6930f47a231a3d6f30efadc0f565ce22d91c805ce3d4b767f3
BLAKE2b-256 checksum
How to use checksums
d1547daf36064a98e31b10bcea0afad7455609b32587326dcb706c77843f1ada
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

1.0.7

2 release files

This release

1.0.6 This release

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page