Hey, >> Similar to the last fix you proposed in the follow-up email, what about >> checking norm_frobenius(W) and norm_frobenius(H) to be positive and to >> reinitialize them with all ones if not? This would fix the generic use case: >> matrix<T> W(N, K); >> matrix<T> H(K, M); >> nmf(A, W, H, conf); > > In the end, I did exactly what you've described here :)
Cheers. One minor hint for ultimate code quality: if (a == 0.0) will lead to a conversion warning as well as a warning on equality-comparisons of floating point numbers when passing -Wconversion to Clang (and probably GCC and Visual Studio with appropriate flags). The fix in this case is to use if (a <= 0) or if (!a) which silences these. There are probably a few more such things in the code and will be eliminated once towards each release, but it's good to be aware of it :-) > Off-topic: I'm also getting compilation errors with the new pipelined > bicgstab. I needed to include viennacl/traits/context.hpp in > viennacl/linalg/bicgstab.hpp, but I also get the following. I don't know > if I've messed something up, or whether something is missing: > > In file included from src/_viennacl/iterative_solvers.hpp:4:0, > from src/_viennacl/iterative_solvers.cpp:1: > external/viennacl-dev/viennacl/linalg/bicgstab.hpp: In function > ‘viennacl::vector<ScalarType> viennacl::linalg::solve(const MatrixType&, > const viennacl::vector<ScalarType>&, const viennacl::linalg::bicgstab_tag&, > viennacl::linalg::no_precond)’: > external/viennacl-dev/viennacl/linalg/bicgstab.hpp:133:9: error: > ‘pipelined_bicgstab_prod’ is not a member of ‘viennacl::linalg’ > viennacl::linalg::pipelined_bicgstab_prod(A, p, Ap, r0star, > ^ > In file included from src/_viennacl/iterative_solvers.hpp:4:0, > from src/_viennacl/iterative_solvers.cpp:1: > external/viennacl-dev/viennacl/linalg/bicgstab.hpp:153:9: error: > ‘pipelined_bicgstab_update_s’ is not a member of ‘viennacl::linalg’ > viennacl::linalg::pipelined_bicgstab_update_s(s, residual, Ap, > ^ > external/viennacl-dev/viennacl/linalg/bicgstab.hpp:160:9: error: > ‘pipelined_bicgstab_prod’ is not a member of ‘viennacl::linalg’ > viennacl::linalg::pipelined_bicgstab_prod(A, s, As, r0star, > ^ > external/viennacl-dev/viennacl/linalg/bicgstab.hpp:167:21: error: > ‘accumulate’ is not a member of ‘std’ > r_dot_r0 = std::accumulate(host_inner_prod_buffer.begin(), > host_inner_prod_buffer.begin() + > buffer_size_per_vector, ScalarType(0)); > ^ > In file included from src/_viennacl/iterative_solvers.hpp:4:0, > from src/_viennacl/iterative_solvers.cpp:1: > external/viennacl-dev/viennacl/linalg/bicgstab.hpp:168:21: error: > ‘accumulate’ is not a member of ‘std’ > As_dot_As = std::accumulate(host_inner_prod_buffer.begin() + > buffer_size_per_vector, host_inner_prod_buffer.begin() + 2 * > buffer_size_per_vector, ScalarType(0)); > ^ > external/viennacl-dev/viennacl/linalg/bicgstab.hpp:169:20: error: > ‘accumulate’ is not a member of ‘std’ > As_dot_s = std::accumulate(host_inner_prod_buffer.begin() + 2 * > buffer_size_per_vector, host_inner_prod_buffer.begin() + 3 * > buffer_size_per_vector, ScalarType(0)); > ^ > external/viennacl-dev/viennacl/linalg/bicgstab.hpp:170:21: error: > ‘accumulate’ is not a member of ‘std’ > Ap_dot_r0 = std::accumulate(host_inner_prod_buffer.begin() + 3 * > buffer_size_per_vector, host_inner_prod_buffer.begin() + 4 * > buffer_size_per_vector, ScalarType(0)); > ^ > external/viennacl-dev/viennacl/linalg/bicgstab.hpp:171:21: error: > ‘accumulate’ is not a member of ‘std’ > As_dot_r0 = std::accumulate(host_inner_prod_buffer.begin() + 4 * > buffer_size_per_vector, host_inner_prod_buffer.begin() + 5 * > buffer_size_per_vector, ScalarType(0)); > ^ > external/viennacl-dev/viennacl/linalg/bicgstab.hpp:172:20: error: > ‘accumulate’ is not a member of ‘std’ > s_dot_s = std::accumulate(host_inner_prod_buffer.begin() + 5 * > buffer_size_per_vector, host_inner_prod_buffer.begin() + 6 * > buffer_size_per_vector, ScalarType(0)); > ^ > external/viennacl-dev/viennacl/linalg/bicgstab.hpp:186:10: error: > ‘pipelined_bicgstab_vector_update’ is not a member of ‘viennacl::linalg’ > viennacl::linalg::pipelined_bicgstab_vector_update(result, alpha, > p, omega, s, > ^ Thanks, this is now fixed. Sorry, it was a hidden include dependency... Best regards, Karli ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ ViennaCL-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/viennacl-devel
