/** @brief Constructs a tensor using a \c vector * * @note It is assumed that vector is column vector * @note Initially the tensor will be one-dimensional. * * @param v vector to be copied. */ BOOST_UBLAS_INLINE tensor (const vector_type &v) : tensor_expression_type<self_type>() , extents_ () , strides_ () , data_ (v.data()) { if(!data_.empty()){ extents_ = extents_type{data_.size(),1}; strides_ = strides_type(extents_); } }
void dump_as_list(const int fd) final { osmium::io::detail::reliable_write(fd, reinterpret_cast<const char*>(m_vector.data()), byte_size()); }
static pointer storage (vector_type& vr) { pointer ptr = vector_traits<v_type>::storage (vr.data()); ptr += vr.start() * vector_traits<v_type>::stride (vr.data()); return ptr; }
static int stride (vector_type& vr) { return vector_traits<v_type>::stride (vr.data()); }
static pointer storage (vector_type& v) { typedef typename detail::generate_const<V,ArrT>::type array_type ; return vector_traits<array_type>::storage (v.data()); }
static pointer storage (vector_type& v) { return v.data(); }
static int stride (vector_type& vs) { return vs.stride() * vector_traits<v_type>::stride (vs.data()); }
static std::ptrdiff_t stride (vector_type& vr) { return vector_traits<v_type>::stride (vr.data()); }
static std::ptrdiff_t stride (vector_type& vs) { return vs.stride() * vector_traits<v_type>::stride (vs.data()); }