Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
more fix sparsity
Browse files Browse the repository at this point in the history
  • Loading branch information
shueja committed Nov 14, 2023
1 parent e79e976 commit ee43eb6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/optimization/CasADiIterCallback.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "casadi/casadi.hpp"
#include "casadi/core/nlpsol.hpp"
#include "casadi/core/sparsity.hpp"
using namespace casadi;
class CasADiIterCallback : public Callback {
// Data members
Expand All @@ -20,18 +21,18 @@ class CasADiIterCallback : public Callback {
// Number of inputs and outputs
casadi_int get_n_in() override { return 6;}
casadi_int get_n_out() override { return 1;}
Sparsity get_sparsity_in(casadi_int i) {
Sparsity get_sparsity_in(casadi_int i) override {
switch (static_cast<NlpsolOutput>(i)) {
case NLPSOL_F:
return Sparsity.scalar();
return Sparsity::scalar();
case NLPSOL_X:
case NLPSOL_LAM_X:
return Sparsity.dense(nx);
return Sparsity::dense(nx);
case NLPSOL_LAM_G:
case NLPSOL_G:
return Sparsity.dense(ng);
return Sparsity::dense(ng);
case NLPSOL_LAM_P:
return Sparsity.dense(np);
return Sparsity::dense(np);
case NLPSOL_NUM_OUT: break;
}
return Sparsity();
Expand Down

0 comments on commit ee43eb6

Please sign in to comment.