请输入您要查询的百科知识:

 

词条 Armadillo (C++ library)
释义

  1. Example in C++ 11

  2. Example in C++ 98

  3. See also

  4. References

  5. External links

{{Infobox software
| name = Armadillo C++ Library
| logo =
| screenshot =
| caption =
| developer =
| latest release version = 9.200
| latest release date = {{Start date and age|2018|11|6}}[1]
| latest preview version = 9.300-RC1[1]
| latest preview date = {{Start date and age|2019|03|14}}[2]
| programming language = C++
| operating system = Cross-platform
| language = English
| genre = Software library
| license = Apache 2.0 (open source)
| website = {{URL|arma.sourceforge.net}}
}}

Armadillo is a linear algebra software library for the C++ programming language. It aims to provide 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. Dense and sparse matrices are supported[3]. Various matrix decompositions are provided through optional integration with Linear Algebra PACKage (LAPACK) and Automatically Tuned Linear Algebra Software (ATLAS) libraries.[4][5] High-performance BLAS/LAPACK replacement libraries such as OpenBLAS and Intel MKL 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 permissive Apache License, making it applicable for the development of both open source and proprietary software. The project is supported by the NICTA research centre in Australia.

Example in C++ 11

Here is a trivial example demonstrating Armadillo functionality:

// Compile with:

// $ g++ -std=c++11 main.cpp -o file_name -O2 -larmadillo

  1. include
  2. include
  3. include

int main()

{
                                                //    ^  // Position of a particle                     //    |  arma::vec Pos = {{0},                         //    | (0,1)                   {1}};                        //    +---x-->
  // Rotation matrix   double phi = -3.1416/2;   arma::mat RotM = {{+cos(phi), -sin(phi)},                    {+sin(phi), +cos(phi)}};
  Pos.print("Current position of the particle:");  std::cout << "Rotating the point " << phi*180/3.1416 << " deg" << std::endl;
  Pos.print("New position of the particle:");   //    ^                                                //    x (1,0)                                                //    |                                                 //    +------>

}

Example in C++ 98

Here is an other trivial example in C++ 98:

  1. include
  2. include

int main()

{
  arma::vec b;  b << 2.0 << 5.0 << 2.0;
  // arma::endr represents the end of a row in a matrix  arma::mat A;  A << 1.0 << 2.0 << arma::endr

<< 2.0 << 3.0 << arma::endr

<< 1.0 << 3.0 << arma::endr;

  std::cout << "Least squares solution:\";  std::cout << arma::solve(A,b) << '\';

}

See also

{{Portal|Free and open-source software}}
  • mlpack
  • List of numerical analysis software
  • List of numerical libraries
  • Numerical linear algebra
  • Scientific computing

References

1. ^{{cite web|url=https://sourceforge.net/p/arma/news/|title=Armadillo C++ matrix library / News: Recent posts|accessdate=14 November 2018|via=SourceForge}}
2. ^{{cite web|url=https://sourceforge.net/p/arma/news/2019/03/armadillo-c-linear-algebra-version-9300-rc1-release-candidate-1/|title=Armadillo C++ linear algebra: version 9.300-RC1 (Release Candidate 1)|date=14 March 2019|last=Sanderson|first=Conrad|accessdate=14 March 2019|via=SourceForge}}
3. ^{{cite conference |url=https://doi.org/10.1007/978-3-319-96418-8_50 |title=A User-Friendly Hybrid Sparse Matrix Class in C++ |author=Conrad Sanderson and Ryan Curtin |conference=Lecture Notes in Computer Science (LNCS), Vol. 10931, pp. 422-430 |year=2018}}
4. ^{{cite journal |title=Armadillo: a template-based C++ library for linear algebra |author=Conrad Sanderson and Ryan Curtin|journal=Journal of Open Source Software |volume=1 |pages=26 |year=2016}}
5. ^{{cite journal |url=http://jmlr.org/papers/v14/curtin13a.html |title=MLPACK: A Scalable C++ Machine Learning Library |author=Ryan Curtin |journal=Journal of Machine Learning Research (JMLR) |volume=14 |issue=Mar |pages= 801–805 |year=2013 |display-authors=etal}}

External links

  • {{Official website}}
{{DEFAULTSORT:Armadillo (C++ library)}}

9 : Articles with example C++ code|C++ numerical libraries|Free computer libraries|Free mathematics software|Free science software|Free software programmed in C++|Free statistical software|Numerical linear algebra|Software using the Apache license

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/16 18:18:49