本文整理汇总了C++中statement::array方法的典型用法代码示例。如果您正苦于以下问题:C++ statement::array方法的具体用法?C++ statement::array怎么用?C++ statement::array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类statement
的用法示例。
在下文中一共展示了statement::array方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute_matrix_col_inplace_sub_matrix
/** @brief Deals with A -= B for a matrix B */
inline void execute_matrix_col_inplace_sub_matrix(statement const & s)
{
typedef statement::container_type StatementContainer;
StatementContainer const & expr = s.array();
if (expr[0].lhs_type_ == MATRIX_COL_FLOAT_TYPE && expr[0].rhs_type_ == MATRIX_COL_FLOAT_TYPE)
{
viennacl::matrix_base<float, viennacl::column_major> & A = *(expr[0].lhs_.matrix_col_float_);
viennacl::matrix_base<float, viennacl::column_major> const & B = *(expr[0].rhs_.matrix_col_float_);
viennacl::linalg::ambm(A,
A, 1.0, 1, false, false,
B, -1.0, 1, false, false);
}
else if (expr[0].lhs_type_ == MATRIX_COL_DOUBLE_TYPE && expr[0].rhs_type_ == MATRIX_COL_DOUBLE_TYPE)
{
viennacl::matrix_base<double, viennacl::column_major> & A = *(expr[0].lhs_.matrix_col_double_);
viennacl::matrix_base<double, viennacl::column_major> const & B = *(expr[0].rhs_.matrix_col_double_);
viennacl::linalg::ambm(A,
A, 1.0, 1, false, false,
B, -1.0, 1, false, false);
}
else
throw "not yet supported!";
}
示例2: execute_vector_inplace_sub_vector
/** @brief Deals with x = y for a vector y */
void execute_vector_inplace_sub_vector(statement const & s)
{
typedef typename statement::container_type StatementContainer;
StatementContainer const & expr = s.array();
if (expr[0].lhs_type_ == VECTOR_FLOAT_TYPE && expr[0].rhs_type_ == VECTOR_FLOAT_TYPE)
{
viennacl::vector_base<float> & x = *(expr[0].lhs_.vector_float_);
viennacl::vector_base<float> const & y = *(expr[0].rhs_.vector_float_);
viennacl::linalg::avbv(x,
x, 1.0, 1, false, false,
y, -1.0, 1, false, false);
}
else if (expr[0].lhs_type_ == VECTOR_DOUBLE_TYPE && expr[0].rhs_type_ == VECTOR_DOUBLE_TYPE)
{
viennacl::vector_base<double> & x = *(expr[0].lhs_.vector_double_);
viennacl::vector_base<double> const & y = *(expr[0].rhs_.vector_double_);
viennacl::linalg::avbv(x,
x, 1.0, 1, false, false,
y, -1.0, 1, false, false);
}
else
throw "not yet supported!";
}
示例3: execute_matrix_col_inplace_sub
/** @brief Generic dispatcher */
inline void execute_matrix_col_inplace_sub(statement const & s)
{
typedef statement::container_type StatementContainer;
StatementContainer const & expr = s.array();
switch (expr[0].rhs_type_family_)
{
case COMPOSITE_OPERATION_FAMILY:
execute_matrix_col_inplace_sub_composite(s);
break;
case MATRIX_COL_TYPE_FAMILY:
execute_matrix_col_inplace_sub_matrix(s);
break;
default:
throw "invalid rvalue in vector assignment";
}
}
示例4: execute_vector_assign
/** @brief Generic dispatcher */
void execute_vector_assign(statement const & s)
{
typedef typename statement::container_type StatementContainer;
StatementContainer const & expr = s.array();
switch (expr[0].rhs_type_family_)
{
case COMPOSITE_OPERATION_FAMILY:
execute_vector_assign_composite(s);
break;
case VECTOR_TYPE_FAMILY:
execute_vector_assign_vector(s);
break;
default:
throw "invalid rvalue in vector assignment";
}
}
示例5: execute_vector_assign_composite
/** @brief Deals with x = RHS where RHS is a vector expression */
void execute_vector_assign_composite(statement const & s)
{
typename statement::container_type const & expr = s.array();
if (expr[1].op_type_ == OPERATION_BINARY_ADD_TYPE)
{
if (expr[0].lhs_type_ == VECTOR_FLOAT_TYPE
&& expr[1].lhs_type_ == VECTOR_FLOAT_TYPE
&& expr[1].rhs_type_ == VECTOR_FLOAT_TYPE)
{
viennacl::vector_base<float> & x = *(expr[0].lhs_.vector_float_);
viennacl::vector_base<float> const & y = *(expr[1].lhs_.vector_float_);
viennacl::vector_base<float> const & z = *(expr[1].rhs_.vector_float_);
viennacl::linalg::avbv(x,
y, 1.0, 1, false, false,
z, 1.0, 1, false, false);
}
else if (expr[0].lhs_type_ == VECTOR_DOUBLE_TYPE
&& expr[1].lhs_type_ == VECTOR_DOUBLE_TYPE
&& expr[1].rhs_type_ == VECTOR_DOUBLE_TYPE)
{
viennacl::vector_base<double> & x = *(expr[0].lhs_.vector_double_);
viennacl::vector_base<double> const & y = *(expr[1].lhs_.vector_double_);
viennacl::vector_base<double> const & z = *(expr[1].rhs_.vector_double_);
viennacl::linalg::avbv(x,
y, 1.0, 1, false, false,
z, 1.0, 1, false, false);
}
else
throw "TODO";
}
else if (expr[1].op_type_ == OPERATION_BINARY_SUB_TYPE)
{
if (expr[0].lhs_type_ == VECTOR_FLOAT_TYPE
&& expr[1].lhs_type_ == VECTOR_FLOAT_TYPE
&& expr[1].rhs_type_ == VECTOR_FLOAT_TYPE)
{
viennacl::vector_base<float> & x = *(expr[0].lhs_.vector_float_);
viennacl::vector_base<float> const & y = *(expr[1].lhs_.vector_float_);
viennacl::vector_base<float> const & z = *(expr[1].rhs_.vector_float_);
viennacl::linalg::avbv(x,
y, 1.0, 1, false, false,
z, -1.0, 1, false, false);
}
else if (expr[0].lhs_type_ == VECTOR_DOUBLE_TYPE
&& expr[1].lhs_type_ == VECTOR_DOUBLE_TYPE
&& expr[1].rhs_type_ == VECTOR_DOUBLE_TYPE)
{
viennacl::vector_base<double> & x = *(expr[0].lhs_.vector_double_);
viennacl::vector_base<double> const & y = *(expr[1].lhs_.vector_double_);
viennacl::vector_base<double> const & z = *(expr[1].rhs_.vector_double_);
viennacl::linalg::avbv(x,
y, 1.0, 1, false, false,
z, -1.0, 1, false, false);
}
else
throw "TODO";
}
else
throw "TODO";
}