示例#1
0
文件: tensor.hpp 项目: boostorg/ublas
	/** @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_);
		}
	}
示例#2
0
 void dump_as_list(const int fd) final {
     osmium::io::detail::reliable_write(fd, reinterpret_cast<const char*>(m_vector.data()), byte_size());
 }
示例#3
0
 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; 
 }
示例#4
0
 static int stride (vector_type& vr) {
   return vector_traits<v_type>::stride (vr.data()); 
 }
示例#5
0
 static pointer storage (vector_type& v) {
   typedef typename detail::generate_const<V,ArrT>::type array_type ;
   return vector_traits<array_type>::storage (v.data()); 
 }
示例#6
0
 static pointer storage (vector_type& v) { return v.data(); }
示例#7
0
 static int stride (vector_type& vs) {
   return vs.stride() * vector_traits<v_type>::stride (vs.data()); 
 }
示例#8
0
 static std::ptrdiff_t stride (vector_type& vr) {
   return vector_traits<v_type>::stride (vr.data()); 
 }
示例#9
0
 static std::ptrdiff_t stride (vector_type& vs) {
   return vs.stride() * vector_traits<v_type>::stride (vs.data()); 
 }