/** Get a sum of the tags of the contained items. There is no
     *  guarantee that this is unique, but there is a high chance it
     *  is unique and it can be used for debug checks relatively
     *  reliably.
     */
    TaggedObject::Tag GetTagSum() const
    {
      TaggedObject::Tag tag = 0;

      if (IsValid(x())) {
        tag += x()->GetTag();
      }
      if (IsValid(s())) {
        tag += s()->GetTag();
      }
      if (IsValid(y_c())) {
        tag += y_c()->GetTag();
      }
      if (IsValid(y_d())) {
        tag += y_d()->GetTag();
      }
      if (IsValid(z_L())) {
        tag += z_L()->GetTag();
      }
      if (IsValid(z_U())) {
        tag += z_U()->GetTag();
      }
      if (IsValid(v_L())) {
        tag += v_L()->GetTag();
      }
      if (IsValid(v_U())) {
        tag += v_U()->GetTag();
      }

      return tag;
    }
Пример #2
0
 inline bool check_pos_definite(const char* function,
                                const Eigen::Matrix<var,Eigen::Dynamic,Eigen::Dynamic>& y,
                                const char* name,
                                T_result* result,
                                const Policy&) {
     typedef 
     typename Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic>::size_type 
     size_type;
     Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic> y_d(y.rows(),y.cols());
     for (size_type i = 0; i < y_d.rows(); i++) 
       for (size_type j = 0; j < y_d.cols(); j++)
         y_d(i,j) = y(i,j).val();
     return stan::math::check_pos_definite(function,y_d,name,result,Policy());
 }
Пример #3
0
  SmartPtr<IteratesVector> IteratesVector::MakeNewContainer() const
  {
    SmartPtr<IteratesVector> ret = MakeNewIteratesVector(false);

    if (IsValid(x())) {
      ret->Set_x(*x());
    }
    if (IsValid(s())) {
      ret->Set_s(*s());
    }
    if (IsValid(y_c())) {
      ret->Set_y_c(*y_c());
    }
    if (IsValid(y_d())) {
      ret->Set_y_d(*y_d());
    }
    if (IsValid(z_L())) {
      ret->Set_z_L(*z_L());
    }
    if (IsValid(z_U())) {
      ret->Set_z_U(*z_U());
    }
    if (IsValid(v_L())) {
      ret->Set_v_L(*v_L());
    }
    if (IsValid(v_U())) {
      ret->Set_v_U(*v_U());
    }

    return ret;

    // We may need a non const version
    //     if (IsCompConst(0)) {
    //       ret->Set_x(*x());
    //     }
    //     else {
    //       ret->Set_x_NonConst(*x_NonConst());
    //     }

    //     if (IsCompConst(1)) {
    //       ret->Set_s(*s());
    //     }
    //     else {
    //       ret->Set_s_NonConst(*s_NonConst());
    //     }

    //     if (IsCompConst(2)) {
    //       ret->Set_y_c(*y_c());
    //     }
    //     else {
    //       ret->Set_y_c_NonConst(*y_c_NonConst());
    //     }

    //     if (IsCompConst(3)) {
    //       ret->Set_y_d(*y_d());
    //     }
    //     else {
    //       ret->Set_y_d_NonConst(*y_d_NonConst());
    //     }

    //     if (IsCompConst(4)) {
    //       ret->Set_z_L(*z_L());
    //     }
    //     else {
    //       ret->Set_z_L_NonConst(*z_L_NonConst());
    //     }

    //     if (IsCompConst(5)) {
    //       ret->Set_z_U(*z_U());
    //     }
    //     else {
    //       ret->Set_z_U_NonConst(*z_U_NonConst());
    //     }

    //     if (IsCompConst(6)) {
    //       ret->Set_v_L(*v_L());
    //     }
    //     else {
    //       ret->Set_v_L_NonConst(*v_L_NonConst());
    //     }

    //     if (IsCompConst(7)) {
    //       ret->Set_v_U(*v_U());
    //     }
    //     else {
    //       ret->Set_v_U_NonConst(*v_U_NonConst());
    //     }

    //    return ret;
  }