当前位置:网站首页>Armadillo installation

Armadillo installation

2022-06-22 06:21:00 High hall mirror sad white hair

Armadillo Is a library of matrix operations

Armadillo install

Download address
http://arma.sourceforge.net/download.html

Unzip it to an appropriate location

cmake introduce

Reference documents

https://cmake.org/cmake/help/latest/module/FindArmadillo.html

cmake_minimum_required(VERSION 3.21)
project(test_0_1)

set(CMAKE_CXX_STANDARD 17)

set(ARMADILLO_INCLUDE_DIR "D:/ProgramData/armadillo-11.0.0/include")
set(ARMADILLO_LIBRARIES "D:/ProgramData/armadillo-11.0.0/examples/lib_win64")

include_directories(${ARMADILLO_INCLUDE_DIR})

add_executable(${PROJECT_NAME} main.cpp)

Run the example

CMakeList.txt File as above ,
Program files :

#include <iostream>
#include <armadillo>

int main()
{
    
    arma::mat A = arma::randu<arma::mat>(4, 5) * 10;
    arma::mat B = arma::randu<arma::mat>(4, 5) * 10;
    arma::mat C = A % B;
    A.print("A = \n");
    B.print("B = \n");
    C.print("A .* B = \n");
    system("pause");
    return 0;
}
原网站

版权声明
本文为[High hall mirror sad white hair]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206220620596419.html