当前位置: 首页>>代码示例>>C++>>正文


C++ matrix_type::data方法代码示例

本文整理汇总了C++中matrix_type::data方法的典型用法代码示例。如果您正苦于以下问题:C++ matrix_type::data方法的具体用法?C++ matrix_type::data怎么用?C++ matrix_type::data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matrix_type的用法示例。


在下文中一共展示了matrix_type::data方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

	/** @brief Constructs a tensor with a matrix
	 *
	 * \note Initially the tensor will be two-dimensional.
	 *
	 *  @param v matrix to be copied.
	 */
	BOOST_UBLAS_INLINE
	tensor (const matrix_type &v)
		: tensor_expression_type<self_type>()
		, extents_ ()
		, strides_ ()
		, data_    (v.data())
	{
		if(!data_.empty()){
			extents_ = extents_type{v.size1(),v.size2()};
			strides_ = strides_type(extents_);
		}
	}
开发者ID:boostorg,项目名称:ublas,代码行数:18,代码来源:tensor.hpp

示例2: storage

 static pointer storage (matrix_type& v) { return v.data(); }
开发者ID:cephdon,项目名称:OMCompiler,代码行数:1,代码来源:ublas_vector2.hpp

示例3: lower_bandwidth

 static int lower_bandwidth(matrix_type& hm) {
    return detail::matrix_bandwidth( hm.data(), uplo_type() );
 }
开发者ID:lainegates,项目名称:FreeCAD,代码行数:3,代码来源:ublas_hermitian.hpp

示例4: leading_dimension

 static int leading_dimension (matrix_type& hm) {
   return matrix_traits<m_type>::leading_dimension (hm.data()); 
 }
开发者ID:lainegates,项目名称:FreeCAD,代码行数:3,代码来源:ublas_hermitian.hpp

示例5: storage

 static pointer storage (matrix_type& hm) {
   return matrix_traits<m_type>::storage (hm.data());
 }
开发者ID:lainegates,项目名称:FreeCAD,代码行数:3,代码来源:ublas_hermitian.hpp

示例6:

 static std::ptrdiff_t leading_dimension (matrix_type& sm) {
   return matrix_traits<m_type>::leading_dimension (sm.data());
 }
开发者ID:cephdon,项目名称:OMCompiler,代码行数:3,代码来源:ublas_symmetric.hpp

示例7: operator

        void operator()(
            const state_type& x, matrix_type& jacobi, const double& t, state_type& dfdt) const
        {
            // fill 0 into jacobi and dfdt
            for (state_type::iterator i(dfdt.begin()); i != dfdt.end(); ++i)
            {
                *i = 0.0;
            }
            for (matrix_type::array_type::iterator i(jacobi.data().begin());
                i != jacobi.data().end(); ++i)
            {
                *i = 0.0;
            }

            // Calculate jacobian for each reaction and merge it.
            for (reaction_container_type::const_iterator
                i(reactions_.begin()); i != reactions_.end(); i++)
            {
                // Calculate a reaction's jacobian.
                // prepare state_array that contain amounts of reactants
                index_container_type::size_type reactants_size(i->reactants.size());
                index_container_type::size_type products_size(i->products.size());
                Ratelaw::state_container_type reactants_states(reactants_size);
                Ratelaw::state_container_type products_states(products_size);
                Ratelaw::state_container_type::size_type cnt(0);
                for (index_container_type::const_iterator
                    j((*i).reactants.begin()); j != (*i).reactants.end(); ++j, cnt++)
                {
                    reactants_states[cnt] = x[*j];
                }
                cnt = 0;
                for (index_container_type::const_iterator
                    j((*i).products.begin()); j != (*i).products.end(); ++j, cnt++)
                {
                    products_states[cnt] = x[*j];
                }
                // prepare matrix object that will be filled with numerical differentiate.
                matrix_type::size_type row_length = reactants_size + products_size;
                matrix_type::size_type col_length = row_length;
                matrix_type mat(row_length, col_length);

                // get the pointer of Ratelaw object and call it.
                if (i->ratelaw.expired() || i->ratelaw.lock()->is_available() == false)
                {
                    boost::scoped_ptr<Ratelaw> temporary_ratelaw_obj(new RatelawMassAction(i->k));
                    temporary_ratelaw_obj->jacobi_func(mat, reactants_states, products_states, volume_);
                }
                else
                {
                    boost::shared_ptr<Ratelaw> ratelaw = (*i).ratelaw.lock();
                    (*ratelaw).jacobi_func(mat, reactants_states, products_states, volume_);
                }

                //merge jacobian
                for(matrix_type::size_type row(0); row < row_length; row++)
                {
                    matrix_type::size_type j_row(row < reactants_size ? (*i).reactants[row] : (*i).products[row - reactants_size]);
                    for(matrix_type::size_type col(0); col < col_length; col++)
                    {
                        matrix_type::size_type j_col(col < reactants_size ? (*i).reactants[col] : (*i).products[col - reactants_size]);
                        jacobi(j_row, j_col) += mat(row, col);
                    }
                }
            }
        }
开发者ID:navoj,项目名称:ecell4,代码行数:65,代码来源:ODESimulator.hpp


注:本文中的matrix_type::data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。