Package: pyarma
PyArmadillo: linear algebra library for Pythonhttps://pyarma.sourceforge.ioCopyright 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 / CSIROQuick Linksdownload latest releasedocumentation for functions and classesbug reports & questionsContentsIntroductionCitation DetailsDocumentation and ExamplesInstallation via pipInstallation from SourceDistribution LicenseBug Reports and Frequently Asked Questions1. IntroductionPyArmadillo is a streamlined linear algebra library (matrix maths) for the Python language, with emphasis on ease of useProvides high-level syntax and functionality deliberately similar to MatlabProvides classes for matrices and cubes; integer, floating point and complex elements are supportedRelies onArmadillofor the underlying C++ implementation of matrix objectsAuthors:Jason Rumengan   -https://www.jasonrumengan.my.idTerry Yue Zhuo   -https://terryyz.github.ioConrad Sanderson -http://conradsanderson.id.auExample program:frompyarmaimport*A=mat(4,5,fill.ones)B=mat(4,5,fill.randu)C=A*B.t()C.print("C:")2: Citation DetailsPlease 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 ExamplesThe documentation for PyArmadillo functions and classes is available at:https://pyarma.sourceforge.io/docs.htmlThe documentation is also in thedoc/docs.htmlfile in the PyArmadillo archive,
which can be viewed with a web browser.A short example program namedexample.pythat uses PyArmadillo
is included with the PyArmadillo archive.4: Installation via pipA precompiled version of PyArmadillo is available via the Python Package Index (PyPI)Use the following command for installation:pip3 install --user pyarmaorpip3 install pyarmaIfpip3cannot be found, try using the following alternatives:python3 -m pippy -m pipTo upgrade PyArmadillo via pip:pip3 install --upgrade --user pyarmaorpip3 install --upgrade pyarmaNOTE: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 pyarmaorpip3 install --no-cache-dir --upgrade pyarmaMore info on the pyarma package at PyPI:https://pypi.org/project/pyarma/5: Installation from SourcePreliminariesInstalling PyArmadillo from source requires:at least Python 3.6; the minimum recommended version is Python 3.8a C++ compiler that supports at least the C++11 standardat least 8 GB of RAM64-bit CPU, preferably with 4+ coresOpenBLAS and LAPACK (or compatible implementations)Linuxbased operating systems (eg. Fedora, Ubuntu, CentOS, Red Hat, Debian, etc)First install OpenBLAS, LAPACK, Python 3, and pip3, along with the corresponding development/header filesOn CentOS 8 / RHEL 8, the CentOS PowerTools repository may need to be enabled:dnf config-manager --set-enabled powertoolsRecommended packages to install before installing PyArmadillo:Fedora, CentOS, RHEL: gcc-c++, libstdc++-devel, openblas-devel, lapack-devel, python3-devel, python3-pipUbuntu and Debian: g++, libopenblas-dev, liblapack-dev, python3-dev, python3-pippip3needs to be updated:pip3 install --user --upgrade pipmacOSFirst install Xcode (version 8 or later) and then type the following command in a terminal window:xcode-select --installXcode command-line tools include the Python 3 development files, butpip3needs to be updated:pip3 install --user --upgrade pipThe "Accelerate" framework is used for accessing BLAS and LAPACK functionsWindows (x64)First install Microsoft Visual Studio (2019 or later)Use the x64 Native Tools Command PromptPyArmadillo contains pre-compiledOpenBLAS,
which is used for accessing BLAS and LAPACK functionspip3needs to be updated:py -m pip install --user --upgrade pipAlternative implementations and/or distributions of BLAS and LAPACK are available at:http://software.intel.com/en-us/intel-mkl/http://icl.cs.utk.edu/lapack-for-windows/lapack/http://ylzhao.blogspot.com.au/2013/10/blas-lapack-precompiled-binaries-for.htmlCaveat: 32-bit Windows (x86) is currently not supportedRunning the InstallerOpen a terminal window and change into the directory containing PyArmadillo sourcesif the source was obtained as a package downloaded from SourceForge:tar xf pyarmadillo-0.123.4.tar.xz
cd pyarmadillo-0.123.4(change0.123.4to match the downloaded version)if the source was obtained by cloning the GitLab repo:git clone https://gitlab.com/jason-rumengan/pyarma/
cd pyarmaExecute the following command:pip3 install --user .NOTE:the full stop character at the end is importantTo see the progress of installation, change the above command topip3 install --verbose --user .Ifpip3cannot be found, try using the following alternatives:python3 -m pippy -m pipInstallation may take5 to 20 minutesdue to compiling C++ sources that extensively use template metaprogramming;
the time taken depends on the number of CPU cores and the amount of available memoryCaveat: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 installscikit-buildusingpip3 install --user scikit-buildand then install PyArmadillo usingpython setup.py install -- -- -j1Link-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 installscikit-buildandninja,
and then enable thePYARMA_LTOoption during installation:pip3 install --user scikit-build ninja
python3 setup.py install -DPYARMA_LTO=ONSupport for Intel MKL and Other BLAS/LAPACK ImplementationsPyArmadillo can optionally use the Intel Math Kernel Library (MKL) as high-speed replacement for standard BLAS and LAPACKIntel MKL should be automatically detected during installation from sourceFor other BLAS/LAPACK implementations, minor modifications to the built-in Armadillo sources may be required.
Specificallyext/armadillo/include/armadillo_bits/config.hppmay 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_LONGSee theArmadillosite for more information:http://arma.sourceforge.net/faq.htmlhttp://arma.sourceforge.net/docs.html#config_hppOn Linux-based systems, MKL might be installed in a non-standard location such as/optwhich 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_PATHenvironment 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.ddirectory.
For example,/etc/ld.so.conf.d/mkl.conf.
If/etc/ld.so.confis modified or/etc/ld.so.conf.d/mkl.confis created,/sbin/ldconfigmust be run afterwards.Below is an example of/etc/ld.so.conf.d/mkl.confwhere Intel MKL is installed in/opt/intel/opt/intel/lib/intel64  
  /opt/intel/mkl/lib/intel64If MKL is installed and it is persistently giving problems during linking,
support for MKL can be disabled by editingext/armadillo/CMakeLists.txtand commenting out the line containingINCLUDE(ARMA_FindMKL),
then deletingext/armadillo/CMakeCache.txt,
and finally re-running PyArmadillo installation.6: Distribution LicensePyArmadillo 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 QuestionsIf you find a bug in the library or the documentation, we are interested in hearing about it.
Please make asmallandself-containedprogram 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.htmlFurther information about PyArmadillo is on the frequently asked questions page:https://pyarma.sourceforge.io/faq.html