Example #1
0
  void QLDSolver::updateEqualityEquations()
  {
    int m = 0;
    for (size_t i=0; i<_equalityConstraints.size(); ++i)
    {
      LinearConstraint* cstr = _equalityConstraints[i];
      int dim = cstr->getDimension();
      
      // XXX http://eigen.tuxfamily.org/api/TopicFunctionTakingEigenTypes.html#TopicPlainFunctionsFailing
      Eigen::Block<MatrixMap> _A_block = _A.block(m, 0, dim, n());
      Eigen::DenseBase<VectorMap>::SegmentReturnType _b_segment = _b.segment(m, dim);
      Eigen::VectorXd v;
      utils::convert(*cstr, findMapping(cstr->getVariable()), CSTR_PLUS_EQUAL, _A_block, _b_segment, v);

      m += dim;
    }
  }
Example #2
0
  void QLDSolver::updateInequalityEquations()
  {
    int p = static_cast<int>(_m);
    for (size_t i=0; i<_inequalityConstraints.size(); ++i)
    {
      LinearConstraint* cstr = _inequalityConstraints[i];
      int dim = cstr->getDimension();

      if(cstr->getType() == CSTR_LOWER_AND_GREATER)
        dim *= 2;

      // XXX http://eigen.tuxfamily.org/api/TopicFunctionTakingEigenTypes.html#TopicPlainFunctionsFailing
      Eigen::Block<Eigen::Map<Eigen::MatrixXd> > _A_block = _A.block(p, 0, dim, n());
      Eigen::VectorBlock<Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, 1> > > _b_segment = _b.segment(p, dim);
      Eigen::VectorXd v;
      utils::convert(*cstr, findMapping(cstr->getVariable()), CSTR_PLUS_GREATER, _A_block, _b_segment, v);

      p += dim;
    }
  }