Exemplo n.º 1
0
void EvaluationMX::evaluateSX(const SXMatrixPtrV& arg, SXMatrixPtrV& res,
    const SXMatrixPtrVV& fseed, SXMatrixPtrVV& fsens,
    const SXMatrixPtrVV& aseed, SXMatrixPtrVV& asens) {
  
  // Create input arguments
  vector<SXMatrix> argv(arg.size());
  for(int i=0; i<arg.size(); ++i){
    argv[i] = SXMatrix(fcn_.input(i).sparsity(),0.);
    if(arg[i] != 0)
      argv[i].set(*arg[i]);
  }

  // Evaluate symbolically
  vector<SXMatrix> resv = fcn_.eval(argv);

  // Collect the result
  for (int i = 0; i < res.size(); ++i) {
    if (res[i] != 0)
      *res[i] = resv[i];
  }
}
Exemplo n.º 2
0
void EvaluationMX::evaluateSX(const SXMatrixPtrV& arg, SXMatrixPtrV& res,
    const SXMatrixPtrVV& fseed, SXMatrixPtrVV& fsens,
    const SXMatrixPtrVV& aseed, SXMatrixPtrVV& asens) {
  
  // Create input arguments
  vector<SXMatrix> argv = getVector(arg);

  // Evaluate symbolically
  vector<SXMatrix> resv = fcn_.eval(argv);

  // Collect the result
  for (int i = 0; i < res.size(); ++i) {
    if (res[i] != 0)
      *res[i] = resv[i];
  }
}