本文整理汇总了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_);
}
}
示例2: storage
static pointer storage (matrix_type& v) { return v.data(); }
示例3: lower_bandwidth
static int lower_bandwidth(matrix_type& hm) {
return detail::matrix_bandwidth( hm.data(), uplo_type() );
}
示例4: leading_dimension
static int leading_dimension (matrix_type& hm) {
return matrix_traits<m_type>::leading_dimension (hm.data());
}
示例5: storage
static pointer storage (matrix_type& hm) {
return matrix_traits<m_type>::storage (hm.data());
}
示例6:
static std::ptrdiff_t leading_dimension (matrix_type& sm) {
return matrix_traits<m_type>::leading_dimension (sm.data());
}
示例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);
}
}
}
}