Exemple #1
0
TEST_F(TestInitTransData, should_return_to_INIT_after_updating_then_reverting)
{
    data.update(Object(2));
    data.revert();

    assertInit();
}
  bool SXFunctionInternal::isSmooth() const {
    assertInit();

    // Go through all nodes and check if any node is non-smooth
    for (vector<AlgEl>::const_iterator it = algorithm_.begin(); it!=algorithm_.end(); ++it) {
      if (!operation_checker<SmoothChecker>(it->op)) {
        return false;
      }
    }
    return true;
  }
Exemple #3
0
  vector<vector<MX> > Function::callParallel(const vector<vector<MX> > &x,
                                             const Dictionary& paropt) {
    assertInit();

    // Make sure not empty
    casadi_assert_message(x.size()>1, "Function: callParallel(vector<vector<MX> >): "
                          "argument must be of length > 1. You supplied length "
                          << x.size() << ".");

    // Return object
    vector<vector<MX> > ret(x.size());

    // Check if we are bypassing the parallelizer
    Dictionary::const_iterator ii=paropt.find("parallelization");
    if (ii!=paropt.end() && ii->second=="expand") {
      for (int i=0; i<x.size(); ++i) {
        ret[i] = call(x[i]);
      }
      return ret;
    }

    // Create parallelizer object and initialize it
    Parallelizer p(vector<Function>(x.size(), *this));
    p.setOption(paropt);
    p.init();

    // Concatenate the arguments
    vector<MX> p_in;
    p_in.reserve(x.size() * getNumInputs());
    for (int i=0; i<x.size(); ++i) {
      p_in.insert(p_in.end(), x[i].begin(), x[i].end());
      p_in.resize(p_in.size()+getNumInputs()-x[i].size());
    }

    // Call the parallelizer
    vector<MX> p_out = p.call(p_in);
    casadi_assert(p_out.size() == x.size() * getNumOutputs());

    // Collect the outputs
    vector<MX>::const_iterator it=p_out.begin();
    for (int i=0; i<x.size(); ++i) {
      ret[i].insert(ret[i].end(), it, it+getNumOutputs());
      it += getNumOutputs();
    }
    return ret;
  }
Exemple #4
0
TEST_F(TestTouchTransData, should_in_RELEASED_state_after_releasing)
{
    data.release();

    ASSERT_FALSE(data.isStable());

    ASSERT_FALSE(data.isPresent());

    ASSERT_TRUE(data.isOldPresent());
    ASSERT_EQ(2, data.getOldValue().getValue());

    ASSERT_TRUE(data.isChanged());
    ASSERT_FALSE(data.isChanged(true));
    ASSERT_EQ(1, alloc_blocks);

    data.confirm();
    assertInit();
}
Exemple #5
0
 Function Function::tangent(int iind, int oind) {
   assertInit();
   return (*this)->tangent(iind, oind);
 }
Exemple #6
0
 Function Function::hessian(int iind, int oind) {
   assertInit();
   return (*this)->hessian(iind, oind);
 }
Exemple #7
0
 Function Function::jacobian(int iind, int oind, bool compact, bool symmetric) {
   assertInit();
   return (*this)->jacobian(iind, oind, compact, symmetric);
 }
Exemple #8
0
 Function Function::gradient(int iind, int oind) {
   assertInit();
   return (*this)->gradient(iind, oind);
 }
Exemple #9
0
 MX LinearSolver::solve(const MX& A, const MX& B, bool transpose) {
   assertInit();
   return (*this)->solve(A, B, transpose);
 }
Exemple #10
0
FX FX::fullJacobian(){
  assertInit();
  return (*this)->fullJacobian();
}
Exemple #11
0
TEST_F(TestInitTransData, the_state_should_be_correct_for_an_uninitialized_trans_data)
{
    assertInit();
}
Exemple #12
0
 void LinearSolver::solve(double* x, int nrhs, bool transpose) {
   assertInit();
   (*this)->solve(x, nrhs, transpose);
 }
Exemple #13
0
 Function Function::fullJacobian() {
   assertInit();
   return (*this)->fullJacobian();
 }
Exemple #14
0
TEST_F(TestActiveTransData, after_reset_should_return_to_idle)
{
    data.reset();
    assertInit();
}
Exemple #15
0
TEST_F(TestInitTransData, should_not_allow_to_modify)
{
    ASSERT_NE(CCINFRA_SUCCESS, data.modify());

    assertInit();
}
Exemple #16
0
TEST_F(TestInitTransData, reset_should_have_no_effect)
{
    data.reset();

    assertInit();
}
Exemple #17
0
TEST_F(TestInitTransData, touch_should_have_no_effect)
{
    data.touch();

    assertInit();
}
Exemple #18
0
TEST_F(TestTouchTransData, should_in_IDLE_state_after_reset)
{
    data.reset();
    assertInit();
}
Exemple #19
0
TEST_F(TestReleaseTransData, should_in_IDLE_state_after_reseting)
{
    data.reset();
    assertInit();
}
Exemple #20
0
 void LinearSolver::prepare() {
   assertInit();
   (*this)->prepare();
 }
Exemple #21
0
TEST_F(TestReleaseTransData, should_in_IDLE_state_after_confirming)
{
    data.confirm();
    assertInit();
}
Exemple #22
0
 void LinearSolver::solve(bool transpose) {
   assertInit();
   (*this)->solve(transpose);
 }
Exemple #23
0
 void Function::evaluate() {
   assertInit();
   (*this)->evaluate();
 }
Exemple #24
0
 bool LinearSolver::prepared() const {
   assertInit();
   return (*this)->prepared_;
 }
Exemple #25
0
void FX::evaluateCompressed(int nfdir, int nadir){
  assertInit();
  casadi_assert(nfdir<=(*this)->nfdir_);
  casadi_assert(nadir<=(*this)->nadir_);
  (*this)->evaluateCompressed(nfdir,nadir);
}