Last active
April 19, 2017 20:01
-
-
Save DKrepsky/b2b461493839c4fa5162 to your computer and use it in GitHub Desktop.
Armadillo with lapack and blas on Qt (Ubuntu 14.10)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When trying to use armadillo with Qt in ubuntu, follow this steps: | |
1- Open synaptic. | |
2- Search for libarmadillo4 and libarmadillo-dev, if they are installed, mark for uninstall, apply. | |
3- Search for libblas3 and liblapack3 and mark both libs to reinstall (this will remove a version problem with armadillo), apply. | |
4- Mark for install liblapack-dev and libblas-dev, apply. | |
5- Install libarmadillo4 and libarmadillo-dev. | |
6- Open Qt (tested with version 5.4) and create a new console application. | |
7- In main.cpp, paste the following code: | |
#include <armadillo> | |
#include <iostream> | |
using namespace std; | |
using namespace arma; | |
int main() | |
{ | |
vec b; | |
b << 2.0 << 5.0 << 2.0; | |
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; | |
} | |
8- In the .pro file, add: LIBS += -llapack -lblas -larmadillo | |
9- Compile, run and test the application. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment