#include <iostream>
#include "xtensor/xarray.hpp"
#include "xtensor-blas/xlinalg.hpp"
using xt::xarray;
using xt::xtensor;
int main() {
xarray<int> A = {1, 2, 3};
xarray<int> B = {3, 4, 5};
auto C = xt::linalg::dot(A, B);
std::cout << C;
}
and it compiles and runs easily with:
g++ -o main main.cpp -lopenblas -llapack
But when I try to use double instead of int and compile with same command I get linker error
undefined reference to "cblas_sgemv"
However, I found that this code will link with cblas library.
g++ -o main main.cpp -lcblas -llapack
EDIT:
Problem solved after recompiling OpenBLAS library. Also lapack linking is not necessary.
Sorry for useless issue.
Here's simple code:
and it compiles and runs easily with:
But when I try to use
double
instead ofint
and compile with same command I get linker errorHowever, I found that this code will link with cblas library.
EDIT: Problem solved after recompiling OpenBLAS library. Also lapack linking is not necessary. Sorry for useless issue.