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.7

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.7
File Size Uploaded
qmatmul-1.0.7.tar.gz 15.6 kB Details

Built distribution (wheel)

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

Total release size: 28.1 kB

Release files / qmatmul-1.0.7.tar.gz

Download URL qmatmul-1.0.7.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
651fd4be6efba4ab29e8aef118d9b7b5eec7bc191fb6eb4dd0500702987e6cab
BLAKE2b-256 checksum
How to use checksums
93b54e41ee99c727b1f272d186a1b462ff4b547859da71724676e3a1d43ba924
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.7-py3-none-any.whl

Download URL qmatmul-1.0.7-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b90e4f0ce2cd8d6c8382e9697c7c5b6e90f5e531b79cb780d1156f862239c8f
BLAKE2b-256 checksum
How to use checksums
b47c04e4dffdcea5ec3321e1e5e1c4931a111da04490b114ccf5849855545522
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

This release

1.0.7 This release

2 release files

1.0.6

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