Armadillo (C++ library)
http://en.wikipedia.org/wiki/Armadillo_(C%2B%2B_library)
点击打开链接
From Wikipedia, the free encyclopedia
Armadillo C++ Library
Stable release 4.300 / May 2, 2014; 3 months ago
Written in C++
Operating system Cross-platform
Available in English
Type Software library
License open source (MPL)
Website arma.sourceforge.net
Armadillo is a linear algebra software library for the C++ programming language. It aims to provide an efficient and streamlined base calculations, while at the same time having a straightforward and easy to use interface. Its intended target users are scientists and engineers.
It supports integer, floating point (single and double precision), complex numbers, and a subset of trigonometric and statistics functions. Various matrix decompositions are provided through optional integration with Linear Algebra PACKage (LAPACK) and Automatically Tuned Linear Algebra Software (ATLAS) libraries.[1][2] High performance LAPACK replacement libraries such as Math Kernel Library (MKL) and AMD Core Math Library (ACML) can also be used.
The library employs a delayed evaluation approach (during compile time) to combine several operations into one and reduce (or eliminate) the need for temporaries. Where applicable, the order of operations is optimised. Delayed evaluation and optimisation are achieved through template metaprogramming.
Armadillo is related to the Boost Basic Linear Algebra Subprograms (uBLAS) library, which also uses template metaprogramming. However, Armadillo builds upon ATLAS and LAPACK libraries, thereby providing machine-dependent optimisations and functions not present in uBLAS.
It is open source software distributed under the Mozilla Public License, making it applicable for the development both open source and proprietary software. The project is supported by the NICTA research centre in Australia and is hosted by SourceForge.
Contents [hide]
1 Example
2 See also
3 References
4 External links
Example[edit]
Here is a trivial example demonstrating Armadillo functionality:
#include <iostream>
#include <armadillo>
using namespace std;
using namespace arma;
int main()
{
vec b;
b << 2.0 << 5.0 << 2.0;
// endr represents the end of a row
// in a matrix
mat A;
A << 1.0 << 2.0 << endr
<< 2.0 << 3.0 << endr
<< 1.0 << 3.0 << endr;
cout << "Least squares solution:" << endl;
cout << solve(A,b) << endl;
return 0;
}
See also[edit]
Portal icon Free software portal
MLPACK (C++ library)
Blitz++
IT++
Numerical linear algebra
List of numerical libraries
List of numerical analysis software
Scientific computing
References[edit]
Jump up ^ Sanderson, Conrad (September 2010). "Armadillo: An Open Source C++ Linear Algebra Library for Fast Prototyping and Computationally Intensive Experiments". Technical Report. NICTA.
Jump up ^ Ryan Curtin et al. (2013). "MLPACK: A Scalable C++ Machine Learning Library". Journal of Machine Learning Research (JMLR) 14 (Mar): 801–805.
External links[edit]
Official website
-
Armadillo is a C++ template library for linear algebra. It is built upon LAPACK and BLAS. It offers a simple API that is similar to that of Matlab.
1. Download the source code of Armadillo from here. Unzip the source code of Armadillo to a directory.
2. Create an environment variable named ARMADILLO_ROOT
with a value of the Armadillo directory.
3. Armadillo requires LAPACK and BLAS libraries for any non-trivial matrix operation. To enable it to use these libraries, open$(ARMADILLO_ROOT)/include/armadillo_bits/config.hpp
and uncomment the defines ofARMA_USE_LAPACK
and ARMA_USE_BLAS
.
4. To use Armadillo in your Visual C++ project, add $(ARMADILLO_ROOT)/include
as an Include directory.
5. Since Armadillo source code uses LAPACK and BLAS, your project needs to link with these libraries. Armadillo ships with pre-built 32-bit .lib
and .dll
files for LAPACK and BLAS. Add $(ARMADILLO_ROOT)/examples/lib_win32
as Library directory to your project. Add blas_win32_MT.lib
and lapack_win32_MT.lib
as additional dependencies to your project.
6. Include the armadillo
header file in your source code. Use the Armadillo classes and methods in your code. Remember to use the namespace arma::
Your code should compile to an EXE file without any further problems.
7. Copy the blas_win32_MT.dll
and lapack_win32_MT.dll
files from$(ARMADILLO_ROOT)/examples/lib_win32
to the directory that contains your EXE file. Your program should execute successfully now.
Tried with: Armadillo 3.920.2 and Visual Studio 2010
- http://choorucode.com/2013/11/15/how-to-use-armadillo-on-windows/
- Latest Files