This is a linear algebra library like Numpy, with less utilities kernels such as a lot of the array manipulation functionalities. The goal of this libarary is to run matrix calculation on both CPU and GPU, so more functions will be implemented in the near future. Rigth now the following kernels are available.
- eye
- zeros
- randn(normal distribution)
- rand(uniform distribution)
- rot2
- rot3
- add/substract
- matmul
- eigenvalue decomposition
- SVD
- LU Decomposition
- matrix inverse
- pseudo-inverse for non-square matrix
from NaN.lib import matGen as mg
from NaN.lib import ops
from NaN.matrix import matrix
# to create a matrix
a = matrix([[1,2,3],[2,3,4],[5,6,7]], 'double')
# to generate a matrix with normal distribution value
# with mean of 0 and std of 1
a = mg.randn((2, 3), (0, 1), 'double')
# to generate a matrix with uniform distribution value
# from 0 to 5
b = mg.rand((3, 2), (0, 5), 'double')
# do a matmul
c = a*b
# do a Singlar Value Decomposition
u,s,vt = ops.svd(c)
Installation of BLAS in pip is very slow and the performance is not great either, so we recommand using a conda environment for optimal performance(see BLAS Recommandation)
- run "pip install ." to install the library
- QR and Chol decomposition
- solvers
- outter/inner/dot/kron product
- GPU support
It is highly recommanded that you use a conda environment for this library since it provides a much faster BLAS compared to pip. To install BLAS from conda, type in:
foo@whoami:~$ conda install -c anaconda openblas
before you pip install this library