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


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

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


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

示例1: operator

  void operator() (const state_type x, state_type& dxdt, double t) {

    // for input voltage, model a step function at time zero
    double Va = 0;
    if (t > 0.0) {
      Va = vin_;
    }
    Matrix<double, 1, 1> u; u << Va;

    // All other node voltages are determined by odeint through our equations:
    Map<const Matrix<double, 2, 1> > xvec(x.data());
    Map<Matrix<double, 2, 1> > result(dxdt.data());

    result = coeff_ * xvec + input_ * u;
  }
开发者ID:nicolati,项目名称:EDASkel,代码行数:15,代码来源:rlc_eigen_odeint.cpp

示例2: result

  // utility function for displaying data.  Applies internal matrices to state
  std::vector<double> state2output(state_type const& x) {
    std::vector<double> result(2);
    Map<const Matrix<double, states, 1> > xvec(x.data());

    Map<Matrix<double, 3, 1> > ovec(result.data());
    ovec = Lred_.transpose() * xvec;  // in theory the input could be involved via Dred_
    return result;
  }
开发者ID:jefftrull,项目名称:EDASkel,代码行数:9,代码来源:coupling_eigen_odeint.cpp

示例3: operator

  void operator() (const state_type x, state_type& dxdt, double t) {
    // determine input voltages
    double Vagg = (agg_slew_ < 0) ? v_ : 0;   // initial value
    if (agg_slew_ == 0) {
      Vagg = 0.0;                             // quiescent
    } else {
      // find the "real" ramp starting point, since we use the center of the swing
      double transition_time = ( v_ / fabs(agg_slew_) ) / 2.0;
      double real_start = agg_start_ - transition_time;
      double real_end = agg_start_ + transition_time;

      if (t >= real_end) {
        Vagg = (agg_slew_ < 0) ? 0 : v_;      // straight to final value
      } else if (t <= real_start) {
        Vagg = (agg_slew_ > 0) ? 0 : v_;      // remain at initial value
      } else {
        Vagg += agg_slew_ * (t - real_start);  // proportional to time in ramp
      }
    }
        
    // same for the victim driver
    double Vvic = (vic_slew_ < 0) ? v_ : 0;   // initial value
    if (vic_slew_ == 0) {
      Vvic = 0.0;
    } else {
      // find the "real" ramp starting point, since we use the center of the swing
      double transition_time = ( v_ / fabs(vic_slew_) ) / 2.0;
      double real_start = vic_start_ - transition_time;
      double real_end = vic_start_ + transition_time;
      if (t >= real_end) {
        Vvic = (vic_slew_ < 0) ? 0 : v_;      // straight to final value
      } else if (t <= real_start) {
        Vvic = (vic_slew_ > 0) ? 0 : v_;      // remain at initial value
      } else {
        Vvic += vic_slew_ * (t - real_start);  // proportional to time in ramp
      }
    }
        
    Map<const Matrix<double, states, 1> > xvec(x.data());  // turn state vector into Eigen matrix
    Matrix<double, 2, 1> u; u << Vagg, Vvic;          // input excitation

    Map<Matrix<double, states, 1> > result(dxdt.data());
    result = coeff_ * xvec + input_ * u;              // sets dxdt via reference

  }
开发者ID:jefftrull,项目名称:EDASkel,代码行数:45,代码来源:coupling_eigen_odeint.cpp

示例4: result

  // utility function for displaying data.  Applies internal matrices to state
  std::vector<double> state2output(state_type const& x,
                                   std::vector<double> const& in) {
    std::vector<double> result(3);
    Map<const Vector2d> xvec(x.data());
    Map<const Matrix<double, 1, 1> > invec(in.data());

    Map<Matrix<double, 3, 1> > ovec(result.data());
    ovec = Lred_.transpose() * xvec + Dred_ * invec;
    return result;
  }
开发者ID:nicolati,项目名称:EDASkel,代码行数:11,代码来源:rlc_eigen_odeint.cpp


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