Neal Becker
2009-01-29 14:38:35 UTC
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
namespace ublas=boost::numeric::ublas;
template<typename out_t, typename in_t>
inline out_t norm_2 (in_t const& in) {
return ublas::norm_2 (in);
}
int main () {
ublas::vector<double> x (10);
double y = norm_2 (x);
double z = norm_2 (project (x, ublas::slice (0, 3, 2)));
}
So, problem is not with calling norm_2 of a vector_slice.
#include <boost/numeric/ublas/vector_proxy.hpp>
namespace ublas=boost::numeric::ublas;
template<typename out_t, typename in_t>
inline out_t norm_2 (in_t const& in) {
return ublas::norm_2 (in);
}
int main () {
ublas::vector<double> x (10);
double y = norm_2 (x);
double z = norm_2 (project (x, ublas::slice (0, 3, 2)));
}
So, problem is not with calling norm_2 of a vector_slice.