أرمديلو (مكتبة سي++)

هذه المقالة يتيمة. ساعد بإضافة وصلة إليها في مقالة متعلقة بها
من ويكيبيديا، الموسوعة الحرة

أرمديلو (بالإنجليزية: Armadillo)‏ هي مكتبة برمجية ذات مصدر مفتوح تستعمل مع لغة سي++ للحسابات المتعلقة بالجبر الخطي.[4]

الاستعمال[عدل]

مثال في C++ 11[عدل]

مثال بسيط يشرح استعمال المكتبة :

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

#include <iostream>
#include <armadillo>
#include <cmath>

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 = RotM*Pos;

  Pos.print("New position of the particle:");   //    ^
                                                //    x (1,0)
                                                //    | 
                                                //    +------>

  return 0;
}

مثال في C++ 98[عدل]

مثال آخر بلغة C++ 98:

#include <iostream>
#include <armadillo>

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:\n";
  std::cout << arma::solve(A,b) << '\n';

  return 0;
}

المراجع[عدل]

  1. ^ وصلة مرجع: http://arma.sourceforge.net/. الوصول: 28 مارس 2017.
  2. ^ أ ب ت وصلة مرجع: http://arma.sourceforge.net/download.html. الوصول: 28 مارس 2017.
  3. ^ وصلة مرجع: http://arma.sourceforge.net/license.html. الوصول: 28 مارس 2017.
  4. ^ Conrad Sanderson and Ryan Curtin (2016). "Armadillo: a template-based C++ library for linear algebra". Journal of Open Source Software. ج. 1 ع. 2: 26. Bibcode:2016JOSS....1...26S. DOI:10.21105/joss.00026. hdl:10072/387317.

روابط خارجية[عدل]