Linear algebra library for Python, with emphasis on ease of use
Project description
PyArmadillo: linear algebra library for Python
Copyright 2020-2021 Jason Rumengan (https://www.jasonrumengan.my.id)
Copyright 2020-2021 Terry Yue Zhuo (https://terryyz.github.io)
Copyright 2020-2021 Conrad Sanderson (https://conradsanderson.id.au)
Copyright 2020-2021 Data61 / CSIRO
Quick Links
Contents
1. Introduction
-
PyArmadillo is a streamlined linear algebra library (matrix maths) for the Python language, with emphasis on ease of use
-
Provides high-level syntax and functionality deliberately similar to Matlab
-
Provides classes for matrices and cubes; integer, floating point and complex elements are supported
-
Relies on Armadillo for the underlying C++ implementation of matrix objects
-
Authors:
- Jason Rumengan - https://www.jasonrumengan.my.id
- Terry Yue Zhuo - https://terryyz.github.io
- Conrad Sanderson - http://conradsanderson.id.au
-
Example program:
from pyarma import * A = mat(4, 5, fill.ones) B = mat(4, 5, fill.randu) C = A*B.t() C.print("C:")
2: Citation Details
Please cite the following report if you use PyArmadillo in your research and/or software.
Citations are useful for the continued development and maintenance of the library.
- Jason Rumengan, Terry Yue Zhuo, Conrad Sanderson.
PyArmadillo: an alternative approach to linear algebra in Python.
Technical Report, Data61/CSIRO, 2021.
3: Documentation and Examples
The documentation for PyArmadillo functions and classes is available at:
https://pyarma.sourceforge.io/docs.html
The documentation is also in the doc/docs.html
file in the PyArmadillo archive,
which can be viewed with a web browser.
A short example program named example.py
that uses PyArmadillo
is included with the PyArmadillo archive.
4: Installation via pip
-
A precompiled version of PyArmadillo is available via the Python Package Index (PyPI)
-
Use the following command for installation:
pip3 install --user pyarma
or
pip3 install pyarma
-
If
pip3
cannot be found, try using the following alternatives:python3 -m pip
py -m pip
-
To upgrade PyArmadillo via pip:
pip3 install --upgrade --user pyarma
or
pip3 install --upgrade pyarma
NOTE: It's possible that pip may erroneously not find the newest version. In that case, try the following command:
pip3 install --no-cache-dir --upgrade --user pyarma
or
pip3 install --no-cache-dir --upgrade pyarma
-
More info on the pyarma package at PyPI:
https://pypi.org/project/pyarma/
5: Installation from Source
-
Preliminaries
-
Installing PyArmadillo from source requires:
- at least Python 3.6; the minimum recommended version is Python 3.8
- a C++ compiler that supports at least the C++11 standard
- at least 8 GB of RAM
- 64-bit CPU, preferably with 4+ cores
- OpenBLAS and LAPACK (or compatible implementations)
-
Linux based operating systems (eg. Fedora, Ubuntu, CentOS, Red Hat, Debian, etc)
- First install OpenBLAS, LAPACK, Python 3, and pip3, along with the corresponding development/header files
- On CentOS 8 / RHEL 8, the CentOS PowerTools repository may need to be enabled:
dnf config-manager --set-enabled powertools
- Recommended packages to install before installing PyArmadillo:
- Fedora, CentOS, RHEL: gcc-c++, libstdc++-devel, openblas-devel, lapack-devel, python3-devel, python3-pip
- Ubuntu and Debian: g++, libopenblas-dev, liblapack-dev, python3-dev, python3-pip
pip3
needs to be updated:
pip3 install --user --upgrade pip
-
macOS
- First install Xcode (version 8 or later) and then type the following command in a terminal window:
xcode-select --install
- Xcode command-line tools include the Python 3 development files, but
pip3
needs to be updated:
pip3 install --user --upgrade pip
- The "Accelerate" framework is used for accessing BLAS and LAPACK functions
- First install Xcode (version 8 or later) and then type the following command in a terminal window:
-
Windows (x64)
- First install Microsoft Visual Studio (2019 or later)
- Use the x64 Native Tools Command Prompt
- PyArmadillo contains pre-compiled OpenBLAS, which is used for accessing BLAS and LAPACK functions
pip3
needs to be updated:
py -m pip install --user --upgrade pip
- Alternative implementations and/or distributions of BLAS and LAPACK are available at:
- Caveat: 32-bit Windows (x86) is currently not supported
-
-
Running the Installer
-
Open a terminal window and change into the directory containing PyArmadillo sources
-
if the source was obtained as a package downloaded from SourceForge:
tar xf pyarmadillo-0.123.4.tar.xz cd pyarmadillo-0.123.4
(change
0.123.4
to match the downloaded version) -
if the source was obtained by cloning the GitLab repo:
git clone https://gitlab.com/jason-rumengan/pyarma/ cd pyarma
-
-
Execute the following command:
pip3 install --user .
NOTE: the full stop character at the end is important
-
To see the progress of installation, change the above command to
pip3 install --verbose --user .
-
If
pip3
cannot be found, try using the following alternatives:python3 -m pip
py -m pip
-
Installation may take 5 to 20 minutes due to compiling C++ sources that extensively use template metaprogramming; the time taken depends on the number of CPU cores and the amount of available memory
-
Caveat: on systems with low memory (< 8 GB), parallel compilation may fail due to template metaprogramming requiring large amounts of memory. To avoid parallel compilation, first install
scikit-build
usingpip3 install --user scikit-build
and then install PyArmadillo usingpython setup.py install -- -- -j1
-
Link-time optimisation (LTO) is off by default. LTO reduces the size of PyArmadillo at the expense of considerably longer compilation time. To enable LTO, first install
scikit-build
andninja
, and then enable thePYARMA_LTO
option during installation:pip3 install --user scikit-build ninja python3 setup.py install -DPYARMA_LTO=ON
-
-
Support for Intel MKL and Other BLAS/LAPACK Implementations
-
PyArmadillo can optionally use the Intel Math Kernel Library (MKL) as high-speed replacement for standard BLAS and LAPACK
-
Intel MKL should be automatically detected during installation from source
-
For other BLAS/LAPACK implementations, minor modifications to the built-in Armadillo sources may be required. Specifically
ext/armadillo/include/armadillo_bits/config.hpp
may need to be edited to ensure Armadillo uses the same integer sizes and style of function names as used by the replacement libraries. The following defines may need to be enabled or disabled:ARMA_BLAS_CAPITALS ARMA_BLAS_UNDERSCORE ARMA_BLAS_LONG ARMA_BLAS_LONG_LONG
See the Armadillo site for more information:
-
On Linux-based systems, MKL might be installed in a non-standard location such as
/opt
which can cause problems during linking. Before installing PyArmadillo, the system should know where the MKL libraries are located. For example,/opt/intel/mkl/lib/intel64/
. This can be achieved by setting theLD_LIBRARY_PATH
environment variable, or for a more permanent solution, adding the directory locations to/etc/ld.so.conf
. It may also be possible to store a text file with the locations in the/etc/ld.so.conf.d
directory. For example,/etc/ld.so.conf.d/mkl.conf
. If/etc/ld.so.conf
is modified or/etc/ld.so.conf.d/mkl.conf
is created,/sbin/ldconfig
must be run afterwards.
Below is an example of/etc/ld.so.conf.d/mkl.conf
where Intel MKL is installed in/opt/intel
/opt/intel/lib/intel64 /opt/intel/mkl/lib/intel64
-
If MKL is installed and it is persistently giving problems during linking, support for MKL can be disabled by editing
ext/armadillo/CMakeLists.txt
and commenting out the line containingINCLUDE(ARMA_FindMKL)
, then deletingext/armadillo/CMakeCache.txt
, and finally re-running PyArmadillo installation.
-
6: Distribution License
PyArmadillo is open source software licensed under the Apache License, Version 2.0 (the "License"). A copy of the License is included in the "LICENSE" file.
Any software that incorporates or distributes PyArmadillo in source or binary form must include, in the documentation and/or other materials provided with the software, a readable copy of the attribution notices present in the "NOTICE" file. See the License for details. The contents of the "NOTICE" file are for informational purposes only and do not modify the License.
7: Bug Reports and Frequently Asked Questions
If you find a bug in the library or the documentation, we are interested in hearing about it. Please make a small and self-contained program which exposes the bug, and then send the program source and the bug description to the developers.
The contact details are at:
https://pyarma.sourceforge.io/contact.html
Further information about PyArmadillo is on the frequently asked questions page:
https://pyarma.sourceforge.io/faq.html
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 Distributions
File details
Details for the file pyarma-0.500.3-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: pyarma-0.500.3-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 15.3 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96a4afc6c5cf9dc0c3fe8c7d88ed93f2188fed544e4abbe38003b8e1d700881f |
|
MD5 | 973268dd9e51ae5377e4ba03b0207f46 |
|
BLAKE2b-256 | cdd5c98c851484a0c7dd5d7f4a068ff536a982e544baffc52e5c792b7a29a0ac |
File details
Details for the file pyarma-0.500.3-cp39-cp39-manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyarma-0.500.3-cp39-cp39-manylinux2014_x86_64.whl
- Upload date:
- Size: 24.1 MB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3c36543bf3fc9eaa390c8eb32941c2341491ee3a6a719d41bc0956518daf001 |
|
MD5 | 73964ae2ccfccb489f1c77fd099e914f |
|
BLAKE2b-256 | c2e98eb37319c121c30446e98557f2a3054ec13519c6e79a78f4cee7b326e1db |
File details
Details for the file pyarma-0.500.3-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pyarma-0.500.3-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 17.5 MB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17a9ef6d6fc28e3e131c53a9ec1edac970b118ee5dbf42142b29f5eab7b10f4c |
|
MD5 | 3f37a61526aa718406615e1f70a80075 |
|
BLAKE2b-256 | 6e36a1cef310cc9af625d9d9a6281fa9c47575b2ca7c80f193109741cd16c304 |
File details
Details for the file pyarma-0.500.3-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: pyarma-0.500.3-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 15.3 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a84378f5213c06a01b79751af8dc648aca4aaa7c4a44102e57358f93dcda367 |
|
MD5 | b5a32f3607c57c023f065523f0126086 |
|
BLAKE2b-256 | f08262e922c47706399253ec355c0eb6de11ddc8647643394fb424c05c559cb3 |
File details
Details for the file pyarma-0.500.3-cp38-cp38-manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyarma-0.500.3-cp38-cp38-manylinux2014_x86_64.whl
- Upload date:
- Size: 24.1 MB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb89e46a0a5895e553bebc9d7c89852d24763501a0ed62187754b9c9f32694c3 |
|
MD5 | b2e9278df5b91367ad5db283417a07fb |
|
BLAKE2b-256 | 507159af4b51a08de6751f53c455a4bac4fb17e26471139e0bd7e6269ef755a3 |
File details
Details for the file pyarma-0.500.3-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pyarma-0.500.3-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 17.5 MB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81fccc88ef2e7e1e6ac6378b5bde162df7295be24891bd95473f41da0acc64f9 |
|
MD5 | 97c5272f93791113796f07b85bfaa11d |
|
BLAKE2b-256 | 3045e1dce3d819fea4c98b0b0881b4a26678eaba138bb3fbac03f227212115cc |
File details
Details for the file pyarma-0.500.3-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: pyarma-0.500.3-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 15.1 MB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a83fa93fdeb1c44c70fa66915ae02a635f997cdba1e12def1fb11a9e03ebf0d |
|
MD5 | 6b9be11e9aa35dfa4b45db014a7e0b3a |
|
BLAKE2b-256 | 468939e826c092ad8137eae62ddf005678658eecd76bde072ae601f1bf5a4a64 |
File details
Details for the file pyarma-0.500.3-cp37-cp37m-manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyarma-0.500.3-cp37-cp37m-manylinux2014_x86_64.whl
- Upload date:
- Size: 24.4 MB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d98fe834dfd55125d51f1010e81cacaff0cddbf72e904176c7e95d81adb6a1e |
|
MD5 | ddbf1e5860582c80930802d5c44c0a87 |
|
BLAKE2b-256 | ee64a6fb7ca0288cfa52af143de8b9cc205e0dd50d96b6d036f8468ecd431e26 |
File details
Details for the file pyarma-0.500.3-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pyarma-0.500.3-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 17.3 MB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1ce1dbaf33b2cfeb727155888358279bc0c1c19e5f48c232b5ab78ba7aea568 |
|
MD5 | b540f0b813c35541a6ce32bede0154d2 |
|
BLAKE2b-256 | 08d3f7e3def560dbe22b674194e812cf9e3a8ba211b105cc8831161e5bc634b1 |
File details
Details for the file pyarma-0.500.3-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: pyarma-0.500.3-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 15.1 MB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7438d27c24aa0c8e74cf23f35fef1cc41da34e590562fecd66fcccefd8abc5d4 |
|
MD5 | 5766570ad5e19b6aefe4877710d360ee |
|
BLAKE2b-256 | f519ccfc36ed827fe44337e138b3eb4bbf1eb873b100391732b00a99bfcf67b0 |
File details
Details for the file pyarma-0.500.3-cp36-cp36m-manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyarma-0.500.3-cp36-cp36m-manylinux2014_x86_64.whl
- Upload date:
- Size: 24.4 MB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebe0073d35d65f71021b73f4e6fa4ad996a5a9cb32ac97302309350a4078498d |
|
MD5 | cb0901666b06e43ac6c8a5a9384dd467 |
|
BLAKE2b-256 | 9a50e619bd7501812a6351127ce98d9059e4117c6dd455d004c6b1503fa8d86a |
File details
Details for the file pyarma-0.500.3-cp36-cp36m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pyarma-0.500.3-cp36-cp36m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 17.3 MB
- Tags: CPython 3.6m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cf1cd046a756d00f66e9241d05507f88bf7a2563a7bbb48ddef39cf754bba33 |
|
MD5 | e1368351e188e6f027523c364f9a0fba |
|
BLAKE2b-256 | 8bd1f06989da8a07c8e13a52f8cc5a392f4eb5de0babbb6598d0a966b21767eb |