Пример #1
0
 /**
  * Converts argument to an automatic differentiation variable.
  *
  * Returns a stan::math::var variable with the input value.
  *
  * @param[in] m A Matrix with scalars
  * @return A Matrix with automatic differentiation variables
  */
 inline matrix_v to_var(const stan::math::matrix_d& m) {
   matrix_v m_v(m.rows(), m.cols());
   for (int j = 0; j < m.cols(); ++j)
     for (int i = 0; i < m.rows(); ++i)
       m_v(i, j) = m(i, j);
   return m_v;
 }
Пример #2
0
//------------------------------------------------------------------------------
void ViscousDamper::calculateForces(const int id_i, const int i) {
  (void)id_i;

  if (m_isStatic(id_i))
    return;

  for (int d = 0; d < m_dim; d++) {
    m_v(i, d) *= m_c;
  }
}