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
Release files for qmatmul 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| qmatmul-1.0.5.tar.gz | 15.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qmatmul-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.7 kB
Release files / qmatmul-1.0.5.tar.gz
| Download URL | qmatmul-1.0.5.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44b90b2c76c8beb4667e95b0bbdfd04b31b9c3059710406077205bac07a19fa1
|
|
BLAKE2b-256 checksum How to use checksums |
3121624c332ca0e382b96444597a26f110263c9e25df719c3e16d6e4d3b16318
|
| 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.5-py3-none-any.whl
| Download URL | qmatmul-1.0.5-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
126884d941d6e7c3ab31ee7945120b43e1440ca489dd9e970eab9094a73f832a
|
|
BLAKE2b-256 checksum How to use checksums |
fd095093ae9c0be5fe3d78426b6d45a36df8425e2471f4d21af050339d6ef637
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|