-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I tried to modify the linear example test to have b as a uniform variable. Declaring Uniform<vec> b; on line 16, and then updating as b.dunif(-10, 10); on line 39, I get compile time errors:
$ make linear.model.test g++ -I.. -Wall -O2 -llapack -larmadillo linear.model.test.cpp -o linear.model.test In file included from ../cppbugs/cppbugs.hpp:27:0, from linear.model.test.cpp:4: ../cppbugs/mcmc.model.hpp: In member function 'void cppbugs::MCModel::sample(int, int, int, int)': ../cppbugs/mcmc.model.hpp:137:14: warning: unused variable 'ideal_scale' [-Wunused-variable] dune:test yasir$ vi linear.model.test.cpp dune:test yasir$ make linear.model.test g++ -I.. -Wall -O2 -llapack -larmadillo linear.model.test.cpp -o linear.model.test In file included from ../cppbugs/cppbugs.hpp:27:0, from linear.model.test.cpp:4: ../cppbugs/mcmc.model.hpp: In member function 'void cppbugs::MCModel::sample(int, int, int, int)': ../cppbugs/mcmc.model.hpp:137:14: warning: unused variable 'ideal_scale' [-Wunused-variable] In file included from ../cppbugs/cppbugs.hpp:23:0, from linear.model.test.cpp:4: ../cppbugs/mcmc.uniform.hpp: In member function 'void cppbugs::Uniform<T>::dunif(double, double) [with T = arma::Col<double>]': linear.model.test.cpp:39:20: instantiated from here ../cppbugs/mcmc.uniform.hpp:33:7: error: no match for 'operator||' in 'arma::operator<(const arma::Base<typename arma::arma_not_cx<typename T1::elem_type>::result, T1>&, typename arma::arma_not_cx<typename T1::elem_type>::result) [with T1 = arma::Mat<double>, typename arma::arma_not_cx<typename T1::elem_type>::result = double](lower) || arma::operator>(const arma::Base<typename arma::arma_not_cx<typename T1::elem_type>::result, T1>&, typename arma::arma_not_cx<typename T1::elem_type>::result) [with T1 = arma::Mat<double>, typename arma::arma_not_cx<typename T1::elem_type>::result = double](upper)' ../cppbugs/mcmc.uniform.hpp:33:7: note: candidate is: ../cppbugs/mcmc.uniform.hpp:33:7: note: operator||(bool, bool) <built-in> ../cppbugs/mcmc.uniform.hpp:33:7: note: no known conversion for argument 2 from 'const arma::mtOp<unsigned int, arma::Mat<double>, arma::op_rel_gt_post>' to 'bool' make: *** [linear.model.test] Error 1
If, on the other hand I try to use vector limits as b.dunif(-10 * arma::ones<arma::vec>(X.n_cols), 10 * arma::ones<arma::vec>(X.n_cols));, it gives me the compile time errors:
$ make linear.model.test g++ -I.. -Wall -O2 -llapack -larmadillo linear.model.test.cpp -o linear.model.test In file included from ../cppbugs/cppbugs.hpp:27:0, from linear.model.test.cpp:4: ../cppbugs/mcmc.model.hpp: In member function 'void cppbugs::MCModel::sample(int, int, int, int)': ../cppbugs/mcmc.model.hpp:137:14: warning: unused variable 'ideal_scale' [-Wunused-variable] linear.model.test.cpp: In member function 'virtual void TestModel::update()': linear.model.test.cpp:39:88: error: no matching function for call to 'cppbugs::Uniform<arma::Col<double> >::dunif(const arma::eOp<arma::Gen<double, arma::gen_ones_full>, arma::eop_scalar_times>, const arma::eOp<arma::Gen<double, arma::gen_ones_full>, arma::eop_scalar_times>)' linear.model.test.cpp:39:88: note: candidate is: ../cppbugs/mcmc.uniform.hpp:32:10: note: void cppbugs::Uniform<T>::dunif(double, double) [with T = arma::Col<double>] ../cppbugs/mcmc.uniform.hpp:32:10: note: no known conversion for argument 1 from 'const arma::eOp<arma::Gen<double, arma::gen_ones_full>, arma::eop_scalar_times>' to 'double' make: *** [linear.model.test] Error 1