Fast matrix transforms
Project description
matvec
A domain-specific language for fast graph shift operations. This implements mathematical fields on numbers, n-dimensional column vectors, and n-by-n sparse matrices.
License: Apache Software License
Author: Emmanouil (Manios) Krasanakis
Dependncies: numpy
:zap: Quickstart
Creating a 5-dimensional vector (can use numpy
arrays
as inputs interchangeably with lists everywhere):
from matvec import Vector
x = Vector([1, 2, 3, 4, 5])
Creating a 5x5 sparse matrix A in coo-format with non-zero elements A[1,2]=9 and A[3,0]=21
from matvec import Matrix
A = Matrix([1, 2],
[3, 0],
[9, 21],
5)
Print the outcome of matrix-vector multiplication:
print(A*x)
Print the outcome of left-multiplying transpose(x) with A:
print(x*A)
:fire: Features
:rocket: Parallelized matrix-vector multiplication.
:chart_with_downwards_trend: Memory reuse optimization.
:mag: numpy compatibility.
:factory: Common arithmetic operations.
:volcano: Benchmark
Benchmarks tested on a machine with 2.6 GHz CPU base clock and up to 4.4 GHz turbo boost, 12 logical cores, and 16GB DDR3 RAM. They span vectors of 1.E4 to 1.E6 elements and matrices with up to 20x the number of non-zeroes. More rigorous evaluation will take place in the future.
Task | numpy/scipy | matvec |
---|---|---|
Create new vector or array | 0.025 sec | 0.014 sec |
1000 temp. additions of 1.E6 vectors only | 2.130 sec | 1.061 sec |
Create matrix | 0.505 sec | 0.183 sec |
Sparse matrix with vector multiplication | 0.045 sec | 0.020 sec |
:memo: List of Operations
- Full arithmetic operations
* + - / == < > <= >=
between vectors and other vectors or scalars. - Matrix-vector multiplication
*
(both left and right). - Element access and assignment for vectors with
[]
. - Masking, such as
y = x[x>0]
. matvec.clear()
Clears cache.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for matvec-0.1.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc0b370cfea6c812c2a993589bf0e25456a7ab6299967e7f3446210b210c6cda |
|
MD5 | 08cd211db3ddd16525c7308c27c494de |
|
BLAKE2b-256 | e0a8d7003729de3aa15483784ee3a2d5312f67541848314ae94d98bbb03e668b |