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


C++ outArg函数代码示例

本文整理汇总了C++中outArg函数的典型用法代码示例。如果您正苦于以下问题:C++ outArg函数的具体用法?C++ outArg怎么用?C++ outArg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: assembleIRKState

void assembleIRKState(
  const int stageIndex,
  const Teuchos::SerialDenseMatrix<int,Scalar> &A_in,
  const Scalar dt,
  const Thyra::VectorBase<Scalar> &x_base,
  const Thyra::ProductVectorBase<Scalar> &x_stage_bar,
  Teuchos::Ptr<Thyra::VectorBase<Scalar> > x_out_ptr
  )
{

  typedef ScalarTraits<Scalar> ST;

  const int numStages_in = A_in.numRows();
  TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE( stageIndex, 0, numStages_in );
  TEUCHOS_ASSERT_EQUALITY( A_in.numRows(), numStages_in );
  TEUCHOS_ASSERT_EQUALITY( A_in.numCols(), numStages_in );
  TEUCHOS_ASSERT_EQUALITY( x_stage_bar.productSpace()->numBlocks(), numStages_in );
  Thyra::VectorBase<Scalar>& x_out = *x_out_ptr;

  V_V( outArg(x_out), x_base );
  for ( int j = 0; j < numStages_in; ++j ) {
    Vp_StV( outArg(x_out), dt * A_in(stageIndex,j), *x_stage_bar.getVectorBlock(j) );
  }

}
开发者ID:00liujj,项目名称:trilinos,代码行数:25,代码来源:Rythmos_RKButcherTableauHelpers.hpp

示例2: coef_dict_add_term

RCP<const Basic> Add::subs(const map_basic_basic &subs_dict) const
{
    RCP<const Add> self = rcp_from_this_cast<const Add>();
    auto it = subs_dict.find(self);
    if (it != subs_dict.end())
        return it->second;

    SymEngine::umap_basic_num d;
    RCP<const Number> coef;

    it = subs_dict.find(coef_);
    if (it != subs_dict.end()) {
        coef = zero;
        coef_dict_add_term(outArg(coef), d, one, it->second);
    } else {
        coef = coef_;
    }

    for (const auto &p: dict_) {
        auto it = subs_dict.find(Add::from_dict(zero, {{p.first, p.second}}));
        if (it != subs_dict.end()) {
            coef_dict_add_term(outArg(coef), d, one, it->second);
        } else {
            it = subs_dict.find(p.second);
            if (it != subs_dict.end()) {
                coef_dict_add_term(outArg(coef), d, one, mul(it->second, p.first->subs(subs_dict)));
            } else {
                coef_dict_add_term(outArg(coef), d, p.second, p.first->subs(subs_dict));
            }
        }
    }

    return Add::from_dict(coef, std::move(d));
}
开发者ID:achabill,项目名称:symengine,代码行数:34,代码来源:add.cpp

示例3: if

RCP<const Basic> Add::subs(const map_basic_basic &subs_dict) const
{
    RCP<const Add> self = rcp_const_cast<Add>(rcp(this));
    auto it = subs_dict.find(self);
    if (it != subs_dict.end())
        return it->second;

    CSymPy::umap_basic_num d;
    RCP<const Number> coef=coef_, coef2;
    RCP<const Basic> t;
    for (auto &p: dict_) {
        RCP<const Basic> term = p.first->subs(subs_dict);
        if (term == p.first) {
            Add::dict_add_term(d, p.second, p.first);
        } else if (is_a<Integer>(*term) &&
                rcp_static_cast<const Integer>(term)->is_zero()) {
            continue;
        } else if (is_a_Number(*term)) {
            iaddnum(outArg(coef),
                    mulnum(p.second, rcp_static_cast<const Number>(term)));
        } else if (is_a<Add>(*term)) {
            for (auto &q: (rcp_static_cast<const Add>(term))->dict_)
                Add::dict_add_term(d, q.second, q.first);
            iaddnum(outArg(coef), rcp_static_cast<const Add>(term)->coef_);
        } else {
            Add::as_coef_term(mul(p.second, term), outArg(coef2), outArg(t));
            Add::dict_add_term(d, coef2, t);
        }
    }
    return Add::from_dict(coef, std::move(d));
}
开发者ID:MridulS,项目名称:csympy,代码行数:31,代码来源:add.cpp

示例4: log

RCP<const Basic> log(const RCP<const Basic> &arg)
{
    if (eq(*arg, *zero)) {
        throw NotImplementedError(
            "log(0) is complex infinity. Yet to be implemented");
    }
    if (eq(*arg, *one))
        return zero;
    if (eq(*arg, *E))
        return one;
    if (is_a_Number(*arg)) {
        RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
        if (not _arg->is_exact()) {
            return _arg->get_eval().log(*_arg);
        } else if (_arg->is_negative()) {
            throw NotImplementedError(
                "Imaginary Result. Yet to be implemented");
        }
    }
    if (is_a<Rational>(*arg)) {
        RCP<const Integer> num, den;
        get_num_den(static_cast<const Rational &>(*arg), outArg(num),
                    outArg(den));
        return sub(log(num), log(den));
    }
    return make_rcp<const Log>(arg);
}
开发者ID:rajithv,项目名称:symengine,代码行数:27,代码来源:pow.cpp

示例5: pow

RCP<const Basic> Mul::power_all_terms(const RCP<const Basic> &exp) const
{
    CSymPy::map_basic_basic d;
    RCP<const Basic> new_coef = pow(coef_, exp);
    RCP<const Number> coef_num = one;
    RCP<const Basic> new_exp;
    for (auto &p: dict_) {
        new_exp = mul(p.second, exp);
        if (is_a_Number(*new_exp)) {
            // No need for additional dict checks here.
            // The dict should be of standard form before this is
            // called.
            if (rcp_static_cast<const Number>(new_exp)->is_zero()) {
                continue;
            } else {
                Mul::dict_add_term_new(outArg(coef_num), d, new_exp, p.first);
            }
        } else {
            Mul::dict_add_term_new(outArg(coef_num), d, new_exp, p.first);
        }
    }
    if (is_a_Number(*new_coef)) {
        imulnum(outArg(coef_num), rcp_static_cast<const Number>(new_coef));
        return Mul::from_dict(coef_num, std::move(d));
    } else {
        // TODO: this can be made faster probably:
        return mul(mul(new_coef, coef_num), Mul::from_dict(one, std::move(d)));
    }
}
开发者ID:MridulS,项目名称:csympy,代码行数:29,代码来源:mul.cpp

示例6: mul_expand

RCP<const Basic> mul_expand(const RCP<const Mul> &self)
{
    RCP<const Basic> a, b;
    self->as_two_terms(outArg(a), outArg(b));
    a = expand(a);
    b = expand(b);
    return mul_expand_two(a, b);
}
开发者ID:MridulS,项目名称:csympy,代码行数:8,代码来源:mul.cpp

示例7: get_pi_shift

bool Cos::is_canonical(const RCP<const Basic> &arg)
{
    // e.g. cos(0)
    if (is_a<Integer>(*arg) &&
            rcp_static_cast<const Integer>(arg)->is_zero())
        return false;
    // e.g cos(k*pi/12)
    RCP<const Integer> n;
    RCP<const Basic> r;
    bool b = get_pi_shift(arg, outArg(n), outArg(r));
    if (b)
        return false;
    return true;
}
开发者ID:MechCoder,项目名称:csympy,代码行数:14,代码来源:functions.cpp

示例8: norm

double 
NOX::Thyra::Vector::
norm(const NOX::Abstract::Vector& weights) const
{
  const NOX::Thyra::Vector& w = 
    dynamic_cast<const NOX::Thyra::Vector&>(weights);

  if (nonnull(weightVec_) && do_implicit_weighting_) {
    ::Thyra::copy(*thyraVec, outArg(*tmpVec_));
    ::Thyra::ele_wise_scale(*weightVec_, outArg(*tmpVec_));
    return ::Thyra::norm_2(*w.thyraVec, *tmpVec_);
  }

  return ::Thyra::norm_2(*w.thyraVec, *thyraVec);
}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:15,代码来源:NOX_Thyra_Vector.C

示例9: while

GaloisFieldDict GaloisFieldDict::gf_gcd(const GaloisFieldDict &o) const
{
    if (modulo_ != o.modulo_)
        throw std::runtime_error("Error: field must be same.");
    GaloisFieldDict f = static_cast<GaloisFieldDict>(*this);
    GaloisFieldDict g = o;
    GaloisFieldDict temp_out;
    while (not g.dict_.empty()) {
        f.gf_div(g, outArg(temp_out), outArg(f)); // f, g = f % g, g
        f.dict_.swap(g.dict_);
    }
    integer_class temp_LC;
    f.gf_monic(temp_LC, outArg(f));
    return f;
}
开发者ID:hari-sikchi,项目名称:symengine,代码行数:15,代码来源:fields.cpp

示例10: sin

RCP<const Basic> sin(const RCP<const Basic> &arg)
{
    if (eq(arg, zero)) return zero;
    RCP<const Basic> ret_arg;
    int index;
    int sign;
    bool conjugate =  eval(arg, 2, 1, 0, //input
                      outArg(ret_arg), index, sign); //output

    if (conjugate) {
        // cos has to be returned
        if (sign == 1)
            return rcp(new Cos(ret_arg));
        else
            return mul(minus_one, rcp(new Cos(ret_arg)));
    }
    else {
        if (eq(ret_arg, zero)) {
            return mul(integer(sign), sin_table[index]);
        }
        else {
            if (sign == 1)
                return rcp(new Sin(ret_arg));
            else
                return mul(minus_one, rcp(new Sin(ret_arg)));
        }
    }
}
开发者ID:MechCoder,项目名称:csympy,代码行数:28,代码来源:functions.cpp

示例11: init

NOX::Abstract::Vector& 
NOX::Thyra::Vector::
init(double value)
{
  ::Thyra::put_scalar(value, outArg(*thyraVec));
  return *this;
}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:7,代码来源:NOX_Thyra_Vector.C

示例12: insert

// Mul (t^exp) to the dict "d"
void Mul::dict_add_term(map_basic_basic &d, const RCP<const Basic> &exp,
        const RCP<const Basic> &t)
{
    auto it = d.find(t);
    if (it == d.end()) {
        insert(d, t, exp);
    } else {
        // Very common case, needs to be fast:
        if (is_a_Number(*it->second) && is_a_Number(*exp)) {
            RCP<const Number> tmp = rcp_static_cast<const Number>(it->second);
            iaddnum(outArg(tmp), rcp_static_cast<const Number>(exp));
            if (tmp->is_zero()) {
                d.erase(it);
            } else {
                it->second = tmp;
            }
        } else {
            // General case:
            it->second = add(it->second, exp);
            if (is_a<Integer>(*it->second) &&
                    rcp_static_cast<const Integer>(it->second)->is_zero()) {
                d.erase(it);
            }
        }
    }
}
开发者ID:MridulS,项目名称:csympy,代码行数:27,代码来源:mul.cpp

示例13: scale

NOX::Abstract::Vector& 
NOX::Thyra::Vector::
scale(double alpha)
{
  ::Thyra::scale(alpha, outArg(*thyraVec));
  return *this;
}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:7,代码来源:NOX_Thyra_Vector.C

示例14: sec

RCP<const Basic> sec(const RCP<const Basic> &arg)
{
    RCP<const Basic> ret_arg;
    int index;
    int sign;
    bool conjugate =  eval(arg, 2, 0, 1, //input
                      outArg(ret_arg), index, sign); //output

    if (conjugate) {
        // cos has to be returned
        if (sign == 1)
            return rcp(new Csc(ret_arg));
        else
            return mul(minus_one, rcp(new Csc(ret_arg)));
    }
    else {
        if (eq(ret_arg, zero)) {
            return mul(integer(sign),
                   div(one, sin_table[(index + 6)% 24]));
        }
        else {
            if (sign == 1)
                return rcp(new Sec(ret_arg));
            else
                return mul(minus_one, rcp(new Sec(ret_arg)));
        }
    }
}
开发者ID:MechCoder,项目名称:csympy,代码行数:28,代码来源:functions.cpp

示例15: bvisit

    void bvisit(const Pow &x)
    {

        RCP<const Basic> base_, exp_, num, den;
        base_ = x.get_base();
        exp_ = x.get_exp();
        as_numer_denom(base_, outArg(num), outArg(den));

        // if the exp is a negative numer, or is intuitively 'negative'
        if (handle_minus(exp_, outArg(exp_))) {
            *numer_ = pow(den, exp_);
            *denom_ = pow(num, exp_);
        } else {
            *numer_ = pow(num, exp_);
            *denom_ = pow(den, exp_);
        }
    }
开发者ID:isuruf,项目名称:symengine,代码行数:17,代码来源:numer_denom.cpp


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