This package is a collection of functions from Apple's Accelerate framework made available on Linux. It implements vDSP functions natively and bridges to LAPACK and BLAS when available.
.package(url: "[email protected]:brokenhandsio/accelerate-linux.git", from: "main")
.product(name: "AccelerateLinux", package: "accelerate-linux")
Simply use
import AccelerateLinux
and then call through to normal Accelerate functions.
Note
To use this on linux you will need BLAS and LAPACK installed. On Ubuntu you can install these with:
apt-get install libopenblas-dev liblapacke-dev
The package is structured as follows:
Sources/AccelerateLinux/MatrixOps
: Contains matrix operations:BasicOps
- Basic matrix operations:-
vDSP_mtransD
- Transpose a matrix -
vDSP_mmulD
- Matrix multiplication
-
LAPACK
- LAPACK functions:-
dgesv_
- Solve a system of linear equations -
dgesvd_
- Singular Value Decomposition -
dgetrf_
- LU Decomposition -
dgetri_
- Inverse of a matrix -
dgeev_
- Eigenvalues and eigenvectors -
dpotrf_
- Cholesky decomposition -
dtrtrs_
- Solve a triangular system of linear equations
-
CBLAS
- BLAS functions:-
cblas_dgemm
- Matrix multiplication
-
Sources/AccelerateLinux/VectorOps
: Contains vector operationsBasicOps
- Basic vector operations:-
vDSP_maxvD
- Find the maximum value in a vector -
vDSP_minvD
- Find the minimum value in a vector -
vDSP_vaddD
- Add two vectors -
vDSP_vsubD
- Subtract two vectors -
vDSP_vmulD
- Multiply two vectors -
vvpow
- Raise a vector to a power -
vDSP_vclrD
- Clear a vector -
vDSP_vfillD
- Fill a vector with a value -
vDSP_vabsD
- Absolute value of a vector -
vDSP_vnegD
- Negate a vector -
vDSP_vsqD
- Square a vector -
vDSP_dotprD
- Dot product of two vectors -
vDSP_vlimD
- Limit a vector to a range -
vDSP_vclipcD
- Clip a vector to a range -
vDSP_vrsumD
- Recursive sum of a vector -
vDSP_vsortD
- Sort a vector -
vDSP_vrampD
- Ramp a vector -
vDSP.sum
- Sum of a vector -
vDSP.add
:-
vDSP.add
- Add two vectors -
vDSP.add
- Add a scalar to a vector
-
-
vDSP.subtract
- Subtract two vectors -
vDSP.multiply
:-
vDSP.multiply
- Multiply two (Double) vectors -
vDSP.multiply
- Multiply a vector by a scalar -
vDSP.multiply
- Multiply two (Float) vectors
-
-
Statistical
- Statistical operations:-
vDSP.mean
- Mean of a vector
-
Transforms
:-
vDSP_vdpsp
- Convert a double vector to a single precision vector
-