Hi, I am coming back to ViennaCL now that the Chow-Patel algorithm is implemented.
But I still have no luck even with very simple matrices and basic algorithms (Linux CentOS 7, ViennaCL 1.7.0). I am trying so solve A.x = y with A = 2 I, and y = (1.0, …, 1.0) whose obvious solution is x = (0.5, …, 0.5). The code given in this email, compiled with g++ -std=c++11 main.cpp -o main gives me the following result: n: 1 0 nan 0 nan n: 3 0 0.5 2 0.5 n: 5 0 0.5 4 0.5 n: 10 0 0.5 9 0.5 n: 20 0 0.5 19 0.5 n: 30 0 nan 29 nan n: 100 0 nan 99 nan which means that it works for n = 3, n = 5, n = 10, n = 20 but does not work for n = 1, n = 30, n = 100. I am completely lost with this library. Is there anything that I am doing wrong? Does anyone get the same results on his computer ? François Fayard Founder & Consultant - Inside Loop Tel: +33 (0)6 01 44 06 93 <tel:+33%206%2001%2044%2006%2093> Web: www.insideloop.io <http://www.insideloop.io/> Twitter: @insideloop_io #include <iostream> #define VIENNACL_WITH_OPENMP #include <viennacl/scalar.hpp> #include <viennacl/vector.hpp> #include <viennacl/matrix.hpp> #include <viennacl/linalg/bicgstab.hpp> int main(int argc, const char *argv[]) { typedef double ScalarType; auto side = std::vector<std::size_t>{1, 3, 5, 10, 20, 30, 100}; for (auto n : side) { std::cout << "n: " << n << std::endl; auto vcl_matrix = viennacl::matrix<ScalarType>(n, n); for (auto k = std::size_t{0}; k < n; ++k) { vcl_matrix(k, k) = 2.0; } auto vcl_rhs = viennacl::vector<ScalarType>(n); for (std::size_t k = 0; k < n; ++k) { vcl_rhs[k] = 1.0; } auto vcl_result = viennacl::vector<ScalarType>(viennacl::linalg::solve( vcl_matrix, vcl_rhs, viennacl::linalg::bicgstab_tag())); std::cout << 0 << " " << vcl_result[0] << std::endl; std::cout << n - 1 << " " << vcl_result[n - 1] << std::endl; std::cout << std::endl; } return 0; }
------------------------------------------------------------------------------
_______________________________________________ ViennaCL-support mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/viennacl-support
